111
This commit is contained in:
@@ -655,7 +655,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
MainCamera: {fileID: 330585545}
|
MainCamera: {fileID: 330585545}
|
||||||
PlayMode: 2
|
PlayMode: 0
|
||||||
--- !u!4 &1019312449
|
--- !u!4 &1019312449
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ ModelImporter:
|
|||||||
strictVertexDataChecks: 0
|
strictVertexDataChecks: 0
|
||||||
tangentSpace:
|
tangentSpace:
|
||||||
normalSmoothAngle: 60
|
normalSmoothAngle: 60
|
||||||
normalImportMode: 0
|
normalImportMode: 1
|
||||||
tangentImportMode: 3
|
tangentImportMode: 3
|
||||||
normalCalculationMode: 4
|
normalCalculationMode: 4
|
||||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3df95ed86e6c7fa4e8459fc5106e7684
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -337,64 +337,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &742264193
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
serializedVersion: 3
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 1.459
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: -8679921383154817045, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 919132149155446097, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: Sensei
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_RemovedGameObjects:
|
|
||||||
- {fileID: 6824746026288583490, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
m_AddedGameObjects: []
|
|
||||||
m_AddedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 332fd822bac56bb469b239ba04ed2da5, type: 3}
|
|
||||||
--- !u!1 &1171561947
|
--- !u!1 &1171561947
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -632,4 +574,3 @@ SceneRoots:
|
|||||||
- {fileID: 462509703}
|
- {fileID: 462509703}
|
||||||
- {fileID: 1598712461}
|
- {fileID: 1598712461}
|
||||||
- {fileID: 215814089}
|
- {fileID: 215814089}
|
||||||
- {fileID: 742264193}
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 44bc8a9986f966a4ebae93b30342d02f
|
|
||||||
@@ -6,41 +6,43 @@ using Tuan.GameFramework;
|
|||||||
|
|
||||||
namespace Tuan.GameScripts.Main
|
namespace Tuan.GameScripts.Main
|
||||||
{
|
{
|
||||||
public class AssetLoad :Singleton <AssetLoad>
|
public class AssetLoader :Singleton <AssetLoader>
|
||||||
{
|
{
|
||||||
Dictionary<string, AssetHandle> assetHandles = new Dictionary<string, AssetHandle>();
|
Dictionary<string, AssetHandle> assetHandles = new Dictionary<string, AssetHandle>();
|
||||||
public async UniTask<T> LoadAsync<T>(string name)where T: Object
|
public async UniTask<T> LoadAsync<T>(string name, LoadingWindow loadingWindow = null) where T : UnityEngine.Object
|
||||||
{
|
{
|
||||||
|
AssetHandle handle = null;
|
||||||
if (!assetHandles.ContainsKey(name))
|
if (!assetHandles.ContainsKey(name))
|
||||||
{
|
{
|
||||||
AssetHandle handle = YooAssets.LoadAssetAsync<T>(name);
|
handle = YooAssets.LoadAssetAsync<T>(name);
|
||||||
await handle.ToUniTask();
|
await handle.ToUniTask(loadingWindow);
|
||||||
assetHandles.Add(name, handle);
|
assetHandles.Add(name, handle);
|
||||||
Debug.Log($"AssetLoad:{name}");
|
Debug.Log($"AssetLoad:{name}");
|
||||||
return handle.AssetObject as T;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssetHandle handle = assetHandles[name];
|
handle = assetHandles[name];
|
||||||
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
||||||
|
}
|
||||||
|
if (loadingWindow != null)
|
||||||
|
UIManager.Inst.CloseUI(loadingWindow);
|
||||||
return handle.AssetObject as T;
|
return handle.AssetObject as T;
|
||||||
}
|
}
|
||||||
}
|
public T Load<T>(string name) where T : UnityEngine.Object
|
||||||
public T Load<T>(string name) where T : Object
|
|
||||||
{
|
{
|
||||||
|
AssetHandle handle = null;
|
||||||
if (!assetHandles.ContainsKey(name))
|
if (!assetHandles.ContainsKey(name))
|
||||||
{
|
{
|
||||||
AssetHandle handle = YooAssets.LoadAssetSync<T>(name);
|
handle = YooAssets.LoadAssetSync<T>(name);
|
||||||
assetHandles.Add(name, handle);
|
assetHandles.Add(name, handle);
|
||||||
Debug.Log($"AssetLoad:{name}");
|
Debug.Log($"AssetLoad:{name}");
|
||||||
return handle.AssetObject as T;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssetHandle handle = assetHandles[name];
|
handle = assetHandles[name];
|
||||||
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
||||||
return handle.AssetObject as T;
|
|
||||||
}
|
}
|
||||||
|
return handle.AssetObject as T;
|
||||||
}
|
}
|
||||||
public AssetHandle GetHandle(string name)
|
public AssetHandle GetHandle(string name)
|
||||||
{
|
{
|
||||||
2
Assets/GameScripts/Main/AssetLoader.cs.meta
Normal file
2
Assets/GameScripts/Main/AssetLoader.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 48a875b73eb969f4fa3a19584bba9262
|
||||||
@@ -32,7 +32,8 @@ namespace Tuan.GameScripts.Main
|
|||||||
async UniTask LoadSceneTest()
|
async UniTask LoadSceneTest()
|
||||||
{
|
{
|
||||||
PatchEvent.ClosePatchWindow();
|
PatchEvent.ClosePatchWindow();
|
||||||
await GameSceneManager.Inst.LoadSceneAsync("Test");
|
LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync<LoadingWindow>("LoadSceneTest",MainUICanvas.Inst.Medium);
|
||||||
|
await SceneLoader.Inst.LoadSceneAsync("Test", loadingWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,12 @@ using Tuan.GameFramework;
|
|||||||
|
|
||||||
namespace Tuan.GameScripts.Main
|
namespace Tuan.GameScripts.Main
|
||||||
{
|
{
|
||||||
public class GameSceneManager : Singleton<GameSceneManager>
|
public class SceneLoader : Singleton<SceneLoader>
|
||||||
{
|
{
|
||||||
Dictionary<string, SceneHandle> sceneHandles = new Dictionary<string, SceneHandle>();
|
Dictionary<string, SceneHandle> sceneHandles = new Dictionary<string, SceneHandle>();
|
||||||
public async UniTask LoadSceneAsync(string sceneName)
|
public async UniTask LoadSceneAsync(string sceneName, LoadingWindow loadingWindow = null)
|
||||||
{
|
{
|
||||||
SceneHandle sceneHandle = null;
|
SceneHandle sceneHandle = null;
|
||||||
LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync<LoadingWindow>($"Loading{sceneName}", MainUICanvas.Inst.Medium, true);
|
|
||||||
if (!sceneHandles.ContainsKey(sceneName))
|
if (!sceneHandles.ContainsKey(sceneName))
|
||||||
{
|
{
|
||||||
sceneHandle = YooAssets.LoadSceneAsync("Test");
|
sceneHandle = YooAssets.LoadSceneAsync("Test");
|
||||||
@@ -24,13 +23,14 @@ namespace Tuan.GameScripts.Main
|
|||||||
sceneHandle = sceneHandles[sceneName];
|
sceneHandle = sceneHandles[sceneName];
|
||||||
}
|
}
|
||||||
sceneHandle.ActivateScene();
|
sceneHandle.ActivateScene();
|
||||||
|
if(loadingWindow != null)
|
||||||
|
UIManager.Inst.CloseUI(loadingWindow);
|
||||||
}
|
}
|
||||||
public async void LoadScene(string sceneName)
|
public void LoadScene(string sceneName)
|
||||||
{
|
{
|
||||||
SceneHandle sceneHandle = null;
|
SceneHandle sceneHandle = null;
|
||||||
if (!sceneHandles.ContainsKey(sceneName))
|
if (!sceneHandles.ContainsKey(sceneName))
|
||||||
{
|
{
|
||||||
LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync<LoadingWindow>($"Loading{sceneName}", MainUICanvas.Inst.Medium, true);
|
|
||||||
sceneHandle = YooAssets.LoadSceneSync("Test");
|
sceneHandle = YooAssets.LoadSceneSync("Test");
|
||||||
sceneHandles[sceneName] = sceneHandle;
|
sceneHandles[sceneName] = sceneHandle;
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,12 @@ namespace Tuan.GameScripts.Main
|
|||||||
}
|
}
|
||||||
sceneHandle.ActivateScene();
|
sceneHandle.ActivateScene();
|
||||||
}
|
}
|
||||||
|
public SceneHandle GetHandle(string name)
|
||||||
|
{
|
||||||
|
if (sceneHandles.ContainsKey(name))
|
||||||
|
return sceneHandles[name];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Tuan.GameScripts.Main;
|
|
||||||
|
|
||||||
public class LoadingWindow : UIBase,IProgress<float>
|
namespace Tuan.GameScripts.Main
|
||||||
{
|
{
|
||||||
|
public class LoadingWindow : UIBase, IProgress<float>
|
||||||
|
{
|
||||||
public Slider slider;
|
public Slider slider;
|
||||||
public Text progressText;
|
public Text progressText;
|
||||||
public void Report(float value)
|
public void Report(float value)
|
||||||
@@ -13,4 +14,6 @@ public class LoadingWindow : UIBase,IProgress<float>
|
|||||||
progressText.text = $"{value * 100:F0}%";
|
progressText.text = $"{value * 100:F0}%";
|
||||||
Debug.Log($"{gameObject.name};{value}");
|
Debug.Log($"{gameObject.name};{value}");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ namespace Tuan.GameScripts.Main
|
|||||||
|
|
||||||
public void SetParent(RectTransform ui, bool isFull = false)
|
public void SetParent(RectTransform ui, bool isFull = false)
|
||||||
{
|
{
|
||||||
rectTransform.SetParent(ui);
|
rectTransform.SetParent(ui,false);
|
||||||
rectTransform.localScale = Vector3.one;
|
//rectTransform.localScale = Vector3.one;
|
||||||
rectTransform.localPosition = Vector3.zero;
|
//rectTransform.localPosition = Vector3.zero;
|
||||||
rectTransform.localRotation = Quaternion.identity;
|
//rectTransform.localRotation = Quaternion.identity;
|
||||||
if (isFull)
|
if (isFull)
|
||||||
SetFull();
|
SetFull();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Tuan.GameScripts.Main
|
|||||||
string uiType = typeof(T).Name;
|
string uiType = typeof(T).Name;
|
||||||
if (!openedUIs.ContainsKey(uiName))
|
if (!openedUIs.ContainsKey(uiName))
|
||||||
{
|
{
|
||||||
GameObject uiPrefab = AssetLoad.Inst.Load<GameObject>(uiType);
|
GameObject uiPrefab = AssetLoader.Inst.Load<GameObject>(uiType);
|
||||||
ui = CreateUI<T>(uiPrefab, uiName, parent, isFull);
|
ui = CreateUI<T>(uiPrefab, uiName, parent, isFull);
|
||||||
openedUIs[uiName] = ui;
|
openedUIs[uiName] = ui;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace Tuan.GameScripts.Main
|
|||||||
ui = openedUIs[uiName] as T;
|
ui = openedUIs[uiName] as T;
|
||||||
uiLinkedList.Remove(ui);
|
uiLinkedList.Remove(ui);
|
||||||
}
|
}
|
||||||
Debug.Log($"ShowUI====>name:{uiName} type:{typeof(T).Name}");
|
Debug.Log($"UIManager.ShowUI====>name:{uiName} type:{typeof(T).Name}");
|
||||||
ui.gameObject.SetActive(true);
|
ui.gameObject.SetActive(true);
|
||||||
ui.OnShow();
|
ui.OnShow();
|
||||||
uiLinkedList.AddLast(ui);
|
uiLinkedList.AddLast(ui);
|
||||||
@@ -39,7 +39,7 @@ namespace Tuan.GameScripts.Main
|
|||||||
string uiType = typeof(T).Name;
|
string uiType = typeof(T).Name;
|
||||||
if (!openedUIs.ContainsKey(uiName))
|
if (!openedUIs.ContainsKey(uiName))
|
||||||
{
|
{
|
||||||
GameObject uiPrefab = await AssetLoad.Inst.LoadAsync<GameObject>(uiType);
|
GameObject uiPrefab = await AssetLoader.Inst.LoadAsync<GameObject>(uiType);
|
||||||
ui = CreateUI<T>(uiPrefab, uiName, parent, isFull);
|
ui = CreateUI<T>(uiPrefab, uiName, parent, isFull);
|
||||||
openedUIs[uiName] = ui;
|
openedUIs[uiName] = ui;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ namespace Tuan.GameScripts.Main
|
|||||||
ui = openedUIs[uiName] as T;
|
ui = openedUIs[uiName] as T;
|
||||||
uiLinkedList.Remove(ui);
|
uiLinkedList.Remove(ui);
|
||||||
}
|
}
|
||||||
Debug.Log($"ShowUIAsync====>name:{uiName} type:{typeof(T).Name}");
|
Debug.Log($"UIManager.ShowUIAsync====>name:{uiName} type:{typeof(T).Name}");
|
||||||
ui.gameObject.SetActive(true);
|
ui.gameObject.SetActive(true);
|
||||||
ui.OnShow();
|
ui.OnShow();
|
||||||
uiLinkedList.AddLast(ui);
|
uiLinkedList.AddLast(ui);
|
||||||
@@ -56,15 +56,17 @@ namespace Tuan.GameScripts.Main
|
|||||||
}
|
}
|
||||||
public void CloseUI(string uiName)
|
public void CloseUI(string uiName)
|
||||||
{
|
{
|
||||||
if (!openedUIs.ContainsKey(uiName))
|
if (!openedUIs.ContainsKey(uiName)) return;
|
||||||
return;
|
|
||||||
var ui = openedUIs[uiName];
|
var ui = openedUIs[uiName];
|
||||||
|
Debug.Log($"UIManager.CloseUI====>name:{uiName} type:{ui}");
|
||||||
ui.OnHide();
|
ui.OnHide();
|
||||||
ui.gameObject.SetActive(false);
|
ui.gameObject.SetActive(false);
|
||||||
uiLinkedList.Remove(ui);
|
uiLinkedList.Remove(ui);
|
||||||
}
|
}
|
||||||
public void CloseUI(UIBase ui)
|
public void CloseUI(UIBase ui)
|
||||||
{
|
{
|
||||||
|
if (!openedUIs.ContainsKey(ui.gameObject.name)) return;
|
||||||
|
Debug.Log($"UIManager.CloseUI====>name:{ui.gameObject.name} type:{ui}");
|
||||||
ui.OnHide();
|
ui.OnHide();
|
||||||
ui.gameObject.SetActive(false);
|
ui.gameObject.SetActive(false);
|
||||||
uiLinkedList.Remove(ui);
|
uiLinkedList.Remove(ui);
|
||||||
@@ -76,7 +78,7 @@ namespace Tuan.GameScripts.Main
|
|||||||
T ui = uiObj.GetComponent<T>();
|
T ui = uiObj.GetComponent<T>();
|
||||||
ui.OnCreate();
|
ui.OnCreate();
|
||||||
if (parent) ui.SetParent(parent, isFull);
|
if (parent) ui.SetParent(parent, isFull);
|
||||||
Debug.Log($"CreateUI====>name:{uiName} type:{typeof(T).Name}");
|
Debug.Log($"UIManager.CreateUI====>name:{uiName} type:{typeof(T).Name}");
|
||||||
return ui;
|
return ui;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user