// 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. //============================================================================= // Menu listening scenarios from server // ------------------------------------------------------------ // Created by Almar Joling // dinsdag 19 juni 2012 //============================================================================= class MenuScenarios extends GUIPage; var bool bAllowSelect; struct TempLevelConfig { /// Tiles to activate after bringing up the level: (set from MenuLevelOptions / Stored in config) var array LeveeTilesToActivate; var bool IsRaining; var bool TakeMeasures; var bool MakeDiagnoses; var bool IsCompleteExercise; var int CurrentLevelScenarioNumber; // Used for loading screen image and for in game MAPS var material CurrentLevelImage; }; var GeoPlayerController GeoPC; var bool bEditReport; var bool bIgnoreEsc; var float HGap; var float VGap; var float MiddleEdge; var float ButtonWidth, ButtonHeight, ButtonHGap, ButtonVGapSmall, ButtonVGapLarge, BarHeight, BarVPos, SButtonSize, SButtonVGap, SButtonHGap, TitleLeftGap, TabWidth, TabHeight, TabLeft, TabTop; var automated GUIListBox listScenarios; var automated GUIButton BackGround, But_Back, But_Play; var automated GUITitleBar Bar_Title, Bar_Hint; var automated GUILabel Lab_GameRules, Lab_Diagnosis, Lab_Measure, Lab_Weathertype, Lab_DiagnosisValue, Lab_MeasureValue, Lab_WeathertypeValue; var localized string EN_Title, NL_Title, EN_Resume, NL_Resume, EN_ResumeHint, NL_ResumeHint, EN_Play, NL_Play, EN_PlayHint, NL_PlayHint, NL_GameRules,EN_GameRules, NL_Diagnoses,EN_Diagnoses, NL_Yes,EN_Yes, NL_HintDiag_Yes,EN_HintDiag_Yes, NL_No,EN_No, NL_HintDiag_No,EN_HintDiag_No, NL_Measures,EN_Measures, NL_HintMeas_Yes,EN_HintMeas_Yes, NL_HintMeas_No,EN_HintMeas_No, NL_FailureChoice,EN_FailureChoice, NL_Fail_Rand,EN_Fail_Rand, NL_HintFail_Rand,EN_HintFail_Rand, NL_Fail_Choice,EN_Fail_Choice, NL_HintFail_Choice,EN_HintFail_Choice, NL_Weathertype,EN_Weathertype, NL_Weath_Clear,EN_Weath_Clear, NL_HintWeath_Clear,EN_HintWeath_Clear, NL_Weath_Rain,EN_Weath_Rain, NL_HintWeath_Rain,EN_HintWeath_Rain; // begin to be set by the extending object var material MapPicture; var automated GUIImage Img_Preview; var automated GUIImage Img_InputBackground; var automated GUIScrollTextBox Scroll_LevelDescription; var string NL_DescriptionDG, EN_DescriptionDG, MapUrl; var int ScenarioNumber; //============================================================================= // Date Id Modification // 2006-10-26 The Created this header // 2006-11-22 Zmr hide quit button, moved help button //============================================================================= function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); OnClose = InternalOnClose; OnKeyEvent = InternalOnKeyEvent; GeoPC=GeoPlayerController(PlayerOwner()); if(GeoPC!=None) { } else { log("ERROR WITH GEOPLAYERCONTROLLER"); } LoadScenarios(); listScenarios.List.OnChange = ObservationListChange; UpdateLanguage(); BackGround.WinWidth = 1; BackGround.WinHeight = 1; BackGround.WinLeft = (1 - BackGround.WinWidth) / 2; BackGround.WinTop = (1 - BackGround.WinHeight) / 2; BackGround.bVisible = false; // Menu Title Bar_Title.WinTop = BackGround.WinTop + ButtonVGapLarge; Bar_Title.WinLeft = (BackGround.WinLeft); Bar_Title.WinWidth = 1; Bar_Title.WinHeight = SButtonSize; //quit/back button But_Back.WinWidth=ButtonWidth; But_Back.WinHeight=ButtonHeight; But_Back.WinLeft=0; But_Back.WinTop=0.93; //Start the game button But_Play.WinWidth=ButtonWidth; But_Play.WinHeight=ButtonHeight; But_Play.WinLeft=BackGround.WinWidth - But_Play.WinWidth; But_Play.WinTop=But_Back.WinTop; // Menu footer Bar_Hint.WinWidth=BackGround.WinWidth - But_Play.WinWidth - But_Back.WinWidth; Bar_Hint.WinHeight=But_Back.WinHeight; Bar_Hint.WinLeft=But_Back.WinLeft + But_Back.WinWidth; Bar_Hint.WinTop=But_Back.WinTop; Img_Preview.WinWidth=0.2; Img_Preview.WinHeight=Img_Preview.WinWidth; Img_Preview.WinLeft= listScenarios.WinLeft+listScenarios.WinWidth + (ButtonHGap*2); Img_Preview.WinTop= listScenarios.WinTop + ButtonHGap; //Bar_Title.WinHeight + Bar_Title.WinTop + ButtonVGapLarge; Img_Preview.Image = MapPicture; Scroll_LevelDescription.WinWidth=Img_Preview.WinWidth*2; Scroll_LevelDescription.WinHeight=Img_Preview.WinWidth; Scroll_LevelDescription.WinLeft=Img_Preview.WinLeft + Img_Preview.WinWidth+0.03; Scroll_LevelDescription.WinTop =Img_Preview.WinTop; Scroll_LevelDescription.SetContent( NL_DescriptionDG); //User Choice Img_InputBackground.WinTop = listScenarios.WinTop ; Img_InputBackground.WinLeft = listScenarios.WinLeft + ButtonHGap; Img_InputBackground.WinWidth = 1 - Img_InputBackground.WinLeft - ButtonVGapLarge; Img_InputBackground.WinHeight = listScenarios.WinHeight; // first line Lab_GameRules.WinTop = Img_Preview.WinTop+Img_Preview.WinHeight+ ButtonHGap; Lab_GameRules.WinLeft = Img_Preview.WinLeft ; Lab_GameRules.WinHeight = ButtonHeight; Lab_GameRules.WinWidth = ButtonWidth *2; // second line Lab_Diagnosis.WinTop = Lab_GameRules.WinTop + 1 *(Lab_GameRules.WinHeight + ButtonHGap); Lab_Diagnosis.WinLeft = Lab_GameRules.WinLeft; Lab_Diagnosis.WinHeight = Lab_GameRules.WinHeight; Lab_Diagnosis.WinWidth = ButtonWidth*1.5; //third line Lab_Measure.WinTop = Lab_GameRules.WinTop + 2 *(Lab_GameRules.WinHeight + ButtonHGap); Lab_Measure.WinLeft = Lab_GameRules.WinLeft; Lab_Measure.WinHeight = Lab_GameRules.WinHeight; Lab_Measure.WinWidth = Lab_Diagnosis.WinWidth; //fourth line Lab_Weathertype.WinTop = Lab_GameRules.WinTop + 3 *(Lab_GameRules.WinHeight + ButtonHGap); Lab_Weathertype.WinLeft = Lab_GameRules.WinLeft; Lab_Weathertype.WinHeight = Lab_GameRules.WinHeight; Lab_Weathertype.WinWidth = Lab_Diagnosis.WinWidth; Lab_DiagnosisValue.WinTop = Lab_Diagnosis.WinTop; Lab_DiagnosisValue.WinLeft = Lab_Diagnosis.WinLeft + Lab_Diagnosis.WinWidth + ButtonHGap; Lab_DiagnosisValue.WinWidth = Lab_Diagnosis.WinWidth; Lab_DiagnosisValue.WinHeight = Lab_Diagnosis.WinHeight; Lab_MeasureValue.WinTop = Lab_Measure.WinTop; Lab_MeasureValue.WinLeft = Lab_Measure.WinLeft + Lab_Measure.WinWidth + ButtonHGap; Lab_MeasureValue.WinWidth = Lab_Measure.WinWidth; Lab_MeasureValue.WinHeight = Lab_Measure.WinHeight; Lab_WeathertypeValue.WinTop = Lab_Weathertype.WinTop; Lab_WeathertypeValue.WinLeft = Lab_Weathertype.WinLeft + Lab_Weathertype.WinWidth + ButtonHGap; Lab_WeathertypeValue.WinWidth = Lab_Weathertype.WinWidth; Lab_WeathertypeValue.WinHeight = Lab_Weathertype.WinHeight; AddScenarios(); } //============================================================================= // Date Id Modification // 2006-10-26 The Created this header //============================================================================= function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); } function AddScenarios() { local GUIList list; local int i; list = (listScenarios).List; list.Clear(); for(i = 0; i < GeoPC.scenarionames.length; i++) { list.Add(GeoPC.scenarionames[i]); } But_Play.MenuState=MSAT_Disabled; if (GeoPC.scenarionames.length > 0 ) { list.SetIndex(0); UpdateScenarioInfo(0); } } //============================================================================= // Date Id Modification // 2006-10-26 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; } else if (Key == 0x1B ) { Controller.ReplaceMenu("GeoInterface.MainMenuOptions"); return true; } } //============================================================================= // Date Id Modification // 2006-10-26 The Created this header //============================================================================= function bool InternalOnClick(GUIComponent Sender) { switch(Sender) { case But_Back: // back / quit button Controller.ReplaceMenu("GeoInterface.MainMenuOptions"); break; case But_Play: // Start the current level LoadMap(); break; } return true; } //============================================================================= // called whenever anything changes to the list (different selection, or change in list elements) // Date Id Modification // 2006-10-26 The Created this header //============================================================================= function ObservationListChange(GUIComponent Sender) { local GUIList list; local int listindex; list = (listScenarios).List; listindex = list.Index; UpdateScenarioInfo(listindex); } function UpdateScenarioInfo(int listindex) { local int i; local GeoLevelDetails GLD; local string temp; local GeoPlayerController.TempLevelConfig tlc; local string sYes, sNo; local string sClear, sRain; if(listindex >= 0) { GLD = new class'GeoLevelDetails'; GLD.ResetLevelDetails(); Log("Selected: " $ listindex); tlc = GeoPC.scenariogld[listindex]; GLD.IsRaining = tlc.IsRaining; GLD.TakeMeasures = tlc.TakeMeasures; GLD.MakeDiagnoses = tlc.MakeDiagnoses; GLD.CurrentLevelScenarioNumber = tlc.CurrentLevelScenarioNumber; GLD.CurrentLevelImage = tlc.CurrentLevelImage; GLD.LeveeTilesToActivate = tlc.LeveeTilesToActivate; /// 12-10-2012 - Update Scenario number: MapURL = "Scenario" $ GLD.CurrentLevelScenarioNumber $ "DG"; if(GeoPC.Dutch) { sYes = NL_Yes; sNo = NL_No; sClear = NL_Weath_Clear; sRain = NL_Weath_Rain; } else { sYes = EN_Yes; sNo = EN_No; sClear = EN_Weath_Clear; sRain = EN_Weath_Rain; } But_Play.MenuState=MSAT_Blurry; Lab_DiagnosisValue.Caption = sNo; Lab_MeasureValue.Caption = sNo; Lab_WeathertypeValue.Caption = sClear; if (GLD.TakeMeasures == true) { Lab_DiagnosisValue.Caption = sYes; } if (GLD.MakeDiagnoses == true) { Lab_MeasureValue.Caption = sYes; } if (GLD.IsRaining == true) { Lab_WeathertypeValue.Caption = sRain; } GLD.SaveConfig(); // update text: for(i = 0; i < GLD.LeveeTilesToActivate.length; i++) { //temp = temp $ GLD.LeveeTilesToActivate[i].Mechanism $ "|"; if (GLD.LeveeTilesToActivate[i].VerySerious == 1) { GLD.ArrayCriticalActiveFailureNames.Insert(0,1); GLD.ArrayCriticalActiveFailureNames[0].FailureName=GLD.LeveeTilesToActivate[i].FailureNames[0]; } if (GLD.LeveeTilesToActivate[i].Serious == 1) { GLD.ArrayRelevantActiveFailureNames.Insert(0,1); GLD.ArrayRelevantActiveFailureNames[0].FailureName=GLD.LeveeTilesToActivate[i].FailureNames[0]; } if (GLD.LeveeTilesToActivate[i].NotSerious == 1) { GLD.ArrayReportableActiveFailureNames.Insert(0,1); GLD.ArrayReportableActiveFailureNames[0].FailureName=GLD.LeveeTilesToActivate[i].FailureNames[0]; } } Log(tlc.DutchDesc); Scroll_LevelDescription.SetContent( tlc.DutchDesc $ "|" $ temp); } } function bool LoadMap() { local GeoCompleteExercise GCE; //log("LevelOptions LoadMap"); GCE = new class'GeoCompleteExercise'; GCE.IsCompleteExercise=false; GCE.SaveConfig(); //if(SaveLevelInfo()) // { SaveConfig(); Console(Controller.Master.Console).ConsoleCommand("start"@MapURL); Controller.CloseAll(false); // } return true; } function LoadScenarios() { if (GeoPC.scenarionames.Length == 0) { GeoPlayerController(PlayerOwner()).ScenarioSuccesCall = ScenarioSucces; GeoPlayerController(PlayerOwner()).GetScenarios(); } } function ScenarioSucces( ) { local GUIList list; list = (listScenarios).List; // Only if list is still empty: if (list.Elements.length == 0) { AddScenarios(); } } function ScenarioFailure( ) { } function bool SaveLevelInfo() { local GeoLevelDetails GLD; local GeoLevelDetails.FailureDescription failure; GLD = new class'GeoLevelDetails'; GLD.ResetLevelDetails(); GLD.ArrayCriticalActiveFailureNames.Length=0; //failure.FailureName = 'LeveeTile2'; //failure.MechanismType = FM_Macro; //GLD.ArrayCriticalActiveFailureNames.Insert(0,1); //GLD.ArrayCriticalActiveFailureNames[0] = failure; GLD.LeveeTilesToActivate.Insert(0,1); GLD.LeveeTilesToActivate[0].MaxCount = 1; GLD.LeveeTilesToActivate[0].Mechanism = failure.MechanismType; GLD.LeveeTilesToActivate[0].VerySerious = 1; GLD.LeveeTilesToActivate[0].Serious =0; GLD.LeveeTilesToActivate[0].NotSerious = 0; GLD.LeveeTilesToActivate[0].FailureNames.Length = 1; // = FailuresToActivate[i].FailureNames; GLD.LeveeTilesToActivate[0].FailureNames[0] = 'LeveeTile2'; /* mechanisms = int(Localize ("Exercise"$LN, "Mechanisms", "GeoSimulator")); Log("Mechanisms detected: " @ mechanisms); LevelDetailsList[LN].LevelFailureList.Remove(0, LevelDetailsList[LN].LevelFailureList.Length); LevelDetailsList[LN].MapString = Localize("Exercise"$LN, "MapString", "GeoSimulator"); LevelDetailsList[LN].MapNumber = int(Localize ("Exercise"$LN, "MapNumber", "GeoSimulator")); LevelDetailsList[LN].bRain = bool(Localize ("Exercise"$LN, "bRain", "GeoSimulator")); LevelDetailsList[LN].bMakeDiag = bool(Localize ("Exercise"$LN, "bMakeDiag", "GeoSimulator")); LevelDetailsList[LN].bTakeMeas = bool(Localize ("Exercise"$LN, "bTakeMeas", "GeoSimulator")); LevelDetailsList[LN].Screenshot = Texture(DynamicLoadObject(Localize ("Exercise"$LN, "Screenshot", "GeoSimulator"),class'Texture')); LevelDetailsList[LN].EN_ShortDescription = (Localize ("Exercise"$LN, "EN_ShortDescription", "GeoSimulator")); LevelDetailsList[LN].NL_ShortDescription = (Localize ("Exercise"$LN, "NL_ShortDescription", "GeoSimulator")); for (j = 0; j < mechanisms ; j++ ) { LevelDetailsList[LN].LevelFailureList.Insert(0,1); LevelDetailsList[LN].LevelFailureList[0].Mechanism = GetFailureFromString (Localize ("E"$LN$"Mechanism"$j, "Mechanism", "GeoSimulator") ); LevelDetailsList[LN].LevelFailureList[0].MaxCount = int(Localize ("E"$LN$"Mechanism"$j, "MaxCount", "GeoSimulator")); LevelDetailsList[LN].LevelFailureList[0].VerySerious = int(Localize ("E"$LN$"Mechanism"$j, "VerySerious", "GeoSimulator")); LevelDetailsList[LN].LevelFailureList[0].Serious = int(Localize ("E"$LN$"Mechanism"$j, "Serious", "GeoSimulator")); LevelDetailsList[LN].LevelFailureList[0].NotSerious = int(Localize ("E"$LN$"Mechanism"$j, "NotSerious", "GeoSimulator")); */ GLD.IsRaining = false; GLD.MakeDiagnoses = true; GLD.TakeMeasures = true; //bTakeMeasures && GLD.MakeDiagnoses; GLD.CurrentLevelScenarioNumber = 1; //ScenarioNumber; GLD.CurrentLevelImage = MapPicture; ScenarioNumber = 1; Log("Scenario number at MenuLevelOptions: " @ ScenarioNumber); GLD.IsCompleteExercise = false; GLD.SaveConfig(); return true; } //============================================================================= // Date Id Modification // 2006-10-26 The Created this header //============================================================================= function ChangeAllow(bool allow) { bAllowSelect = allow; } //============================================================================= // Date Id Modification // 2006-10-26 The Created this header //============================================================================= function UpdateLanguage() { if(GeoPC.Dutch) { // The title bar Bar_Title.Caption = NL_Title; But_Back.Caption=NL_Resume; But_Back.Hint=NL_ResumeHint; But_Play.Caption = NL_Play; But_Play.Hint = NL_PlayHint; Lab_GameRules.Caption = NL_GameRules; Lab_Diagnosis.Caption = NL_Diagnoses; Lab_Measure.Caption = NL_Measures ; // Lab_FailureChoice.Caption = NL_FailureChoice; Lab_Weathertype.Caption = NL_Weathertype; } else { // The title bar Bar_Title.Caption = EN_Title; But_Back.Caption=EN_Resume; But_Back.Hint=EN_ResumeHint; But_Play.Caption = EN_Play; But_Play.Hint = EN_PlayHint; Lab_GameRules.Caption = EN_GameRules; Lab_Diagnosis.Caption = EN_Diagnoses; Lab_Measure.Caption = EN_Measures ; // Lab_FailureChoice.Caption = EN_FailureChoice; Lab_Weathertype.Caption = EN_Weathertype; } } //============================================================================= // Date Id Modification // 2006-10-26 The Created this header //============================================================================= defaultproperties { BackGround=GUIButton'Background1' Begin Object class=GUITitleBar name=SettingHeader Caption="Levee Patroller Options" StyleName="Header" Justification=TXTA_Center End Object Bar_Title=GUITitleBar'SettingHeader' Begin Object class=GUIListBox Name=ScenariosBox bVisibleWhenEmpty=True StyleName="SquareMenuButton" WinWidth=0.2 WinHeight=0.5 WinLeft=0.05 WinTop=0.15 End Object Begin Object class=GUITitleBar name=SettingFooter bUseTextHeight=false StyleName="Footer" Justification=TXTA_Center End Object Bar_Hint=GUITitleBar'SettingFooter' Begin Object Class=GUIButton Name=Button OnClick=InternalOnClick StyleName="SquareMenuButton" End Object But_Back=GUIButton'Button' But_Play=GUIButton'Button' Begin Object class=GUILabel Name=LabelTitle Caption= "" TextColor=(R=255,G=120,B=0,A=255) TextFont="MidGameFont" End Object Begin Object class=GUILabel Name=Label Caption= "" TextColor=(R=255,G=255,B=255,A=255) TextFont="MidGameFont" End Object Begin Object Class=GUIImage Name=cImage_PreviewImage ImageStyle=ISTY_Scaled ImageRenderStyle=MSTY_Normal ImageColor=(R=255,G=255,B=255,A=255); End Object Img_Preview=cImage_PreviewImage Begin Object Class=GUIScrollTextBox Name=cScroll_LevelDescription CharDelay=0.0021 EOLDelay=0.001 bNeverFocus=true bVisibleWhenEmpty=True End Object Scroll_LevelDescription=cScroll_LevelDescription Begin Object class=GUIImage Name=InputBK1 Image=Material'GUIContent.BorderBoxD' ImageColor=(R=255,G=255,B=255,A=160); ImageRenderStyle=MSTY_Alpha ImageStyle=ISTY_Stretched End Object Img_InputBackground = GUIImage'InputBK1' Lab_GameRules=GUILabel'LabelTitle' Lab_Diagnosis=GUILabel'Label' Lab_Measure=GUILabel'Label' Lab_Weathertype=GUILabel'Label' Lab_DiagnosisValue=GUILabel'Label' Lab_MeasureValue=GUILabel'Label' Lab_WeathertypeValue=GUILabel'Label' listScenarios=ScenariosBox ButtonWidth=0.12 ButtonHeight=0.055 ButtonHGap=0.01 ButtonVGapLarge=0.03 ButtonVGapSmall=0.02 BarHeight=0.21 BarVPos=0.5 SButtonSize=0.06 SButtonHGap=0.02 SButtonVGap=0.02 TitleLeftGap=0.05 OpenSound=sound'RuntimeInterfaceSounds.SelectDshort' bRequire640x480=false bAllowedAsLast=true bAllowSelect=true bIgnoreEsc=true NL_Title="Scenario spelen" EN_Title="Play a scenario" EN_Resume="Back" NL_Resume="Terug" EN_ResumeHint="Go back to Main Menu" NL_ResumeHint="Terug naar het hoofdmenu" EN_Play ="Begin" NL_Play ="Start" EN_PlayHint ="Play the scenario" NL_PlayHint ="Start het scenario" MapPicture = Material'GeoDelft.MapPreview.Level4screenshot'; NL_DescriptionDG = "Kies een scenario in de lijst links (indien beschikbaar)." MapUrl="Scenario1DG" NL_GameRules="SPELEIGENSCHAPPEN" EN_GameRules="GAMEPLAY OPTIONS" NL_Diagnoses="Diagnosticeren" EN_Diagnoses="Make Diagnoses" NL_Yes = "Ja" EN_Yes = "Yes" NL_HintDiag_Yes="Maak het mogelijk om het faalmechanisme achter een schadebeeld vast te stellen" EN_HintDiag_Yes="Enables the task of determining the failure mechanism behind signals" NL_No = "Nee" EN_No = "No" NL_HintDiag_No="Laat het Actiecentrum het faalmechanimse achter een schadebeeld vaststellen" EN_HintDiag_No="Let the Action Center determine which failure mechanism is associated with the signals" NL_Measures="Maatregelen nemen" EN_Measures="Take measures" NL_HintMeas_Yes="Maak het mogelijk om zelf de beschermende maatregelen te kiezen" EN_HintMeas_Yes="Enables the task of determining the right measure to prevent further damage" NL_HintMeas_No="Laat het Actiecentrum de juiste beschermende maatregel voor je kiezen" EN_HintMeas_No="Let the Action Center determine what the best measure is to prevent further damage" NL_FailureChoice="Faalmechanismen" EN_FailureChoice="Failure Mechanisms" NL_Fail_Rand="Willekeurig" EN_Fail_Rand="Random" NL_HintFail_Rand="Plaats een willekeurig aantal faalmechanismen in het landschap" EN_HintFail_Rand="Choose this to randomly place the failure mechanisms in the region" NL_Fail_Choice="Kiezen" EN_Fail_Choice="Custom" NL_HintFail_Choice="Selecteer zelf het aantal en de soort faalmechanismen" EN_HintFail_Choice="Choose this to customize the number and type of failure mechanisms" NL_Weathertype="Weerkeuze" EN_Weathertype="Weather options" NL_Weath_Clear="Helder" EN_Weath_Clear="Clear" NL_HintWeath_Clear="Inspecteer tijdens helder weer (beter zicht)" EN_HintWeath_Clear="Inspect during clear weather (high visibility)" NL_Weath_Rain="Regen" EN_Weath_Rain="Rain" NL_HintWeath_Rain="Inspecteer tijdens regenachtig weer (slecht zicht)" EN_HintWeath_Rain="Inspect during rainy weather (low visibility)" }