修正框架
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82d391f556304004096b011bbd27de11
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a44844ae79b98fd42a13d84fa3b87f63
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3da2a5e816dc8054c8c154faf463f46f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08087e76abe4f1a44b1b02c9a716ba1f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d43d8ee099053249a2aba58d719bf26
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,50 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 场景 - 管理器
|
||||
/// </summary>
|
||||
public class ManagerScene : ModuleSingle<ManagerScene> {
|
||||
/// <summary> 场景加载完成 </summary>
|
||||
public static event Action OnCompleteLoad;
|
||||
/// <summary> 平滑进度 </summary>
|
||||
public float smoothedProgress;
|
||||
|
||||
protected override void Awake() => NoReplace(false);
|
||||
|
||||
#region 协程加载
|
||||
/// <summary> 协程加载内置场景 </summary>
|
||||
public void Load(string sceneName, Action complete = null, LoadSceneMode mode = LoadSceneMode.Single) {
|
||||
StartCoroutine(ILoad(sceneName, complete, mode));
|
||||
}
|
||||
/// <summary> 协程加载内置场景 </summary>
|
||||
public IEnumerator ILoad(string sceneName, Action complete, LoadSceneMode mode) {
|
||||
smoothedProgress = 0f;
|
||||
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName, mode);
|
||||
operation.allowSceneActivation = false;
|
||||
while (!operation.isDone) { yield return ILoad(operation); }
|
||||
SettingsProgress(false, smoothedProgress);
|
||||
complete?.Invoke();
|
||||
OnCompleteLoad?.Invoke();
|
||||
}
|
||||
/// <summary> 协程处理进度 </summary>
|
||||
public IEnumerator ILoad(AsyncOperation operation) {
|
||||
// 输出加载进度
|
||||
float progress = Mathf.Clamp01(operation.progress / 0.9f);
|
||||
smoothedProgress = Mathf.MoveTowards(smoothedProgress, progress, Time.deltaTime);
|
||||
SettingsProgress(true, smoothedProgress);
|
||||
// 当加载进度达到90%且平滑变量和实际进度一致时,激活场景
|
||||
if (operation.progress < 0.9f || smoothedProgress < 1f) { yield break; }
|
||||
operation.allowSceneActivation = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary> 设置进度 </summary>
|
||||
private void SettingsProgress(bool active, float progress) {
|
||||
// ModuleUI.LoadingSettings(active, progress);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc0f04b4d1e94e3469c593bff5d56655
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 全局管理
|
||||
/// </summary>
|
||||
public class SingleManager : ModuleSingle<SingleManager> {
|
||||
|
||||
protected override void Awake() => NoReplace();
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 583ea9bd27e0e034d89711b923d7f4a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee662750a93822c408a0c1d04b7bb488
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI模块
|
||||
/// </summary>
|
||||
public class ModuleUI : ModuleSingle<ModuleUI> {
|
||||
public static Page page;
|
||||
public static event Action<Page> OnJumpPage;
|
||||
|
||||
public UIDocument document;// 绑定文档
|
||||
|
||||
/// <summary> 根目录文档 </summary>
|
||||
public VisualElement root => document.rootVisualElement;
|
||||
|
||||
protected override void Awake() => NoReplace();
|
||||
|
||||
/// <summary> 跳转页面 </summary>
|
||||
public static void Jump(Page pageType) => OnJumpPage?.Invoke(pageType);
|
||||
}
|
||||
/// <summary>
|
||||
/// 页面类型
|
||||
/// </summary>
|
||||
public enum Page {
|
||||
None,
|
||||
|
||||
Menu,// 主菜单
|
||||
Scene,// 场景选择
|
||||
Prepare,// 准备游戏
|
||||
Battle,// 战斗页面
|
||||
Settlement,// 结算页面
|
||||
|
||||
Settings,// 游戏设置
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3ee54ac782eb1d4a9c8b92a859c3d38
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4d3d9edca07b4c4e9e7128eb34a1511
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 217b5fdf76c9e1e4abbb9bd77f28883e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user