// 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 that shows up, when you are having a conversation in train // // ------------------------------------------------------------ // Created by Rui Guimaraes // © 2006, Geodelft // // Date Id Modification // 2006-11-22 Zmr Disabled quit button, bNoTeleType, immediately show ok button // 2007-05-16 wsl Fixed typo //============================================================================= class MenuTrainingConversation extends GUIPage; var float ButtonWidth; var float ButtonHeight; var float ButtonHGap; var float ButtonVGap; var float BarHeight; var float BarVPos; var float SButtonSize; var float SButtonVGap; var float SButtonHGap; var float MenuWidth; var float MenuHeight; var float TitleLeftGap; var float LineHeight; var GUIFont GFont; var GUIButton OKButt; var GeoPlayerControllerTraining GeoPC; var int NOSTB; var GUIScrollTextBox Scroll_LevelDescription; var array Lines, Answers; var int LineToDisplay; var string EN_Title, NL_Title; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); OnKeyEvent = InternalOnKeyEvent; OnClose = InternalOnClose; // Menu Background Controls[0].WinWidth = MenuWidth; Controls[0].WinHeight = MenuHeight; Controls[0].WinLeft = (1 - Controls[0].WinWidth) / 2; Controls[0].WinTop = (1 - Controls[0].WinHeight) / 2; // BUTTON Close Controls[1].WinTop = Controls[0].WinTop + SButtonVGap; Controls[1].WinLeft = Controls[0].WinLeft + MenuWidth - (SButtonSize) - SButtonHGap; Controls[1].WinWidth = SButtonSize; Controls[1].WinHeight = SButtonSize; Controls[1].SetVisibility(false);// When true change position of Help // BUTTON Help Controls[2].WinTop = Controls[1].WinTop; Controls[2].WinLeft = Controls[1].WinLeft;// - (SButtonSize) - SButtonHGap; Controls[2].WinWidth = SButtonSize; Controls[2].WinHeight = SButtonSize; // BUTTON Next Controls[3].WinTop = Controls[0].WinTop + Controls[0].WinHeight - (LineHeight + SButtonVGap); Controls[3].WinLeft = Controls[2].WinLeft; Controls[3].WinWidth = LineHeight; Controls[3].WinHeight = LineHeight; Controls[3].SetVisibility(false); // Menu Title Controls[4].WinTop = Controls[1].WinTop; Controls[4].WinLeft = Controls[0].WinLeft + TitleLeftGap; Controls[4].WinWidth = Controls[0].WinWidth - (2*(SButtonSize + SButtonHGap) + 2*SButtonHGap); Controls[4].WinHeight = SButtonSize; // Call Picture Controls[5].WinTop = Controls[1].WinTop + SButtonVGap + SButtonSize; Controls[5].WinLeft = Controls[4].WinWidth + Controls[0].WinLeft +2*SButtonHGap;//+ SButtonHGap/2; Controls[5].WinWidth = Controls[0].WinWidth + Controls[0].WinLeft - Controls[5].WinLeft - 2*SButtonHGap; Controls[5].WinHeight = 2.2*Controls[5].WinWidth; // Scroll Panel //NOSTB NumberOfScrollTextBox Controls[NOSTB].WinTop = Controls[5].WinTop; Controls[NOSTB].WinLeft = Controls[0].WinLeft + SButtonHGap; Controls[NOSTB].WinWidth = Controls[4].WinWidth; Controls[NOSTB].WinHeight = Controls[0].WinHeight - (SbuttonSize + 4*SButtonVGap+lineHeight); GUIScrollTextBox(Controls[NOSTB]).SetContent("You are calling the training center"); GUIScrollTextBox(Controls[NOSTB]).MyScrollText.Separator = "|"; // Combo AnswerBox Controls[7].WinTop = Controls[3].WinTop; Controls[7].WinLeft = Controls[NOSTB].WinLeft; Controls[7].WinWidth = Controls[NOSTB].WinWidth; Controls[7].WinHeight = LineHeight; Controls[8].WinTop = Controls[3].WinTop; Controls[8].WinLeft = Controls[1].WinLeft-(SButtonSize +SButtonHGap)+LineHeight+SButtonHGap; Controls[8].WinWidth = SButtonSize + SButtonHGap; Controls[8].WinHeight = Controls[3].WinHeight; OKButt = GUIButton(Controls[8]); OKButt.SetVisibility(true);//immediately be able to close conversation GeoPC = GeoPlayerControllerTraining(PlayerOwner()); Controls[0].SetFocus(none); GUIButton(Controls[2]).bVisible=false; if(GeoPC!=None) { UpdateLanguage(); } else { log("ERROR WITH TYPE OF GAME"); } } //============================================================================= // Date Id Modification // 2007-04-05 Zmr Created this header //============================================================================= Event Opened(GUIComponent Sender) { Super.Opened(Sender); bVisible = true; } function UpdateLanguage() { if(GeoPC.Dutch) { GUILabel(Controls[4]).Caption = NL_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent(GeoPC.NL_TrainMsg); }else { GUILabel(Controls[4]).Caption = EN_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent(GeoPC.EN_TrainMsg); } } // what happens when an button is clicked function bool InternalOnClick(GUIComponent Sender) { local int i; for(i = 0; i < Controls.length; i++) { if(Sender == Controls[i]) { switch(i) { case 1: //Quit button break; case 8: if(GeoPC.TrainStep==4 && GeoPC.TrainSubStep==2 && GeoPC.TakingAction==true) { Controller.ReplaceMenu("GeoSimulator.MenuTrainingYellowMarker"); } else if(GeoPC.TrainStep==6 && GeoPC.TakingAction==true) { Controller.ReplaceMenu("GeoSimulator.MenuTrainingMarker"); } else { GeoPC.InMenu(false); Controller.CloseMenu(); } break; case 2: // Help Button Controller.OpenMenu("GeoSimulator.HelpMenuTrainingConversation"); bVisible = false; break; case 3: // Next Button UpdateLanguage(); GUIScrollTextBox(Controls[NOSTB]).InternalOnAdjustTop(Controls[NOSTB]); Controls[3].MenuState=MSAT_Disabled; OKButt.SetVisibility(true); break; /* if(GeoPC.TrainStep==4 && GeoPC.TrainSubStep==2 && GeoPC.TakingAction==true) { Controller.ReplaceMenu("GeoSimulator.MenuYellowMarker"); } else if(GeoPC.TrainStep==6 && GeoPC.TakingAction==true) { Controller.ReplaceMenu("GeoSimulator.MenuTrainingMarker"); } else { } */ } } } return true; } 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(Key == 0x1B) { GeoPC.InMenu(false); Controller.CloseMenu(); return true; } } function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); GeoPC.TakingAction=false; } defaultproperties { Begin Object Class=GUIButton name=Background bAcceptsInput=false bNeverFocus=true StyleName="GeoCallBar" End Object Controls(0)=GUIButton'Background' Begin Object Class=GUIGFxButton Name=Close Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Closed' Position="ICP_Scaled" StyleName="MidGameButton" OnClick=InternalOnClick End Object Controls(1)=GUIButton'Close' 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=GUILabel Name=MenuTitle Caption="***" TextAlign=TXTA_Left TextColor=(R=255,G=120,B=0,A=255) TextFont="HeaderFont" bMultiLine=true End Object Controls(4)=GUILabel'MenuTitle' Begin Object Class=GUIGFxButton Name=CallPic Caption="" Graphic=Material'InGameMenuImagesT.ImageButtons.TCtmp' Position="ICP_Scaled" StyleName="MidGameButton" bNeverFocus=true bAcceptsInput=false OnClick=InternalOnClick End Object Controls(5)=GUIButton'CallPic' Begin Object Class=GUIScrollTextBox Name=cScroll_LevelDescription CharDelay=0.0001 EOLDelay=0.001 bNeverFocus=true bVisibleWhenEmpty=True bNoTeletype=true; End Object Controls(6)=GUIScrollTextBox'cScroll_LevelDescription' NOSTB=6; //NumberOfScrollTextBox Begin Object class=moComboBox Name=cAnswerCombo Caption="Resolution" // OnChange=MyComboInternalOnChange // OnMousePressed=InternalMousePressed Hint="*** failure" bReadOnly=true CaptionWidth=0.0 bHeightFromComponent=false bVisible=false End Object Controls[7]=moComboBox'cAnswerCombo' Begin Object Class=GUIButton Name=Ok Caption="Ok" StyleName="MidGameButton" bNeverFocus=true OnClick=InternalOnClick End Object Controls(8)=GUIButton'Ok' Begin Object class=GUIFont Name=ScrollFont KeyName="DefaultFont" FontArrayNames=("EM_Fonts_T.FontMono800x600_PageADXT") bFixedSize=true End Object GFont=ScrollFont ButtonWidth=0.17 ButtonHeight=0.12 ButtonHGap=0.02 ButtonVGap=0.037 BarHeight=0.21 BarVPos=0.5 SButtonSize=0.06 SButtonHGap=0.02 SButtonVGap=0.02 TitleLeftGap=0.05 MenuWidth=0.8 MenuHeight=0.8 LineHeight=0.035 bRequire640x480=false bAllowedAsLast=true EN_Title = "Training Center" NL_Title = "Training Centrum" }