UI框架开发中
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
public class UIManager : SingletonMono<UIManager>
|
||||
public class UIManager : Singleton<UIManager>
|
||||
{
|
||||
Transform uiRoot;
|
||||
Dictionary<string, UIBaseWindow> openedWindows = new Dictionary<string, UIBaseWindow>();
|
||||
@@ -20,9 +20,10 @@ public class UIManager : SingletonMono<UIManager>
|
||||
{
|
||||
YooAssets.LoadAssetAsync<GameObject>(windowName).Completed += handle =>
|
||||
{
|
||||
GameObject go = Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform);
|
||||
GameObject go = GameObject.Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform);
|
||||
var window = go.GetComponent<T>();
|
||||
window.Show();
|
||||
openedWindows[windowName] = window;
|
||||
onShow?.Invoke(window);
|
||||
};
|
||||
}
|
||||
@@ -33,5 +34,20 @@ public class UIManager : SingletonMono<UIManager>
|
||||
{
|
||||
openedWindows[windowName].Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("δ<>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>ڣ<EFBFBD>ʹ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
}
|
||||
public bool CheckShow(string windowName)
|
||||
{
|
||||
if (openedWindows.ContainsKey(windowName))
|
||||
{
|
||||
return openedWindows[windowName].gameObject.activeSelf;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user