Initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class GameLoopManager : Singleton<GameLoopManager>
|
||||
{
|
||||
[Header("µÚÒ»¸ö¶Ô»°")]
|
||||
[SerializeField] private TalkSceneSO firstTalkSO;
|
||||
|
||||
private TalkSceneSO currentTalkSceneSO;
|
||||
|
||||
[SerializeField]
|
||||
private string clinicScene;
|
||||
|
||||
public void StartNewGame()
|
||||
{
|
||||
currentTalkSceneSO = firstTalkSO;
|
||||
|
||||
StartCoroutine(LoadClinicScene());
|
||||
}
|
||||
|
||||
private IEnumerator LoadClinicScene()
|
||||
{
|
||||
yield return StartCoroutine(SceneLoader.Instance.LoadSceneAsync(clinicScene));
|
||||
StartMenuViewer.Instance.HideStartMenu();
|
||||
DialogController.Instance.StartDialog(currentTalkSceneSO.yarnProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18a3ec3914131d44199ae33902edf159
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class SceneLoader : Singleton<SceneLoader>
|
||||
{
|
||||
#region 场景转换参数
|
||||
private string currentScene;
|
||||
private AsyncOperationHandle _loadHandle;
|
||||
private string sceneToLoad;
|
||||
private bool isLoading;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 同步场景转换
|
||||
/// </summary>
|
||||
/// <param name="targetScene">目标场景</param>
|
||||
public void LoadScene(string targetScene)
|
||||
{
|
||||
StartCoroutine(LoadSceneAsync(targetScene));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步场景转换
|
||||
/// </summary>
|
||||
/// <param name="targetScene">目标场景</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerator LoadSceneAsync(string targetScene)
|
||||
{
|
||||
if (isLoading)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 场景转换参数
|
||||
isLoading = true;
|
||||
sceneToLoad = targetScene;
|
||||
if (currentScene != null)
|
||||
{
|
||||
yield return Addressables.UnloadSceneAsync(_loadHandle);
|
||||
}
|
||||
|
||||
_loadHandle = Addressables.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive, true);
|
||||
yield return _loadHandle;
|
||||
|
||||
currentScene = sceneToLoad;
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 659578126d1c9994496a59778efff63c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AibisDream {
|
||||
public class StartMenu : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button startButton;
|
||||
[SerializeField] private Button continueButton;
|
||||
[SerializeField] private Button quitButton;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
startButton.onClick.AddListener(StartGame);
|
||||
continueButton.onClick.AddListener(ContinueGame);
|
||||
quitButton.onClick.AddListener(QuitGame);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
startButton?.onClick.RemoveListener(StartGame);
|
||||
continueButton?.onClick.RemoveListener(ContinueGame);
|
||||
quitButton?.onClick.RemoveListener(QuitGame);
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
GameLoopManager.Instance.StartNewGame();
|
||||
}
|
||||
|
||||
public void ContinueGame()
|
||||
{
|
||||
Debug.Log("¼ÌÐøÓÎÏ·¹¦ÄÜÔÝ먦·¢");
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb281616aaeece54c86a0a0a1f1d966d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Game Scene/TalkSceneSO")]
|
||||
public class TalkSceneSO : ScriptableObject
|
||||
{
|
||||
public TalkSceneSO nextScene;
|
||||
|
||||
public YarnProject yarnProject;
|
||||
|
||||
public bool isEndOfDay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 157431981b8a721458e6706c374a3867
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user