存档功能
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 117dcc671050f5247bd8743b91ecaab7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -513,19 +513,15 @@ MonoBehaviour:
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
_filter:
|
||||
- 0.0048309183
|
||||
- 0.016401261
|
||||
- 0.04532712
|
||||
- 0.08293076
|
||||
- 0.12053438
|
||||
- 0.14946026
|
||||
- 0.1610306
|
||||
- 0.14946026
|
||||
- 0.12053438
|
||||
- 0.08293076
|
||||
- 0.04532712
|
||||
- 0.016401261
|
||||
- 0.0048309183
|
||||
- 0.007228916
|
||||
- 0.043749984
|
||||
- 0.12409639
|
||||
- 0.20444278
|
||||
- 0.24096388
|
||||
- 0.20444278
|
||||
- 0.12409639
|
||||
- 0.043749984
|
||||
- 0.007228916
|
||||
--- !u!114 &-6086986437317696584
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
|
||||
+1434
-8
File diff suppressed because it is too large
Load Diff
@@ -58,7 +58,7 @@ namespace AibisDream
|
||||
|
||||
// SpriteGroup加载
|
||||
characterGroup.config.key = data.groupName;
|
||||
characterGroup.InstantiateByConfig();
|
||||
yield return characterGroup.InstantiateByConfigAsync();
|
||||
characterGroup.SwitchState(data.state);
|
||||
yield return characterGroup.Fade(data.shown);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ namespace AibisDream
|
||||
StartCoroutine(LoadScene());
|
||||
}
|
||||
|
||||
public void StartWithSaveFile(string saveFileName)
|
||||
{
|
||||
StartMenu.Instance.HideStartMenu();
|
||||
StartCoroutine(LoadSaveFile(saveFileName));
|
||||
}
|
||||
|
||||
public void StartNewGame()
|
||||
{
|
||||
_currentTalkSceneSo = firstTalkSo;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class SaveFileUIController : MonoBehaviour
|
||||
{
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
|
||||
#region 索引
|
||||
public Button buttonPrefab;
|
||||
public Transform buttonParent;
|
||||
public Button returnButton;
|
||||
#endregion
|
||||
|
||||
private void Start()
|
||||
{
|
||||
returnButton.onClick.AddListener(HideSaveFileUI);
|
||||
}
|
||||
|
||||
public void ShowSaveFileUI()
|
||||
{
|
||||
// 清空旧按钮
|
||||
foreach (Transform child in buttonParent)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
// 加载存档文件
|
||||
string[] saveFiles = Directory.GetFiles(SaveFilePath, "*.json");
|
||||
var orderedSaveFiles = saveFiles.OrderByDescending(item => item).ToArray();
|
||||
foreach (var saveFile in orderedSaveFiles)
|
||||
{
|
||||
var button = Instantiate(buttonPrefab, buttonParent);
|
||||
button.GetComponentInChildren<TMP_Text>().text = Path.GetFileNameWithoutExtension(saveFile);
|
||||
button.onClick.AddListener(() => OnSaveFileSelected(saveFile));
|
||||
}
|
||||
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnSaveFileSelected(string saveFileName)
|
||||
{
|
||||
// 隐藏UI
|
||||
gameObject.SetActive(false);
|
||||
// 开始游戏
|
||||
GameLoopManager.Instance.StartWithSaveFile(saveFileName);
|
||||
}
|
||||
|
||||
public void HideSaveFileUI()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a351e509c8dd5944f9e6406f59ea5c0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user