Beispiel #1
0
        private void CalculateTurnInformation(GameSession gameSession)
        {
            if (crlRefreshMap == null)
            {
                Initialization();
            }

            Logger.Debug(TraceMessage.Execute(this, $"Turn: {gameSession.Turn}."));

            HistoryMovementLog.Update(_gameSession);

            _gameSession = gameSession;

            turnStep = 0;

            granularTurnInformation = CalculateGranularTurnInformation(_gameSession);



            var timeDrawScreen = Stopwatch.StartNew();

            History.Enqueue(granularTurnInformation.DeepClone());

            Logger.Debug(TraceMessage.Execute(this, $"Time {timeDrawScreen.Elapsed.TotalMilliseconds} ms."));
        }
        public void MovementLogEmptyTest()
        {
            var movementLog = new MovementLog(2);

            var localServer = EnvironmentGlobal.CreateGameServer("MovementLogTests");

            movementLog.Update(localServer.RefreshGameSession());

            Assert.IsTrue(movementLog.GetHistoryForCelestialObject(100).Count == 0);
        }
        public void UpdateTest()
        {
            var movementLog = new MovementLog(4);

            var localServer = EnvironmentGlobal.CreateGameServer("MovementLogTests");

            movementLog.Update(localServer.RefreshGameSession());

            Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 2);

            Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[0].Coordinates, new PointF(8000, 10000));

            Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[1].Coordinates, new PointF(10000, 10000));

            localServer.TurnCalculation();

            movementLog.Update(localServer.RefreshGameSession());

            Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 3);

            Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[0].Coordinates, new PointF(8000, 10000));

            Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[1].Coordinates, new PointF(10000, 10000));

            Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[2].Coordinates, new PointF(10005, 10000));

            localServer.TurnCalculation();

            movementLog.Update(localServer.RefreshGameSession());

            Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 4);

            localServer.TurnCalculation();

            movementLog.Update(localServer.RefreshGameSession());

            Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 4);

            //Assert.IsTrue(MovementLog.);
        }