Update() private method

Update is called once per frame.
private Update ( ) : void
return void
        //====================================================================================
        // 関数
        //====================================================================================
        /// <summary>
        /// 更新される時に呼び出されます
        /// </summary>
        private void Update()
        {
            m_fPSCounter.Update();

            m_timer += Time.unscaledDeltaTime;
            if (m_timer < INTERVAL)
            {
                return;
            }
            m_timer -= INTERVAL;

            // Note: Right shift 10 bits is a divide by 1024 and which first yields
            // the number of Kilobytes. Then divinding that result further by 1024f
            //yields a floating point number of total Megabytes.
            // GetMonoUsedSizeLong returns a raw bytecount.
            var monoUsed  = (Profiler.GetMonoUsedSizeLong() >> 10) / 1024f; // convert byte count Megabytes (MB)
            var monoTotal = (Profiler.GetMonoHeapSizeLong() >> 10) / 1024f;
            var unityUsed =
                (Profiler.GetTotalAllocatedMemoryLong() >> 10) / 1024f;
            var unityTotal =
                (Profiler.GetTotalReservedMemoryLong() >> 10) / 1024f;

            m_fpsTextUI.SetText("{0}", (int)m_fPSCounter.Fps);
            m_gcTextUI.SetText("{0}", GC.CollectionCount(0));
            m_monoUsedTextUI.SetText("{0}", (int)monoUsed);
            m_monoTotalTextUI.SetText("{0}", (int)monoTotal);
            m_unityUsedTextUI.SetText("{0}", (int)unityUsed);
            m_unityTotalTextUI.SetText("{0}", (int)unityTotal);
        }
Exemplo n.º 2
0
        private void OnEnable()
        {
            //var scale = Screen.dpi/160.0f;

            //if (scale != 0.0f && scale >= 1.1f)
            //{
            //    _scaled = true;
            //    _guiScale.Set(scale, scale, scale);
            //}

            windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow };

            _fps = new FPSCounter();
            StartCoroutine(_fps.Update());

            nameRect  = messageLine;
            valueRect = messageLine;

#if MOBILE
            this.useGUILayout = false;
            _windowRect       = WindowRect;
            _fakeWindowRect   = new Rect(0.0f, 0.0f, _windowRect.width, _windowRect.height);
            _fakeDragRect     = new Rect(0.0f, 0.0f, _windowRect.width - 32, 24);
#else
            _windowRect = WindowRect;
#endif

            LogMessage(ConsoleMessage.Info(string.Format(" UtyMap, version {0}", EnvironmentApi.Version)));
            LogMessage(ConsoleMessage.Info(" type 'help' for available commands."));
            LogMessage(ConsoleMessage.Info(" double tap or press tilda to show/hide console."));
            LogMessage(ConsoleMessage.Info(""));
        }
Exemplo n.º 3
0
        public void Update(CanvasTimingInformation timing)
        {
            fpsCounter.Update(timing);
            InputManager.Update();
            Matrix3x2.Invert(Camera.Transform, out Matrix3x2 inverse);
            if (LocalPlayer != null)
            {
                HandlePlayerInput();
            }
            nowTime = timing.ElapsedTime.TotalSeconds;
            gameServer.ProcessMessages();

            foreach (Message message in gameServer.ReceivedMessages)
            {
                if (message is InputAckMessage ackMessage)
                {
                    lastProcessedInputSeqNumber = ackMessage.SequenceNumber;
                }
            }

            foreach (Message message in gameServer.ReceivedMessages)
            {
                HandleServerMessage(message);
            }

            EntityManager.Update((float)timing.ElapsedTime.TotalSeconds);
            Camera.Update();
            InputManager.AfterUpdate();

            if (nowTime - lastTimeProcessed > timeToDisconnect && timeToDisconnect > 1)
            {
                gameServer.Disconnect();
                this.SetConnectScreen();
            }
        }
Exemplo n.º 4
0
 private void Update()
 {
     if (showFPS)
     {
         fpsCounter.Update();
     }
 }
