// 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 map of the level // Loads MyLevel.LevelMap.MapPreview texture from each level // ------------------------------------------------------------ // Created by Rui Guimaraes // © 2006, Geodelft // Date Id Modification // 2006-11-22 zmr The quit button sets the location as it was before opening the menu // 2007-06-10 gui Maps sizes can now be editable individually in GeoMapDetails //============================================================================= class MenuRedMarkerLocation extends GUIPage; var globalconfig string EN_Topic, NL_Topic; var GeoPlayerController GeoPC; var bool bIgnoreEsc; 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 Canvas GlobalCanvas; var LocationNameSign PreviousLocationSign; var RedMarker.GlobalLocations LocationBeforeDrawn; //Variables for map texture (can be easilly changed this way) var float MapHeight, MapWidth, MapCenterX, MapCenterY; function InitComponent(GUIController MyController, GUIComponent MyOwner) { local string MapName; Super.InitComponent(MyController, MyOwner); OnKeyEvent = InternalOnKeyEvent; OnClose = InternalOnClose; GeoPC=GeoPlayerController(PlayerOwner()); MapName=string(GeoPC.Outer); // BUTTON 1 Controls[1].WinTop = 0.15 + SButtonVGap; Controls[1].WinLeft = 0.5 + (0.7 / 2) - (SButtonSize) - SButtonHGap; Controls[1].WinWidth = SButtonSize; Controls[1].WinHeight = SButtonSize; // BUTTON 2 Controls[2].WinTop = Controls[1].WinTop; Controls[2].WinLeft = Controls[1].WinLeft - (SButtonSize) - SButtonHGap;; Controls[2].WinWidth = SButtonSize; Controls[2].WinHeight = SButtonSize; // OK BUTTON Controls[7].WinTop = 0.15 + Controls[0].WinHeight - SButtonVGap - SButtonSize; Controls[7].WinLeft = 0.5 + (0.7 / 2) - (SButtonSize + SButtonSize + SButtonHGap) - SButtonHGap; Controls[7].WinWidth = 2*SButtonSize + SButtonHGap; Controls[7].WinHeight = SButtonSize; //UPDATE BACKGROUND IMAGE GUIGFxButton(Controls[5]).Graphic=Material(DynamicLoadObject(MapName$".LevelMap.MapPreview", class'Material')); //UpdateMarkers(); UpdateLimits(); if(GeoPC!=None) UpdateLanguage(); else Warn("Error with the type of game."); Controls[0].SetFocus(none); LocationBeforeDrawn = GeoPC.NearByMarker.GlobalLocation; GeoPC.geoFb.logEvent("RedmarkerLocation"); } function UpdateLimits() { local GeoMapDetails GMD; local GeoLevelDetails GLD; local int MapNumber; GMD = new class'GeoMapDetails'; GLD = new class'GeoLevelDetails'; MapNumber = GLD.CurrentLevelScenarioNumber; MapHeight=GMD.GetHeight(MapNumber); MapWidth=GMD.GetWidth(MapNumber); MapCenterX=GMD.GetCenterX(MapNumber); MapCenterY=GMD.GetCenterY(MapNumber); } function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { if(Key == 0x1B || Key == 0x6D || Key == 0x4D) // EXITS WITH ESC, M and m { GeoPC.NearByMarker.GlobalLocation = LocationBeforeDrawn; Controller.ReplaceMenu("GeoSimulator.MenuMarker"); // Close _all_ menus /*if(bIgnoreEsc) { bIgnoreEsc=false; return true; } else { GeoPC.InMenu(false); Controller.CloseMenu(); return true; } */ } return true; } function bool OnDraw(Canvas MyCanvas) { Super.OnDraw(MyCanvas); UpdatePosition(MyCanvas); GlobalCanvas = MyCanvas; // Shouldn't be this way? return true; } function UpdatePosition(Canvas MyCanvas) { if(GeoPC.NearByMarker.GlobalLocation.LocationSign == NONE) { if((Controller.MouseX / MyCanvas.ClipX ) > Controls[5].WinLeft && (Controller.MouseX / MyCanvas.ClipX ) < (Controls[5].WinLeft + Controls[5].WinWidth) && (Controller.MouseY / MyCanvas.ClipY ) > Controls[5].WinTop && (Controller.MouseY / MyCanvas.ClipY ) < (Controls[5].WinTop + Controls[5].WinHeight)) { Controls[6].WinLeft=(Controller.MouseX / MyCanvas.ClipX ) - (Controls[6].WinWidth / 2); Controls[6].WinTop=(Controller.MouseY / MyCanvas.ClipY ) - (Controls[6].WinHeight / 2); } } else { Controls[6].WinLeft=GeoPC.NearByMarker.GlobalLocation.LeftDistance - (Controls[6].WinWidth / 2); Controls[6].WinTop=GeoPC.NearByMarker.GlobalLocation.TopDistance - (Controls[6].WinHeight / 2); Controls[7].bVisible = true; } } function bool MapWatch(GUIComponent Sender) { local vector TempLoc; local float TempWidth, TempHeight; if(GeoPC.NearByMarker.GlobalLocation.LocationSign == NONE) { TempWidth=(Controls[5].WinWidth) / 2; TempHeight=(Controls[5].WinHeight) / 2; TempLoc.x=(-(((Controller.MouseX / GlobalCanvas.ClipX ) - 0.5) / TempWidth) * MapWidth) + MapCenterX; TempLoc.y=(-(((Controller.MouseY / GlobalCanvas.ClipY ) - 0.54) / TempHeight) * MapHeight) + MapCenterY; TempLoc.z=GeoPC.Pawn.Location.Z; GeoPC.NearByMarker.CheckLocationSign(TempLoc); GeoPC.NearByMarker.GlobalLocation.LeftDistance=(Controller.MouseX / GlobalCanvas.ClipX ); GeoPC.NearByMarker.GlobalLocation.TopDistance=(Controller.MouseY / GlobalCanvas.ClipY ); } GeoPC.geoFb.logRedMarkerLocation(GeoPC.NearByMarker); PreviousLocationSign=None; return true; } function bool CrossMove(GUIComponent Sender) { if(GeoPC.NearByMarker.GlobalLocation.LocationSign == NONE) { MapWatch(Sender); // show ok button when marker is placed Controls[7].bVisible = true; } else { PreviousLocationSign = GeoPC.NearByMarker.GlobalLocation.LocationSign; GeoPC.NearByMarker.GlobalLocation.LocationSign = NONE; // hide ok button when marker is being placed Controls[7].bVisible = false; } return true; } function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); } function bool InternalOnClick(GUIComponent Sender) { local int i; local PlayerController pc; pc = PlayerOwner(); for(i=0; i<8; i++) { if(Sender==Controls[i]) { switch(i) { case 1: //quit /*if(PreviousLocationSign!=None) { GeoPC.NearByMarker.GlobalLocation.LocationSign=PreviousLocationSign; }*/ //Set the Location as before opening this page GeoPC.NearByMarker.GlobalLocation = LocationBeforeDrawn; Controller.ReplaceMenu("GeoSimulator.MenuMarker"); // Close _all_ menus break; case 2: //HELP Controller.ReplaceMenu("GeoSimulator.HelpMenuRedMarkerLocation"); break; case 3: Controller.OpenMenu("GeoInterface.NotAvailable"); break; case 7: //ok is pressed, so quit if(PreviousLocationSign!=None) { GeoPC.NearByMarker.GlobalLocation.LocationSign=PreviousLocationSign; } Controller.ReplaceMenu("GeoSimulator.MenuMarker"); // Close _all_ menus break; } } } return true; } function UpdateLanguage() { if(GeoPC.Dutch) { GUILabel(Controls[4]).Caption=NL_Topic; } else { GUILabel(Controls[4]).Caption=EN_Topic; } } defaultproperties { Begin Object Class=GUIButton name=QuitBackground WinWidth=0.7 WinLeft=0.15 WinTop=0.15 WinHeight=0.78 bAcceptsInput=false bNeverFocus=true StyleName="GeoCallBar" End Object Controls(0)=GUIButton'QuitBackground' Begin Object Class=GUIGFxButton Name=NoReport Caption="" Graphic=Material'InGameMenuImagesT.NoBackgroundButtons.Closed' Position="ICP_Scaled" StyleName="MidGameButton" OnClick=InternalOnClick End Object Controls(1)=GUIButton'NoReport' 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 bVisible=false OnClick=InternalOnClick End Object Controls(3)=GUIButton'NextPage' Begin Object class=GUILabel Name=TopicDesc Caption="***" TextALign=TXTA_Center TextColor=(R=255,G=120,B=0,A=255) TextFont="HeaderFont" WinWidth=1 WinLeft=0 WinTop=0.2 WinHeight=32 End Object Controls(4)=GUILabel'TopicDesc' Begin Object Class=GUIGFxButton Name=OkButton1 Caption="Ok" Position="ICP_Scaled" StyleName="MidGameButton" bNeverFocus=true bVisible=false OnClick=InternalOnClick End Object Controls(7)=GUIButton'OkButton1' // ************************************************************** // MAP // // ************************************************************** Begin Object class=GUIGFxButton Name=Map WinWidth=0.66 WinLeft=0.17 WinTop=0.25 WinHeight=0.58 Position="ICP_Scaled" StyleName="MidGameButton" bNeverFocus=true bVisible=true OnClick=MapWatch End Object Controls(5)=GUIGFxButton'Map' Begin Object class=GUIGFxButton Name=MiniMarker WinWidth=0.02 WinHeight=0.03 Graphic=Material'GeoGameplayTextures.MapIcons.MapX' Position="ICP_Scaled" StyleName="None" bNeverFocus=true bVisible=true OnClick=CrossMove End Object Controls(6)=GUIGFxButton'MiniMarker' 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 OpenSound=sound'RuntimeInterfaceSounds.SelectDshort' bIgnoreEsc=true bRequire640x480=false bAllowedAsLast=true EN_Topic="Mark the location" NL_Topic="Markeer de locatie" MapHeight=19000 MapWidth=25000 MapCenterX=0 MapCenterY=0 }