public DialogueTabViewModel()
        {
            MainWindow.Instance.dialogueTabSelect.SelectionChanged += DialogueTabSelect_SelectionChanged;
            MainWindow.Instance.dialogueTabButtonAdd.Click         += DialogueTabButtonAdd_Click;
            NPCDialogue empty = new NPCDialogue();

            Dialogue = empty;
            UpdateTabs();

            ContextMenu cmenu = new ContextMenu();

            cmenu.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCResponse), (result) =>
            {
                if (result is NPCResponse npcr)
                {
                    AddResponse(new Dialogue_Response(npcr));
                }
            }));

            MainWindow.Instance.dialogueAddReplyButton.ContextMenu = cmenu;

            ContextMenu cmenu2 = new ContextMenu();

            cmenu2.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCMessage), (result) =>
            {
                if (result is NPCMessage npcm)
                {
                    AddMessage(new Dialogue_Message(npcm));
                }
            }));

            MainWindow.Instance.dialogueAddMessageButton.ContextMenu = cmenu2;

            ContextMenu cmenu3 = new ContextMenu();

            cmenu3.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCDialogue), (result) =>
            {
                if (result is NPCDialogue npcd)
                {
                    MainWindow.CurrentProject.data.dialogues.Add(npcd);
                    MetroTabItem tabItem = CreateTab(npcd);
                    MainWindow.Instance.dialogueTabSelect.Items.Add(tabItem);
                    MainWindow.Instance.dialogueTabSelect.SelectedIndex = MainWindow.Instance.dialogueTabSelect.Items.Count - 1;
                }
            }));

            MainWindow.Instance.dialogueTabButtonAdd.ContextMenu = cmenu3;

            var dialogueInputIdControlContext = new ContextMenu();

            dialogueInputIdControlContext.Items.Add(ContextHelper.CreateFindUnusedIDButton((id) =>
            {
                this.ID = id;
                MainWindow.Instance.dialogueInputIdControl.Value = id;
            }, GameIntegration.EGameAssetCategory.NPC));

            MainWindow.Instance.dialogueInputIdControl.ContextMenu = dialogueInputIdControlContext;
        }
예제 #2
0
        public CharacterTabViewModel()
        {
            MainWindow.Instance.characterTabSelect.SelectionChanged += CharacterTabSelect_SelectionChanged;
            MainWindow.Instance.characterTabButtonAdd.Click         += CharacterTabButtonAdd_Click;
            NPCCharacter empty = new NPCCharacter();

            Character = empty;
            UpdateColorPicker();
            UpdateTabs();

            ContextMenu cmenu3 = new ContextMenu();

            cmenu3.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCCharacter), (result) =>
            {
                if (result is NPCCharacter npcc)
                {
                    MainWindow.CurrentProject.data.characters.Add(npcc);
                    MetroTabItem tabItem = CreateTab(npcc);
                    MainWindow.Instance.characterTabSelect.Items.Add(tabItem);
                    MainWindow.Instance.characterTabSelect.SelectedIndex = MainWindow.Instance.characterTabSelect.Items.Count - 1;
                }
            }));

            MainWindow.Instance.characterTabButtonAdd.ContextMenu = cmenu3;

            MainWindow.Instance.txtDisplayName.ContextMenu = ContextHelper.CreateContextMenu(ContextHelper.EContextOption.Group_Rich | ContextHelper.EContextOption.Group_TextEdit);

            #region Clothing Init
            #region Default
            ContextMenu cidDefault_hat = new ContextMenu();
            cidDefault_hat.Items.Add(ContextHelper.CreateSelectHatButton((asset) =>
            {
                this.DefaultClothing.Hat = asset.id;
                MainWindow.Instance.controlClothingDefaultHat.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultHat.ContextMenu   = cidDefault_hat;
            MainWindow.Instance.controlClothingDefaultHat.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_glasses = new ContextMenu();
            cidDefault_glasses.Items.Add(ContextHelper.CreateSelectGlassesButton((asset) =>
            {
                this.DefaultClothing.Glasses = asset.id;
                MainWindow.Instance.controlClothingDefaultGlasses.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultGlasses.ContextMenu   = cidDefault_glasses;
            MainWindow.Instance.controlClothingDefaultGlasses.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_backpack = new ContextMenu();
            cidDefault_backpack.Items.Add(ContextHelper.CreateSelectBackpackButton((asset) =>
            {
                this.DefaultClothing.Backpack = asset.id;
                MainWindow.Instance.controlClothingDefaultBackpack.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultBackpack.ContextMenu   = cidDefault_backpack;
            MainWindow.Instance.controlClothingDefaultBackpack.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_shirt = new ContextMenu();
            cidDefault_shirt.Items.Add(ContextHelper.CreateSelectShirtButton((asset) =>
            {
                this.DefaultClothing.Shirt = asset.id;
                MainWindow.Instance.controlClothingDefaultShirt.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultShirt.ContextMenu   = cidDefault_shirt;
            MainWindow.Instance.controlClothingDefaultShirt.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_pants = new ContextMenu();
            cidDefault_pants.Items.Add(ContextHelper.CreateSelectPantsButton((asset) =>
            {
                this.DefaultClothing.Pants = asset.id;
                MainWindow.Instance.controlClothingDefaultPants.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultPants.ContextMenu   = cidDefault_pants;
            MainWindow.Instance.controlClothingDefaultPants.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_mask = new ContextMenu();
            cidDefault_mask.Items.Add(ContextHelper.CreateSelectMaskButton((asset) =>
            {
                this.DefaultClothing.Mask = asset.id;
                MainWindow.Instance.controlClothingDefaultMask.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultMask.ContextMenu   = cidDefault_mask;
            MainWindow.Instance.controlClothingDefaultMask.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidDefault_vest = new ContextMenu();
            cidDefault_vest.Items.Add(ContextHelper.CreateSelectVestButton((asset) =>
            {
                this.DefaultClothing.Vest = asset.id;
                MainWindow.Instance.controlClothingDefaultVest.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingDefaultVest.ContextMenu   = cidDefault_vest;
            MainWindow.Instance.controlClothingDefaultVest.ValueChanged += (sender, e) => UpdateClothing();
            #endregion
            #region Halloween
            ContextMenu cidHalloween_hat = new ContextMenu();
            cidHalloween_hat.Items.Add(ContextHelper.CreateSelectHatButton((asset) =>
            {
                this.HalloweenClothing.Hat = asset.id;
                MainWindow.Instance.controlClothingHalloweenHat.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenHat.ContextMenu   = cidHalloween_hat;
            MainWindow.Instance.controlClothingHalloweenHat.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_glasses = new ContextMenu();
            cidHalloween_glasses.Items.Add(ContextHelper.CreateSelectGlassesButton((asset) =>
            {
                this.HalloweenClothing.Glasses = asset.id;
                MainWindow.Instance.controlClothingHalloweenGlasses.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenGlasses.ContextMenu   = cidHalloween_glasses;
            MainWindow.Instance.controlClothingHalloweenGlasses.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_backpack = new ContextMenu();
            cidHalloween_backpack.Items.Add(ContextHelper.CreateSelectBackpackButton((asset) =>
            {
                this.HalloweenClothing.Backpack = asset.id;
                MainWindow.Instance.controlClothingHalloweenBackpack.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenBackpack.ContextMenu   = cidHalloween_backpack;
            MainWindow.Instance.controlClothingHalloweenBackpack.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_shirt = new ContextMenu();
            cidHalloween_shirt.Items.Add(ContextHelper.CreateSelectShirtButton((asset) =>
            {
                this.HalloweenClothing.Shirt = asset.id;
                MainWindow.Instance.controlClothingHalloweenShirt.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenShirt.ContextMenu   = cidHalloween_shirt;
            MainWindow.Instance.controlClothingHalloweenShirt.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_pants = new ContextMenu();
            cidHalloween_pants.Items.Add(ContextHelper.CreateSelectPantsButton((asset) =>
            {
                this.HalloweenClothing.Pants = asset.id;
                MainWindow.Instance.controlClothingHalloweenPants.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenPants.ContextMenu   = cidHalloween_pants;
            MainWindow.Instance.controlClothingHalloweenPants.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_mask = new ContextMenu();
            cidHalloween_mask.Items.Add(ContextHelper.CreateSelectMaskButton((asset) =>
            {
                this.HalloweenClothing.Mask = asset.id;
                MainWindow.Instance.controlClothingHalloweenMask.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenMask.ContextMenu   = cidHalloween_mask;
            MainWindow.Instance.controlClothingHalloweenMask.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidHalloween_vest = new ContextMenu();
            cidHalloween_vest.Items.Add(ContextHelper.CreateSelectVestButton((asset) =>
            {
                this.HalloweenClothing.Vest = asset.id;
                MainWindow.Instance.controlClothingHalloweenVest.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingHalloweenVest.ContextMenu   = cidHalloween_vest;
            MainWindow.Instance.controlClothingHalloweenVest.ValueChanged += (sender, e) => UpdateClothing();
            #endregion
            #region Christmas
            ContextMenu cidChristmas_hat = new ContextMenu();
            cidChristmas_hat.Items.Add(ContextHelper.CreateSelectHatButton((asset) =>
            {
                this.ChristmasClothing.Hat = asset.id;
                MainWindow.Instance.controlClothingChristmasHat.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasHat.ContextMenu   = cidChristmas_hat;
            MainWindow.Instance.controlClothingChristmasHat.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_glasses = new ContextMenu();
            cidChristmas_glasses.Items.Add(ContextHelper.CreateSelectGlassesButton((asset) =>
            {
                this.ChristmasClothing.Glasses = asset.id;
                MainWindow.Instance.controlClothingChristmasGlasses.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasGlasses.ContextMenu   = cidChristmas_glasses;
            MainWindow.Instance.controlClothingChristmasGlasses.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_backpack = new ContextMenu();
            cidChristmas_backpack.Items.Add(ContextHelper.CreateSelectBackpackButton((asset) =>
            {
                this.ChristmasClothing.Backpack = asset.id;
                MainWindow.Instance.controlClothingChristmasBackpack.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasBackpack.ContextMenu   = cidChristmas_backpack;
            MainWindow.Instance.controlClothingChristmasBackpack.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_shirt = new ContextMenu();
            cidChristmas_shirt.Items.Add(ContextHelper.CreateSelectShirtButton((asset) =>
            {
                this.ChristmasClothing.Shirt = asset.id;
                MainWindow.Instance.controlClothingChristmasShirt.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasShirt.ContextMenu   = cidChristmas_shirt;
            MainWindow.Instance.controlClothingChristmasShirt.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_pants = new ContextMenu();
            cidChristmas_pants.Items.Add(ContextHelper.CreateSelectPantsButton((asset) =>
            {
                this.ChristmasClothing.Pants = asset.id;
                MainWindow.Instance.controlClothingChristmasPants.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasPants.ContextMenu   = cidChristmas_pants;
            MainWindow.Instance.controlClothingChristmasPants.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_mask = new ContextMenu();
            cidChristmas_mask.Items.Add(ContextHelper.CreateSelectMaskButton((asset) =>
            {
                this.ChristmasClothing.Mask = asset.id;
                MainWindow.Instance.controlClothingChristmasMask.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasMask.ContextMenu   = cidChristmas_mask;
            MainWindow.Instance.controlClothingChristmasMask.ValueChanged += (sender, e) => UpdateClothing();

            ContextMenu cidChristmas_vest = new ContextMenu();
            cidChristmas_vest.Items.Add(ContextHelper.CreateSelectVestButton((asset) =>
            {
                this.ChristmasClothing.Vest = asset.id;
                MainWindow.Instance.controlClothingChristmasVest.Value = asset.id;
            }));
            MainWindow.Instance.controlClothingChristmasVest.ContextMenu   = cidChristmas_vest;
            MainWindow.Instance.controlClothingChristmasVest.ValueChanged += (sender, e) => UpdateClothing();
            #endregion
            #endregion
            MainWindow.Instance.clothingTabControl.SelectionChanged += (sender, e) => UpdateClothing();
            #region Equipment Init
            ContextMenu cid_primary = new ContextMenu();
            cid_primary.Items.Add(ContextHelper.CreateSelectItemButton((asset) =>
            {
                EquipmentPrimary = asset.id;
                MainWindow.Instance.primaryIdBox.Value = asset.id;
            }, new AssetFilter_Equippable("Interface", "AssetPicker_Filter_Equippable", Equip_Type.Primary)));
            MainWindow.Instance.primaryIdBox.ContextMenu   = cid_primary;
            MainWindow.Instance.primaryIdBox.ValueChanged += (sender, e) => UpdateEquipment();

            ContextMenu cid_secondary = new ContextMenu();
            cid_secondary.Items.Add(ContextHelper.CreateSelectItemButton((asset) =>
            {
                EquipmentSecondary = asset.id;
                MainWindow.Instance.secondaryIdBox.Value = asset.id;
            }, new AssetFilter_Equippable("Interface", "AssetPicker_Filter_Equippable", Equip_Type.Secondary)));
            MainWindow.Instance.secondaryIdBox.ContextMenu   = cid_secondary;
            MainWindow.Instance.secondaryIdBox.ValueChanged += (sender, e) => UpdateEquipment();

            ContextMenu cid_tertiary = new ContextMenu();
            cid_tertiary.Items.Add(ContextHelper.CreateSelectItemButton((asset) =>
            {
                EquipmentTertiary = asset.id;
                MainWindow.Instance.tertiaryIdBox.Value = asset.id;
            }, new AssetFilter_Equippable("Interface", "AssetPicker_Filter_Equippable", Equip_Type.Tertiary)));
            MainWindow.Instance.tertiaryIdBox.ContextMenu   = cid_tertiary;
            MainWindow.Instance.tertiaryIdBox.ValueChanged += (sender, e) => UpdateEquipment();
            #endregion

            var txtIDContext = new ContextMenu();

            txtIDContext.Items.Add(ContextHelper.CreateFindUnusedIDButton((id) =>
            {
                this.ID = id;
                MainWindow.Instance.txtID.Value = id;
            }, GameIntegration.EGameAssetCategory.OBJECT));

            MainWindow.Instance.txtID.ContextMenu = txtIDContext;

            var dialogueIDContext = new ContextMenu();

            dialogueIDContext.Items.Add(ContextHelper.CreateSelectAssetButton(typeof(GameDialogueAsset), (asset) =>
            {
                this.DialogueID = asset.id;
                MainWindow.Instance.txtStartDialogueID.Value = asset.id;
            }, "Control_SelectAsset_Dialogue", MahApps.Metro.IconPacks.PackIconMaterialKind.Chat));

            MainWindow.Instance.txtStartDialogueID.ContextMenu = dialogueIDContext;
        }
        public QuestTabViewModel()
        {
            MainWindow.Instance.questTabSelect.SelectionChanged += QuestTabSelect_SelectionChanged;
            MainWindow.Instance.questTabButtonAdd.Click         += QuestTabButtonAdd_Click;
            NPCQuest empty = new NPCQuest();

            Quest = empty;
            UpdateTabs();

            ContextMenu cmenu = new ContextMenu();

            cmenu.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(Condition), (result) =>
            {
                if (result is Condition item)
                {
                    AddCondition(new Universal_ItemList(item, true));
                }
            }));

            MainWindow.Instance.questAddConditionButton.ContextMenu = cmenu;

            ContextMenu cmenu2 = new ContextMenu();

            cmenu2.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(Reward), (result) =>
            {
                if (result is Reward item)
                {
                    AddReward(new Universal_ItemList(item, true));
                }
            }));

            MainWindow.Instance.questAddRewardButton.ContextMenu = cmenu2;

            ContextMenu cmenu3 = new ContextMenu();

            cmenu3.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCQuest), (result) =>
            {
                if (result is NPCQuest item)
                {
                    MainWindow.CurrentProject.data.quests.Add(item);
                    MetroTabItem tabItem = CreateTab(item);
                    MainWindow.Instance.questTabSelect.Items.Add(tabItem);
                    MainWindow.Instance.questTabSelect.SelectedIndex = MainWindow.Instance.questTabSelect.Items.Count - 1;
                }
            }));

            MainWindow.Instance.questTabButtonAdd.ContextMenu = cmenu3;

            MainWindow.Instance.questTitleBox.ContextMenu = ContextHelper.CreateContextMenu(ContextHelper.EContextOption.Group_Rich | ContextHelper.EContextOption.Group_TextEdit);
            MainWindow.Instance.questDescBox.ContextMenu  = ContextHelper.CreateContextMenu(ContextHelper.EContextOption.Group_Rich | ContextHelper.EContextOption.Group_TextEdit);

            var questIdBoxContext = new ContextMenu();

            questIdBoxContext.Items.Add(ContextHelper.CreateFindUnusedIDButton((id) =>
            {
                this.ID = id;
                MainWindow.Instance.questIdBox.Value = id;
            }, GameIntegration.EGameAssetCategory.NPC));

            MainWindow.Instance.questIdBox.ContextMenu = questIdBoxContext;
        }
예제 #4
0
        public VendorTabViewModel()
        {
            MainWindow.Instance.vendorTabSelect.SelectionChanged += VendorTabSelect_SelectionChanged;
            MainWindow.Instance.vendorTabButtonAdd.Click         += VendorTabButtonAdd_Click;
            NPCVendor empty = new NPCVendor();

            Vendor = empty;
            UpdateTabs();

            ContextMenu cmenu2 = new ContextMenu();

            cmenu2.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(VendorItem), (result) =>
            {
                if (result is VendorItem item)
                {
                    if (item.isBuy)
                    {
                        AddItemBuy(item);
                    }
                    else
                    {
                        AddItemSell(item);
                    }
                }
            }));

            MainWindow.Instance.vendorAddItemButton.ContextMenu = cmenu2;

            ContextMenu cmenu3 = new ContextMenu();

            cmenu3.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCVendor), (result) =>
            {
                if (result is NPCVendor item)
                {
                    MainWindow.CurrentProject.data.vendors.Add(item);
                    MetroTabItem tabItem = CreateTab(item);
                    MainWindow.Instance.vendorTabSelect.Items.Add(tabItem);
                    MainWindow.Instance.vendorTabSelect.SelectedIndex = MainWindow.Instance.vendorTabSelect.Items.Count - 1;
                }
            }));

            MainWindow.Instance.vendorTitleTxtBox.ContextMenu = ContextHelper.CreateContextMenu(ContextHelper.EContextOption.Group_Rich | ContextHelper.EContextOption.Group_TextEdit);
            MainWindow.Instance.vendorDescTxtBox.ContextMenu  = ContextHelper.CreateContextMenu(ContextHelper.EContextOption.Group_Rich | ContextHelper.EContextOption.Group_TextEdit);

            ContextMenu cmenu4 = new ContextMenu();

            cmenu4.Items.Add(ContextHelper.CreateSelectAssetButton(typeof(GameCurrencyAsset), (asset) =>
            {
                Currency = asset.guid.ToString("N");
                MainWindow.Instance.vendorCurrencyBox.Text = asset.guid.ToString("N");
            }, "Control_SelectAsset_Currency", MahApps.Metro.IconPacks.PackIconMaterialKind.CurrencyUsd));
            cmenu4.Items.Add(ContextHelper.CreateGenericButton(new AdvancedCommand(() =>
            {
                Currency = string.Empty;
                MainWindow.Instance.vendorCurrencyBox.Text = string.Empty;
            }, (obj) =>
            {
                return(!string.IsNullOrEmpty(Currency));
            }), "Control_Vendor_SwitchToExperience", MahApps.Metro.IconPacks.PackIconMaterialKind.Star));

            MainWindow.Instance.vendorCurrencyBox.ContextMenu = cmenu4;

            var vendorIdTxtBoxContext = new ContextMenu();

            vendorIdTxtBoxContext.Items.Add(ContextHelper.CreateFindUnusedIDButton((id) =>
            {
                this.ID = id;
                MainWindow.Instance.vendorIdTxtBox.Value = id;
            }, GameIntegration.EGameAssetCategory.NPC));

            MainWindow.Instance.vendorIdTxtBox.ContextMenu = vendorIdTxtBoxContext;
        }