Exemplo n.º 5
0
    void OnEnable()
    {
        windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow };

        fps = new FPSCounter();
        StartCoroutine(fps.Update());

        nameRect  = messageLine;
        valueRect = messageLine;

        Message.defaultColor = defaultColor;
        Message.warningColor = warningColor;
        Message.errorColor   = errorColor;
        Message.systemColor  = systemColor;
        Message.inputColor   = inputColor;
        Message.outputColor  = outputColor;

        _windowRect = new Rect(Screen.width / 2 - 300, 30, 960, 720);


        LogMessage(Message.System("输入 '/?' 显示帮助"));
        LogMessage(Message.Log(""));

        this.RegisterCommandCallback("close", CMDClose, "关闭调试窗口");
        this.RegisterCommandCallback("clear", CMDClear, "清除调试信息");
        this.RegisterCommandCallback("sys", CMDSystemInfo, "显示系统信息");
        this.RegisterCommandCallback("/?", CMDHelp, "显示可用命令");
        this.RegisterCommandCallback("openlog", CMDOpenLog, "打来Log显示");
        this.RegisterCommandCallback("closelog", CMDCloseLog, "关闭Log显示");
    }
Exemplo n.º 6
0
        private void OnEnable()
        {
            var scale = Screen.dpi / 160.0f;

            if (scale != 0.0f && scale >= 1.1f)
            {
                _scaled = true;
                _guiScale.Set(scale, scale, scale);
            }

            windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow };

            _fps = new FPSCounter();
            StartCoroutine(_fps.Update());

            nameRect  = messageLine;
            valueRect = messageLine;

#if MOBILE
            this.useGUILayout = false;
            _windowRect       = new Rect(5.0f, 5.0f, 300.0f, 450.0f);
            _fakeWindowRect   = new Rect(0.0f, 0.0f, _windowRect.width, _windowRect.height);
            _fakeDragRect     = new Rect(0.0f, 0.0f, _windowRect.width - 32, 24);
#else
            _windowRect = new Rect(30.0f, 30.0f, 300.0f, 450.0f);
#endif

            LogMessage(ConsoleMessage.Info(string.Format(" ActionStreetMap Engine, version {0}", Version)));
            LogMessage(ConsoleMessage.Info(" type 'help' for available commands."));
            LogMessage(ConsoleMessage.Info(""));

            //RegisterTerminalCommands();
        }
Exemplo n.º 7
0
    private void Update()
    {
        HandleTargetedPlayerPanel();
        HandleLeaderboardAndStatsPanel();

        fpsCounter.Update();
        ShowGameTechStats();
    }
Exemplo n.º 8
0
 /// <summary>
 /// UnityEvent : Update
 /// </summary>
 void Update()
 {
     if (!this._entityManager.Exists(this._playerEntity) &&
         !this._titleCanvas.enabled &&
         !this._resultCanvas.enabled)
     {
         this.Result();
     }
     FPSCounterInstance.Update();
 }
Exemplo n.º 9
0
        /// <summary>
        /// Dibuja la escena actual.
        /// </summary>
        /// <param name="gameTime">Gestiona el dibujado del render grafico, el estado actual del juego y el contenido del grafo de escena.</param>
        public static void Draw(GameTime gameTime)
        {
            GameTime = gameTime;

            Graphics.Begin();
            {
                GameStates.Draw(gameTime);
                Scene.Draw(gameTime);
                PhysicEngine.Draw(gameTime);
            }
            Graphics.End();
            fps.Update(gameTime);           // Actualizamos la cuenta de fotogramas por segundo al finalizar las operaciones de dibujado.
        }
Exemplo n.º 10
0
        public override void Update(GameTime gameTime)
        {
            mouse.Update();
            keyboard.Update(gameTime);
            console.Update();
            screenManager.Update(gameTime);
            fpsCounter.Update(gameTime);
            messageLog.Update(gameTime);
            camera.Update(gameTime);

            mouseRay = GMath.GetRayFromScreenPoint(mouse.ScreenPositionV, GraphicsDevice.Viewport,
                                                   camera.Projection, camera.View);
        }
Exemplo n.º 11
0
        protected override void Update(GameTime gameTime)
        {
            //if (!IsActive)
            //    return;

            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            fps.Update(deltaTime);

            UiManager.GetActiveUserInterface().Update(gameTime);

            base.Update(gameTime);
        }
