// 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 for help // // ------------------------------------------------------------ // Created by Rui Guimaraes // © 2006, Geodelft // ------------------------------------------------------------ // 2006-12-13 Bas Added bPreviousCloseMenu used in HelpMenuPlaceRedMarker // 2007-11-13 Zmr Fixed esc functionality. Now it swallows and then does the same as ESC //============================================================================= class HelpMenu 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 GeoPlayerController GeoPC; var int NOSTB; var GUIScrollTextBox Scroll_LevelDescription; var array Lines, Answers; var int LineToDisplay; var string EN_Title, NL_Title; var string PreviousMenuName, EN_HelpText, NL_HelpText; var bool bPreviousCloseMenu, //checks whether to close the menu or to replace the menu. -Bas bCloseMenuButStillInMenu;//Closes the help menu, but gives the control to the menu below it in stack. var bool bIgnoreEsc; 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; // 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[2].WinLeft + SButtonHGap/2; Controls[5].WinWidth = 2*SButtonSize; Controls[5].WinHeight = 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; GeoPC = GeoPlayerController(PlayerOwner()); Controls[0].SetFocus(none); if(GeoPC!=None) { UpdateLanguage(); } else { log("ERROR WITH TYPE OF GAME"); } GeoPC.geoFb.logHelp(self, PreviousMenuName); } function UpdateLanguage() { if(GeoPC.Dutch) { GUILabel(Controls[4]).Caption = NL_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent(NL_HelpText); }else { GUILabel(Controls[4]).Caption = EN_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent(EN_HelpText); } } // 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: if(bPreviousCloseMenu){ GeoPC.InMenu(false); Controller.CloseMenu(); }else if(bCloseMenuButStillInMenu) { Controller.CloseMenu(); bCloseMenuButStillInMenu = false; }else { Controller.ReplaceMenu(PreviousMenuName); } break; case 2: // Help Button // Controller.OpenMenu("GeoInterface.NotAvailable"); break; case 3: // Next Button GUIScrollTextBox(Controls[NOSTB]).InternalOnAdjustTop(Controls[NOSTB]); break; } } } 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(bIgnoreEsc && Key == 0x1B) { bIgnoreEsc = false; }else if( Key == 0x1B) { if(bPreviousCloseMenu){ GeoPC.InMenu(false); Controller.CloseMenu(); }else if(bCloseMenuButStillInMenu) { Controller.CloseMenu(); bCloseMenuButStillInMenu = false; }else { Controller.ReplaceMenu(PreviousMenuName); } } return true; } function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); } defaultproperties { bIgnoreEsc = true 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 bVisible=false 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.0021 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=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 = "Help" NL_Title = "Help" PreviousMenuName="GeoSimulator.MenuInventory" bPreviousCloseMenu=false bCloseMenuButStillInMenu=false EN_HelpText="No help available for this item." NL_HelpText="Hiervoor is geen uitleg beschikbaar." }