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 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 |
//----------------------------------------------------------- // //----------------------------------------------------------- class UT2K4MidGameMenu extends UT2K4GUIPage; #EXEC OBJ LOAD FILE=2K4Menus.utx var bool bIgnoreEsc; var localized string LeaveMPButtonText; var localized string LeaveSPButtonText; var localized string LeaveEntryButtonText; var bool bPerButtonSizes; var GUIButton SizingButton; var Automated GUIImage MyHeader; var Automated GUIButton bContinue, bQuit, bForfit, bSettings, bChangeTeam, bAdd2Favorites, bServerBrowser, bVoting, bMapVoting, bKickVoting, bMatchSetup; function InitComponent(GUIController MyController, GUIComponent MyOwner) { local PlayerController PC; Super.InitComponent(MyController, MyOwner); PC = PlayerOwner(); if (PC.GameReplicationInfo == None || !PC.GameReplicationInfo.bTeamGame || PC.GameReplicationInfo.bNoTeamChanges ) RemoveComponent(bChangeTeam); // if (PC.Level.NetMode != NM_Client || CurrentServerIsInFavorites()) // RemoveComponent(bAdd2Favorites); // Set 'leave' button text depending on if we are SP or MP if( PC.Level.NetMode != NM_StandAlone ) bForfit.Caption = LeaveMPButtonText; else bForfit.Caption = LeaveSPButtonText; // disable voting in single player mode if( PC.Level.NetMode == NM_StandAlone ) { RemoveComponent(bVoting); RemoveComponent(bMapVoting); RemoveComponent(bKickVoting); RemoveComponent(bMatchSetup); } GetSizingButton(); } function GetSizingButton() { local int i; for (i = 0; i < Components.Length; i++) { if (GUIButton(Components[i]) != None) { if (SizingButton == None || Len(GUIButton(Components[i]).Caption) > Len(SizingButton.Caption)) SizingButton = GUIButton(Components[i]); } } } function bool InternalOnPreDraw(Canvas Canvas) { local int i, X, Y; local float XL,YL; SizingButton.Style.TextSize(Canvas, SizingButton.MenuState, SizingButton.Caption, XL, YL, SizingButton.FontScale); XL += 16; YL += 8; bQuit.WinWidth = XL; bQuit.WinLeft = Canvas.ClipX - bQuit.WinWidth; bQuit.WinTop = 0; bQuit.WinHeight = YL; for (i = 0; i < Components.Length; i++) { if (GUIButton(Components[i]) != None && Components[i] != bQuit) { if (bPerButtonSizes) { Components[i].Style.TextSize(Canvas, Components[i].MenuState, GUIButton(Components[i]).Caption, XL, YL, Components[i].FontScale); YL += 8; } if (X + XL > bQuit.WinLeft) { X = 0; Y += YL; } Components[i].WinTop = Y; Components[i].WinLeft = X; Components[i].WinWidth = XL; Components[i].WinHeight = YL; X += XL; } } MyHeader.WinHeight = Y + YL + 2; 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; } return 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'UT2K4Browser_ServerListPageFavorites'.default.Favorites.Length; i++ ) { if( class'UT2K4Browser_ServerListPageFavorites'.default.Favorites[i].IP == ipString && class'UT2K4Browser_ServerListPageFavorites'.default.Favorites[i].Port == portNum ) return true; } return false; } */ 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==bQuit) // QUIT { Controller.OpenMenu(Controller.GetQuitPage()); } else if(Sender==bForfit) // 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==bContinue) // CONTINUE { Controller.CloseMenu(); // Close _all_ menus } else if(Sender==bSettings) // SETTINGS { Controller.OpenMenu(Controller.GetSettingsPage()); } else if(Sender==bChangeTeam) // CHANGE TEAM { PlayerOwner().SwitchTeam(); Controller.CloseMenu(); } else if(Sender==bAdd2Favorites) // ADD FAVORITE { PlayerOwner().ConsoleCommand( "ADDCURRENTTOFAVORITES" ); Controller.CloseMenu(); } else if(Sender==bServerBrowser) // SERVER BROWSER { Controller.OpenMenu(Controller.GetServerBrowserPage()); } else if(Sender==bVoting) // VOTING { // if drop down menu is not visible then make it visible otherwise hide it if(bMapVoting.bVisible == false) { bMapVoting.bVisible = true; bMapVoting.WinLeft = bVoting.WinLeft; bMapVoting.WinWidth = bVoting.WinWidth; bMapVoting.WinTop = bVoting.WinTop + bVoting.WinHeight; bMapVoting.WinHeight = bVoting.WinHeight; bKickVoting.bVisible = true; bKickVoting.WinLeft = bVoting.WinLeft; bKickVoting.WinWidth = bVoting.WinWidth; bKickVoting.WinTop = bVoting.WinTop + bVoting.WinHeight * 2; bKickVoting.WinHeight = bVoting.WinHeight; bMatchSetup.bVisible = true; bMatchSetup.WinLeft = bVoting.WinLeft; bMatchSetup.WinWidth = bVoting.WinWidth; bMatchSetup.WinTop = bVoting.WinTop + bVoting.WinHeight * 3; bMatchSetup.WinHeight = bVoting.WinHeight; } else { bMapVoting.bVisible = false; bKickVoting.bVisible = false; bMatchSetup.bVisible = false; } } else if(Sender==bMapVoting) { Controller.OpenMenu(Controller.MapVotingMenu); } else if(Sender==bKickVoting) { Controller.OpenMenu(Controller.KickVotingMenu); } else if(Sender==bMatchSetup) { Controller.OpenMenu(Controller.MatchSetupMenu); } return true; } function InternalOnMouseRelease(GUIComponent Sender) { if (Sender == Self) Controller.CloseMenu(); } DefaultProperties { Begin Object class=GUIImage name=MGHeader WinWidth=1 WinHeight=64 WinLeft=0 WinTop=0 Image=Material'2K4Menus.Controls.header' ImageStyle=ISTY_Stretched ImageRenderStyle=MSTY_Normal bVisible=true End Object MyHeader=MGHeader Begin Object Class=GUIButton Name=ContMatchButton Caption="CONTINUE" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=0 End Object bContinue=ContMatchButton Begin Object Class=GUIButton Name=QuitGameButton Caption="EXIT UT2004" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=8 End Object bQuit=QuitGameButton Begin Object Class=GUIButton Name=LeaveMatchButton Caption="" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=1 End Object bForfit=LeaveMatchButton Begin Object Class=GUIButton Name=SettingsButton Caption="SETTINGS" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=2 End Object bSettings=SettingsButton Begin Object Class=GUIButton Name=ChangeTeamButton Caption="CHANGE TEAM" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=3 End Object bChangeTeam=ChangeTeamButton Begin Object Class=GUIButton Name=AddFavoriteButton Caption="ADD FAVORITE" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=4 End Object bAdd2Favorites=AddFavoriteButton Begin Object Class=GUIButton Name=BrowserButton Caption="SERVER BROWSER" StyleName="SquareButton" OnClick=InternalOnClick TabOrder=5 End Object bServerBrowser=BrowserButton Begin Object Class=GUIButton Name=VotingButton Caption="Voting . . . " StyleName="SquareButton" OnClick=InternalOnClick TabOrder=6 End Object bVoting=VotingButton Begin Object Class=GUIButton Name=MapVotingButton Caption="Map Voting" StyleName="SquareButton" OnClick=InternalOnClick bVisible=False bTabStop=False RenderWeight=0.6 End Object bMapVoting=MapVotingButton Begin Object Class=GUIButton Name=KickVotingButton Caption="Kick Voting" StyleName="SquareButton" OnClick=InternalOnClick bVisible=False bTabStop=False RenderWeight=0.6 End Object bKickVoting=KickVotingButton Begin Object Class=GUIButton Name=MatchSetupButton Caption="Match Setup" StyleName="SquareButton" OnClick=InternalOnClick bVisible=False bTabStop=False RenderWeight=0.6 End Object bMatchSetup=MatchSetupButton OnKeyEvent=InternalOnKeyEvent OnClose=InternalOnClose OnPreDraw=InternalOnPreDraw WinWidth=1.0 WinHeight=1.0 WinTop=0.0 WinLeft=0.0 bIgnoreEsc=true bAllowedAsLast=true LeaveMPButtonText="DISCONNECT" LeaveSPButtonText="FORFEIT" LeaveEntryButtonText="SERVER BROWSER" OnMouseRelease=InternalOnMouseRelease } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |