111
This commit is contained in:
@@ -655,7 +655,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MainCamera: {fileID: 330585545}
|
||||
PlayMode: 2
|
||||
PlayMode: 0
|
||||
--- !u!4 &1019312449
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -109,7 +109,7 @@ ModelImporter:
|
||||
strictVertexDataChecks: 0
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
normalImportMode: 1
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
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_Father: {fileID: 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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -632,4 +574,3 @@ SceneRoots:
|
||||
- {fileID: 462509703}
|
||||
- {fileID: 1598712461}
|
||||
- {fileID: 215814089}
|
||||
- {fileID: 742264193}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bc8a9986f966a4ebae93b30342d02f
|
||||
@@ -6,41 +6,43 @@ using Tuan.GameFramework;
|
||||
|
||||
namespace Tuan.GameScripts.Main
|
||||
{
|
||||
public class AssetLoad :Singleton <AssetLoad>
|
||||
public class AssetLoader :Singleton <AssetLoader>
|
||||
{
|
||||
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))
|
||||
{
|
||||
AssetHandle handle = YooAssets.LoadAssetAsync<T>(name);
|
||||
await handle.ToUniTask();
|
||||
handle = YooAssets.LoadAssetAsync<T>(name);
|
||||
await handle.ToUniTask(loadingWindow);
|
||||
assetHandles.Add(name, handle);
|
||||
Debug.Log($"AssetLoad:{name}");
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetHandle handle = assetHandles[name];
|
||||
handle = assetHandles[name];
|
||||
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
if (loadingWindow != null)
|
||||
UIManager.Inst.CloseUI(loadingWindow);
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
public T Load<T>(string name) where T : Object
|
||||
public T Load<T>(string name) where T : UnityEngine.Object
|
||||
{
|
||||
AssetHandle handle = null;
|
||||
if (!assetHandles.ContainsKey(name))
|
||||
{
|
||||
AssetHandle handle = YooAssets.LoadAssetSync<T>(name);
|
||||
handle = YooAssets.LoadAssetSync<T>(name);
|
||||
assetHandles.Add(name, handle);
|
||||
Debug.Log($"AssetLoad:{name}");
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetHandle handle = assetHandles[name];
|
||||
handle = assetHandles[name];
|
||||
Debug.Log($"AssetLoad:{name}(已缓存handle)");
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
return handle.AssetObject as T;
|
||||
}
|
||||
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()
|
||||
{
|
||||
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
|
||||
{
|
||||
public class GameSceneManager : Singleton<GameSceneManager>
|
||||
public class SceneLoader : Singleton<SceneLoader>
|
||||
{
|
||||
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;
|
||||
LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync<LoadingWindow>($"Loading{sceneName}", MainUICanvas.Inst.Medium, true);
|
||||
if (!sceneHandles.ContainsKey(sceneName))
|
||||
{
|
||||
sceneHandle = YooAssets.LoadSceneAsync("Test");
|
||||
@@ -24,13 +23,14 @@ namespace Tuan.GameScripts.Main
|
||||
sceneHandle = sceneHandles[sceneName];
|
||||
}
|
||||
sceneHandle.ActivateScene();
|
||||
if(loadingWindow != null)
|
||||
UIManager.Inst.CloseUI(loadingWindow);
|
||||
}
|
||||
public async void LoadScene(string sceneName)
|
||||
public void LoadScene(string sceneName)
|
||||
{
|
||||
SceneHandle sceneHandle = null;
|
||||
if (!sceneHandles.ContainsKey(sceneName))
|
||||
{
|
||||
LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync<LoadingWindow>($"Loading{sceneName}", MainUICanvas.Inst.Medium, true);
|
||||
sceneHandle = YooAssets.LoadSceneSync("Test");
|
||||
sceneHandles[sceneName] = sceneHandle;
|
||||
}
|
||||
@@ -40,6 +40,12 @@ namespace Tuan.GameScripts.Main
|
||||
}
|
||||
sceneHandle.ActivateScene();
|
||||
}
|
||||
public SceneHandle GetHandle(string name)
|
||||
{
|
||||
if (sceneHandles.ContainsKey(name))
|
||||
return sceneHandles[name];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Tuan.GameScripts.Main;
|
||||
|
||||
public class LoadingWindow : UIBase,IProgress<float>
|
||||
namespace Tuan.GameScripts.Main
|
||||
{
|
||||
public Slider slider;
|
||||
public Text progressText;
|
||||
public void Report(float value)
|
||||
public class LoadingWindow : UIBase, IProgress<float>
|
||||
{
|
||||
slider.value = value;
|
||||
progressText.text = $"{value * 100:F0}%";
|
||||
Debug.Log($"{gameObject.name};{value}");
|
||||
public Slider slider;
|
||||
public Text progressText;
|
||||
public void Report(float value)
|
||||
{
|
||||
slider.value = value;
|
||||
progressText.text = $"{value * 100:F0}%";
|
||||
Debug.Log($"{gameObject.name};{value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace Tuan.GameScripts.Main
|
||||
|
||||
public void SetParent(RectTransform ui, bool isFull = false)
|
||||
{
|
||||
rectTransform.SetParent(ui);
|
||||
rectTransform.localScale = Vector3.one;
|
||||
rectTransform.localPosition = Vector3.zero;
|
||||
rectTransform.localRotation = Quaternion.identity;
|
||||
rectTransform.SetParent(ui,false);
|
||||
//rectTransform.localScale = Vector3.one;
|
||||
//rectTransform.localPosition = Vector3.zero;
|
||||
//rectTransform.localRotation = Quaternion.identity;
|
||||
if (isFull)
|
||||
SetFull();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Tuan.GameScripts.Main
|
||||
string uiType = typeof(T).Name;
|
||||
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);
|
||||
openedUIs[uiName] = ui;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Tuan.GameScripts.Main
|
||||
ui = openedUIs[uiName] as T;
|
||||
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.OnShow();
|
||||
uiLinkedList.AddLast(ui);
|
||||
@@ -39,7 +39,7 @@ namespace Tuan.GameScripts.Main
|
||||
string uiType = typeof(T).Name;
|
||||
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);
|
||||
openedUIs[uiName] = ui;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace Tuan.GameScripts.Main
|
||||
ui = openedUIs[uiName] as T;
|
||||
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.OnShow();
|
||||
uiLinkedList.AddLast(ui);
|
||||
@@ -56,15 +56,17 @@ namespace Tuan.GameScripts.Main
|
||||
}
|
||||
public void CloseUI(string uiName)
|
||||
{
|
||||
if (!openedUIs.ContainsKey(uiName))
|
||||
return;
|
||||
if (!openedUIs.ContainsKey(uiName)) return;
|
||||
var ui = openedUIs[uiName];
|
||||
Debug.Log($"UIManager.CloseUI====>name:{uiName} type:{ui}");
|
||||
ui.OnHide();
|
||||
ui.gameObject.SetActive(false);
|
||||
uiLinkedList.Remove(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.gameObject.SetActive(false);
|
||||
uiLinkedList.Remove(ui);
|
||||
@@ -76,7 +78,7 @@ namespace Tuan.GameScripts.Main
|
||||
T ui = uiObj.GetComponent<T>();
|
||||
ui.OnCreate();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user