// // CPT operator / SondeerGame // This source file is (c) by Deltares. // - October 2014 // //============================================================================= // Class for Menu that appears when pressing Escape. // Gives three options: continue, quit, settings. // ------------------------------------------------------------ // // © 2006, Geodelft // // Date Id Modification // 2006-10-24 The Created this header // 2006-10-24 The Formatted code // 2006-10-24 The Implemented score at close of level // 2006-10-26 The Resized controls and made lowercase captions //============================================================================= class MenuMidGame extends GeoGUIPage config(GeoUser); var bool bIgnoreEsc; var automated GeoFrame QuitBackground; var automated GeoTitle Title; var automated GeoButton ContMatchButton; var automated GeoButton LeaveMatchButton; var automated GeoButton SettingsButton; //============================================================================= // Date Id Modification // 2006-10-24 The Created this header // 2007-08-08 gui Added calling to function to call GeoPC //============================================================================= function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); OnKeyEvent = InternalOnKeyEvent; OnClose = InternalOnClose; // widthstep = (1 / 4); ContMatchButton.WinLeft = 0.1; LeaveMatchButton.WinLeft = 0.4; SettingsButton.WinLeft = 0.7 ; /* // Bar Controls[0].WinHeight = BarHeight; Controls[0].WinWidth = 0.9; Controls[0].WinTop = BarVPos - (0.5 * BarHeight); Controls[0].Winleft = 0.05; // U MIDDLE Controls[1].WinTop = BarVPos - (1.0 * ButtonHeight); Controls[1].WinLeft = 0.5 - (0.5 * ButtonWidth); // U L Controls[2].WinTop = Controls[1].WinTop; Controls[2].WinLeft = 0.5 - (1.5 * ButtonWidth) - ButtonHGap; // U R Controls[3].WinTop = Controls[1].WinTop; Controls[3].WinLeft = 0.5 + (0.5 * ButtonWidth) + ButtonHGap; for(i=1; i<4; i++) { Controls[i].WinWidth = ButtonWidth; Controls[i].WinHeight = ButtonHeight; } */ // UpdateLanguage(); } //============================================================================= // Date Id Modification // 2006-10-24 The Created this header //============================================================================= 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; } } //============================================================================= // Date Id Modification // 2006-10-24 The Created this header //============================================================================= 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); } //============================================================================= // Date Id Modification // 2006-10-24 The Created this header // 2006-10-24 The Implemented score at close of level //============================================================================= function bool InternalOnClick(GUIComponent Sender) { if(Sender == LeaveMatchButton) // LEAVE/DISCONNECT { ///PlayerOwner().ConsoleCommand("Exit"); //Controller.CloseMenu(); //Controller.OpenMenu("GeoInterface.dialogStopGamePage"); Log("main menu: "@ Controller.GetMainMenuClass()); Log("a"); // Controller.CloseMenu(); Log("b"); // Controller.OpenMenu(Controller.GetMainMenuClass()); Log("c"); Log("d"); GeoPC.Leave(); Controller.OpenMenu(Controller.GetMainMenuClass()); Controller.OpenMenu("GeoInterface.MenuMainMenu"); PlayerOwner().ConsoleCommand( "DISCONNECT" ); return true; } if(Sender == ContMatchButton) // CONTINUE { Controller.CloseMenu(); // Close _all_ menus return true; } if(Sender == SettingsButton) // SETTINGS { Controller.OpenMenu("GeoInterface.MenuSettings"); return true; } return true; } //============================================================================= // Date Id Modification // 2006-10-24 The Created this header //============================================================================= defaultproperties { Begin Object Class=GeoFrame name=TQuitBackground WinHeight = 0.34 WinWidth = 1.0 WinTop = 0.33 WinLeft = 0.0 End Object Begin Object Class=GeoTitle name=TMenuTitle IniOption="TMenuTitle" TextAlign=TXTA_Center WinWidth = 1.0 WinTop = 0.41 WinLeft = 0.0 End Object Begin Object Class=GeoButton Name=TContMatchButton OnClick=InternalOnClick IniOption="TContMatchButton" WinLeft = 0.2 WinTop=0.54 WinWidth= 0.2 End Object Begin Object Class=GeoButton Name=TLeaveMatchButton OnClick=InternalOnClick IniOption="TLeaveMatchButton" WinLeft= 0.5 WinTop=0.54 WinWidth= 0.2 End Object Begin Object Class=GeoButton Name=TSettingsButton OnClick=InternalOnClick IniOption="TSettingsButton" WinLeft= 0.8 WinTop=0.54 WinWidth= 0.2 End Object QuitBackGround=TQuitBackground Title=TMenuTitle ContMatchButton = TContMatchButton LeaveMatchButton = TLeaveMatchButton SettingsButton = TSettingsButton OpenSound=sound'RuntimeInterfaceSounds.SelectDshort' bIgnoreEsc=true bRequire640x480=false bAllowedAsLast=true }