示例#1
0
        public void WcfAddFighter(Fighter.TypeFighter typeFighter, Cell addedCell)
        {
            addedCell = SearchNeedCell(addedCell);
            CellViewModel cellVM = SearchCellVMtoCell(addedCell);

            if (Fighter.CanAddFighter(typeFighter, _fieldViewModel.Game.WhoTurn))
            {
                switch (typeFighter)
                {
                case Fighter.TypeFighter.WizardFighter:
                    cellVM.Cell.Fighter = new WizardFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                case Fighter.TypeFighter.ArcherFighter:
                    cellVM.Cell.Fighter = new ArcherFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                case Fighter.TypeFighter.BarbarianFighter:
                    cellVM.Cell.Fighter = new BarbarianFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                default:
                    break;
                }
                _fieldViewModel.BattleFieldViewModel.RefreshPanelEnergyAndWhoTurn();
                FieldViewModel.ClearAllCellsFromSelection();
                cellVM.Fighter = null; //refresh
            }
            else
            if (FieldViewModel.Game.WhoTurn._user.Equals(_fieldViewModel.BattleFieldViewModel.You))
            {
                new MsgBoxGame("Not enough energy").ShowDialog();
            }
        }
示例#2
0
        public void WcfEndTurn()
        {
            FieldViewModel.Field.EndTurn(You, Enemy);
            FieldViewModel.ClearAllCellsFromSelection();

            RefreshPanelEnergyAndWhoTurn();
        }
示例#3
0
        public void WcfMakeTurn(Cell fromCell, Cell toCell)
        {
            CellViewModel fromCellVM = SearchCellVMtoCell(fromCell);
            CellViewModel toCellVM   = SearchCellVMtoCell(toCell);

            FieldViewModel.Field.MakeTurn(fromCellVM._cell, toCellVM.Cell);
            toCellVM.RaisePropertyChanged("Fighter");
            fromCellVM.RaisePropertyChanged("Fighter");
            FieldViewModel.ClearAllCellsFromSelection();
            FieldViewModel.BattleFieldViewModel.RefreshPanelEnergyAndWhoTurn();
            if (IsEndGame())
            {
                FieldViewModel.Game.Winner = FieldViewModel.Game.WhoTurn._user;
                FieldViewModel.BattleFieldViewModel.Proxy.EndGame(FieldViewModel.Game);
            }
        }
示例#4
0
 private void MakeSelectedExecute()
 {
     if (_fieldViewModel.HelperIsAddNewFigure.IsAddedCommand)
     {
         if (this.Fighter == null && Cell.GetPossibleAddCell(_fieldViewModel.Field.Game.WhoTurn).Contains(_cell))
         {
             FieldViewModel.BattleFieldViewModel.Proxy.AddFighter(FieldViewModel.Game, _fieldViewModel.HelperIsAddNewFigure.TypeFighter, _cell);
         }
         _fieldViewModel.HelperIsAddNewFigure.IsAddedCommand = false;
         FieldViewModel.ClearAllCellsFromSelection();
     }
     else
     if (!this.IsSelected)
     {
         _fieldViewModel.MarkCellsForTurn(this);
     }
     else
     {
         FieldViewModel.ClearAllCellsFromSelection();
     }
 }