private void timer1_Tick(object sender, EventArgs e)
        {
            GameNetworkClient client = GameNetworkClient.Instance;

            if (client != null)
            {
                client.Update();
            }
        }
Example #2
0
        protected override void OnTick(float delta)
        {
            base.OnTick(delta);

            if (needMapLoadName != null)
            {
                string name = needMapLoadName;
                needMapLoadName = null;
                ServerOrSingle_MapLoad(name, EntitySystemWorld.Instance.DefaultWorldType, false);
            }
            if (needMapCreateForDynamicMapExample)
            {
                needMapCreateForDynamicMapExample = false;
                DynamicCreatedMapExample.ServerOrSingle_MapCreate();
            }
            if (needWorldLoadName != null)
            {
                string name = needWorldLoadName;
                needWorldLoadName = null;
                WorldLoad(name);
            }

            if (EngineConsole.Instance != null)
            {
                EngineConsole.Instance.DoTick(delta);
            }
            controlManager.DoTick(delta);

            //update server
            GameNetworkServer server = GameNetworkServer.Instance;

            if (server != null)
            {
                server.Update();
            }

            //update client
            GameNetworkClient client = GameNetworkClient.Instance;

            if (client != null)
            {
                client.Update();

                //check for disconnection
                if (client_AllowCheckForDisconnection)
                {
                    if (client.Status == NetworkConnectionStatuses.Disconnected)
                    {
                        Client_DisconnectFromServer();

                        Log.Error("Disconnected from server.\n\nReason: \"{0}\"",
                                  client.DisconnectionReason);
                    }
                }
            }
        }
        protected override void OnTick(float delta)
        {
            base.OnTick(delta);

            //update client
            GameNetworkClient client = GameNetworkClient.Instance;

            if (client != null)
            {
                client.Update();
            }
        }