game(ui): interim menu commit

This commit is contained in:
sippy-thinks 2024-08-11 15:51:21 +08:00
parent 663b9114ba
commit c800b72ef1
11 changed files with 12279 additions and 51 deletions

File diff suppressed because one or more lines are too long

View file

@ -364,6 +364,15 @@ public void NewGame()
// TODO: reset game state // TODO: reset game state
} }
/// <summary>
/// function to restart the current run
/// </summary>
public void RestartRun()
{
// TODO: implement this
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// function to set an interaction prompt/tooltip for the player /// function to set an interaction prompt/tooltip for the player
/// </summary> /// </summary>

View file

@ -1,14 +1,21 @@
/* /*
* author: mark joshwel * author: mark joshwel, sai puay
* date: 11/8/2024 * date: 11/8/2024
* description: TODO * description: script for handling win overlay functions
*/ */
using UnityEngine.UIElements;
/// <summary> /// <summary>
/// TODO /// class managing the win overlay and button function invocations
/// </summary> /// </summary>
public class OverlayCompleteUnderTimeMenu : CommonMenu public class OverlayCompleteUnderTimeMenu : CommonMenu
{ {
/// <summary>
/// button to return to the main menu
/// </summary>
private Button _buttonReturn;
/// <summary> /// <summary>
/// function to associate a display state with the menu, /// function to associate a display state with the menu,
/// and subscribe button events to their respective functions /// and subscribe button events to their respective functions
@ -18,5 +25,10 @@ public override void OnEnable()
// set the associated state and call the base OnEnable // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.OverlayCompleteUnderTimeMenu; associatedState = GameManager.DisplayState.OverlayCompleteUnderTimeMenu;
base.OnEnable(); base.OnEnable();
// get the return button from the ui root and subscribe appropriate functions
_buttonReturn = UI.Q<Button>("ButtonReturn");
_buttonReturn.clicked += PlayClick;
_buttonReturn.clicked += OverlayPauseMenu.OptionReturnToMainMenu;
} }
} }

View file

@ -1,14 +1,26 @@
/* /*
* author: mark joshwel * author: mark joshwel, sai puay
* date: 11/8/2024 * date: 11/8/2024
* description: TODO * description: script for handling win failure/dnf overlay functions
*/ */
using UnityEngine.UIElements;
/// <summary> /// <summary>
/// TODO /// class managing the win failure/dnf overlay and button function invocations
/// </summary> /// </summary>
public class OverlayFailedOverTimeMenu : CommonMenu public class OverlayFailedOverTimeMenu : CommonMenu
{ {
/// <summary>
/// button to retry the run
/// </summary>
private Button _buttonRetry;
/// <summary>
/// button to return to the main menu
/// </summary>
private Button _buttonReturn;
/// <summary> /// <summary>
/// function to associate a display state with the menu, /// function to associate a display state with the menu,
/// and subscribe button events to their respective functions /// and subscribe button events to their respective functions
@ -18,5 +30,15 @@ public override void OnEnable()
// set the associated state and call the base OnEnable // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.OverlayFailedOverTimeMenu; associatedState = GameManager.DisplayState.OverlayFailedOverTimeMenu;
base.OnEnable(); base.OnEnable();
// get the retry button from the ui root and subscribe appropriate functions
_buttonRetry = UI.Q<Button>("ButtonRetry");
_buttonRetry.clicked += PlayClick;
_buttonRetry.clicked += OverlayPauseMenu.OptionRetryGame;
// get the return button from the ui root and subscribe appropriate functions
_buttonReturn = UI.Q<Button>("ButtonReturn");
_buttonReturn.clicked += PlayClick;
_buttonReturn.clicked += OverlayPauseMenu.OptionReturnToMainMenu;
} }
} }

View file

