Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Right menu button events
        /// </summary>
        private void RightMenuButtonEvents(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "BtnExtraInfo":
                string AffectionPrev = "";
                innerCardNode.ActionXmlDataNodesByPath("Spec", (DM.XmlDataNode specNode) =>
                {
                    AffectionPrev = specNode.GetAttributesSafe("Affection");
                });

                new SubWindows.Global_MultipleValueInputed(new Dictionary <string, string>()
                {
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"Chapter"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"%BtnDropCards_ToolTip%") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityEnemy"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityEnemy_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityUser"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityUser_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityScript"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"PriorityScript_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"EmotionLimit"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"EmotionLimit_ToolTip") },
                    { DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"WideAreaCode"), DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"WideAreaCode_ToolTip") }
                }, new List <string>()
                {
                    innerCardNode.GetInnerTextByPath("Chapter"),
                    innerCardNode.GetInnerTextByPath("Priority"),
                    innerCardNode.GetInnerTextByPath("SortPriority"),
                    innerCardNode.GetInnerTextByPath("PriorityScript"),
                    innerCardNode.GetInnerTextByPath("EmotionLimit"),
                    AffectionPrev
                }, new List <Action <string> >()
                {
                    (string inputedVar) => {
                        innerCardNode.SetXmlInfoByPathAndEmptyWillRemove("Chapter", inputedVar);
                    },
                    (string inputedVar) => {
                        innerCardNode.SetXmlInfoByPathAndEmptyWillRemove("Priority", inputedVar);
                    },
                    (string inputedVar) => {
                        innerCardNode.SetXmlInfoByPathAndEmptyWillRemove("SortPriority", inputedVar);
                    },
                    (string inputedVar) => {
                        innerCardNode.SetXmlInfoByPathAndEmptyWillRemove("PriorityScript", inputedVar);
                    },
                    (string inputedVar) => {
                        innerCardNode.SetXmlInfoByPathAndEmptyWillRemove("EmotionLimit", inputedVar);
                    },
                    (string inputedVar) => {
                        innerCardNode.ActionXmlDataNodesByPath("Spec", (DM.XmlDataNode specNode) =>
                        {
                            specNode.attribute["Affection"] = inputedVar;
                            MainWindow.mainWindow.UpdateDebugInfo();
                        });
                    }
                }).ShowDialog();
                UpdateExtrainfoIcon();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_CARD);
                break;

            case "BtnDropCards":
                List <string> selectedCardDropTables = new List <string>();
                DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.GetXmlDataNodesByPath("DropTable").ForEachSafe((DM.XmlDataNode cardDropTableID) =>
                {
                    if (cardDropTableID.CheckIfGivenPathWithXmlInfoExists("Card", innerCardNode.GetAttributesSafe("ID")))
                    {
                        selectedCardDropTables.Add(DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForDropBook(cardDropTableID.attribute["ID"]));
                    }
                });

                new SubWindows.Global_AddItemToListWindow((string addedDropTableItemID) =>
                {
                    if (DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.CheckIfGivenPathWithXmlInfoExists("DropTable",
                                                                                                                     attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", addedDropTableItemID }
                    }))
                    {
                        List <DM.XmlDataNode> foundCardDropTableNode = (DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable",
                                                                                                                                                                    attributeToCheck: new Dictionary <string, string>()
                        {
                            { "ID", addedDropTableItemID }
                        }));
                        if (foundCardDropTableNode.Count > 0 &&
                            !foundCardDropTableNode[0].CheckIfGivenPathWithXmlInfoExists("Card", innerCardNode.GetAttributesSafe("ID")))
                        {
                            foundCardDropTableNode[0].AddXmlInfoByPath("Card", innerCardNode.GetAttributesSafe("ID"));
                        }
                    }
                    else
                    {
                        DM.XmlDataNode madeDropTableNode = DM.EditGameData_CardInfos.MakeNewStaticCardDropTableBase(addedDropTableItemID);
                        if (!madeDropTableNode.CheckIfGivenPathWithXmlInfoExists("Card", innerCardNode.GetAttributesSafe("ID")))
                        {
                            madeDropTableNode.AddXmlInfoByPath("Card", innerCardNode.GetAttributesSafe("ID"));
                            DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.subNodes.Add(madeDropTableNode);
                        }
                    }
                    MainWindow.mainWindow.UpdateDebugInfo();
                }, (string deletedDropTableItemID) => {
                    if (DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.CheckIfGivenPathWithXmlInfoExists("DropTable",
                                                                                                                     attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", deletedDropTableItemID }
                    }))
                    {
                        List <DM.XmlDataNode> foundCardDropTableNode = (DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable",
                                                                                                                                                                    attributeToCheck: new Dictionary <string, string>()
                        {
                            { "ID", deletedDropTableItemID }
                        }));
                        if (foundCardDropTableNode.Count > 0)
                        {
                            DM.XmlDataNode FOUND_CARD_DROP_TABLE_NODE = foundCardDropTableNode[0];

                            List <DM.XmlDataNode> baseCardDropTableNode = DM.GameInfos.staticInfos["CardDropTable"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable",
                                                                                                                                                                  attributeToCheck: new Dictionary <string, string>()
                            {
                                { "ID", deletedDropTableItemID }
                            });
                            if (baseCardDropTableNode.Count > 0)
                            {
                                DM.XmlDataNode FOUND_CARD_DROP_TABLE_IN_GAME = baseCardDropTableNode[0];

                                List <string> foundCardDropTablesInGameItems = new List <string>();
                                FOUND_CARD_DROP_TABLE_IN_GAME.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                                {
                                    foundCardDropTablesInGameItems.Add(cardNode.innerText);
                                });


                                if (DM.EditGameData_CardInfos.StaticCard.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card",
                                                                                                                       attributeToCheck: new Dictionary <string, string>()
                                {
                                    { "ID", innerCardNode.GetAttributesSafe("ID") }
                                }).Count == 1 &&
                                    !foundCardDropTablesInGameItems.Contains(innerCardNode.GetAttributesSafe("ID")))
                                {
                                    FOUND_CARD_DROP_TABLE_NODE.RemoveXmlInfosByPath("Card", innerCardNode.GetAttributesSafe("ID"));
                                }


                                List <string> foundCardDropTables = new List <string>();
                                FOUND_CARD_DROP_TABLE_NODE.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                                {
                                    foundCardDropTables.Add(cardNode.innerText);
                                });


                                if (foundCardDropTables.Count == foundCardDropTablesInGameItems.Count &&
                                    foundCardDropTables.Except(foundCardDropTablesInGameItems).Count() == 0 &&
                                    DM.EditGameData_CardInfos.StaticCard.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card",
                                                                                                                       attributeToCheck: new Dictionary <string, string>()
                                {
                                    { "ID", innerCardNode.GetAttributesSafe("ID") }
                                }).Count == 1)
                                {
                                    bool isContainAnyExistCard = false;
                                    DM.EditGameData_CardInfos.StaticCard.rootDataNode.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                                    {
                                        if (foundCardDropTables.Contains(cardNode.GetAttributesSafe("ID")) &&
                                            cardNode.GetAttributesSafe("ID") != innerCardNode.GetAttributesSafe("ID"))
                                        {
                                            isContainAnyExistCard = true;
                                        }
                                    });
                                    if (!isContainAnyExistCard)
                                    {
                                        DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.RemoveXmlInfosByPath("DropTable",
                                                                                                                        attributeToCheck: new Dictionary <string, string>()
                                        {
                                            { "ID", deletedDropTableItemID }
                                        }, deleteOnce: true);
                                    }
                                }
                            }
                        }
                        MainWindow.mainWindow.UpdateDebugInfo();
                    }
                }, selectedCardDropTables, SubWindows.AddItemToListWindow_PRESET.DROP_TABLE).ShowDialog();

                List <string> selectedCardDropTablesToCheck = new List <string>();
                DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.GetXmlDataNodesByPath("DropTable").ForEachSafe((DM.XmlDataNode cardDropTableID) =>
                {
                    if (cardDropTableID.CheckIfGivenPathWithXmlInfoExists("Card", innerCardNode.attribute["ID"]))
                    {
                        selectedCardDropTablesToCheck.Add(cardDropTableID.attribute["ID"]);
                    }
                });

                if (selectedCardDropTablesToCheck.Count > 0)
                {
                    string extraInfo = "";
                    selectedCardDropTablesToCheck.ForEach((string dropBookInfo) =>
                    {
                        extraInfo += $"{DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForDropBook(dropBookInfo)}\n";
                    });
                    extraInfo = extraInfo.TrimEnd('\n');

                    BtnDropCards.Background = Tools.ColorTools.GetImageBrushFromPath(this, "../Resources/iconYesDropBook.png");
                    BtnDropCards.ToolTip    = $"{DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"%BtnDropCards_ToolTip%")} ({DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.BOOK_INFO, $"Inputted")})\n{extraInfo}";
                }
                else
                {
                    BtnDropCards.Background = Tools.ColorTools.GetImageBrushFromPath(this, "../Resources/iconNoDropBook.png");
                    BtnDropCards.ToolTip    = $"{DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"%BtnDropCards_ToolTip%")} ({DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.BOOK_INFO, $"NotInputted")})";
                }
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_CARD_DROP_TABLE);
                break;

            case "BtnCopyCard":
                DM.EditGameData_CardInfos.StaticCard.rootDataNode.subNodes.Add(innerCardNode.Copy());
                initStack();
                MainWindow.mainWindow.UpdateDebugInfo();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_CARD);
                break;

            case "BtnDelete":
                if (DM.EditGameData_CardInfos.LocalizedBattleCards.rootDataNode.CheckIfGivenPathWithXmlInfoExists("cardDescList/BattleCardDesc",
                                                                                                                  attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", innerCardNode.GetAttributesSafe("ID") }
                }))
                {
                    DM.EditGameData_CardInfos.LocalizedBattleCards.rootDataNode.RemoveXmlInfosByPath("cardDescList/BattleCardDesc",
                                                                                                     attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", innerCardNode.GetAttributesSafe("ID") }
                    }, deleteOnce: true);
                }

                DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.GetXmlDataNodesByPath("DropTable").ForEach((DM.XmlDataNode dropTableNode) =>
                {
                    List <DM.XmlDataNode> baseCardDropTableNode = DM.GameInfos.staticInfos["CardDropTable"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable",
                                                                                                                                                          attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", dropTableNode.GetAttributesSafe("ID") }
                    });
                    if (baseCardDropTableNode.Count > 0)
                    {
                        DM.XmlDataNode FOUND_CARD_DROP_TABLE_IN_GAME = baseCardDropTableNode[0];

                        List <string> foundCardDropTablesInGameItems = new List <string>();
                        FOUND_CARD_DROP_TABLE_IN_GAME.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                        {
                            foundCardDropTablesInGameItems.Add(cardNode.innerText);
                        });

                        if (DM.EditGameData_CardInfos.StaticCard.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card",
                                                                                                               attributeToCheck: new Dictionary <string, string>()
                        {
                            { "ID", innerCardNode.GetAttributesSafe("ID") }
                        }).Count == 1 &&
                            !foundCardDropTablesInGameItems.Contains(innerCardNode.GetAttributesSafe("ID")))
                        {
                            dropTableNode.RemoveXmlInfosByPath("Card", innerCardNode.GetAttributesSafe("ID"));
                        }

                        List <string> foundCardDropTables = new List <string>();
                        dropTableNode.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                        {
                            foundCardDropTables.Add(cardNode.innerText);
                        });

                        if (foundCardDropTables.Count == foundCardDropTablesInGameItems.Count &&
                            foundCardDropTables.Except(foundCardDropTablesInGameItems).Count() == 0 &&
                            DM.EditGameData_CardInfos.StaticCard.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card",
                                                                                                               attributeToCheck: new Dictionary <string, string>()
                        {
                            { "ID", innerCardNode.GetAttributesSafe("ID") }
                        }).Count == 1)
                        {
                            bool isContainAnyExistCard = false;
                            DM.EditGameData_CardInfos.StaticCard.rootDataNode.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                            {
                                if (foundCardDropTables.Contains(cardNode.GetAttributesSafe("ID")) &&
                                    cardNode.GetAttributesSafe("ID") != innerCardNode.GetAttributesSafe("ID"))
                                {
                                    isContainAnyExistCard = true;
                                }
                            });
                            if (!isContainAnyExistCard)
                            {
                                DM.EditGameData_CardInfos.StaticCardDropTable.rootDataNode.RemoveXmlInfosByPath("DropTable",
                                                                                                                attributeToCheck: new Dictionary <string, string>()
                                {
                                    { "ID", dropTableNode.GetAttributesSafe("ID") }
                                }, deleteOnce: true);
                            }
                        }
                    }
                });

                DM.EditGameData_CardInfos.StaticCard.rootDataNode.subNodes.Remove(innerCardNode);
                initStack();
                MainWindow.mainWindow.UpdateDebugInfo();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_CARD);
                break;
            }
        }