Esempio n. 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();
            }
        }
Esempio n. 2
0
        public void WcfEndTurn()
        {
            FieldViewModel.Field.EndTurn(You, Enemy);
            FieldViewModel.ClearAllCellsFromSelection();

            RefreshPanelEnergyAndWhoTurn();
        }
Esempio n. 3
0
 public BattleFieldViewModel(FieldViewModel fieldViewModel, User you, BattleFieldView battleFieldView)
 {
     BattleFieldView = battleFieldView;
     You             = you;
     FieldViewModel  = fieldViewModel;
     FieldViewModel.BattleFieldViewModel = this;
     Proxy = new GameProxy(this);
     Proxy.RegistrationGame(Game, you);
     BattleFieldView.Closed += BattleFieldView_Closed;
 }
Esempio n. 4
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);
            }
        }
Esempio n. 5
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();
     }
 }
Esempio n. 6
0
 public CellViewModel(Cell cell, FieldViewModel fieldViewModel)
 {
     _cell           = cell;
     _fieldViewModel = fieldViewModel;
 }
Esempio n. 7
0
 private void SetHelpersMethod(Fighter.TypeFighter typeFighter)
 {
     FieldViewModel.MarkCellsForAddNewFigure();
     FieldViewModel.HelperIsAddNewFigure.IsAddedCommand = true;
     FieldViewModel.HelperIsAddNewFigure.TypeFighter    = typeFighter;
 }