Пример #1
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 virtual void OnTick(float delta)
        {
            //reset MousePosition for relative mode
            if (mouseRelativeMode)
            {
                Cursor.Position = PointToScreen(new Point(
                                                    mouseRelativeModeStartPosition.X, mouseRelativeModeStartPosition.Y));
            }

            if (Tick != null)
            {
                Tick(this, delta);
            }

            if (controlManager != null)
            {
                controlManager.DoTick(delta);
            }
        }
        protected virtual void OnTick(float delta)
        {
            //reset MousePosition for relative mode
            if (mouseRelativeMode)
            {
                Point point = PointToScreen(
                    new Point(mouseRelativeModeStartPosition.X, mouseRelativeModeStartPosition.Y));
                System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)point.X, (int)point.Y);
            }

            if (Tick != null)
            {
                Tick(this, delta);
            }

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