Exemplo n.º 12
0
        protected override void DebugDraw()
        {
            spriteBatch.Begin();
            FPSCounter.Update(spriteBatch);

            Vector2 pos      = DebugPos;
            Vector2 shadePos = pos + Vector2.One;

            if (debugObjects.Count > 0)
            {
                List <string> keys = debugObjects.Keys.ToList();
                foreach (string key in keys)
                {
                    string drawString = key + ": " + debugObjects[key].ToString();
                    pos.Y      += 15;
                    shadePos.Y += 15;

                    spriteBatch.DrawString(DebugFont, drawString, shadePos, Color.Black);
                    spriteBatch.DrawString(DebugFont, drawString, pos, DebugColor);
                }
            }

            if (debugValues.Count > 0)
            {
                List <string> keys = debugValues.Keys.ToList();
                foreach (string key in keys)
                {
                    string drawString = key + ": " + debugValues[key].ToString();
                    pos.Y      += 15;
                    shadePos.Y += 15;

                    spriteBatch.DrawString(DebugFont, drawString, shadePos, Color.Black);
                    spriteBatch.DrawString(DebugFont, drawString, pos, DebugColor);
                }
            }

            if (debugStrings.Count > 0)
            {
                foreach (string text in debugStrings)
                {
                    pos.Y      += 15;
                    shadePos.Y += 15;

                    spriteBatch.DrawString(DebugFont, text, shadePos, Color.Black);
                    spriteBatch.DrawString(DebugFont, text, pos, DebugColor);
                }
            }

            spriteBatch.End();
        }
    void Update()
    {
        fpsCounter.Update();

        CaptureAndPrepareTexture(camTexture, ref displayingTex);

        var boxes = yolo.Run(displayingTex);

        DrawBoundingBox(boxes);
        imageRenderer.texture = displayingTex;

        string resultText = "";

        resultText = "FPS:" + fpsCounter.FPS.ToString("F2");
        text.text  = resultText;
    }
Exemplo n.º 14
0
        public void drawUI(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Begin(SpriteSortMode.BackToFront,
                              BlendState.Opaque,
                              Settings.SAMPLER_STATE,
                              DepthStencilState.Default,
                              RasterizerState.CullNone,
                              Settings.GLOBAL_SHADER,
                              Camera.Main.Transform);

            healthBar.Draw(spriteBatch, Camera.Main);

            fpsCounter.Update(gameTime);
            fpsCounter.Draw(spriteBatch, Camera.Main);

            spriteBatch.End();
        }
Exemplo n.º 15
0
    void OnEnable()
    {
        var scale = Screen.dpi / 160.0f;

        if (scale != 0.0f && scale >= 1.1f)
        {
            _scaled = true;
            _guiScale.Set(scale, scale, scale);
        }

        windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow };

        fps = new FPSCounter();
        StartCoroutine(fps.Update());

        nameRect  = messageLine;
        valueRect = messageLine;

        Message.defaultColor = defaultColor;
        Message.warningColor = warningColor;
        Message.errorColor   = errorColor;
        Message.systemColor  = systemColor;
        Message.inputColor   = inputColor;
        Message.outputColor  = outputColor;
#if MOBILE
        this.useGUILayout = false;
        _windowRect       = new Rect(5.0f, 5.0f, 300.0f, 450.0f);
        _fakeWindowRect   = new Rect(0.0f, 0.0f, _windowRect.width, _windowRect.height);
        _fakeDragRect     = new Rect(0.0f, 0.0f, _windowRect.width - 32, 24);
#else
        _windowRect = new Rect(30.0f, 30.0f, 300.0f, 450.0f);
#endif

        LogMessage(Message.System(string.Format(" DebugConsole version {0}", VERSION)));
        LogMessage(Message.System(" Copyright 2008-2010 Jeremy Hollingsworth "));
        LogMessage(Message.System(" Ennanzus-Interactive.com "));
        LogMessage(Message.System(" type '/?' for available commands."));
        LogMessage(Message.Log(""));

        this.RegisterCommandCallback("close", CMDClose);
        this.RegisterCommandCallback("clear", CMDClear);
        this.RegisterCommandCallback("sys", CMDSystemInfo);
        this.RegisterCommandCallback("/?", CMDHelp);
    }
Exemplo n.º 16
0
    void OnEnable()
    {
        fps = new FPSCounter();
        StartCoroutine(fps.Update());

        Message.defaultColor = defaultColor;
        Message.warningColor = warningColor;
        Message.errorColor   = errorColor;
        Message.systemColor  = systemColor;
        Message.inputColor   = inputColor;
        Message.outputColor  = outputColor;

        _windowRect = new Rect(Screen.width / 2 - 200, 30, 400, 320);


        //LogMessage(Message.System("输入 '/?' 显示帮助"));

        this.RegisterCommandCallback("clear", CMD_Clear, "清除调试信息");
        this.RegisterCommandCallback("sys", CMD_SystemInfo, "显示系统信息");
        this.RegisterCommandCallback("/?", CMD_Help, "显示可用命令");
    }
