Inheritance: ViewModelBase
Exemple #1
0
        public PlayerViewModel()
        {
            Hero1Model = new HeroViewModel();
            Hero2Model = new HeroViewModel();

            IsSelectionMode = false;
            AutoInvokeSkillCommands = new ObservableCollection<SkillCommand>();
            ActiveSkillCommands = new ObservableCollection<SkillCommand>();
            RulerGivenSkillCommands = new ObservableCollection<SkillCommand>();

            PrivateDecks = new ObservableCollection<PrivateDeckViewModel>();

            MultiChoiceCommands = new ObservableCollection<ICommand>();

            submitCardUsageCommand = new SimpleRelayCommand(SubmitCardUsageCommand);
            cancelCardUsageCommand = new SimpleRelayCommand(CancelCardUsageCommand);
            abortCardUsageCommand = new SimpleRelayCommand(AbortCardUsageCommand);

            SubmitAnswerCommand = DisabledCommand;
            CancelAnswerCommand = DisabledCommand;
            AbortAnswerCommand = DisabledCommand;

            _possibleRoles = new ObservableCollection<Role>();
            _updateCardUsageStatusHandler = (o, e) => { _UpdateCardUsageStatus(); };
            _onSkillCommandSelectedHandler = _OnSkillCommandSelected;
            IsCardChoiceQuestionShown = false;

            Marks = new ObservableCollection<MarkViewModel>();
            StatusMarks = new ObservableCollection<MarkViewModel>();
            HandCards = new ObservableCollection<CardViewModel>();
            _lastSelectedPlayers = new List<Player>();
        }
        public PlayerViewModel()
        {
            Hero1Model = new HeroViewModel();
            Hero2Model = new HeroViewModel();

            IsSelectionMode = false;
            AutoInvokeSkillCommands = new ObservableCollection<SkillCommand>();
            ActiveSkillCommands = new ObservableCollection<SkillCommand>();
            RulerGivenSkillCommands = new ObservableCollection<SkillCommand>();

            PrivateDecks = new ObservableCollection<SpecialDeckViewModel>();

            MultiChoiceCommands = new ObservableCollection<ICommand>();

            submitCardUsageCommand = new SimpleRelayCommand(SubmitCardUsageCommand);
            cancelCardUsageCommand = new SimpleRelayCommand(CancelCardUsageCommand);
            abortCardUsageCommand = new SimpleRelayCommand(AbortCardUsageCommand);
            cancelSkillSelectionCommand = new SimpleRelayCommand(CancelSkillSelectionCommand) { CanExecuteStatus = true };

            SubmitAnswerCommand = DisabledCommand;
            CancelAnswerCommand = DisabledCommand;
            AbortAnswerCommand = DisabledCommand;

            _possibleRoles = new ObservableCollection<Role>();
            IsCardChoiceQuestionShown = false;

            Marks = new ObservableCollection<MarkViewModel>();
            StatusMarks = new ObservableCollection<MarkViewModel>();
            HandCards = new ObservableCollection<CardViewModel>();
            _lastSelectedPlayers = new List<Player>();
            _cardsInSwitchMode = new HashSet<CardViewModel>();
        }
Exemple #3
0
        public virtual void Update()
        {
            if (_card != null)
            {
                if (_uiCard != null && _uiCard.Id == _card.Id)
                {
                    return;
                }
                if (GameEngine.CardSet.Count > _card.Id && _card.Id >= 0)
                {
                    _uiCard = GameEngine.CardSet[_card.Id];
                }
                else
                {
                    _uiCard    = new Card();
                    _uiCard.Id = _card.Id;
                    if (_uiCard.Id == Card.UnknownCardId)
                    {
                        _uiCard.Type = new UnknownCardHandler();
                    }
                    else if (_uiCard.Id == Card.UnknownHeroId)
                    {
                        _uiCard.Type = new UnknownHeroCardHandler();
                    }
                    else if (_uiCard.Id == Card.UnknownRoleId)
                    {
                        _uiCard.Type = new UnknownRoleCardHandler();
                    }
                }

                var heroCard = _uiCard.Type as HeroCardHandler;
                if (heroCard != null)
                {
                    HeroModel = new HeroViewModel(heroCard.Hero);
                }
                else
                {
                    if (HeroModel != null)
                    {
                        HeroModel.Hero = null;
                    }
                    HeroModel = null;
                }

                if (_card.Log != null)
                {
                    Footnote = LogFormatter.TranslateCardFootnote(_card.Log);
                }
            }
            else
            {
                if (_uiCard == null)
                {
                    return;
                }
                _uiCard = null;
            }
            OnPropertyChanged("Id");
            OnPropertyChanged("IsKnownCard");
            OnPropertyChanged("Suit");
            OnPropertyChanged("SuitColor");
            OnPropertyChanged("ActualTypeString");
            OnPropertyChanged("RankString");
            OnPropertyChanged("ColoredRankString");
            OnPropertyChanged("TypeString");
            OnPropertyChanged("Category");
            OnPropertyChanged("AttackRange");
            OnPropertyChanged("HeroModel");
        }
Exemple #4
0
        public void Update()
        {
            if (_card != null)
            {
                if (_uiCard != null && _uiCard.Id == _card.Id) return;
                if (GameEngine.CardSet.Count > _card.Id && _card.Id >= 0)
                {
                    _uiCard = GameEngine.CardSet[_card.Id];
                }
                else
                {
                    _uiCard = new Card();
                    _uiCard.Id = _card.Id;
                    if (_uiCard.Id == Card.UnknownCardId)
                    {
                        _uiCard.Type = new UnknownCardHandler();
                    }
                    else if (_uiCard.Id == Card.UnknownHeroId)
                    {
                        _uiCard.Type = new UnknownHeroCardHandler();
                    }
                    else if (_uiCard.Id == Card.UnknownRoleId)
                    {
                        _uiCard.Type = new UnknownRoleCardHandler();
                    }
                }

                var heroCard = _uiCard.Type as HeroCardHandler;
                if (heroCard != null)
                {
                    HeroModel = new HeroViewModel(heroCard.Hero);
                }
                else
                {
                    if (HeroModel != null) HeroModel.Hero = null;
                    HeroModel = null;
                }

                if (_card.Log != null)
                {
                    Footnote = LogFormatter.TranslateCardFootnote(_card.Log);
                }
            }
            else
            {
                if (_uiCard == null) return;
                _uiCard = null;
            }
            OnPropertyChanged("Id");
            OnPropertyChanged("Suit");
            OnPropertyChanged("SuitColor");
            OnPropertyChanged("ActualTypeString");
            OnPropertyChanged("RankString");
            OnPropertyChanged("TypeString");
            OnPropertyChanged("Category");
            OnPropertyChanged("AttackRange");
            OnPropertyChanged("HeroModel");
        }