Core.Object | +--Engine.Actor | +--Engine.Menu | +--UnrealShare.UnrealMenu | +--UnrealShare.UnrealLongMenu | +--UnrealShare.UnrealFavoritesMenu
string
Aliases[12]
EditList[2]
int
EditSelection
Favorites[12]
OldAlias
OldFavorite
bool
bEditAlias
bEditFavorite
bEditMode
void
DrawMenu(Canvas Canvas)
ProcessLeft()
ProcessMenuEscape()
ProcessMenuInput(string InputString)
ProcessMenuUpdate(string InputString)
ProcessRight()
ProcessSelection()
SaveConfigs()
00001 //============================================================================= 00002 // UnrealFavoritesMenu 00003 //============================================================================= 00004 class UnrealFavoritesMenu extends UnrealLongMenu; 00005 00006 var config string Favorites[12]; //Menu List has aliases 00007 var config string Aliases[12]; //Menu List has aliases 00008 var localized string EditList[2]; 00009 var bool bEditMode; 00010 var bool bEditAlias; 00011 var bool bEditFavorite; 00012 var string OldFavorite; 00013 var string OldAlias; 00014 var int EditSelection; 00015 00016 function SaveConfigs() 00017 { 00018 SaveConfig(); 00019 } 00020 00021 function ProcessMenuInput( coerce string InputString ) 00022 { 00023 if ( bEditAlias ) 00024 { 00025 Aliases[EditSelection] = InputString; 00026 bEditAlias = false; 00027 Favorites[EditSelection] = "_"; 00028 bEditFavorite = true; 00029 } 00030 else 00031 { 00032 bEditFavorite = false; 00033 bEditMode = false; 00034 Selection = EditSelection + 1; 00035 Favorites[EditSelection] = InputString; 00036 } 00037 } 00038 00039 function ProcessMenuEscape() 00040 { 00041 if ( bEditAlias ) 00042 Aliases[EditSelection] = OldAlias; 00043 else 00044 Favorites[EditSelection] = OldFavorite; 00045 } 00046 00047 function ProcessMenuUpdate( coerce string InputString ) 00048 { 00049 if ( bEditAlias ) 00050 Aliases[EditSelection] = (InputString$"_"); 00051 else 00052 Favorites[EditSelection] = (InputString$"_"); 00053 } 00054 00055 function bool ProcessSelection() 00056 { 00057 local Menu ChildMenu; 00058 00059 if ( Aliases[Selection-1] != "....." ) 00060 { 00061 SaveConfigs(); 00062 ChildMenu = spawn(class'UnrealMeshMenu', owner); 00063 if ( ChildMenu != None ) 00064 { 00065 UnrealMeshMenu(ChildMenu).StartMap = Favorites[Selection - 1]; 00066 HUD(Owner).MainMenu = ChildMenu; 00067 ChildMenu.ParentMenu = self; 00068 ChildMenu.PlayerOwner = PlayerOwner; 00069 } 00070 } 00071 return true; 00072 } 00073 00074 function bool ProcessLeft() 00075 { 00076 bEditMode = true; 00077 bEditAlias = true; 00078 OldFavorite = Favorites[Selection-1]; 00079 OldAlias = Aliases[Selection-1]; 00080 Favorites[Selection-1] = ""; 00081 Aliases[Selection-1] = "_"; 00082 EditSelection = Selection - 1; 00083 PlayerOwner.Player.Console.GotoState('MenuTyping'); 00084 } 00085 00086 function bool ProcessRight() 00087 { 00088 ProcessLeft(); 00089 } 00090 00091 function DrawMenu(canvas Canvas) 00092 { 00093 local int StartX, StartY, Spacing, i; 00094 00095 DrawBackGround(Canvas, (Canvas.ClipY < 250)); 00096 00097 // Draw Title 00098 StartX = Max(16, 0.5 * Canvas.ClipX - 80); 00099 Canvas.Font = Canvas.LargeFont; 00100 Canvas.SetPos(StartX, 4 ); 00101 Canvas.DrawText(MenuTitle, False); 00102 00103 if ( !bEditMode ) 00104 { 00105 // List Aliases 00106 Spacing = Clamp(Canvas.ClipY/20, 10, 32); 00107 StartX = Max(48, 0.5 * Canvas.ClipX - 64); 00108 StartY = Max(40, 0.5 * (Canvas.ClipY - MenuLength * Spacing)); 00109 00110 Canvas.Font = Canvas.MedFont; 00111 for ( i=0; i<12; i++ ) 00112 { 00113 if ( Aliases[i] != "" ) 00114 { 00115 SetFontBrightness( Canvas, (Selection == i + 1) ); 00116 Canvas.SetPos(StartX, StartY + i * Spacing ); 00117 Canvas.DrawText(Aliases[i], false); 00118 } 00119 } 00120 Canvas.DrawColor = Canvas.Default.DrawColor; 00121 00122 DrawHelpPanel(Canvas, StartY + MenuLength * Spacing + 8, 228); 00123 } 00124 else 00125 { 00126 if ( bEditFavorite ) 00127 { 00128 bEditFavorite = false; 00129 PlayerOwner.Player.Console.GotoState('MenuTyping'); 00130 } 00131 00132 Spacing = Clamp(Canvas.ClipY/20, 16, 32); 00133 StartX = Max(48, 0.5 * Canvas.ClipX - 120); 00134 StartY = Max(40, 0.5 * (Canvas.ClipY - 2 * Spacing)); 00135 00136 Canvas.Font = Canvas.MedFont; 00137 SetFontBrightness( Canvas, bEditAlias ); 00138 Canvas.SetPos(StartX, StartY ); 00139 Canvas.DrawText(EditList[0], false); 00140 Canvas.SetPos(StartX + 128, StartY ); 00141 Canvas.DrawText(Aliases[EditSelection], false); 00142 00143 SetFontBrightness( Canvas, !bEditAlias ); 00144 Canvas.SetPos(StartX, StartY + Spacing ); 00145 Canvas.DrawText(EditList[1], false); 00146 Canvas.SetPos(StartX + 104, StartY + Spacing ); 00147 Canvas.DrawText(Favorites[EditSelection], false); 00148 Canvas.DrawColor = Canvas.Default.DrawColor; 00149 } 00150 } 00151 00152 defaultproperties 00153 { 00154 Favorites(0)="unreal://unreal.mplayer.com" 00155 Favorites(1)="unreal://unreal.heat.net" 00156 Favorites(2)="unreal://unreal.won.net" 00157 Favorites(3)="unreal://unreal.gamespy.com" 00158 Favorites(4)="unreal://unreal.gamehub.net" 00159 Favorites(5)="unreal://unreal.vrgn.com" 00160 Favorites(6)="unreal://nali.unrealserver.net" 00161 Favorites(7)="unreal://krall.unreal.org" 00162 Favorites(8)="unreal://server.unreal.com" 00163 Aliases(0)="MPlayer.com" 00164 Aliases(1)="Heat.net" 00165 Aliases(2)="World Opponent Network" 00166 Aliases(3)="GameSpy" 00167 Aliases(4)="AT&T Worldnet" 00168 Aliases(5)="VRGN Game Network" 00169 Aliases(6)="Now OnLine" 00170 Aliases(7)="The Unreal Org" 00171 Aliases(8)="Epic MegaGames" 00172 Aliases(9)="..Empty.." 00173 Aliases(10)="..Empty.." 00174 Aliases(11)="..Empty.." 00175 EditList(0)="Name for Server:" 00176 EditList(1)="Address:" 00177 MenuLength=12 00178 HelpMessage(1)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00179 HelpMessage(2)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00180 HelpMessage(3)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00181 HelpMessage(4)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00182 HelpMessage(5)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00183 HelpMessage(6)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00184 HelpMessage(7)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00185 HelpMessage(8)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00186 HelpMessage(9)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00187 HelpMessage(10)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00188 HelpMessage(11)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00189 HelpMessage(12)="Hit enter to go to this server. Hit the right arrow key to edit this entry." 00190 MenuTitle="FAVORITES" 00191 }