1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using UnityEngine;
- using GFGGame;
- using GFGGame.Launcher;
- using FairyGUI;
- using System;
- using System.Collections.Generic;
- using YooAsset;
- using UnityEngine.SceneManagement;
- public class GameLauncher : MonoBehaviour
- {
- public static GameLauncher Instance;
- /// <summary>
- /// ×ÊԴϵͳÔËÐÐģʽ
- /// </summary>
- public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
- private void Awake()
- {
- Instance = this;
- DontDestroyOnLoad(gameObject);
- var roots = this.gameObject.scene.GetRootGameObjects();
- foreach(var t in roots)
- {
- if(t.name == "FairyGUI" || t.name == "Stage Camera")
- {
- DontDestroyOnLoad(t);
- }
- }
- }
- // Start is called before the first frame update
- void Start()
- {
- Screen.sleepTimeout = SleepTimeout.NeverSleep;
- Application.runInBackground = true;
- LauncherConfig.InitScriptCompilation();
- FGUILauncher.Init();
- HealthAdviceView.Open();
- int time = LauncherConfig.netType == LauncherConfig.EnumNetType.TISHEN ? 10 : 1;
- Timers.inst.Add(time, 1, (object param) =>
- {
- HealthAdviceView.Close();
- LauncherView.Instance.Open();
- LauncherController.InitLauncherCfg();
- });
- }
- }
|