// 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 with the action center // // ------------------------------------------------------------ // Created by Maarten van Zomeren // © 2006, Geodelft // // Date Id Modification // 2006-09-21 gui NAME CHANGED. This menu was previously called MenuConversation // 2006-09-25 bas Fixed CalcNewLines(). // 2006-09-29 bas Finished Con_Checking and Con_Correcting. // 2006-09-29 bas Changed correcting state // 2006-10-04 bas Changed SamenvattingSchadebeeld(): different behaviour for 1 signal or multiple signals // 2006-10-04 bas Checking/Correcting: Added message when player is reporting at the wrong location // 2006-10-05 bas Revised checking/correcting with MayTakeDiagnosis // 2006-10-06 bas Added State_Stable // 2006-10-07 The Fixed compiler error in GetInformation // 2006-10-09 gui Stable set option to check before quite // 2006-10-09 bas revised decision when signal is changed // 2006-11-01 bas fixed 'You are called by the AC' problem in UpdateLanguage() // 2006-11-10 bas changed several things in handling a signal with missing answers // 2006-11-16 zmr added take measure functionality // 2006-11-22 bas fixed some bugs in conversation // 2006-11-23 zmr made cancel button invisible // 2006-11-27 zmr The second time in con_measure the measure does not disappear // When you are called by the Ac on close back to game otherwise to Menu Marker. // 2006-12-01 zmr Ac crash fixed. Everything with bStableSet commented. (Also in MenuActionCenterStartEnd) // 2006-12-04 zmr When Ac calls player the for an remember or correcting msg the menumap is displayed. // 2006-12-05 Bas Fixed multiple 'nullpointers' (Accessed None) in GetInformation() // 2006-12-12 Bas AC tells player only once he's at the wrong location // 2006-12-13 Bas Fixed bug in storeSignalInformation()/Fixed typo in AC/Added bGameEndingCall // 2007-04-10 wsl Most of functionality moved to MenuActionCenterStandard; this class is now // a superclass for all AC menus, and can not be instantiated itself // 2007-04-10 wsl Added OnKeyEvent function to catch escape key presses so closing that way is impossible // 2007-06-22 Wsl in missingAnswers() changed parameter to function to Signal // 2007-08-27 Wsl removed all occurrences of bStableSet (not used) and bCalledByAC //============================================================================= class MenuActionCenter extends GUIPage dependsOn(SignalStringData) dependsOn(SignalReport) dependsOn(Signal) DependsOn(ConversationState); var Signal.GeoSignalTypes TempSignalType; var SignalStringData.AnswerStruct TempAnswerStruct; var float ButtonWidth; var float ButtonHeight; var float ButtonHGap; var float ButtonVGap; var float SButtonSize; var float SButtonVGap; var float SButtonHGap; var float MenuWidth; var float MenuHeight; var float TitleLeftGap; var float ButtonsLeftOffset; // this is the horizontal position where the second // column of the menu starts (the buttons and the picture) var float LineHeight; var GeoLevelDetails GLD; var GUIFont GFont; var array ConvState; var SignalStringData.HowSeriousStruct HSeriousStruct; var array Signals; var SignalStringData DataObject; var GeoPlayerController GeoPC; var int NOSTB; // index of ScrollTextBox in Controls-array var array Lines, Answers, AnswersInBox; var int LineToDisplay; var QAStringHashTable CurrentLanguage, Dutch, English; var bool AskQuestion; var bool MayTakeMeasures, MayMakeDiagnoses; var bool bSignalChanged;//default: false, true if player has changed the LATEST report -bas var bool bMissingAnswers; //whether there are answers to signal questions missing -bas var string EN_Title, NL_Title; var string NL_NextLine, EN_NextLine; var string NL_hangingUp, EN_hangingUp; var int ComboChangeCounter; var int reportCount; //number of times the player has checked/corrected a signal in a row -bas var bool diagnosisRequired;//whether diagnosis by player is required -bas var bool changingCombo; //==================================================================================== // Subclasses must call super.InitComponent() before adding their own functionality! //==================================================================================== function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); OnClose = InternalOnClose; OnKeyEvent = InternalOnKeyEvent; // 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; // this button is just to keep the old numbering of the Controls // (there can be no gaps in the Controls-array) Controls[1].setVisibility(false); // BUTTON Help Controls[2].WinTop = Controls[0].WinTop + SButtonVGap; Controls[2].WinLeft = Controls[0].WinLeft + MenuWidth - SButtonSize - SButtonHGap; Controls[2].WinWidth = SButtonSize; Controls[2].WinHeight = SButtonSize; // BUTTON Next Controls[3].WinTop = Controls[0].WinTop + Controls[0].WinHeight - 2*(LineHeight + SButtonVGap); Controls[3].WinLeft = Controls[0].WinLeft + ButtonsLeftOffset; Controls[3].WinWidth = (Controls[0].WinLeft + Controls[0].WinWidth - SButtonHGap) - Controls[3].WinLeft; Controls[3].WinHeight = LineHeight; // Menu Title Controls[4].WinTop = Controls[2].WinTop; Controls[4].WinLeft = Controls[0].WinLeft + TitleLeftGap; Controls[4].WinWidth = Controls[0].WinWidth - TitleLeftGap - SButtonSize - SButtonHGap; Controls[4].WinHeight = SButtonSize; // Call Picture Controls[5].WinTop = Controls[2].WinTop + Controls[2].WinHeight + SButtonVGap; Controls[5].WinLeft = Controls[3].WinLeft; Controls[5].WinWidth = Controls[3].WinWidth; Controls[5].WinHeight = 2.2 * Controls[5].WinWidth; // to compensate for the changed aspect ratio of the image // Scroll Panel containing the text //NOSTB NumberOfScrollTextBox Controls[NOSTB].WinTop = Controls[5].WinTop; Controls[NOSTB].WinLeft = Controls[0].WinLeft + SButtonHGap; Controls[NOSTB].WinWidth = (Controls[3].WinLeft - SButtonHGap) - Controls[NOSTB].WinLeft; Controls[NOSTB].WinHeight = Controls[0].WinHeight - (SbuttonSize + 4*SButtonVGap+lineHeight); GUIScrollTextBox(Controls[NOSTB]).SetContent("You are calling the Action Center"); GUIScrollTextBox(Controls[NOSTB]).MyScrollText.Separator = "|"; // Combo AnswerBox Controls[7].WinTop = Controls[3].WinTop + (LineHeight + SButtonVGap); Controls[7].WinLeft = Controls[NOSTB].WinLeft; Controls[7].WinWidth = Controls[NOSTB].WinWidth; Controls[7].WinHeight = LineHeight; // Hangup Button Controls[8].WinTop = Controls[7].WinTop; Controls[8].WinLeft = Controls[3].WinLeft; Controls[8].WinWidth = Controls[3].WinWidth; Controls[8].WinHeight = Controls[3].WinHeight; Controls[8].setVisibility(false); GeoPC = GeoPlayerController(PlayerOwner()); Controls[0].SetFocus(none); if (!GeoPC.IsDroogte()) { DataObject = new class'SignalStringData'; }else { DataObject = new class'SignalStringDataDroogte'; } ConvState = GeoPC.NearByMarker.ConvState; ConvState.Insert(ConvState.Length,1); ConvState[ConvState.Length-1] = new Class'ConversationState'; GetInformation(); //about location and player name etc FillHashTable(); LineToDisplay = 1; if(GeoPC != None) UpdateLanguage(); else log("ERROR with loading GEOPC in MenuActionCenter"); CalcNewLines(); } //============================================================================= // Date Id Modification // 2007-04-05 Zmr Created this header //============================================================================= Event Opened(GUIComponent Sender) { Super.Opened(Sender); bVisible = true; } //============================================================================= // This function takes care of getting all the information needed to run the menu properly // from var Signals, ConvState, DataObject... // each subclass should implement its own version of GetInformation(), as the // information needs vary among subclasses. // // Date Id Modification // 2007-06-05 Wsl Moved to subclasses //============================================================================= function GetInformation() { } // Write the next text on the textbox function NextLine() { local array comboStrings; local int i; if(lineToDisplay == Lines.Length && AskQuestion) { GUIScrollTextBox(Controls[NOSTB]).AddText("|"$Lines[LineToDisplay-1]); LineToDisplay++; comboStrings.Insert(0, AnswersInBox.Length + 1); comboStrings[0] = CurrentLanguage.getValue("maakselectie"); for(i = 0; i < AnswersInBox.Length; ++i) { comboStrings[i+1] = AnswersInBox[i]; } AskTheQuestion(comboStrings); AskQuestion = false; } else { if(LineToDisplay >= Lines.Length) { CalcNewLines(); } if(lineToDisplay<= Lines.Length) { GUIScrollTextBox(Controls[NOSTB]).AddText("|"$Lines[LineToDisplay-1]); LineToDisplay++; } } } //============================================================================= // Determines the text to be shown on the next line (depending on the game // information) and puts it in the Lines-array. // Each subclass implements it's own version of CalcNewLines! //============================================================================= function CalcNewLines() { } //============================================================================= // Fills the hashtable with the right dutch or english texts to be shown later // Each subclass implements it's own version of FillHashTable! //============================================================================= function FillHashTable() { Dutch = New class'QAStringHashTable'; English = New class'QAStringHashTable'; Dutch.add("maakselectie", ""); English.add("maakselectie", ""); } //=================================================================================== // Makes appropriate changes to the menu after a change of language // Subclasses must call super.UpdateLanguage() before adding their own functionality //=================================================================================== function UpdateLanguage() { if(GeoPC.Dutch) { GUILabel(Controls[4]).Caption = NL_Title; //changed this to make difference of being called and calling the AC -bas if(GeoPC.bRememberWarning || GeoPC.bCorrectionWarning || GeoPC.bGameStartingCall || GeoPC.bGameEndingCall) { GUIScrollTextBox(Controls[NOSTB]).SetContent("Je wordt gebeld door het Actiecentrum."); } else { GUIScrollTextBox(Controls[NOSTB]).SetContent("Je belt het Actiecentrum."); } GUIButton(Controls[3]).Caption = NL_NextLine; GUIButton(Controls[8]).Caption = NL_hangingUp; CurrentLanguage=Dutch; } else { GUILabel(Controls[4]).Caption = EN_Title; //changed this to make difference of being called and calling the AC -bas if(GeoPC.bRememberWarning || GeoPC.bCorrectionWarning || GeoPC.bGameStartingCall || GeoPC.bGameEndingCall) { GUIScrollTextBox(Controls[NOSTB]).SetContent("You are called by the Action Center."); } else { GUIScrollTextBox(Controls[NOSTB]).SetContent("You are calling the Action Center."); } GUIButton(Controls[3]).Caption = EN_NextLine; GUIButton(Controls[8]).Caption = EN_hangingUp; CurrentLanguage=English; } } //================================================================================== // Date Id Modification // 2006-11-10 Bas Created this header/function // 2007-06-22 Wsl Changed parameter from index in Signal-array to the Signal itself // (so that it can be used for ChangedSignals too) // // This function returns the number of missingAnswers of Signal s //================================================================================== function int missingAnswers(Signal s) { local array aTemp; local int i,notAnswered; aTemp = DataObject.GetAllAnswers(s, s.SignalReports.Length-1); notAnswered = 0; for(i = 0; i < aTemp.Length; i++) { if(aTemp[i] == -1) notAnswered++; } return notAnswered; } // this function add the question field in the menu and add the questions to it. // it is always called from NextLine(). function AskTheQuestion(array Answers) { local moComboBox comboBox; local int i; Controls[3].MenuState=MSAT_Disabled; comboBox = moComboBox(Controls[7]); comboBox.SetVisibility(true); for(i = 0; i < Answers.Length;i++) { comboBox.AddItem(Answers[i],,Answers[i]); } } //After this function the question field in the menu is gone and the values it had are also gone function HideQuestion() { local moComboBox comboBox; local int i; comboBox = moComboBox(Controls[7]); comboBox.SetVisibility(false); for(i = comboBox.ItemCount() - 1; i > -1; i--) { comboBox.RemoveItem(i); } } // // Menu functions // // what happens when an button is clicked (instead of each subclass implementing // their own InternalOnClick, user clicks are redirected to separate functions per button; // these functions (like 'HelpButtonClicked()' could be handled by the subclasses). function bool InternalOnClick(GUIComponent Sender) { local int i; for(i = 2; i < Controls.length; i++) { if(Sender == Controls[i]) { switch(i) { case 2: HelpButtonClicked(); break; case 3: NextLine(); break; case 8: HangupButtonClicked(); break; } } } return true; } //============================================================================= // Date Id Modification // 2006-04-10 wsl function added // // Actions performed when the help button is clicked. Currently the same for all. //============================================================================= function HelpButtonClicked() { Controller.OpenMenu("GeoSimulator.HelpMenuActionCenter"); bVisible = false; } //============================================================================= // Date Id Modification // 2006-04-10 wsl function added // // Actions performed when the hangup button is clicked. // Each subclass implements it's own version of OKButtonClicked! //============================================================================= function HangupButtonClicked() { } function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); } function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { if(Key == 0x1B) { // do nothing; this catches the Escape keypress so it doesn't close this menu from 'above' } return true; } function OnMouseComboPressed(GUIComponent Sender, bool bRepeat) { log("In OnMouseComboPressed "); moComboBox(Controls[7]).MyComboBox.InternalOnMousePressed(Sender, bRepeat); Controls[3].MenuState=MSAT_Blurry; } function OnComboChange(GUIComponent Sender) { local int i; local int index; local array tempAr; local moComboBox cb; // // Apparently calling GetItem() on the combobox results in a call to OnComboChange.... // so return if we're currently changing the combo box (bit of a hack...) // Also, I don't really want to rearrange the combobox in this function, but I just could // not find another way. So if anyone has an idea.... // if( changingCombo ) return; cb = moComboBox(Controls[7]); if( cb.MyComboBox.List.GetItemAtIndex(0) == CurrentLanguage.getValue("maakselectie") ) { // initialise the hack... ;) changingCombo = true; index = cb.GetIndex(); if( cb.GetIndex() != 0 ) { tempAr.Insert(0, cb.ItemCount()-1); for( i = 1; i < cb.ItemCount(); ++i) { tempAr[i-1] = cb.GetItem(i); } while( cb.ItemCount()!= 0 ) { cb.RemoveItem(0); } for( i = 0; i < tempAr.Length; ++i) { cb.AddItem(tempAr[i],,tempAr[i]); } cb.SetIndex(index-1); Controls[3].MenuState=MSAT_Blurry; } } // and switch off the hack! changingCombo = false; } defaultproperties { AskQuestion = false; Begin Object Class=GUIButton name=Background bAcceptsInput=false bNeverFocus=true StyleName="GeoCallBar" End Object Controls(0)=GUIButton'Background' // there is no close button in this menu; this is for continuity of controls-array Begin Object Class=GUIGFxButton Name=Stub End Object Controls(1)=GUIButton'Stub' 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="NP" 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.ACtmp' Position="ICP_Scaled" StyleName="MidGameButton" bNeverFocus=true bAcceptsInput=false 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 bStripColors=false End Object Controls(6)=GUIScrollTextBox'cScroll_LevelDescription' NOSTB=6; //NumberOfScrollTextBox Begin Object class=moComboBox Name=cAnswerCombo Caption="Resolution" OnChange=OnComboChange OnMousePressed=OnMouseComboPressed Hint="*** failure" bReadOnly=true CaptionWidth=0.0 bHeightFromComponent=false bVisible=false End Object Controls[7]=moComboBox'cAnswerCombo' Begin Object Class=GUIButton Name=Hangup Caption="Hangup" StyleName="MidGameButton" bNeverFocus=true OnClick=InternalOnClick End Object Controls(8)=GUIButton'Hangup' 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 SButtonSize=0.06 SButtonHGap=0.02 SButtonVGap=0.02 TitleLeftGap=0.05 ButtonsLeftOffset = 0.6 MenuWidth=0.8 MenuHeight=0.8 LineHeight=0.035 bRequire640x480=false bAllowedAsLast=true bSignalChanged=false bMissingAnswers=false changingCombo=false EN_Title = "Action Center" NL_Title = "Actiecentrum" EN_NextLine = "Next Reaction" NL_NextLine = "Volgende Reactie" EN_hangingUp = "Hang up" NL_hangingUp = "Ophangen" MayTakeMeasures=false MayMakeDiagnoses=false }