@ -1,14 +1,32 @@
/* /*
* author: mark joshwel * author: mark joshwel, sai puay
* date: 11/8/2024 * date: 11/8/2024
* description: TODO * description: script for handling pause overlay functions
*/ */
using UnityEngine;
using UnityEngine.UIElements;
/// <summary> /// <summary>
/// TODO /// class managing the pause overlay and button function invocations
/// </summary> /// </summary>
public class OverlayPauseMenu : CommonMenu public class OverlayPauseMenu : CommonMenu
{ {
/// <summary>
/// button to resume the run
/// </summary>
private Button _buttonResume;
/// <summary>
/// button to retry the run
/// </summary>
private Button _buttonRetry;
/// <summary>
/// button to return to the main menu
/// </summary>
private Button _buttonReturn;
/// <summary> /// <summary>
/// function to associate a display state with the menu, /// function to associate a display state with the menu,
/// and subscribe button events to their respective functions /// and subscribe button events to their respective functions
@ -18,5 +36,50 @@ public override void OnEnable()
// set the associated state and call the base OnEnable // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.OverlayPauseMenu; associatedState = GameManager.DisplayState.OverlayPauseMenu;
base.OnEnable(); base.OnEnable();
// get the resume button from the ui root and subscribe appropriate functions
_buttonResume = UI.Q<Button>("ButtonResume");
_buttonResume.clicked += PlayClick;
_buttonResume.clicked += OptionResumeGame;
// get the retry button from the ui root and subscribe appropriate functions
_buttonRetry = UI.Q<Button>("ButtonRetry");
_buttonRetry.clicked += PlayClick;
_buttonRetry.clicked += OptionRetryGame;
// get the return button from the ui root and subscribe appropriate functions
_buttonReturn = UI.Q<Button>("ButtonReturn");
_buttonReturn.clicked += PlayClick;
_buttonReturn.clicked += OptionReturnToMainMenu;
}
/// <summary>
/// handles resume button press,
/// signals the game manager appropriately
/// </summary>
private static void OptionResumeGame()
{
Debug.Log("OverlayPauseMenu.OptionResumeGame (static shared): clicked, resuming game");
GameManager.Instance.NewGame();
}
/// <summary>
/// handles retry button press,
/// signals the game manager appropriately
/// </summary>
public static void OptionRetryGame()
{
Debug.Log("OverlayPauseMenu.OptionRetryGame (static shared): clicked, retrying run");
GameManager.Instance.RestartRun();
}
/// <summary>
/// handles return button press,
/// signals the game manager appropriately
/// </summary>
public static void OptionReturnToMainMenu()
{
Debug.Log("OverlayPauseMenu.OptionReturnToMainMenu (static shared): clicked, returning to main menu");
GameManager.Instance.SetDisplayState(GameManager.DisplayState.ScreenMainMenu);
} }
} }

View file

@ -15,17 +15,17 @@ public class ScreenMainMenu : CommonMenu
/// <summary> /// <summary>
/// button to quit game /// button to quit game
/// </summary> /// </summary>
public Button ButtonExit; private Button _buttonExit;
/// <summary> /// <summary>
/// button to show the options menu /// button to show the options menu
/// </summary> /// </summary>
public Button ButtonOptions; private Button _buttonOptions;
/// <summary> /// <summary>
/// button to play game /// button to play game
/// </summary> /// </summary>
public Button ButtonPlay; private Button _buttonPlay;
/// <summary> /// <summary>
/// function to associate a display state with the menu, /// function to associate a display state with the menu,
@ -38,19 +38,19 @@ public override void OnEnable()
base.OnEnable(); base.OnEnable();
// get the start button from the ui root and subscribe appropriate functions // get the start button from the ui root and subscribe appropriate functions
ButtonPlay = UI.Q<Button>("ButtonPlay"); _buttonPlay = UI.Q<Button>("ButtonPlay");
ButtonPlay.clicked += PlayClick; _buttonPlay.clicked += PlayClick;
ButtonPlay.clicked += OptionStartGame; _buttonPlay.clicked += OptionStartGame;
// get the options button from the ui root and subscribe appropriate functions // get the options button from the ui root and subscribe appropriate functions
ButtonOptions = UI.Q<Button>("ButtonOptions"); _buttonOptions = UI.Q<Button>("ButtonOptions");
ButtonOptions.clicked += PlayClick; _buttonOptions.clicked += PlayClick;
ButtonOptions.clicked += OptionShowOptions; _buttonOptions.clicked += OptionShowOptions;
// get the quit button from the ui root and subscribe appropriate functions // get the quit button from the ui root and subscribe appropriate functions
ButtonExit = UI.Q<Button>("ButtonExit"); _buttonExit = UI.Q<Button>("ButtonExit");
ButtonExit.clicked += PlayClick; _buttonExit.clicked += PlayClick;
ButtonExit.clicked += OptionQuitGame; _buttonExit.clicked += OptionQuitGame;
} }
/// <summary> /// <summary>

