private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (scene.name == "Main") { Init(); Instance.gameObject.AddIfNeedComponent <AlwaysDayConsoleCommand>(); Instance.gameObject.AddIfNeedComponent <NoInfectConsoleCommand>(); Instance.gameObject.AddIfNeedComponent <OverPowerConsoleCommand>(); } else if (scene.name == "StartScreen") { //DisplayManager.OnDisplayChanged += Screen_OnDisplayChanged; if (isInfoBarEnabled) { CmInfoBar = new CM_InfoBar(); } if (isConsoleEnabled) { CmLogger = new CM_Logger(); } CmConfig.Load(); } }
public void Awake() { Instance = this; useGUILayout = false; DontDestroyOnLoad(this); drawRect = new Rect(windowRect.x + 5, windowRect.y, windowRect.width, windowRect.height); isShow = true; }
public CM_InfoBar() { if (Instance == null) { Instance = FindObjectOfType(typeof(CM_InfoBar)) as CM_InfoBar; if (Instance == null) { GameObject cm_infobar = new GameObject("CM_InfoBar"); Instance = cm_infobar.AddComponent <CM_InfoBar>(); } } }