Add MainMenuUI component for game start and exit functionality; implement scene loading and browser detection
This commit is contained in:
@@ -4016,8 +4016,7 @@ MonoBehaviour:
|
||||
coins: 0
|
||||
roundTime: 60
|
||||
maxRounds: 10
|
||||
winScene:
|
||||
m_Handle: 0
|
||||
winScene: {fileID: 102900000, guid: aa0f834fdce931b899f0fe952ad0b680, type: 3}
|
||||
arenaCenter: {fileID: 537749035}
|
||||
player: {fileID: 1261447603}
|
||||
--- !u!4 &749274450
|
||||
|
1240
Assets/Scenes/menu.unity
Normal file
1240
Assets/Scenes/menu.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/menu.unity.meta
Normal file
7
Assets/Scenes/menu.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df478f6f2bf83fa90ad24f823d620f94
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1377
Assets/Scenes/win.unity
Normal file
1377
Assets/Scenes/win.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/win.unity.meta
Normal file
7
Assets/Scenes/win.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa0f834fdce931b899f0fe952ad0b680
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -4,6 +4,7 @@ using Data;
|
||||
using Sirenix.Serialization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Systems
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace Systems
|
||||
[OdinSerialize, SerializeField] private int coins = 0;
|
||||
[OdinSerialize, SerializeField] private float roundTime = 60f;
|
||||
[OdinSerialize, SerializeField] private int maxRounds = 20;
|
||||
[OdinSerialize, SerializeField] private Scene winScene;
|
||||
[OdinSerialize, SerializeField] private Object winScene;
|
||||
[OdinSerialize, SerializeField] private Transform arenaCenter;
|
||||
|
||||
[OdinSerialize, SerializeField] private Character player;
|
||||
|
42
Assets/Scripts/UI/MainMenuUI.cs
Normal file
42
Assets/Scripts/UI/MainMenuUI.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class MainMenuUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Object mainScene;
|
||||
[SerializeField] private Button exitButton;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
DetectIfBrowser();
|
||||
}
|
||||
|
||||
private void DetectIfBrowser()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
||||
{
|
||||
exitButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
SceneManager.LoadScene(mainScene.name);
|
||||
}
|
||||
|
||||
public void ExitGame()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/UI/MainMenuUI.cs.meta
Normal file
3
Assets/Scripts/UI/MainMenuUI.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c900e12a827647ada2f645b798bfb13e
|
||||
timeCreated: 1752406688
|
@@ -5,9 +5,15 @@ EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 0
|
||||
path: Assets/Scenes/SampleScene.unity
|
||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/menu.unity
|
||||
guid: df478f6f2bf83fa90ad24f823d620f94
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/main.unity
|
||||
guid: 9552b637a550584c597db3ec7cc2d716
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/win.unity
|
||||
guid: aa0f834fdce931b899f0fe952ad0b680
|
||||
m_configObjects:
|
||||
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3}
|
||||
m_UseUCBPForAssetBundles: 0
|
||||
|
Reference in New Issue
Block a user