This commit is contained in:
2026-02-13 19:23:01 +08:00
parent 1de53fcd62
commit e68fd61b86
945 changed files with 86252 additions and 1670 deletions
+38 -6
View File
@@ -48,7 +48,16 @@ public enum UIPanel
SettingPanel = 199,
#endregion
#region 200-299 Game界面
ZGXQDistrict= 251,
ZGXQCreateRoom=252,
ZGXQSelectCoin=2521,
ZGXQGameExplain=2522,
ZGXQJoinGame=253,
ZGXQWin = 254,
ZGXQDefeated= 255,
ZGXQSetting=256,
ZGXQHint=257,
ZGXQIntroduce = 258,
#endregion
@@ -82,7 +91,35 @@ public class UIManager : MonoSingleton<UIManager>
uiRoot = canvas != null ? canvas.transform : transform;
}
}
/// <summary>
/// 同步显示(若未实例化则立即实例化)
/// </summary>
public T Show<T>(UIPanel type, object args = null) where T : UIBase
{
if (addressMap.ContainsKey(type))
{
// 模拟异步:此处可替换为真正的资源加载(Addressables/AssetBundle)
var handle = Addressables.LoadAsset<GameObject>(addressMap[type]);
if (handle.Status == AsyncOperationStatus.Succeeded)
{
var panel = GetOrCreatePanel(type, handle.Result);
panel?.Show(args);
return (T)panel;
}
else
{
Debug.LogError($"Failed to load UI prefab for {type}");
return null;
}
}
else
{
Debug.Log("加载失败" + type.ToString() + "不存在");
return null;
}
}
/// <summary>
/// 同步显示(若未实例化则立即实例化)
/// </summary>
@@ -111,11 +148,6 @@ public class UIManager : MonoSingleton<UIManager>
Debug.Log("加载失败" + type.ToString() + "不存在");
return null;
}
}
/// <summary>