CultivationOfBrewing/Assets/Scripts/Bootstrap.cs

73 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Bootstrap : SingletonMono<Bootstrap>
{
public UIManager uiManager;
public EventCenter eventCenter;
public ScenesManager scenesManager;
protected override void Awake()
{
base.Awake();
uiManager = new UIManager();
eventCenter = new EventCenter();
scenesManager = new ScenesManager();
DontDestroyOnLoad(gameObject);
}
private void Start()
{
uiManager.ShowPanel<UI_TipsForPracticePanel>(this, E_UI_Layer.System, (panel) =>
{
});
//Debug.Log("<color=yellow>按键S显示UI按键H关闭UI按键E控制物体变色</color>");
//uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
//{
// eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.1f);
// scenesManager.LoadSceneAsyn(this, "TestScene", () =>
// {
// Debug.Log("加载场景成功");
// eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.9f);
// });
//});
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("s"))
{
Debug.Log("Input.GetKeyDown(\"u\")");
uiManager.ShowPanel<UI_TestPanel>(this, E_UI_Layer.Bot, (panel) =>
{
panel.OnInit();
Debug.Log("UI_TestPanel显示成功");
});
}
if (Input.GetKeyDown("h"))
{
Debug.Log("Input.GetKeyDown(\"h\")");
uiManager.HidePanel<UI_TestPanel>();
}
if (Input.GetKeyDown("e"))
{
Debug.Log("Input.GetKeyDown(\"e\")");
eventCenter.EventTrigger(Enum_EventType.TestEvent1);
}
}
}