fix(UI): 修复当UIBase的IsOpenOnFirstLoad为false的时候,会导致组件的Awake无法触发的BUG
This commit is contained in:
@@ -1162,7 +1162,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: f22aa900f1d1442e9f5ae9750b6ead86, type: 3}
|
m_Script: {fileID: 11500000, guid: f22aa900f1d1442e9f5ae9750b6ead86, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
IsOpenOnFirstLoad: 1
|
IsOpenOnFirstLoad: 0
|
||||||
inputText: {fileID: 1852915598}
|
inputText: {fileID: 1852915598}
|
||||||
outputText: {fileID: 1439567735}
|
outputText: {fileID: 1439567735}
|
||||||
--- !u!1 &1852915596
|
--- !u!1 &1852915596
|
||||||
|
@@ -10,6 +10,12 @@ namespace Core
|
|||||||
public abstract class UIBase : MonoBehaviour
|
public abstract class UIBase : MonoBehaviour
|
||||||
{
|
{
|
||||||
public bool IsOpenOnFirstLoad;
|
public bool IsOpenOnFirstLoad;
|
||||||
|
|
||||||
|
protected virtual void Awake()
|
||||||
|
{
|
||||||
|
if (!IsOpenOnFirstLoad) Hide();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the UI is shown.
|
/// Called when the UI is shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -48,11 +48,6 @@ namespace Core
|
|||||||
if (uiBase != null && !openedUIs.ContainsKey(uiName))
|
if (uiBase != null && !openedUIs.ContainsKey(uiName))
|
||||||
{
|
{
|
||||||
openedUIs[uiName] = uiBase;
|
openedUIs[uiName] = uiBase;
|
||||||
uiBase.Hide(); // 默认关闭
|
|
||||||
if (uiBase.IsOpenOnFirstLoad)
|
|
||||||
{
|
|
||||||
uiBase.Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user