Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------
- // Main Menu where all the fancy stuff takes place.
- //------------------------------------------------------------------------------
- class MyMainMenuScene extends GUIMenuScene;
- event InitMenuScene()
- {
- FindComponentByTag("TitleBackground").OnMouseReleased = TitleBackgroundEvent;
- FindComponentByTag("BackToTitleButton").OnMouseReleased = BackToTitleButtonEvent;
- FindComponentByTag("StartButton").OnMouseReleased = StartButtonEvent;
- super.InitMenuScene();
- }
- // Override the mouse cursor function. The reason is that our cursor texture is
- // large and should point at it's middle rather than using the top-left corner.
- function DrawCursor(Canvas C, float PosX, float PosY, optional bool bHasSelection)
- {
- C.SetPos(PosX - OwnerHUD.RatioX * (CursorTexture.SizeX/2), PosY - OwnerHUD.RatioX * (CursorTexture.SizeX/2));
- if (bHasSelection)
- {
- // Set the cursor color
- C.DrawColor = SelectionCursorColor;
- // Draw the texture on the screen
- C.DrawTile(SelectionCursorTexture, SelectionCursorTexture.SizeX, SelectionCursorTexture.SizeY,
- 0.f, 0.f, SelectionCursorTexture.SizeX, SelectionCursorTexture.SizeY,, true);
- }
- else
- {
- // Set the cursor color
- C.DrawColor = CursorColor;
- // Draw the texture on the screen
- C.DrawTile(CursorTexture, OwnerHUD.RatioX * CursorTexture.SizeX, OwnerHUD.RatioX * CursorTexture.SizeY,
- 0.f, 0.f, CursorTexture.SizeX, CursorTexture.SizeY,, true);
- }
- }
- // Go from Title screen to the next one.
- function TitleBackgroundEvent(optional GUIComponent Component, optional byte ButtonNum)
- {
- FindComponentByTag("CharSelContainer").bEnabled = True;
- FindComponentByTag("TitleContainer").bEnabled = False;
- }
- // Go from Char Select screen back to title.
- function BackToTitleButtonEvent(optional GUIComponent Component, optional byte ButtonNum)
- {
- FindComponentByTag("TitleContainer").bEnabled = True;
- FindComponentByTag("CharSelContainer").bEnabled = False;
- }
- // Start the actual game map.
- function StartButtonEvent(optional GUIComponent Component, optional byte ButtonNum)
- {
- FindComponentByTag("StartButton").OnMouseReleased = None; // Need to release this delegate first to prevent an app crash.
- ConsoleCommand("open MyMap");
- }
- DefaultProperties
- {
- bDrawGUIComponents = True
- bCaptureMouseInput = True
- CursorTexture = Texture2D'MyUI.HUD.AimCrossred'
- SelectionCursorTexture = Texture2D'MyUI.HUD.AimCrossred'
- // A GUI page for the Title screen.
- Begin Object class=GUIContainerComponent Name=TitleScreen
- Tag = "TitleContainer"
- PosX = 0.0
- PosY = 0.0
- PosXEnd = 1.0
- PosYEnd = 1.0
- // Make the background image a button to capture a mouse input everywhere on the screen.
- Begin Object class=GUIButtonComponent Name=TitleBackgroundImage
- Tag = "TitleBackground"
- PosX = 0.0
- PosY = 0.0
- PosXEnd = 1.0
- PosYEnd = 1.0
- bDrawCaption = False
- bForceNormalDrawInfo = True
- bForceNormalCaptionInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.TitleScreen.Titelscreen', SubUVEnd=(X=2048,Y=2048), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(TitleBackgroundImage)
- // With the huge title screen button, we no longer need an actual button element for this, so make it a VisualComponent instead.
- Begin Object class=GUIVisualComponent Name=TitleConfirmButton
- Tag = "TitleConfirmButton"
- PosX = 0.35
- PosY = 0.74
- PosXEnd = 0.6
- PosYEnd = 0.8
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.TitleScreen.PressStart', SubUVEnd=(X=1024,Y=128), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(TitleConfirmButton)
- End Object
- GUIComponents.Add(TitleScreen)
- // A GUI page for the Character Selection screen.
- Begin Object class=GUIContainerComponent Name=CharSelectScreen
- Tag = "CharSelContainer"
- PosX = 0.0
- PosY = 0.0
- PosXEnd = 1.0
- PosYEnd = 1.0
- bEnabled = False
- Begin Object class=GUIVisualComponent Name=CharBackgroundImage
- Tag = "CharBackground"
- PosX = 0.0
- PosY = 0.0
- PosXEnd = 1.0
- PosYEnd = 1.0
- bForceNormalDrawInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.CharselectBG', SubUVEnd=(X=2048,Y=2048), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(CharBackgroundImage)
- Begin Object class=GUIButtonComponent Name=PreviousButton
- Tag = "PreviousButton"
- PosX = 0.24
- PosY = 0.37
- PosXEnd = 0.31
- PosYEnd = 0.42
- bDrawCaption = False
- bForceNormalDrawInfo = True
- bForceNormalCaptionInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.backbutton', SubUVEnd=(X=256,Y=64), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(PreviousButton)
- Begin Object class=GUIButtonComponent Name=NextButton
- Tag = "NextButton"
- PosX = 0.687
- PosY = 0.37
- PosXEnd = 0.757
- PosYEnd = 0.42
- bDrawCaption = False
- bForceNormalDrawInfo = True
- bForceNormalCaptionInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.NextButton', SubUVEnd=(X=256,Y=64), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(NextButton)
- Begin Object class=GUIButtonComponent Name=StartButton
- Tag = "StartButton"
- PosX = 0.36
- PosY = 0.744
- PosXEnd = 0.59
- PosYEnd = 0.79
- bDrawCaption = False
- bForceNormalDrawInfo = True
- bForceNormalCaptionInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.enterlevel', SubUVEnd=(X=512,Y=64), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(StartButton)
- Begin Object class=GUIButtonComponent Name=BackToTitleButton
- Tag = "BackToTitleButton"
- PosX = 0.635
- PosY = 0.11
- PosXEnd = 0.76
- PosYEnd = 0.136
- bDrawCaption = False
- bForceNormalDrawInfo = True
- bForceNormalCaptionInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.backtotitle', SubUVEnd=(X=256,Y=32), bStretchHorizontally=false, bStretchVertically=false)
- End Object
- ChildComponents.Add(BackToTitleButton)
- End Object
- GUIComponents.Add(CharSelectScreen)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement