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