View file

@ -30,7 +30,7 @@ public class ScreenOptionsMenu : CommonMenu
/// slider for sfx volume /// slider for sfx volume
/// </summary> /// </summary>
public Slider SliderAudioSfx; public Slider SliderAudioSfx;
/// <summary> /// <summary>
/// function to associate a display state with the menu, /// function to associate a display state with the menu,
/// and subscribe button events to their respective functions /// and subscribe button events to their respective functions
@ -44,7 +44,7 @@ public override void OnEnable()
// get the start button from the ui root and subscribe appropriate functions // get the start button from the ui root and subscribe appropriate functions
ButtonReturn = UI.Q<Button>("ButtonReturn"); ButtonReturn = UI.Q<Button>("ButtonReturn");
ButtonReturn.clicked += PlayClick; ButtonReturn.clicked += PlayClick;
ButtonReturn.clicked += OptionReturnToMainMenu; ButtonReturn.clicked += OverlayPauseMenu.OptionReturnToMainMenu;
// get the music slider from the ui root // get the music slider from the ui root
SliderAudioMaster = UI.Q<Slider>("MasterSlider"); SliderAudioMaster = UI.Q<Slider>("MasterSlider");
@ -52,14 +52,14 @@ public override void OnEnable()
// SliderAudioMusic.value = Audio.GetMusicVolume() * 100; // SliderAudioMusic.value = Audio.GetMusicVolume() * 100;
// and subscribe appropriate functions // and subscribe appropriate functions
SliderAudioMaster.RegisterCallback<ChangeEvent<float>>(OptionSetMasterVolume); SliderAudioMaster.RegisterCallback<ChangeEvent<float>>(OptionSetMasterVolume);
// get the music slider from the ui root // get the music slider from the ui root
SliderAudioMusic = UI.Q<Slider>("MusicSlider"); SliderAudioMusic = UI.Q<Slider>("MusicSlider");
// TODO: and set the initial value to the current music volume // TODO: and set the initial value to the current music volume
// SliderAudioMusic.value = Audio.GetMusicVolume() * 100; // SliderAudioMusic.value = Audio.GetMusicVolume() * 100;
// and subscribe appropriate functions // and subscribe appropriate functions
SliderAudioMusic.RegisterCallback<ChangeEvent<float>>(OptionSetMusicVolume); SliderAudioMusic.RegisterCallback<ChangeEvent<float>>(OptionSetMusicVolume);
// get the sfx slider from the ui root // get the sfx slider from the ui root
SliderAudioSfx = UI.Q<Slider>("SFXSlider"); SliderAudioSfx = UI.Q<Slider>("SFXSlider");
// TODO: and set the initial value to the current sfx volume // TODO: and set the initial value to the current sfx volume
@ -68,16 +68,6 @@ public override void OnEnable()
SliderAudioSfx.RegisterCallback<ChangeEvent<float>>(OptionSetSfxVolume); SliderAudioSfx.RegisterCallback<ChangeEvent<float>>(OptionSetSfxVolume);
} }
/// <summary>
/// handles return to the main menu button press,
/// signals the game manager appropriately
/// </summary>
private void OptionReturnToMainMenu()
{
// return to the main menu
Game.SetDisplayState(GameManager.DisplayState.ScreenMainMenu);
}
/// <summary> /// <summary>
/// handle music volume slider change, /// handle music volume slider change,
/// sets the music channel volume in the audio manager appropriately /// sets the music channel volume in the audio manager appropriately
@ -88,7 +78,7 @@ private void OptionSetMasterVolume(ChangeEvent<float> evt)
// TODO: slider is from 0 to 100, convert to 0 to 1, and set // TODO: slider is from 0 to 100, convert to 0 to 1, and set
// Audio.SetMusicVolume(evt.newValue / 100); // Audio.SetMusicVolume(evt.newValue / 100);
} }
/// <summary> /// <summary>
/// handle music volume slider change, /// handle music volume slider change,
/// sets the music channel volume in the audio manager appropriately /// sets the music channel volume in the audio manager appropriately

View file

@ -49,6 +49,15 @@
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
},
{
"name": "Pause",
"type": "Button",
"id": "9a25646e-bf8a-47f8-9cc5-90a6bf73c55e",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
} }
], ],
"bindings": [ "bindings": [
@ -238,6 +247,50 @@
"action": "Action", "action": "Action",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "49fab935-fbc7-47d7-af25-0e579f3a4030",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "One Modifier",
"id": "adfdd4ca-fa26-47ba-acb5-9e5920597c99",
"path": "OneModifier",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "modifier",
"id": "2914f47a-f360-44fb-84ed-58e7f7dde74a",
"path": "<Keyboard>/leftCtrl",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "binding",
"id": "136aa112-aed7-4edf-a8de-d8f16f9c7ee1",
"path": "<Keyboard>/backquote",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": true
} }
] ]
} }

View file

@ -2,9 +2,11 @@
<Style src="project://database/Assets/UI%20Toolkit/Interfaces/Common.uss?fileID=7433441132597879392&amp;guid=7e22eeee55627cf478c5e125a8197039&amp;type=3#Common" /> <Style src="project://database/Assets/UI%20Toolkit/Interfaces/Common.uss?fileID=7433441132597879392&amp;guid=7e22eeee55627cf478c5e125a8197039&amp;type=3#Common" />
<ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: stretch; align-self: stretch; width: auto;"> <ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: stretch; align-self: stretch; width: auto;">
<ui:VisualElement name="HoriHolder" style="flex-grow: 1; flex-direction: column; max-height: 60%; margin-left: 10%; margin-right: 10%;"> <ui:VisualElement name="HoriHolder" style="flex-grow: 1; flex-direction: column; max-height: 60%; margin-left: 10%; margin-right: 10%;">
<ui:VisualElement name="Logospace" style="flex-grow: 1; width: auto; flex-direction: row; padding-bottom: 6%; height: 50%; min-height: 50%;"> <ui:VisualElement name="Logospace" style="flex-grow: 1; width: auto; flex-direction: row; height: 50%; min-height: 50%;">
<ui:VisualElement name="Header" style="background-image: none; -unity-background-scale-mode: scale-to-fit; flex-grow: 1; flex-shrink: 0; align-items: center; justify-content: center; align-self: stretch;"> <ui:VisualElement name="Header" style="background-image: none; -unity-background-scale-mode: scale-to-fit; flex-grow: 1; flex-shrink: 0; align-items: center; justify-content: center; align-self: stretch;">
<ui:Label tabindex="-1" text="ON TIME" parse-escape-sequences="true" display-tooltip-when-elided="true" name="HeaderLabel" style="-unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/GODarkslide/GODarkslide-distressed.ttf?fileID=12800000&amp;guid=1f2f7dc4dddb45a4e91b4b96053f09f6&amp;type=3#GODarkslide-distressed&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/GODarkslide/GODarkslide-distressed%20SDF.asset?fileID=11400000&amp;guid=e706151e7fb3790409b13d29b812a8ff&amp;type=2#GODarkslide-distressed SDF&quot;); font-size: 80px; color: rgb(255, 255, 255); -unity-text-align: upper-center; white-space: normal; text-overflow: clip; rotate: -12.347deg;" /> <ui:Label tabindex="-1" text="A" parse-escape-sequences="true" display-tooltip-when-elided="true" name="FinalGradeLabel" style="-unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/GODarkslide/GODarkslide-distressed.ttf?fileID=12800000&amp;guid=1f2f7dc4dddb45a4e91b4b96053f09f6&amp;type=3#GODarkslide-distressed&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/GODarkslide/GODarkslide-distressed%20SDF.asset?fileID=11400000&amp;guid=e706151e7fb3790409b13d29b812a8ff&amp;type=2#GODarkslide-distressed SDF&quot;); font-size: 100px; color: rgb(193, 39, 45); -unity-text-align: upper-center; white-space: normal; text-overflow: clip; rotate: -12.347deg; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
<ui:Label tabindex="-1" text="Completed in 01:59.23" parse-escape-sequences="true" display-tooltip-when-elided="true" name="FinalTimeLabel" style="color: rgb(255, 255, 255); font-size: 26px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold.otf?fileID=12800000&amp;guid=505dfbc18d2d4604db47ff55755f9dc8&amp;type=3#Fervojo-Bold&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold%20SDF.asset?fileID=11400000&amp;guid=1abb65c0bf74b1649863fc75b2b83ac1&amp;type=2#Fervojo-Bold SDF&quot;);" />
<ui:Label tabindex="-1" text="1,000" parse-escape-sequences="true" display-tooltip-when-elided="true" name="FinalScoreLabel" style="color: rgb(255, 255, 255); font-size: 20px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;" />
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="Buttonspace" style="flex-grow: 1; width: 50%; min-width: 50%; height: 50%; min-height: 50%; align-items: center; justify-content: flex-end; align-self: center; flex-direction: column;"> <ui:VisualElement name="Buttonspace" style="flex-grow: 1; width: 50%; min-width: 50%; height: 50%; min-height: 50%; align-items: center; justify-content: flex-end; align-self: center; flex-direction: column;">

View file

@ -6,6 +6,8 @@ EditorBuildSettings:
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1 - enabled: 1
path: Assets/Scenes/SampleScene.unity path: Assets/Scenes/Playgrounds/RyanAIPlayground.unity
guid: 99c9720ab356a0642a771bea13969a05 guid: 99c9720ab356a0642a771bea13969a05
m_configObjects: {} m_configObjects:
com.unity.input.settings: {fileID: 11400000, guid: 9e7be553448fa2546aea5752021cbcf7,
type: 2}

View file

@ -99,7 +99,7 @@
{ {
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "ShapeBuilder.ActiveShapeIndex", "key": "ShapeBuilder.ActiveShapeIndex",
"value": "{\"m_Value\":2}" "value": "{\"m_Value\":9}"
}, },
{ {
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
@ -119,7 +119,7 @@
{ {
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize", "key": "ShapeBuilder.LastSize",
"value": "{\"m_Value\":{\"x\":-2.3972702026367189,\"y\":6.764400482177734,\"z\":2.3311424255371095}}" "value": "{\"m_Value\":{\"x\":2.637908935546875,\"y\":0.6330699920654297,\"z\":2.631824493408203}}"
}, },
{ {
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
@ -170,6 +170,11 @@
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Cone", "key": "ShapeBuilder.Cone",
"value": "{}" "value": "{}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Torus",
"value": "{}"
} }
] ]
} }