// 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. //============================================================================= // Options to choose level // ------------------------------------------------------------ // © 2006, Geodelft // // Date Id Modification // 2006-10-09 The Created this header // 2006-10-09 The Disabled level 6 option // 2006-12-12 gui Placed level 4 // 2007-02-02 The Added IsReleaseVersion and set it to true // 2007-05-30 wsl Pressing Esc does the same as back-button // 2008-01-28 Jln Is release version is no longer necessary. Level 4 does exist now. //============================================================================= class MiniGames extends GUIPage config(GeoUser); #exec OBJ LOAD FILE=GUIContent.utx #exec OBJ LOAD FILE=MiniGamesT.utx //var bool IsReleaseVersion; var bool Dutch; var float SavedPitch; var automated GUIGFXButton but_Level1, but_Level2, but_Level3, but_Level4, but_Level5, but_Level6, but_Level7, but_Level8; var automated GUITitleBar but_BackGroundButton; var automated GUIButton but_Back; var automated GUITitleBar lab_Hint; var automated GUILabel lab_BackGroundLabel; var automated GUILabel lab_Normaal; var automated GUILabel lab_Droogte; var automated GUIImage ima_MainLogo; // Buttons in 2 languages var string EN_but_Back, NL_but_Back; // Hints in 2 languages var string EN_hint_Back, EN_hint_Level1, EN_hint_Level2, EN_hint_Level3, EN_hint_Level4, EN_SelectText, NL_hint_Back, NL_hint_Level1, NL_hint_Level2, NL_hint_Level3, NL_hint_Level4, NL_SelectText ; var string EN_hint_Level5, EN_hint_Level6, EN_hint_Level7, EN_hint_Level8, NL_hint_Level5, NL_hint_Level6, NL_hint_Level7, NL_hint_Level8; var string EN_Droogte, EN_Normal, NL_Droogte, NL_Normaal; var array normalImages; var array hoverImages; var array buttons; var bool AllowSelect; // To make sure that on sub menus appear can't click on options //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function InitComponent(GUIController MyController, GUIComponent MyOwner) { local string version; Super.InitComponent(MyController, MyOwner); lab_Hint.SetFocus(none); SetLanguage(); UpdateLanguage(); SaveConfig(); normalImages[0] = Material'MiniGamesT.piping'; normalImages[1] = Material'MiniGamesT.overloop'; normalImages[2] = Material'MiniGamesT.micro'; normalImages[3] = Material'MiniGamesT.macro'; normalImages[4] = Material'MiniGamesT.droogte_botulisme'; normalImages[5] = Material'MiniGamesT.droogte_scheuren'; normalImages[6] = Material'MiniGamesT.droogte_wigscheur'; normalImages[7] = Material'MiniGamesT.droogte_wilnis'; hoverImages[0] = Material'MiniGamesT.piping_hover'; hoverImages[1] = Material'MiniGamesT.overloop_hover'; hoverImages[2] = Material'MiniGamesT.micro_hover'; hoverImages[3] = Material'MiniGamesT.macro_hover'; hoverImages[4] = Material'MiniGamesT.droogte_botulisme_hover'; hoverImages[5] = Material'MiniGamesT.droogte_scheuren_hover'; hoverImages[6] = Material'MiniGamesT.droogte_wigscheur_hover'; hoverImages[7] = Material'MiniGamesT.droogte_wilnis_hover'; buttons[0] = but_Level1; buttons[1] = but_Level2; buttons[2] = but_Level3; buttons[3] = but_Level4; buttons[4] = but_Level5; buttons[5] = but_Level6; buttons[6] = but_Level7; buttons[7] = but_Level8; buttons[0].winLeft = 0.24; buttons[0].winTop = 0.4; buttons[1].winLeft = buttons[0].winLeft; buttons[1].winTop = buttons[0].winTop + buttons[0].winHeight + 0.05; buttons[2].winLeft = 0.24 + buttons[0].winWidth + 0.02; buttons[2].winTop = 0.4; buttons[3].winLeft = buttons[2].winLeft; buttons[3].winTop = buttons[2].winTop + buttons[2].winHeight + 0.05; buttons[4].winLeft = 0.55; buttons[4].winTop = 0.4; buttons[5].winLeft = buttons[4].winLeft; buttons[5].winTop = buttons[4].winTop + buttons[4].winHeight + 0.05; buttons[6].winLeft = 0.55 + buttons[4].winWidth + 0.02; buttons[6].winTop = 0.4; buttons[7].winLeft = buttons[6].winLeft; buttons[7].winTop = buttons[6].winTop + buttons[6].winHeight + 0.05; lab_Normaal.winLeft = (buttons[0].winLeft); // + buttons[2].winLeft) / 3; lab_Normaal.winTop = 0.35; lab_Droogte.winLeft = (buttons[4].winLeft); // + buttons[6].winLeft) / 3; lab_Droogte.winTop = 0.35; // Determin by version: version = GeoPlayerController(PlayerOwner()).version; if (Caps(version) != "DROOGTE") { lab_Droogte.SetVisibility(false); buttons[4].SetVisibility(false); buttons[5].SetVisibility(false); buttons[6].SetVisibility(false); buttons[7].SetVisibility(false); } else { lab_Droogte.SetVisibility(true); buttons[4].SetVisibility(true); buttons[5].SetVisibility(true); buttons[6].SetVisibility(true); buttons[7].SetVisibility(true); } } //============================================================================= // whenever the window is opened it makes a refresh of language // Date Id Modification // 2007-02-02 The Created this header //============================================================================= event Opened(GUIComponent Sender) { Super.Opened(Sender); SetLanguage(); UpdateLanguage(); } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function ChangeAllow(bool a) { AllowSelect = a; } //============================================================================= //LANGUAGE: IF IT IS IN GAME OR IN MENU'S // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function bool SetLanguage() { if(PlayerOwner().IsA('GeoPlayerController')) { return GeoPlayerController(PlayerOwner()).Dutch; } else { warn("THIS PLAYER CONTROLLER DOESN'T SUPPORT LANGUAGE"); return true; } } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function MyOpenPage() { Dutch=SetLanguage(); UpdateLanguage(); } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function InternalOnClose(optional Bool bCanceled) { local rotator NewRot; // Reset player NewRot = PlayerOwner().Rotation; NewRot.Pitch = SavedPitch; PlayerOwner().SetRotation(NewRot); // Save config. //pPlayer.InternalApply(none); Super.OnClose(bCanceled); } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function bool MyKeyEvent(out byte Key,out byte State,float delta) { if(Key == 0x1B && State == 1) // Escape pressed { Controller.ReplaceMenu("GeoInterface.MainMenuOptions"); return true; } else return false; } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= event ChangeHint(string NewHint) { lab_Hint.Caption = NewHint; //SHOULDN'T BE LIKE THIS BUT WORKS -> normal way not working if(NewHint == EN_hint_Level1 || NewHint == NL_hint_Level1) { FocusImage(1); } else if(NewHint == EN_hint_Level2 || NewHint == NL_hint_Level2) { FocusImage(2); } else if(NewHint == EN_hint_Level3 || NewHint == NL_hint_Level3) { FocusImage(3); } else if(NewHint == EN_hint_Level4 || NewHint == NL_hint_Level4) { FocusImage(4); } else if(NewHint == EN_hint_Level5 || NewHint == NL_hint_Level5) { FocusImage(5); } else if(NewHint == EN_hint_Level6 || NewHint == NL_hint_Level6) { FocusImage(6); } else if(NewHint == EN_hint_Level7 || NewHint == NL_hint_Level7) { FocusImage(7); } else if(NewHint == EN_hint_Level8 || NewHint == NL_hint_Level8) { FocusImage(8); } else { FocusImage(0); } } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= event NotifyLevelChange() { Controller.CloseMenu(true); } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header // 2007-02-02 The Added IsReleaseVersion and set it to true //============================================================================= function bool ButtonClick(GUIComponent Sender) { if (Sender != None && AllowSelect) { switch(Sender) { case but_Level1: LoadMap("Pipingscenario1dg.urt"); break; case but_Level2: LoadMap("overtoppingscenario2dg.urt"); break; case but_Level3: LoadMap("MicrostabScenario2DG.urt"); break; case but_Level4: LoadMap("MacrostabScenario2DG.urt"); break; /// Droogte levels: case but_Level5: LoadMap("Mini_BotulismeScenario2DGDroog.urt"); break; case but_Level6: LoadMap("Mini_CracksScenario2DGDroog.urt"); break; case but_Level7: LoadMap("Mini_WigScenario2DGDroog.urt"); break; case but_Level8: LoadMap("Mini_WilnisScenario2DGDroog.urt"); break; case but_Back: Controller.ReplaceMenu("GeoInterface.MainMenuOptions"); break; default: break; } } return true; } function bool LoadMap(string MapURL) { local GeoCompleteExercise GCE; GCE = new class'GeoCompleteExercise'; GCE.IsCompleteExercise=false; GCE.SaveConfig(); SaveConfig(); Console(Controller.Master.Console).ConsoleCommand("start"@MapURL); Controller.CloseAll(false); return true; } /// Terribly way of doing this (who did it), but for now it's the fasted. /// But with 8 it gets quite ridiculous. function FocusImage(int id) { local int i; for (i = 0; i < 8; i++) { if (i == (id-1)) { buttons[i].Graphic = hoverImages[i]; } else { buttons[i].Graphic = normalImages[i]; } } } /* //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function FocusImage0() { but_Level1.Graphic=Material'MiniGamesT.piping'; but_Level2.Graphic=Material'MiniGamesT.overloop'; but_Level3.Graphic=Material'MiniGamesT.micro'; but_Level4.Graphic=Material'MiniGamesT.macro'; } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function FocusImage1() { but_Level1.Graphic=Material'MiniGamesT.piping_hover'; //focus but_Level2.Graphic=Material'MiniGamesT.overloop'; but_Level3.Graphic=Material'MiniGamesT.micro'; but_Level4.Graphic=Material'MiniGamesT.macro'; } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function FocusImage2() { but_Level1.Graphic=Material'MiniGamesT.piping'; but_Level2.Graphic=Material'MiniGamesT.overloop_hover'; //focus but_Level3.Graphic=Material'MiniGamesT.micro'; but_Level4.Graphic=Material'MiniGamesT.macro'; } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function FocusImage3() { but_Level1.Graphic=Material'MiniGamesT.piping'; but_Level2.Graphic=Material'MiniGamesT.overloop'; but_Level3.Graphic=Material'MiniGamesT.micro_hover'; //focus but_Level4.Graphic=Material'MiniGamesT.macro'; } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function FocusImage4() { but_Level1.Graphic=Texture'MiniGamesT.Failures.Piping'; but_Level2.Graphic=Material'MiniGamesT.Failures.overloop'; but_Level3.Graphic=Material'MiniGamesT.Failures.micro'; but_Level4.Graphic=Material'MiniGamesT.Failures.macro_hover'; // focus } */ //============================================================================= // Date Id Modification // 2007-02-02 The Created this header //============================================================================= function UpdateLanguage() { if(Dutch) { but_Back.Caption=NL_but_Back; lab_BackGroundLabel.Caption=NL_SelectText; but_Level1.Hint=NL_hint_Level1; but_Level2.Hint=NL_hint_Level2; but_Level3.Hint=NL_hint_Level3; but_Level4.Hint=NL_hint_Level4; but_Level5.Hint=NL_hint_Level5; but_Level6.Hint=NL_hint_Level6; but_Level7.Hint=NL_hint_Level7; but_Level8.Hint=NL_hint_Level8; lab_Droogte.Caption = NL_Droogte; lab_Normaal.Caption = NL_Normaal; but_Back.Hint=NL_hint_Back; ima_MainLogo.Image=Material'GeoDelft.Logo_NL'; } else { but_Back.Caption=EN_but_Back; lab_BackGroundLabel.Caption=EN_SelectText; but_Level1.Hint=EN_hint_Level1; but_Level2.Hint=EN_hint_Level2; but_Level3.Hint=EN_hint_Level3; but_Level4.Hint=EN_hint_Level4; but_Level5.Hint=EN_hint_Level5; but_Level6.Hint=EN_hint_Level6; but_Level7.Hint=EN_hint_Level7; but_Level8.Hint=EN_hint_Level8; lab_Droogte.Caption = EN_Droogte; lab_Normaal.Caption = EN_Normal; but_Back.Hint=EN_hint_Back; ima_MainLogo.Image=Material'GeoDelft.Logo_EN'; } } //============================================================================= // Date Id Modification // 2007-02-02 The Created this header // 2007-02-02 The Added IsReleaseVersion and set it to true //============================================================================= defaultproperties { Begin Object Class=GUIImage Name=GeoMainLogo WinWidth=1.0 WinHeight=0.15 WinLeft=0 WinTop=0.08 Image=Material'GeoDelft.Logo_EN' ImageColor=(R=255,G=255,B=255,A=240); ImageStyle=ISTY_Justified ImageRenderStyle=MSTY_Alpha ImageAlign=IMGA_Center End Object Begin Object class=GUITitleBar name=SettingFooter WinWidth=0.88 WinHeight=0.055 WinLeft=0.12 WinTop=0.93 bUseTextHeight=false StyleName="Footer" Justification=TXTA_Center End Object //TITLE AND BACKGROUND OF MAP Begin Object Class=GUITitleBar Name=BackGroundButton bUseTextHeight=false Caption="" Hint="" StyleName="SquareMenuButton" WinWidth=0.61 WinHeight=0.59 WinLeft=0.195 WinTop=0.27 End Object Begin Object class=GUILabel Name=BackGroundLabel Caption="" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) TextFont="HeaderFont" WinWidth=1 WinLeft=0 WinTop=0.3 WinHeight=32 End Object Begin Object class=GUILabel Name=NormaalLabel Caption="" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) TextFont="HeaderFont" WinWidth=0.2 WinLeft=0 WinTop=0.3 WinHeight=32 End Object Begin Object class=GUILabel Name=DroogteLabel Caption="" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) TextFont="HeaderFont" WinWidth=0.2 WinLeft=0 WinTop=0.3 WinHeight=32 bVisible=false End Object //BUTTONS FOR THE OPTIONS Begin Object Class=GUIGFXButton Name=Level1 Graphic=Material'MiniGamesT.failures.piping' Position="ICP_Scaled" bFocusOnWatch=True Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.28 WinTop=0.34 End Object Begin Object Class=GUIGFXButton Name=Level2 Graphic=Material'MiniGamesT.failures.overloop' Position="ICP_Scaled" bFocusOnWatch=True Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.52 WinTop=0.34 End Object Begin Object Class=GUIGFXButton Name=Level3 Graphic=Material'MiniGamesT.failures.micro' Position="ICP_Scaled" bFocusOnWatch=True Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.52 WinTop=0.6 End Object Begin Object Class=GUIGFXButton Name=Level4 Graphic=Material'MiniGamesT.failures.macro' Position="ICP_Scaled" bFocusOnWatch=True Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.28 WinTop=0.6 End Object Begin Object Class=GUIGFXButton Name=Level5 Graphic=Material'MiniGamesT.droogte_botulisme' Position="ICP_Scaled" bFocusOnWatch=True Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.48 WinTop=0.34 bVisible=true End Object Begin Object Class=GUIGFXButton Name=Level6 Graphic=Material'MiniGamesT.droogte_scheuren' Position="ICP_Scaled" bFocusOnWatch=True bVisible=true Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.62 WinTop=0.34 End Object Begin Object Class=GUIGFXButton Name=Level7 Graphic=Material'MiniGamesT.droogte_wigscheur' Position="ICP_Scaled" bFocusOnWatch=True bVisible=true Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.62 WinTop=0.6 End Object Begin Object Class=GUIGFXButton Name=Level8 Graphic=Material'MiniGamesT.droogte_wilnis' Position="ICP_Scaled" bFocusOnWatch=True bVisible=true Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.10 WinHeight=0.15 WinLeft=0.38 WinTop=0.6 End Object Begin Object Class=GUIButton Name=Back Caption="***" Hint="***" OnClick=ButtonClick StyleName="SquareMenuButton" WinWidth=0.12 WinHeight=0.055 WinLeft=0 WinTop=0.93 End Object OnKeyEvent=MyKeyEvent bAllowedAsLast=true bDisconnectOnOpen=false ima_MainLogo=GeoMainLogo AllowSelect = true lab_Hint=SettingFooter OnOpen=MyOpenPage but_Level1 = Level1 but_Level2 = Level2 but_Level3 = Level3 but_Level4 = Level4 but_Level5 = Level5 but_Level6 = Level6 but_Level7 = Level7 but_Level8 = Level8 lab_Normaal = NormaalLabel lab_Droogte = DroogteLabel but_Back = Back but_BackGroundButton = BackGroundButton lab_BackGroundLabel = BackGroundLabel bPersistent=true EN_but_Back="Back" EN_SelectText="Select a mechanism:" EN_Droogte="Drought"; EN_Normal="Normal"; NL_but_Back="Terug" NL_SelectText="Selecteer een mechanisme:" NL_Droogte = "Droogte"; NL_Normaal = "Normaal"; EN_hint_Back="Go to Main Menu" EN_hint_Level1="Piping" EN_hint_Level2="Overflow" EN_hint_Level3="Microstability" EN_hint_Level4="Macrostability" EN_hint_Level5="Botulism" EN_hint_Level6="Cracks" EN_hint_Level7="Wigcracks" EN_hint_Level8="Wilnis" NL_hint_Level1="Piping" NL_hint_Level2="Overtopping" NL_hint_Level3="Microstabiliteit" NL_hint_Level4="Macrostabiliteit" NL_hint_Level5="Botulisme" NL_hint_Level6="Scheuren" NL_hint_Level7="Wigscheur" NL_hint_Level8="Wilnis" NL_hint_Back="Ga naar het Hoofdmenu" //IsReleaseVersion=false; }