using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class TestScene1Manager : MonoBehaviour { public GameObject[] obj; // Start is called before the first frame update void Start() { Bootstrap.Instance.eventCenter.AddEventListener(Enum_EventType.TestEvent1, TestFunc1); } private void TestFunc1() { GameObject objTemp = obj[Random.Range(0, obj.Length)]; objTemp.GetComponent().material.color = new Color(Random.Range(1, 255f) / 255f, Random.Range(1, 255f) / 255f, Random.Range(1, 255f) / 255f, 1f); } // Update is called once per frame void Update() { if (Input.GetKeyDown("v")) { Bootstrap.Instance.uiManager.ShowPanel(E_UI_Layer.System, (panel) => { ///2 为进度条速度 Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 1f); Bootstrap.Instance.scenesManager.LoadSceneAsyn("TestScene", () => { Debug.Log("加载TestScene 场景成功"); ///5 为进度条速度 Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 5f); }); }); } } private void OnDisable() { if (Bootstrap.Instance != null) Bootstrap.Instance.eventCenter.RemoveEventListener(Enum_EventType.TestEvent1, TestFunc1); } }