コード例 #1
0
ファイル: ServerClient.cs プロジェクト: jascou/PanzerKontrol
        void OnReinforceUnit(ClientToServerMessage message)
        {
            ReinforceUnitRequest request = message.ReinforceUnitRequest;

            if (request == null)
            {
                throw new ServerClientException("Invalid unit reinforcement request");
            }
            Unit unit = PlayerState.GetUnit(request.UnitId);

            if (unit == null)
            {
                throw new ServerClientException("Encountered an invalid unit ID in a reinforcement request");
            }
            PlayerState.ReinforceUnit(unit);
            UnitReinforcementBroadcast unitReinforced = new UnitReinforcementBroadcast(new ReinforcementState(PlayerState), unit.Id, unit.Strength);
            ServerToClientMessage      broadcast      = new ServerToClientMessage(unitReinforced);

            BroadcastMessage(broadcast);
        }
コード例 #2
0
ファイル: Message.cs プロジェクト: jascou/PanzerKontrol
 public ClientToServerMessage(ReinforceUnitRequest request)
 {
     Type = ClientToServerMessageType.ReinforceUnit;
     ReinforceUnitRequest = request;
 }