Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------
- // Main Menu where all the fancy stuff takes place.
- //------------------------------------------------------------------------------
- class SRMainMenuScene extends GUIMenuScene;
- event InitMenuScene()
- {
- DefaultInputComponent = FindComponentByTag("TitlePage");
- FindComponentByTag("TitleBackground").OnMousePressed = TitleBackgroundReleased;
- FindComponentByTag("TitlePage").OnBecomeEnabled = TitleScreenBecomeEnabled;
- FindComponentByTag("TitlePage").OnInputKey = TitleScreenInput;
- FindComponentByTag("CharSelPage").OnInputKey = CharSelScreenInput;
- FindComponentByTag("CharSelPage").OnBecomeEnabled = CharSelScreenBecomeEnabled;
- FindComponentByTag("BackToTitleButton").OnMousePressed = BackToTitleButtonReleased;
- FindComponentByTag("StartButton").OnMousePressed = StartButtonReleased;
- super.InitMenuScene();
- }
- // Draws the mouse cursor.
- // Overriden because our cursor's selection point shall be in the center and not in the top-left corner.
- function DrawCursor(Canvas C, float PosX, float PosY, optional bool bHasSelection)
- {
- local float CursorScale;
- CursorScale = 2*OwnerHUD.ViewX/CursorTexture.SizeX; // 2048 = cursor texture size.
- C.SetPos(PosX - CursorScale * (CursorTexture.SizeX/2), PosY - CursorScale * (CursorTexture.SizeX/2));
- if (bHasSelection)
- {
- // Set the cursor color
- C.DrawColor = SelectionCursorColor;
- // Draw the texture on the screen
- C.DrawTile(SelectionCursorTexture, CursorScale * SelectionCursorTexture.SizeX, CursorScale * 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, CursorScale * CursorTexture.SizeX, CursorScale * CursorTexture.SizeY,
- 0.f, 0.f, CursorTexture.SizeX, CursorTexture.SizeY,, true);
- }
- }
- //=============================================================================
- // Delegate handlers
- //=============================================================================
- //-----------------------------------------------------------------------------
- // Title Screen
- function TitleScreenBecomeEnabled(optional GUIComponent Component)
- {
- local AudioComponent AudioComp;
- AudioComp = SRMainMenuHUD(OwnerHUD).MenuMusic;
- AudioComp.Stop();
- AudioComp.SoundCue = SoundCue'MyMusic.Sounds.main_title_full_version_Cue';
- AudioComp.Play();
- }
- function bool TitleScreenInput(int ControllerId, name Key, EInputEvent Event, float AmountDepressed = 1.f, bool bGamepad = FALSE)
- {
- if (event == IE_Released)
- {
- if (Key == 'Enter' || Key == 'XboxTypeS_Start')
- {
- TitleBackgroundReleased();
- return True;
- }
- if (Key == 'Escape')
- {
- ConsoleCommand("exit");
- return True;
- }
- }
- return False;
- }
- // Go from Title screen to the next one.
- function TitleBackgroundReleased(optional GUIComponent Component, optional byte ButtonNum)
- {
- PushPage(GUIPage(FindComponentByTag("CharSelPage")));
- OwnerHUD.PlaySound(SoundCue'MyUI.Sounds.StartConfirm_Cue', False);
- DefaultInputComponent = FindComponentByTag("CharSelPage");
- }
- //-----------------------------------------------------------------------------
- // Character Selection Screen
- function CharSelScreenBecomeEnabled(optional GUIComponent Component)
- {
- local AudioComponent AudioComp;
- AudioComp = SRMainMenuHUD(OwnerHUD).MenuMusic;
- AudioComp.Stop();
- AudioComp.SoundCue = SoundCue'MyMusic.Sounds.a_heros_welcome_Cue';
- AudioComp.Play();
- }
- function bool CharSelScreenInput(int ControllerId, name Key, EInputEvent Event, float AmountDepressed = 1.f, bool bGamepad = FALSE)
- {
- if (event == IE_Released)
- {
- if (Key == 'Enter' || Key == 'XboxTypeS_Start')
- {
- StartButtonReleased();
- return True;
- }
- }
- return False;
- }
- // Go from Char Select screen back to title.
- function BackToTitleButtonReleased(optional GUIComponent Component, optional byte ButtonNum)
- {
- PopPage();
- DefaultInputComponent = FindComponentByTag("TitlePage");
- }
- // Start the actual game map.
- function StartButtonReleased(optional GUIComponent Component, optional byte ButtonNum)
- {
- FindComponentByTag("StartButton").OnMouseReleased = none;
- OwnerHUD.PlaySound(SoundCue'MyUI.Sounds.StartConfirm_Cue', False);
- ConsoleCommand("open TechDemo");
- }
- //=============================================================================
- DefaultProperties
- {
- bDrawGUIComponents = True
- bCaptureMouseInput = True
- bCaptureKeyInput = True
- CursorTexture = Texture2D'MyUI.HUD.AimCrossred'
- SelectionCursorTexture = Texture2D'MyUI.HUD.AimCrossred'
- SelectionCursorColor = (R=255, G=0, B=0, A=255)
- // A GUI page for the Title screen.
- Begin Object class=GUIPage Name=TitleScreen
- Tag = "TitlePage"
- 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=GUIVisualComponent Name=TitleBackgroundImage
- Tag = "TitleBackground"
- PosX = 0.0
- PosY = 0.0
- PosXEnd = 1.0
- PosYEnd = 1.0
- bForceNormalDrawInfo = True
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.TitleScreen.Titelscreen', SubUVEnd=(X=2048,Y=2048))
- 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.30
- PosY = 0.65
- PosXEnd = 0.7
- PosYEnd = 0.75
- // button is simply drawn normal
- DrawInfo(0) = (bUseMaterial=True, ComponentMaterial=Material'MyUI.TitleScreen.PressStart_Mat', SubUVEnd=(X=1,Y=1))
- End Object
- ChildComponents.Add(TitleConfirmButton)
- End Object
- GUIComponents.Add(TitleScreen)
- // A GUI page for the Character Selection screen.
- Begin Object class=GUIPage Name=CharSelectScreen
- Tag = "CharSelPage"
- 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))
- 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
- MouseEnteredSound = SoundCue'MyUI.Sounds.HoverOver_Cue'
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.backbutton', SubUVEnd=(X=256,Y=64))
- 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
- MouseEnteredSound = SoundCue'MyUI.Sounds.HoverOver_Cue'
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.NextButton', SubUVEnd=(X=256,Y=64))
- 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
- MouseEnteredSound = SoundCue'MyUI.Sounds.HoverOver_Cue'
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.enterlevel', SubUVEnd=(X=512,Y=64))
- 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
- MouseEnteredSound = SoundCue'MyUI.Sounds.HoverOver_Cue'
- // button is simply drawn normal
- DrawInfo(0) = (ComponentTexture=Texture2D'MyUI.CharacterScreen.backtotitle', SubUVEnd=(X=256,Y=32))
- End Object
- ChildComponents.Add(BackToTitleButton)
- End Object
- GUIComponents.Add(CharSelectScreen)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement