Merge pull request 'Couple More menu Items' (#15) from AddingAnxiety into main

Reviewed-on: admin/GGJ2026#15
Reviewed-by: Connor <[email protected]>
This commit is contained in:
Connor
2026-01-31 10:47:26 -06:00
6 changed files with 1456 additions and 18 deletions
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -187,7 +187,14 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ff915f6cddaa45cea485d96c5fd4a0b0, type: 3}
m_Name:
m_EditorClassIdentifier:
startSceneName: Level1
buttonNames:
- Start
- Experiment
- Level2
sceneNames:
- Level1
- Experiment
- Level2
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
+26 -13
View File
@@ -1,12 +1,14 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
public class MainMenuController : MonoBehaviour
{
[SerializeField] private string startSceneName = "Level1";
[SerializeField] private List<string> buttonNames = new List<string> { "Start", "Experiment", "Level2" };
[SerializeField] private List<string> sceneNames = new List<string> { "Level1", "Experiment", "Level2" };
private UIDocument uiDocument;
private Button startButton;
private List<Button> buttons;
private void OnEnable()
{
@@ -22,29 +24,40 @@ public class MainMenuController : MonoBehaviour
return;
}
startButton = root.Q<Button>("Start");
if (startButton == null)
buttons = new List<Button> { new Button(), new Button(), new Button() };
for (int i = 0; i < buttons.Count; i++)
{
return;
}
int buttonIndex = i;
startButton.clicked += HandleStartClicked;
buttons[i] = root.Q<Button>(buttonNames[i]);
if (buttons[i] == null)
{
continue;
}
buttons[i].clicked += () => HandleStartClicked(sceneNames[buttonIndex]);
}
}
private void OnDisable()
{
if (startButton != null)
for (int i = 0; i < buttons.Count; i++)
{
startButton.clicked -= HandleStartClicked;
startButton = null;
if (buttons[i] == null)
{
continue;
}
buttons[i].clicked -= () => HandleStartClicked(buttonNames[i]);
}
}
private void HandleStartClicked()
private void HandleStartClicked(string sceneName)
{
if (!string.IsNullOrWhiteSpace(startSceneName))
if (!string.IsNullOrWhiteSpace(sceneName))
{
SceneManager.LoadScene(startSceneName);
SceneManager.LoadScene(sceneName);
}
}
}
+5 -2
View File
@@ -1,5 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 1; justify-content: center;">
<ui:Button text="Start" name="Start" emoji-fallback-support="true"/>
<ui:Label text="Fun Fun Happy Time Game" name="Title" style="color: rgb(255, 255, 255); font-size: 25px; align-self: center; background-color: rgb(10, 10, 10); -unity-text-align: lower-left; top: auto;"/>
<ui:VisualElement style="flex-grow: 1; justify-content: center; align-self: auto; align-content: auto; background-color: rgb(17, 17, 17);">
<ui:Button text="Start" name="Start" emoji-fallback-support="true" style="background-color: rgb(101, 24, 101); color: rgb(255, 255, 255); font-size: 30px; width: 75%; align-self: center;"/>
<ui:Button text="Experiment" name="Experiment" emoji-fallback-support="true" style="background-color: rgb(101, 24, 101); color: rgb(255, 255, 255); font-size: 30px; width: 75%; align-self: center;"/>
<ui:Button text="Level 2" name="Level2" emoji-fallback-support="true" style="background-color: rgb(101, 24, 101); color: rgb(255, 255, 255); font-size: 30px; width: 75%; align-self: center;"/>
</ui:VisualElement>
</ui:UXML>
+6 -2
View File
@@ -1,14 +1,18 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{1E981750-D248-28D9-7629-4D5A5BCFF26D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1E981750-D248-28D9-7629-4D5A5BCFF26D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E981750-D248-28D9-7629-4D5A5BCFF26D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E981750-D248-28D9-7629-4D5A5BCFF26D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E981750-D248-28D9-7629-4D5A5BCFF26D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -11,6 +11,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/Level1.unity
guid: f2712fcc06e3886479fa5ea3af6501b5
- enabled: 1
path: Assets/Scenes/Experiment.unity
guid: f3fd43139aacd9b448040647675d0aaf
m_configObjects:
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3}
m_UseUCBPForAssetBundles: 0