コード例 #1
0
ファイル: Entry.cs プロジェクト: niuniuzhu/AnimalRunning
        void Start()
        {
            AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException;

            Application.runInBackground = true;
            Application.targetFrameRate = 60;
            DontDestroyOnLoad(this.gameObject);

            Env.isEditor   = Application.isEditor;
            Env.isRunning  = true;
            Env.platform   = ( int )Application.platform;
            Env.useNetwork = this.useNetwork;
            Env.StartTime();

            LoggerProxy.Init(Application.dataPath.Replace("\\", "/") + "/../Log/", this.logServerIp, this.logServerPort);
            LoggerProxy.logLevel = this.logLevel;

            Defs.Init(Resources.Load <TextAsset>("Defs/b_defs").text);

            UIManager.Init();

            if (Env.useNetwork)
            {
                NetworkManager.SetupKCP();
                Windows.CONNECTING_WIN.Open(NetworkConfig.CONNECTION_TIMEOUT / 1000f);
                NetModule.Initialize(this.useKCP ? NetworkManager.PType.Kcp : NetworkManager.PType.Tcp);
                NetModule.instance.OnSocketEvent += this.OnSocketEvent;
                NetModule.instance.Connect(this.ip, this.port);
            }
            else
            {
                Standalone.Init(this.cid, ( byte )this.image, this.map);
                Standalone.Load();
            }
        }
コード例 #2
0
ファイル: Entry.cs プロジェクト: niuniuzhu/AnimalRunning
 void OnApplicationQuit()
 {
     Env.isRunning = false;
     if (Env.useNetwork)
     {
         NetModule.instance.OnSocketEvent -= this.OnSocketEvent;
         NetModule.instance.Dispose();
     }
     else
     {
         Standalone.Dispose();
     }
     UIManager.Dispose();
     LoggerProxy.Dispose();
     AppDomain.CurrentDomain.UnhandledException -= this.OnUnhandledException;
 }