Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 |
class UT2MidGameMenu extends UT2K3GUIPage; var bool bIgnoreEsc; var localized string LeaveMPButtonText; var localized string LeaveSPButtonText; var localized string LeaveEntryButtonText; var float ButtonWidth; var float ButtonHeight; var float ButtonHGap; var float ButtonVGap; var float BarHeight; var float BarVPos; function InitComponent(GUIController MyController, GUIComponent MyOwner) { local int i; Super.InitComponent(MyController, MyOwner); OnKeyEvent = InternalOnKeyEvent; OnClose = InternalOnClose; // Bar Controls[0].WinHeight = BarHeight; Controls[0].WinWidth = 1.0; Controls[0].WinTop = BarVPos - (0.5 * BarHeight); Controls[0].Winleft = 0.0; // U MIDDLE Controls[1].WinTop = BarVPos - ButtonVGap - (1.5 * ButtonHeight); Controls[1].WinLeft = 0.5 - (0.5 * ButtonWidth); // B L Controls[2].WinTop = BarVPos - (0.5 * ButtonHeight); Controls[2].WinLeft = 0.5 - (1.5 * ButtonWidth) - ButtonHGap; // U L Controls[3].WinTop = Controls[1].WinTop; Controls[3].WinLeft = Controls[2].WinLeft; // U R Controls[4].WinTop = Controls[1].WinTop; Controls[4].WinLeft = 0.5 + (0.5 * ButtonWidth) + ButtonHGap; // B R Controls[5].WinTop = Controls[2].WinTop; Controls[5].WinLeft = Controls[4].WinLeft; // B MID Controls[6].WinTop = Controls[2].WinTop; Controls[6].WinLeft = Controls[1].WinLeft; // VB L Controls[7].WinTop = BarVPos + ButtonVGap + (0.5 * ButtonHeight); Controls[7].WinLeft = Controls[1].WinLeft; for(i=1; i<8; i++) { Controls[i].WinWidth = ButtonWidth; Controls[i].WinHeight = ButtonHeight; } // If its not a team game, or it's a SP ladder match - dont show the 'Change Teams' button Controls[5].bVisible = PlayerOwner().GameReplicationInfo.bTeamGame; if ( PlayerOwner().Level.Game !=None &&PlayerOwner().Level.Game.CurrentGameProfile != none ) { Controls[5].bVisible = false; } // Set 'leave' button text depending on if we are SP or MP if( PlayerOwner().Level.NetMode != NM_StandAlone ) GUIButton(Controls[3]).Caption = LeaveMPButtonText; else GUIButton(Controls[3]).Caption = LeaveSPButtonText; // Only show 'Add Favorite' button if we are a client if( PlayerOwner().Level.NetMode == NM_Client && !CurrentServerIsInFavorites() ) Controls[6].bVisible = true; else Controls[6].bVisible = false; } // See if we already have this server in our favorites function bool CurrentServerIsInFavorites() { local string address, ipString, portString; local int colonPos, portNum, i; // Get current network address address = PlayerOwner().GetServerNetworkAddress(); if(address == "") return true; // slightly hacky - dont want to add "none"! // Parse text to find IP and possibly port number colonPos = InStr(address, ":"); if(colonPos < 0) { // No colon - assume port 7777 ipString = address; portNum = 7777; } else { // Parse out port number ipString = Left(address, colonPos); portString = Mid(address, colonPos+1); portNum = int(portString); } for(i=0; i<class'Browser_ServerListPageFavorites'.default.Favorites.Length; i++ ) { if( class'Browser_ServerListPageFavorites'.default.Favorites[i].IP == ipString && class'Browser_ServerListPageFavorites'.default.Favorites[i].Port == portNum ) return true; } return false; } function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { // Swallow first escape key event (key up from key down that opened menu) if(bIgnoreEsc && Key == 0x1B) { bIgnoreEsc = false; return true; } } function InternalOnClose(optional Bool bCanceled) { local PlayerController pc; pc = PlayerOwner(); // Turn pause off if currently paused if(pc != None && pc.Level.Pauser != None) pc.SetPause(false); Super.OnClose(bCanceled); } function bool InternalOnClick(GUIComponent Sender) { if(Sender==Controls[2]) // QUIT { Controller.OpenMenu("xinterface.UT2QuitPage"); } else if(Sender==Controls[3]) // LEAVE/DISCONNECT { PlayerOwner().ConsoleCommand( "DISCONNECT" ); if ( PlayerOwner().Level.Game.CurrentGameProfile != None ) { PlayerOwner().Level.Game.CurrentGameProfile.ContinueSinglePlayerGame(PlayerOwner().Level, true); // replace menu } else Controller.CloseMenu(); } else if(Sender==Controls[1]) // CONTINUE { Controller.CloseMenu(); // Close _all_ menus } else if(Sender==Controls[4]) // SETTINGS { Controller.OpenMenu("xinterface.UT2SettingsPage"); } else if(Sender==Controls[5] && Controls[5].bVisible) // CHANGE TEAM { PlayerOwner().SwitchTeam(); Controller.CloseMenu(); } else if(Sender==Controls[6] && Controls[6].bVisible) // ADD FAVORITE { PlayerOwner().ConsoleCommand( "ADDCURRENTTOFAVORITES" ); Controller.CloseMenu(); } else if(Sender==Controls[7]) // SERVER BROWSER { Controller.OpenMenu("xinterface.ServerBrowser"); } return true; } defaultproperties { bIgnoreEsc=Wahr LeaveMPButtonText="DISCONNECT" LeaveSPButtonText="FORFEIT" LeaveEntryButtonText="SERVER BROWSER" ButtonWidth=0.270000 ButtonHeight=0.040000 ButtonHGap=0.020000 ButtonVGap=0.020000 BarHeight=0.210000 BarVPos=0.500000 bRequire640x480=Falsch bAllowedAsLast=Wahr OpenSound=Sound'MenuSounds.selectDshort' Begin Object Class=GUIButton Name=QuitBackground StyleName="SquareBar" bAcceptsInput=Falsch bNeverFocus=Wahr OnKeyEvent=QuitBackground.InternalOnKeyEvent End Object Controls(0)=GUIButton'XInterface.UT2MidGameMenu.QuitBackground' Begin Object Class=GUIButton Name=ContMatchButton Caption="CONTINUE" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=ContMatchButton.InternalOnKeyEvent End Object Controls(1)=GUIButton'XInterface.UT2MidGameMenu.ContMatchButton' Begin Object Class=GUIButton Name=QuitGameButton Caption="EXIT UT2003" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=QuitGameButton.InternalOnKeyEvent End Object Controls(2)=GUIButton'XInterface.UT2MidGameMenu.QuitGameButton' Begin Object Class=GUIButton Name=LeaveMatchButton StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=LeaveMatchButton.InternalOnKeyEvent End Object Controls(3)=GUIButton'XInterface.UT2MidGameMenu.LeaveMatchButton' Begin Object Class=GUIButton Name=SettingsButton Caption="SETTINGS" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=SettingsButton.InternalOnKeyEvent End Object Controls(4)=GUIButton'XInterface.UT2MidGameMenu.SettingsButton' Begin Object Class=GUIButton Name=ChangeTeamButton Caption="CHANGE TEAM" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=ChangeTeamButton.InternalOnKeyEvent End Object Controls(5)=GUIButton'XInterface.UT2MidGameMenu.ChangeTeamButton' Begin Object Class=GUIButton Name=AddFavoriteButton Caption="ADD FAVORITE" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=AddFavoriteButton.InternalOnKeyEvent End Object Controls(6)=GUIButton'XInterface.UT2MidGameMenu.AddFavoriteButton' Begin Object Class=GUIButton Name=BrowserButton Caption="SERVER BROWSER" StyleName="MidGameButton" OnClick=UT2MidGameMenu.InternalOnClick OnKeyEvent=BrowserButton.InternalOnKeyEvent End Object Controls(7)=GUIButton'XInterface.UT2MidGameMenu.BrowserButton' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |