// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // In game menu for choosing place of failure on dike // Triggers the start of placing marker // ------------------------------------------------------------ // Created by Rui Guimaraes // © 2006, Geodelft // // Date Id Modification // 2006 11 22 Zmr Made the quit button go to menuObservationMain // 2007 11 13 Zmr Added esc functionality //============================================================================= class MenuSignalLocation extends GUIPage; #exec OBJ LOAD FILE=InGameMenuImagesT.utx var string EN_Title, NL_Title; var GeoPlayerController GeoPC; var bool bIgnoreEsc; var float BarHeight; var float BarVPos; var float SButtonSize; var float SButtonHGap; var float SButtonVGap; var float TitleLeftGap; var Color NormalColor, SelectedColor; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); OnKeyEvent = InternalOnKeyEvent; GeoPC=GeoPlayerController(PlayerOwner()); if(GeoPC!=None) UpdateLanguage(); else log("ERROR WITH TYPE OF GAME"); // Menu Background Controls[0].WinWidth = 0.75; Controls[0].WinHeight = 0.55; Controls[0].WinLeft = (1 - Controls[0].WinWidth) / 2; Controls[0].WinTop = (1 - Controls[0].WinHeight) / 2; // QuitButton Controls[1].WinTop = 0.5 - (Controls[0].WinHeight / 2) + SButtonVGap; Controls[1].WinLeft = 0.5 + (Controls[0].WinWidth / 2) - SButtonSize - SButtonHGap; Controls[1].WinWidth = SButtonSize; Controls[1].WinHeight = SButtonSize; // HelpButton Controls[2].WinTop = Controls[1].WinTop; Controls[2].WinLeft = Controls[1].WinLeft - SButtonSize - SButtonHGap; Controls[2].WinWidth = SButtonSize; Controls[2].WinHeight = SButtonSize; // NextButton Controls[3].WinTop = Controls[0].WinTop + Controls[0].WinHeight - SButtonSize - SButtonVGap; Controls[3].WinLeft = Controls[1].WinLeft; Controls[3].WinWidth = SButtonSize; Controls[3].WinHeight = SButtonSize; // PreviousButton if(GeoPC.ReportingMode == MODE_CreatingNewObservation) { Controls[4].WinTop = Controls[3].WinTop; Controls[4].WinLeft = Controls[0].WinLeft + TitleLeftGap; Controls[4].WinWidth = SButtonSize; Controls[4].WinHeight = SButtonSize; } else { Controls[4].SetVisibility(false); } // Menu Title Controls[5].WinTop = Controls[1].WinTop; Controls[5].WinLeft = Controls[0].WinLeft + TitleLeftGap; Controls[5].WinWidth = 0.4; Controls[5].WinHeight = 0.1; // image of foreland Controls[6].WinTop = 0.5 - (0.5 * Controls[6].WinHeight); Controls[6].WinLeft = 0.5 - (2.5 * Controls[6].WinWidth); // Image of outerdike Controls[7].WinTop = Controls[6].WinTop; Controls[7].WinLeft = Controls[6].WinLeft + Controls[6].WinWidth; // image of top Controls[8].WinTop = Controls[6].WinTop; Controls[8].WinLeft = Controls[7].WinLeft + Controls[7].WinWidth; // image of innerdike Controls[9].WinTop = Controls[6].WinTop; Controls[9].WinLeft = Controls[8].WinLeft + Controls[8].WinWidth; // image of hinterland Controls[10].WinTop = Controls[6].WinTop; Controls[10].WinLeft = Controls[9].WinLeft + Controls[9].WinWidth; InitializeImageSelections(); } //============================================================================= // Date Id Modification // 2007-04-05 Zmr Created this header //============================================================================= Event Opened(GUIComponent Sender) { Super.Opened(Sender); bVisible = true; } function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { //must not swallow if( Key == 0x1B) { Controller.ReplaceMenu("GeoSimulator.MenuObservationMain"); } return true; } function bool InternalOnClick(GUIComponent Sender) { local PlayerController pc; pc = PlayerOwner(); if(Sender == Controls[1]) { // Quit Button Controller.ReplaceMenu("GeoSimulator.MenuObservationMain"); } else if(Sender == Controls[2]) { // Help Button Controller.OpenMenu("GeoSimulator.HelpMenuSignalLocation"); bVisible = false; } else if(Sender == Controls[3]) { // Next Button storeLocationValue(); // switch for kind of signal to determine menu to be opened switch(GeoPC.NewSignal.SignalType) { case SIG_RipRapPitching: Controller.ReplaceMenu("GeoSimulator.MenuRipPitching"); break; case SIG_GrassRevetment: Controller.ReplaceMenu("GeoSimulator.MenuGrass"); break; case SIG_Crack: Controller.ReplaceMenu("GeoSimulator.MenuCrack"); break; case SIG_Settlement: Controller.ReplaceMenu("GeoSimulator.MenuSettlement"); break; case SIG_HorizontalMovement: Controller.ReplaceMenu("GeoSimulator.MenuHorizontalMovement"); break; case SIG_Uprise: Controller.ReplaceMenu("GeoSimulator.MenuUprise"); break; case SIG_Liquefaction: Controller.ReplaceMenu("GeoSimulator.MenuLiquefaction"); break; case SIG_WaterOutflow: Controller.ReplaceMenu("GeoSimulator.MenuWaterOutflow"); break; case SIG_OverToppingWash: Controller.ReplaceMenu("GeoSimulator.MenuOverToppingWash"); break; case SIG_FloatingWasteOther: Controller.ReplaceMenu("GeoSimulator.MenuFloatingWaste"); break; case SIG_HumanActivity: Controller.ReplaceMenu("GeoSimulator.MenuHumanActivity"); break; case SIG_BioActivity: Controller.ReplaceMenu("GeoSimulator.MenuBioActivity"); break; case SIG_NONE: Controller.ReplaceMenu("GeoSimulator.MenuChooseSignal"); break; } } else if(Sender == Controls[4]) { // Previous Button storeLocationValue(); Controller.ReplaceMenu("GeoSimulator.MenuChooseSignal"); } else if(Sender == Controls[6] || Sender == Controls[7] || Sender == Controls[8] || Sender == Controls[9] || Sender == Controls[10]) { // an image SetImageSelections(Sender); } return true; } function SetImageSelections(GUIComponent Sender) { // give all images their normal colour, then modify colour of Sender local int i; for(i = 6; i < 11; i++) { (ColorModifier(GuiImage(Controls[i]).Image)).Color = NormalColor; } (ColorModifier(GuiImage(Sender).Image)).Color = SelectedColor; } function InitializeImageSelections() { local int i; // initialize selectedness of the location images, according to the current GeoPC.NewSignal switch(GeoPC.NewSignal.CrossCutLocation) { case CUT_Foreland: SetImageSelections(Controls[6]); break; case CUT_OuterSlope: SetImageSelections(Controls[7]); break; case CUT_Top: SetImageSelections(Controls[8]); break; case CUT_InnerSlope: SetImageSelections(Controls[9]); break; case CUT_Hinterland: SetImageSelections(Controls[10]); break; case CUT_NONE: for(i = 6; i < 11; i++) { (ColorModifier(GuiImage(Controls[i]).Image)).Color = NormalColor; } break; } } function storeLocationValue() { // save currently selected location in GeoPC if((ColorModifier(GuiImage(Controls[6]).Image)).Color == SelectedColor) GeoPC.NewSignal.CrossCutLocation = CUT_ForeLand; else if((ColorModifier(GuiImage(Controls[7]).Image)).Color == SelectedColor) GeoPC.NewSignal.CrossCutLocation = CUT_OuterSlope; else if((ColorModifier(GuiImage(Controls[8]).Image)).Color == SelectedColor) GeoPC.NewSignal.CrossCutLocation = CUT_Top; else if((ColorModifier(GuiImage(Controls[9]).Image)).Color == SelectedColor) GeoPC.NewSignal.CrossCutLocation = CUT_InnerSlope; else if((ColorModifier(GuiImage(Controls[10]).Image)).Color == SelectedColor) GeoPC.NewSignal.CrossCutLocation = CUT_Hinterland; else GeoPC.NewSignal.CrossCutLocation = CUT_NONE; } function UpdateLanguage() { if(GeoPC.Dutch) { GUIImage(Controls[6]).Image=Material'InGameMenuImagesT.NL_Foreland_S'; GUIImage(Controls[7]).Image=Material'InGameMenuImagesT.DikeMenu.NL_Outerdike_S'; GUIImage(Controls[8]).Image=Material'InGameMenuImagesT.DikeMenu.NL_Top_S'; GUIImage(Controls[9]).Image=Material'InGameMenuImagesT.DikeMenu.NL_Innerdike_S'; GUIImage(Controls[10]).Image=Material'InGameMenuImagesT.DikeMenu.NL_Hinterland_S'; GUILabel(Controls[5]).Caption=NL_Title; } else { GUIImage(Controls[6]).Image=Material'InGameMenuImagesT.DikeMenu.EN_Foreland_S'; GUIImage(Controls[7]).Image=Material'InGameMenuImagesT.DikeMenu.EN_Outerdike_S'; GUIImage(Controls[8]).Image=Material'InGameMenuImagesT.DikeMenu.EN_Top_S'; GUIImage(Controls[9]).Image=Material'InGameMenuImagesT.DikeMenu.EN_Innerdike_S'; GUIImage(Controls[10]).Image=Material'InGameMenuImagesT.DikeMenu.EN_Hinterland_S'; GUILabel(Controls[5]).Caption=EN_Title; } } defaultproperties { Begin Object Class=GUIButton name=Background bAcceptsInput=false bNeverFocus=true StyleName="GeoCallBar" End Object Controls(0)=GUIButton'Background' Begin Object Class=GUIGFxButton Name=QuitButton Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Closed' Position=ICP_Scaled StyleName="MidGameButton" OnClick=InternalOnClick bNeverFocus=true End Object Controls(1)=GUIButton'QuitButton' Begin Object Class=GUIGFxButton Name=HelpButton Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Questionmark' Position=ICP_Scaled StyleName="MidGameButton" bNeverFocus=true OnClick=InternalOnClick End Object Controls(2)=GUIButton'HelpButton' Begin Object Class=GUIGFxButton Name=NextPage Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Next' Position=ICP_Scaled StyleName="MidGameButton" bNeverFocus=true OnClick=InternalOnClick End Object Controls(3)=GUIButton'NextPage' Begin Object Class=GUIGFxButton Name=PreviousPage Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Previous' Position=ICP_Scaled StyleName="MidGameButton" bNeverFocus=true OnClick=InternalOnClick End Object Controls(4)=GUIButton'PreviousPage' Begin Object class=GUILabel Name=MenuTitle Caption="***" TextAlign=TXTA_Left TextColor=(R=255,G=120,B=0,A=255) TextFont="HeaderFont" bMultiLine=true WinWidth=1 WinLeft=0 WinTop=0.3 WinHeight=32 End Object Controls(5)=GUILabel'MenuTitle' Begin Object class=GUIImage name=DikeImages WinWidth=0.13 WinHeight=0.18 WinLeft=0.52 WinTop=0.30 ImageColor=(R=255,G=255,B=255,A=255); ImageStyle=ISTY_Scaled ImageRenderStyle=MSTY_Normal bAcceptsInput=true bCaptureMouse=True OnClick=InternalOnClick End Object // Controls 6-10 are the images of the different levee locations Controls(6)=GUIImage'DikeImages' Controls(7)=GUIImage'DikeImages' Controls(8)=GUIImage'DikeImages' Controls(9)=GUIImage'DikeImages' Controls(10)=GUIImage'DikeImages' BarHeight=0.21 BarVPos=0.5 SButtonSize=0.06 SButtonHGap=0.02 SButtonVGap=0.02 TitleLeftGap=0.05 OpenSound=sound'RuntimeInterfaceSounds.SelectDshort' bIgnoreEsc=true bRequire640x480=false bAllowedAsLast=true NormalColor=(R=255,B=255,G=255,A=255) SelectedColor=(R=255,B=150,G=150,A=255) EN_Title="Select the location of the signal" NL_Title="Geef de locatie van het signaal aan" }