GlobalEventCenter.cs 720 B

1234567891011121314151617181920212223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /* 全局事件中心-订阅发布 */
  5. public class GlobalEventCenter : MonoBehaviour
  6. {
  7. public System.Action onGameSceneLoad;
  8. public System.Action onGameSceneDestroy;
  9. public System.Action<bool> onSimulateMouseAwakeChanged; //Param0:激活/熄灭
  10. public System.Action<bool> onDeviceCalibrateViewAwakeChanged;
  11. private static GlobalEventCenter _ins;
  12. public static GlobalEventCenter ins {
  13. get {
  14. if (!_ins) {
  15. _ins = new GameObject("GlobalEventCenter").AddComponent<GlobalEventCenter>();
  16. DontDestroyOnLoad(_ins);
  17. }
  18. return _ins;
  19. }
  20. }
  21. }