Beispiel #1
0
        /// <summary>
        /// Process environment commands.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(EnvironmentCommand request)
        {
            switch (request.Command)
            {
            case EnvironmentCommands.Start:
                GameController.Start();
                break;

            case EnvironmentCommands.Reset:
                GameController.Reset();
                break;
            }

            var status = GameController.GetEnvironmentStatus();

            switch (status.Item1)
            {
            case EnvironmentStatus.Registering:
                ServerEvents.NotifyAll(new GetReadyMessage {
                    Dragons = status.Item3
                });
                break;

            case EnvironmentStatus.Active:
                ServerEvents.NotifyChannel("player", new EnvironmentStatusMessage {
                    Status = status.Item1, Dragons = status.Item3
                });
                break;
            }

            ServerEvents.NotifyAll(new EnvironmentStatusMessage {
                Status = status.Item1, Dragons = status.Item3
            });
        }