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

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

            if (unit == null)
            {
                throw new ServerClientException("Encountered an invalid unit ID in an upgrade request");
            }
            PlayerState.UpgradeUnit(unit, unit.GetUpgrade(request.UpgradeId));
            UnitUpgradedBroadcast unitUpgraded = new UnitUpgradedBroadcast(new ReinforcementState(PlayerState), unit.Id);
            ServerToClientMessage broadcast    = new ServerToClientMessage(unitUpgraded);

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