Exemplo n.º 17
0
        public virtual void Draw(GameTime gameTime)
        {
            Level.GetCurrentLevel().Draw();


            if (FpsEnabled)
            {
                _frameCounter.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
                var fps = string.Format("FPS: {0}", _frameCounter.AverageFramesPerSecond);

                _spriteBatch.Begin();
                _spriteBatch.DrawString(_spriteFont, fps, new Vector2(10, 10), Color.Black);
                _spriteBatch.End();
            }

            if (ToylandSiege.GetInstance().configurationManager.DebugDraw)
            {
                DebugUtilities.DrawColliderWireframes();
            }

            DrawUI();
        }
Exemplo n.º 18
0
        public void Update(Time Elapsed)
        {
            fpsCounter.Update(Elapsed);
            input.Update(Elapsed);
            musicPlayer.Update(Elapsed);

            background.Update(Elapsed);

            if (currentScreen != null)
            {
                currentScreen.Update(Elapsed);
            }

            if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
            {
                currentScreen.DeActivate();
                currentScreen = mainScreen;
                currentScreen.Activate();
            }

            Console.Title = "fps: " + fpsCounter.FPS;
        }
Exemplo n.º 19
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            foreach (var b in balls)
            {
                b.Draw(spriteBatch, ballTexture, hitboxColor);
            }

            fps.Update((float)gameTime.TotalGameTime.TotalSeconds);
            spriteBatch.DrawString(debugFont, $"FPS: {fpsCounter}", new Vector2(20, 20), Color.White);
            spriteBatch.DrawString(debugFont, $"Counter: {ballCounter}", new Vector2(20, 40), Color.White);

            crosshair.Draw(spriteBatch);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 20
0
        protected override void Update(GameTime gameTime)
        {
            fpsCounter.Update(gameTime);

            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            gameWorld.Update(gameTime);

            renderer.UpdateCameraPosition(gameWorld.LocalPlayer.Position.X, gameTime);

            eventAggregationManager.SendMessage(new CheckGameStateMessage());

            if (Config.EditMode)
            {
                LevelEditor.Update();
            }

            base.Update(gameTime);
        }
Exemplo n.º 21
0
        //====================================================================================
        // 関数
        //====================================================================================
        /// <summary>
        /// 更新される時に呼び出されます
        /// </summary>
        private void Update()
        {
            m_fPSCounter.Update();

            m_timer += Time.unscaledDeltaTime;
            if (m_timer < INTERVAL)
            {
                return;
            }
            m_timer -= INTERVAL;

            var monoUsed   = (Profiler.GetMonoUsedSizeLong() >> 10) / 1024f;
            var monoTotal  = (Profiler.GetMonoHeapSizeLong() >> 10) / 1024f;
            var unityUsed  = (Profiler.GetTotalAllocatedMemoryLong() >> 10) / 1024f;
            var unityTotal = (Profiler.GetTotalReservedMemoryLong() >> 10) / 1024f;

            m_fpsTextUI.SetText("{0}", ( int )m_fPSCounter.Fps);
            m_gcTextUI.SetText("{0}", GC.CollectionCount(0));
            m_monoUsedTextUI.SetText("{0}", ( int )monoUsed);
            m_monoTotalTextUI.SetText("{0}", ( int )monoTotal);
            m_unityUsedTextUI.SetText("{0}", ( int )unityUsed);
            m_unityTotalTextUI.SetText("{0}", ( int )unityTotal);
        }
