예제 #1
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            if (!Visible)
            {
                return;
            }
            if (playerManager.LocalPlayer?.ControlledEntity == null)
            {
                contents.Text = "No attached entity.";
                return;
            }

            var entityTransform   = playerManager.LocalPlayer.ControlledEntity.Transform;
            var playerWorldOffset = entityTransform.WorldPosition;
            var playerScreen      = eyeManager.WorldToScreen(playerWorldOffset);

            var               mouseScreenPos = inputManager.MouseScreenPosition;
            int               mouseWorldMap;
            int               mouseWorldGrid;
            GridCoordinates   mouseWorldPos;
            ScreenCoordinates worldToScreen;
            IEntity           mouseEntity = null;

            try
            {
                var coords = eyeManager.ScreenToWorld(new ScreenCoordinates(mouseScreenPos));
                mouseWorldMap  = (int)coords.MapID;
                mouseWorldGrid = (int)coords.GridID;
                mouseWorldPos  = coords;
                worldToScreen  = eyeManager.WorldToScreen(coords);
                if (stateManager.CurrentState is GameScreen gameScreen)
                {
                    mouseEntity = gameScreen.GetEntityUnderPosition(coords);
                }
            }
            catch
            {
                mouseWorldPos  = eyeManager.ScreenToWorld(mouseScreenPos);
                mouseWorldGrid = 0;
                mouseWorldMap  = 0;
                worldToScreen  = new ScreenCoordinates();
            }

            contents.Text = $@"Positioning Debug:
Character Pos:
    World: {playerWorldOffset}
    Screen: {playerScreen}
    Grid: {entityTransform.GridID}
    Map: {entityTransform.MapID}

Mouse Pos:
    Screen: {mouseScreenPos}
    World: {mouseWorldPos}
    W2S: {worldToScreen.Position}
    Grid: {mouseWorldGrid}
    Map: {mouseWorldMap}
    Entity: {mouseEntity}";

            MinimumSizeChanged();
        }
예제 #2
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            base.Update(args);

            if ((GameTiming.RealTime - LastUpdate).Seconds < 1 || !Visible)
            {
                return;
            }

            if (!NetManager.IsConnected)
            {
                contents.Text = "Not connected to server.";
                return;
            }

            LastUpdate = GameTiming.RealTime;

            var stats           = NetManager.Statistics;
            var sentBytes       = stats.SentBytes - LastSentBytes;
            var receivedBytes   = stats.ReceivedBytes - LastReceivedBytes;
            var sentPackets     = stats.SentPackets - LastSentPackets;
            var receivedPackets = stats.ReceivedPackets - LastReceivedPackets;

            LastSentBytes       = stats.SentBytes;
            LastReceivedBytes   = stats.ReceivedBytes;
            LastSentPackets     = stats.SentPackets;
            LastReceivedPackets = stats.ReceivedPackets;

            contents.Text = $@"UP: {sentBytes / ONE_KIBIBYTE:N} KiB/s, {sentPackets} pckt/s, {LastSentBytes / ONE_KIBIBYTE:N} KiB, {LastSentPackets} pckt
DOWN: {receivedBytes / ONE_KIBIBYTE:N} KiB/s, {receivedPackets} pckt/s, {LastReceivedBytes / ONE_KIBIBYTE:N} KiB, {LastReceivedPackets} pckt
PING: {NetManager.ServerChannel?.Ping ?? -1} ms";

            MinimumSizeChanged();
        }
예제 #3
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            if (!Visible)
            {
                return;
            }
            var fps = Godot.Performance.GetMonitor(Godot.Performance.Monitor.TimeFps);

            Text = $"FPS: {fps}";
        }
예제 #4
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            if (!VisibleInTree)
            {
                return;
            }

            var fps = IoCManager.Resolve <IGameTiming>().FramesPerSecondAvg;

            Text = $"FPS: {fps:N1}";
        }
예제 #5
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            if (!VisibleInTree)
            {
                return;
            }

            var fps = _gameTiming.FramesPerSecondAvg;

            Text = $"FPS: {fps:N1}";
        }
예제 #6
0
        // Prevent window headers from getting off screen due to game window resizes.
        protected override void Update(ProcessFrameEventArgs args)
        {
            var windowSize = Godot.OS.GetWindowSize().Convert();

            if (Position.Y > windowSize.Y)
            {
                Position = new Vector2(Position.X, windowSize.Y - HEADER_SIZE_Y);
            }
            if (Position.X > windowSize.X)
            {
                // 50 is arbitrary here. As long as it's bumped back into view.
                Position = new Vector2(windowSize.X - 50, Position.Y);
            }
        }
예제 #7
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            base.Update(args);

            if (!VisibleInTree)
            {
                return;
            }

            _contents.Text = $@"Paused: {_gameTiming.Paused}, CurTick: {_gameTiming.CurTick},
CurTime: {_gameTiming.CurTime}, RealTime: {_gameTiming.RealTime}";

            MinimumSizeChanged();
        }
        protected override void Update(ProcessFrameEventArgs args)
        {
            if (!Visible)
            {
                return;
            }
            if (playerManager.LocalPlayer?.ControlledEntity == null)
            {
                contents.Text = "No attached entity.";
                return;
            }

            var entityTransform   = playerManager.LocalPlayer.ControlledEntity.GetComponent <ITransformComponent>();
            var playerWorldOffset = entityTransform.WorldPosition;
            var playerScreen      = eyeManager.WorldToScreen(playerWorldOffset);

            var     mouseScreenPos = inputManager.MouseScreenPosition;
            int     mouseWorldMap;
            int     mouseWorldGrid;
            Vector2 mouseWorldPos;

            try
            {
                var coords = eyeManager.ScreenToWorld(new ScreenCoordinates(mouseScreenPos, entityTransform.MapID));
                mouseWorldMap  = (int)coords.MapID;
                mouseWorldGrid = (int)coords.GridID;
                mouseWorldPos  = coords.Position;
            }
            catch
            {
                mouseWorldPos  = eyeManager.ScreenToWorld(mouseScreenPos);
                mouseWorldGrid = 0;
                mouseWorldMap  = 0;
            }

            contents.Text = $@"Positioning Debug:
Character Pos:
    World: {playerWorldOffset}
    Screen: {playerScreen}
    Grid: {entityTransform.GridID}
    Map: {entityTransform.MapID}

Mouse Pos:
    Screen: {mouseScreenPos}
    World: {mouseWorldPos}
    Grid: {mouseWorldGrid}
    Map: {mouseWorldMap}";

            MinimumSizeChanged();
        }
예제 #9
0
 public override void Update(ProcessFrameEventArgs e)
 {
     _componentManager.CullRemovedComponents();
     _entityManager.Update(e.Elapsed);
     playerManager.Update(e.Elapsed);
 }
예제 #10
0
 public void Update(ProcessFrameEventArgs e)
 {
     CurrentState?.Update(e);
 }
예제 #11
0
        protected override void Update(ProcessFrameEventArgs args)
        {
            base.Update(args);

            _flushQueue();
        }
예제 #12
0
 /// <summary>
 ///     Update the contents of this screen.
 /// </summary>
 public virtual void Update(ProcessFrameEventArgs e)
 {
 }
예제 #13
0
 public void Update(ProcessFrameEventArgs args)
 {
     RootControl.DoUpdate(args);
 }
예제 #14
0
 public void Update(ProcessFrameEventArgs args)
 {
     throw new System.NotImplementedException();
 }