提交
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06cf7b752fd13514990983c1082743d8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1087
-48
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEditor;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -90,5 +91,43 @@ namespace AibisDream
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
#region 重新开始游戏功能
|
||||
|
||||
/// <summary>
|
||||
/// 重新开始游戏,重新加载当前场景
|
||||
/// </summary>
|
||||
public void RestartGame()
|
||||
{
|
||||
// 确保场景正在加载或卸载前,先重置相关状态
|
||||
StartCoroutine(RestartGameCoroutine());
|
||||
}
|
||||
|
||||
private IEnumerator RestartGameCoroutine()
|
||||
{
|
||||
if (_isLoading)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 清除当前场景的状态(如果需要)
|
||||
_isLoading = true;
|
||||
|
||||
if (!string.IsNullOrEmpty(_currentScene.Value))
|
||||
{
|
||||
// 卸载当前场景
|
||||
yield return Addressables.UnloadSceneAsync(_loadHandle);
|
||||
}
|
||||
yield return MainUIController.Instance.FadeInSync(1);
|
||||
DialogController.Instance.StopDialog();
|
||||
yield return MainUIController.Instance.TVFadeInSync(1);
|
||||
MainUIController.Instance.ShowMainUI();
|
||||
StartMenu.Instance.showStartMenu();
|
||||
yield return MainUIController.Instance.FadeOutSync(1);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,25 +4,42 @@ using AibisDream.Kit;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using RainbowArt.CleanFlatUI;
|
||||
|
||||
|
||||
namespace AibisDream {
|
||||
public class StartMenu : Singleton<StartMenu>
|
||||
{
|
||||
[SerializeField] private GameObject startMenuPanel;
|
||||
[SerializeField] private Button startButton;
|
||||
[SerializeField] private Button selectLevelButton;
|
||||
[SerializeField] private Button quitButton;
|
||||
|
||||
[SerializeField] private Button settingButton;
|
||||
|
||||
[SerializeField] private ModalWindow settingWindow;
|
||||
|
||||
[SerializeField] private Button surveyButton;
|
||||
|
||||
[SerializeField] private Button followButton;
|
||||
|
||||
[SerializeField] private GameObject startTab;
|
||||
|
||||
[SerializeField] private SceneSelectionUIController sceneSelection;
|
||||
[SerializeField] private GameObject levelTab;
|
||||
[SerializeField] private GameObject buttonPrefab;
|
||||
|
||||
[SerializeField] private string surveyURL = "https://wj.qq.com/s2/15348910/3c8c/"; // 替换为你的问卷链接
|
||||
|
||||
[SerializeField] private string qqURL ="https://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XQFpOqRb1_zqkCdR2bLT3kHb11XzZ54T&authKey=w8G8qxzecnATXDOec1Ybv8LA%2FTTN8gQkyegvbK%2FUZ9m90WxggTjXy2U6%2FJesWJF3&noverify=0&group_code=325268983";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
startButton.onClick.AddListener(StartGame);
|
||||
selectLevelButton.onClick.AddListener(SelectLevel);
|
||||
quitButton.onClick.AddListener(QuitGame);
|
||||
surveyButton.onClick.AddListener(OpenLink);
|
||||
followButton.onClick.AddListener(OpenQQLink);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
@@ -42,6 +59,18 @@ namespace AibisDream {
|
||||
SwitchToLevelTab();
|
||||
}
|
||||
|
||||
public void OpenSetting()
|
||||
{
|
||||
MainUIController.Instance.HideMainUI();
|
||||
showStartMenu();
|
||||
|
||||
}
|
||||
public void BackToMenu()
|
||||
{
|
||||
SceneLoader.Instance.RestartGame();
|
||||
|
||||
}
|
||||
|
||||
private void SwitchToLevelTab()
|
||||
{
|
||||
sceneSelection.ShowSceneSelection(GameLoopManager.Instance.totalSceneSos);
|
||||
@@ -52,6 +81,14 @@ namespace AibisDream {
|
||||
startTab.SetActive(true);
|
||||
levelTab.SetActive(false);
|
||||
}
|
||||
public void OpenLink()
|
||||
{
|
||||
Application.OpenURL(surveyURL);
|
||||
}
|
||||
public void OpenQQLink()
|
||||
{
|
||||
Application.OpenURL(qqURL);
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
@@ -60,7 +97,11 @@ namespace AibisDream {
|
||||
|
||||
public void HideStartMenu()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
startMenuPanel.SetActive(false);
|
||||
}
|
||||
public void showStartMenu()
|
||||
{
|
||||
startMenuPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace AibisDream
|
||||
|
||||
#region 主场景图片
|
||||
|
||||
[SerializeField]private GameObject mainUIPanel;
|
||||
|
||||
private FadeImage _tvScene;
|
||||
private FadeImage _blackImage;
|
||||
private FadeImage _news;
|
||||
@@ -99,7 +101,11 @@ namespace AibisDream
|
||||
/// </summary>
|
||||
public void HideMainUI()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
mainUIPanel.SetActive(false);
|
||||
}
|
||||
public void ShowMainUI()
|
||||
{
|
||||
mainUIPanel.SetActive(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,19 +169,19 @@ namespace AibisDream
|
||||
|
||||
private void InitChildObj()
|
||||
{
|
||||
var rawTvScene = transform.Find(TVScene).gameObject.GetComponent<Image>();
|
||||
var rawTvScene = transform.GetChild(0).Find(TVScene).gameObject.GetComponent<Image>();
|
||||
_tvScene = new FadeImage(rawTvScene);
|
||||
|
||||
var rawBlackImage = transform.Find(BlackImage).gameObject.GetComponent<Image>();
|
||||
var rawBlackImage = transform.GetChild(0).Find(BlackImage).gameObject.GetComponent<Image>();
|
||||
_blackImage = new FadeImage(rawBlackImage);
|
||||
|
||||
var rawNews = transform.Find(NewsImage).gameObject.GetComponent<Image>();
|
||||
var rawNews = transform.GetChild(0).Find(NewsImage).gameObject.GetComponent<Image>();
|
||||
_news = new FadeImage(rawNews);
|
||||
|
||||
_objPanel = transform.Find(ObjPanel).gameObject;
|
||||
_objPanel = transform.GetChild(0).Find(ObjPanel).gameObject;
|
||||
_objImage = _objPanel.transform.GetChild(0).GetComponent<Image>();
|
||||
|
||||
_fullScreen = transform.Find("Full Screen Image").GetComponent<Image>();
|
||||
_fullScreen = transform.GetChild(0).Find("Full Screen Image").GetComponent<Image>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user