private void SelectItemButtonEvents(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "BtnBookID":
                new SubWindows.Global_InputInfoWithSearchWindow((string selectedItem) =>
                {
                    innerEnemyNode.SetXmlInfoByPath("BookId", selectedItem);
                    string BOOK_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.ENEMY_INFO, $"BOOK");

                    BtnBookID.ToolTip = $"{BOOK_WORD} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForKeyBook(selectedItem)}";

                    LblBookID.Content = $"{BOOK_WORD} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForKeyBook(selectedItem)}";
                    BtnBookID.Content = "          ";
                }, SubWindows.InputInfoWithSearchWindow_PRESET.CRITICAL_BOOKS).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                break;

            case "BtnDeckID":
                new SubWindows.Global_InputInfoWithSearchWindow((string selectedItem) =>
                {
                    innerEnemyNode.SetXmlInfoByPath("DeckId", selectedItem);
                    string DECK_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.ENEMY_INFO, $"DECK");

                    BtnDeckID.ToolTip = $"{DECK_WORD} : {DM.LocalizedGameDescriptions.GetDecriptionForDeck(selectedItem)}";

                    LblDeckID.Content = $"{DECK_WORD} : {DM.LocalizedGameDescriptions.GetDecriptionForDeck(selectedItem)}";
                    BtnDeckID.Content = "          ";
                }, SubWindows.InputInfoWithSearchWindow_PRESET.DECKS).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_DECKS);
                break;

            case "BtnRewardLevel_0":
            case "BtnRewardLevel_1":
            case "BtnRewardLevel_2":
            case "BtnRewardLevel_3":
                string        DROP_BOOK_LEVEL = btn.Name.Split('_').Last();
                List <string> dropTableItems  = new List <string>();
                innerEnemyNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "Level", DROP_BOOK_LEVEL, (DM.XmlDataNode dropTableNode) =>
                {
                    dropTableNode.ActionXmlDataNodesByPath("DropItem", (DM.XmlDataNode dropItemNode) =>
                    {
                        dropTableItems.Add(DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForDropBook(dropItemNode.innerText));
                    });
                });
                new SubWindows.Global_AddItemToListWindow((string addedDropBookItemID) =>
                {
                    if (!innerEnemyNode.CheckIfGivenPathWithXmlInfoExists("DropTable",
                                                                          attributeToCheck: new Dictionary <string, string>()
                    {
                        { "Level", DROP_BOOK_LEVEL }
                    }))
                    {
                        innerEnemyNode.AddXmlInfoByPath("DropTable",
                                                        attributePairsToSet: new Dictionary <string, string>()
                        {
                            { "Level", DROP_BOOK_LEVEL }
                        });
                    }

                    innerEnemyNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "Level", DROP_BOOK_LEVEL, (DM.XmlDataNode dropTableNode) =>
                    {
                        dropTableNode.AddXmlInfoByPath("DropItem", valueToSet: addedDropBookItemID,
                                                       attributePairsToSet: new Dictionary <string, string>()
                        {
                            { "Prob", "1" }
                        });
                    });

                    MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                    MainWindow.mainWindow.UpdateDebugInfo();
                }, (string deletedDropBookItemID) =>
                {
                    innerEnemyNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "Level", DROP_BOOK_LEVEL, (DM.XmlDataNode dropTableNode) =>
                    {
                        dropTableNode.RemoveXmlInfosByPath("DropItem", deletedDropBookItemID);
                    });

                    List <string> dropIDs = new List <string>();
                    innerEnemyNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "Level", DROP_BOOK_LEVEL, (DM.XmlDataNode dropTableNode) =>
                    {
                        dropTableNode.ActionXmlDataNodesByPath("DropItem", (DM.XmlDataNode dropItemNode) =>
                        {
                            dropIDs.Add(dropItemNode.innerText);
                        });
                    });
                    if (dropIDs.Count <= 0)
                    {
                        innerEnemyNode.RemoveXmlInfosByPath("DropTable",
                                                            attributeToCheck: new Dictionary <string, string>()
                        {
                            { "Level", DROP_BOOK_LEVEL }
                        });
                    }

                    MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                    MainWindow.mainWindow.UpdateDebugInfo();
                }, dropTableItems, SubWindows.AddItemToListWindow_PRESET.DROP_BOOK).ShowDialog();
                InitRewards();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Button events that need search window
        /// </summary>
        private void SelectItemButtonEvents(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "BtnStage":
                new SubWindows.Global_InputInfoWithSearchWindow((string selectedItem) =>
                {
                    DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage",
                                                                                                        attributeToCheck: new Dictionary <string, string>()
                    {
                        { "id", selectedItem }
                    }).ActionOneItemSafe((DM.XmlDataNode stageNode) =>
                    {
                        innerStageNode.SetXmlInfoByPath("Chapter", stageNode.GetInnerTextByPath("Chapter"));
                        innerStageNode.SetXmlInfoByPath("StoryType", stageNode.GetInnerTextByPath("StoryType"));

                        innerStageNode.RemoveXmlInfosByPath("Story");
                        DM.XmlDataNode copyedStageNode = stageNode.Copy();
                        innerStageNode.subNodes.AddRange(copyedStageNode.GetXmlDataNodesByPath("Story"));

                        string EPISODE_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"EPISODE");
                        BtnStage.ToolTip    = $"{EPISODE_WORD} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForStage(selectedItem)}";

                        LblStage.Content = $"{EPISODE_WORD} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForStage(selectedItem)}";;
                        BtnStage.Content = "          ";
                    });
                    MainWindow.mainWindow.UpdateDebugInfo();
                    MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                }, SubWindows.InputInfoWithSearchWindow_PRESET.EPISODE).ShowDialog();
                break;

            case "BtnStageCustom":
                new SubWindows.Global_MultipleValueInputed(new Dictionary <string, string>()
                {
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Chapter"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Chapter_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"StoryType"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"StoryType_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Story_Start_Conditon"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Story_Start_Conditon_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Story_End_Conditon"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"Story_End_Conditon_TooTip") }
                }, new List <string>()
                {
                    innerStageNode.GetInnerTextByPath("Chapter"),
                    innerStageNode.GetInnerTextByPath("StoryType"),
                    innerStageNode.GetInnerTextByAttributeWithPath("Story", "Condition", "Start"),
                    innerStageNode.GetInnerTextByAttributeWithPath("Story", "Condition", "End")
                }, new List <Action <string> >()
                {
                    (string inputedVar) => {
                        innerStageNode.SetXmlInfoByPathAndEmptyWillRemove("Chapter", inputedVar);
                    },
                    (string inputedVar) => {
                        innerStageNode.SetXmlInfoByPathAndEmptyWillRemove("StoryType", inputedVar);
                    },
                    (string inputedVar) => {
                        innerStageNode.ActionXmlDataNodesByAttributeWithPath("Story", "Condition", "Start", (DM.XmlDataNode storyNode) => {
                            storyNode.innerText = inputedVar;
                        });
                        MainWindow.mainWindow.UpdateDebugInfo();
                        MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                    },
                    (string inputedVar) => {
                        innerStageNode.ActionXmlDataNodesByAttributeWithPath("Story", "Condition", "End", (DM.XmlDataNode storyNode) => {
                            storyNode.innerText = inputedVar;
                        });
                        MainWindow.mainWindow.UpdateDebugInfo();
                        MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                    }
                }).ShowDialog();

                MainWindow.mainWindow.UpdateDebugInfo();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);


                string STORY_TYPE      = innerStageNode.GetInnerTextByPath("StoryType");
                string EPISODE_WORD_EX = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"EPISODE");
                BtnStage.ToolTip = $"{EPISODE_WORD_EX} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForStage(STORY_TYPE)}";

                LblStage.Content = $"{EPISODE_WORD_EX} : {DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForStage(STORY_TYPE)}";;
                BtnStage.Content = "          ";

                break;

            case "BtnFloor":
                new SubWindows.Global_ListSeleteWindow((string floorNumStr) => {
                    innerStageNode.SetXmlInfoByPath("FloorNum", floorNumStr);
                    string FLOOR_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"AVALIABLE_FLOOR");
                    BtnFloor.ToolTip  = $"{FLOOR_WORD} : {floorNumStr}";

                    LblFloor.Content = $"{FLOOR_WORD} : {floorNumStr}";
                    BtnFloor.Content = "          ";

                    MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                }, SubWindows.Global_ListSeleteWindow_PRESET.FLOORS).ShowDialog();
                break;

            case "BtnInvitation":
                List <string> selectedDropBooks = new List <string>();
                innerStageNode.ActionXmlDataNodesByPath("Invitation/Book", (DM.XmlDataNode xmlDataNode) =>
                {
                    selectedDropBooks.Add(DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForDropBook(xmlDataNode.innerText));
                });

                new SubWindows.Global_AddItemToListWindow((string addedDropBookItemID) =>
                {
                    innerStageNode.ActionXmlDataNodesByPath("Invitation", (DM.XmlDataNode invitationNode) =>
                    {
                        invitationNode.AddXmlInfoByPath("Book", addedDropBookItemID);
                    });
                }, (string deletedDropBookItemID) => {
                    innerStageNode.ActionXmlDataNodesByPath("Invitation", (DM.XmlDataNode invitationNode) =>
                    {
                        invitationNode.RemoveXmlInfosByPath("Book", deletedDropBookItemID);
                    });
                }, selectedDropBooks, SubWindows.AddItemToListWindow_PRESET.DROP_BOOK).ShowDialog();

                if (innerStageNode.GetXmlDataNodesByPath("Invitation/Book").Count > 0)
                {
                    string extraInfo = "";
                    innerStageNode.ActionXmlDataNodesByPath("Invitation/Book", (DM.XmlDataNode xmlDataNode) =>
                    {
                        extraInfo += $"{DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForDropBook(xmlDataNode.GetInnerTextSafe())}/";
                    });
                    extraInfo = extraInfo.TrimEnd('/');

                    string INVITATION_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"INVITATION_BOOK");
                    LblInvitation.Content = $"{INVITATION_WORD} : {extraInfo}";
                    BtnInvitation.ToolTip = $"{INVITATION_WORD} : {extraInfo}";
                    BtnInvitation.Content = "          ";
                }
                else
                {
                    LblInvitation.Content = "";
                    BtnInvitation.ToolTip = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"%BtnInvitation_ToolTip%").Split('$')[0];
                    BtnInvitation.Content = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"%BtnInvitation%").Split('$')[0];
                }
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                break;

            case "BtnAddWave":
                innerStageNode.subNodes.Add(DM.EditGameData_StageInfo.MakeNewWaveInfoBase());
                InitSqlWaves();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                break;
            }
        }