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