public PlayerViewModel(BuilderContext context) : base(context)
 {
     
     PlayerChanged += PlayerViewModel_PlayerChanged;
     Context.HistoryButtonChange += Player_HistoryButtonChange;
     Undo = new Command(() =>
     {
         Context.Undo();
         FirePlayerChanged();
         Save();
     }, () =>
     {
         return Context.CanUndo();
     });
     Redo = new Command(() =>
     {
         Context.Redo();
         FirePlayerChanged();
         Save();
     }, () =>
     {
         return Context.CanRedo();
     });
     playerInfo = new PlayerInfoViewModel(this);
     playerSkills = new PlayerSkillViewModel(this);
     playerResources = new PlayerResourcesViewModel(this);
     playerFeatures = new PlayerFeaturesViewModel(this);
     playerProficiencies = new PlayerProficiencyViewModel(this);
     playerActions = new PlayerActionsViewModel(this);
     playerConditions = new PlayerConditionViewModel(this);
     playerInventory = new PlayerInventoryViewModel(this);
     playerShops = new PlayerShopViewModel(this);
     playerInventoryChoices = new PlayerInventoryChoicesViewModel(this);
     playerJournal = new PlayerJournalViewModel(this);
     playerForms = new PlayerFormsCompanionsViewModel(this);
     playerNotes = new PlayerNotesViewModel(this);
     playerPDF = new PlayerPDFViewModel(this);
     build = new SwitchToBuildModel(this);
     UpdateSpellcasting();
     UpdateForms();
 }
예제 #2
0
        public ResourceViewModel(object value, PlayerResourcesViewModel model)
        {
            Value  = value;
            Reduce = new Command(() =>
            {
                if (IsChangeable && last != null && last.Equals(ResourceID))
                {
                    Used++;
                    model.MakeHistory("Resource" + ResourceID);
                    if (Max > 0 && Used > Max)
                    {
                        Used = Max;
                    }
                    model.Context.Player.SetUsedResources(ResourceID, Used);
                    model.UpdateUsed();

                    model.Save();
                }
                last = ResourceID;
            });
        }
예제 #3
0
        public PlayerViewModel(PlayerModel parent) : base(parent.Context)
        {
            Parent                 = parent;
            ChildModel             = true;
            PlayerChanged         += PlayerViewModel_PlayerChanged;
            Undo                   = parent.Undo;
            Redo                   = parent.Redo;
            playerInfo             = new PlayerInfoViewModel(this);
            playerSkills           = new PlayerSkillViewModel(this);
            playerResources        = new PlayerResourcesViewModel(this);
            playerFeatures         = new PlayerFeaturesViewModel(this);
            playerProficiencies    = new PlayerProficiencyViewModel(this);
            playerConditions       = new PlayerConditionViewModel(this);
            playerInventory        = new PlayerInventoryViewModel(this);
            playerShops            = new PlayerShopViewModel(this);
            playerInventoryChoices = new PlayerInventoryChoicesViewModel(this);
            playerJournal          = new PlayerJournalViewModel(this);
            playerNotes            = new PlayerNotesViewModel(this);
            playerPDF              = new PlayerPDFViewModel(this);

            UpdateSpellcasting();
        }