Exemplo n.º 22
0
    void OnEnable()
    {
        var scale = Screen.dpi / 160.0f;

        if (scale != 0.0f && scale >= 1.1f)
        {
            m_scaled = true;
            m_guiScale.Set(scale, scale, scale);
        }
        windowMethods = new GUI.WindowFunction[] { LogWindow, WatchVarWindow, CommandWindow };

        m_fps = new FPSCounter();
        StartCoroutine(m_fps.Update());

        nameRect  = messageLine;
        valueRect = messageLine;

        Message.defaultColor = defaultColor;
        Message.warningColor = warningColor;
        Message.errorColor   = errorColor;
        Message.systemColor  = systemColor;
        Message.inputColor   = inputColor;
        Message.outputColor  = outputColor;
#if MOBILE
        this.useGUILayout = false;
#endif
        m_windowRect = new Rect(m_windowRect.x, m_windowRect.y, m_windowRect.width, m_windowRect.height);

        CommandMessage(Message.System(" Click the left commands."));
        CommandMessage(Message.Normal(""));

        //		this.RegisterCommandCallback("Close", CMDClose);
        this.RegisterCommandCallback("Clear", CMDClear);
        this.RegisterCommandCallback("SystemInfo", CMDSystemInfo);
        this.RegisterCommandCallback("PathInfo", CMDSystemPathInfo);
        this.RegisterCommandCallback("CameraInfo", CMDSystemCameraInfo);
    }
Exemplo n.º 23
0
 private void Update()
 {
     fpsCounter.Update();
 }
Exemplo n.º 24
0
 public void Update()
 {
     NodeEditor.Update();
     FPSCounter.Update();
 }
Exemplo n.º 25
0
        /// <summary>
        /// 允许游戏允许逻辑例如更新地图, 检查碰撞, 收集输入, 或者播放音效.
        /// </summary>
        /// <param name="gameTime">提供一个游戏时间快照.</param>
        public override void Update(GameTime gameTime)
        {
            // 获取键盘状态
            lastKeyboardState    = currentKeyboardState;
            currentKeyboardState = Keyboard.GetState(Keys.F, Keys.Escape);
            // 当按下 F 键时
            if (currentKeyboardState.IsKeyDown(Keys.F) && lastKeyboardState.IsKeyUp(Keys.F))
            {
                GameSettings.ShowFPS = !(GameSettings.ShowFPS);
            }
            // 开始状态循环
            if (State == GameState.Menu)
            {
                playerSettings.Update(gameTime);
            }
            else if (State == GameState.StartLoad)
            {
                loading.Initialize();
                loading.Update(gameTime);
                board.Initialize();
                State = GameState.Loading;
            }
            else if (State == GameState.Loading)
            {
                loading.Update(gameTime);
            }
            else if (State == GameState.CheckLoaded)
            {
                if (board.IsInitializing)
                {
                    loading.Initialize();
                    loading.Update(gameTime);
                    State = GameState.Loading;
                }
                else
                {
                    board.Update(gameTime);
                    State = GameState.InGame;
                }
            }
            else if (State == GameState.InGame)
            {
                // 当按下 Escape 键时
                if (currentKeyboardState.IsKeyUp(Keys.Escape) && lastKeyboardState.IsKeyDown(Keys.Escape))
                {
                    if (board.CurrentBoardState == BoardState.GameOver)
                    {
                        State = GameState.Menu;
                        playerSettings.Show(SettingType.Start);
                    }
                    else
                    {
                        State = GameState.Pause;
                        playerSettings.Show(SettingType.Pause);
                    }
                    playerSettings.Update(gameTime);
                }
                board.Update(gameTime);
            }
            else if (State == GameState.Pause)
            {
                playerSettings.Update(gameTime);
            }
            else if (State == GameState.Over)
            {
            }
            if (GameSettings.ShowFPS)
            {
                fpsCounter.Update(gameTime);
            }

            base.Update(gameTime);
        }
Exemplo n.º 26
0
    void OnEnable()
    {
        fps = new FPSCounter();
        StartCoroutine(fps.Update());

        Message.defaultColor = defaultColor;
        Message.warningColor = warningColor;
        Message.errorColor = errorColor;
        Message.systemColor = systemColor;
        Message.inputColor = inputColor;
        Message.outputColor = outputColor;

        _windowRect = new Rect(Screen.width / 2 - 200, 30, 400, 320);

        //LogMessage(Message.System("输入 '/?' 显示帮助"));

        this.RegisterCommandCallback("clear", CMD_Clear, "清除调试信息");
        this.RegisterCommandCallback("sys", CMD_SystemInfo, "显示系统信息");
        this.RegisterCommandCallback("/?", CMD_Help, "显示可用命令");
    }
Exemplo n.º 27
0
 public void Update()
 {
     FPSCounter.Update();
 }
Exemplo n.º 28
0
 public void Update()
 {
     fpsCounter.Update(Time.deltaTime);
     fpsText.text = "Fps: " + fpsCounter.GetAverageFps(1f).ToString("###");
 }