コード例 #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/Lockstep
        private void Init()
        {
            this._ready = true;

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

            UIManager.Init();

            NetworkManager.SetupKCP();
            NetworkManager.AddPacketTypes();
            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);

            Windows.CONNECTING_WIN.Open(Core.Net.NetworkConfig.CONNECTION_TIMEOUT / 1000f);
        }