Exemplo n.º 1
0
        /// <summary>
        /// Reflect text chagnes in TextBox
        /// </summary>
        private void ReflectTextChangeInTextBox(object sender, TextChangedEventArgs e)
        {
            if (innerBuffNode == null)
            {
                return;
            }

            TextBox tbx = sender as TextBox;

            switch (tbx.Name)
            {
            case "TbxBuffID":
                innerBuffNode.attribute["ID"] = tbx.Text;
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_BUFF_DESC);
                break;

            case "TbxBuffName":
                innerBuffNode.SetXmlInfoByPath("Name", tbx.Text);
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_BUFF_DESC);
                break;

            case "TbxBuffDes":
                innerBuffNode.SetXmlInfoByPath("Desc", tbx.Text);
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_BUFF_DESC);
                break;
            }
            MainWindow.mainWindow.UpdateDebugInfo();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Change rarity button events
        /// </summary>
        private void ChangeRarityButtonEvents(object sender, RoutedEventArgs e)
        {
            Button rarityButton = sender as Button;

            BtnRarity_Common.Background   = null;
            BtnRarity_Uncommon.Background = null;
            BtnRarity_Rare.Background     = null;
            BtnRarity_Unique.Background   = null;

            rarityButton.Background = Tools.ColorTools.GetSolidColorBrushByHexStr("#54FFFFFF");
            WindowBg.Fill           = Tools.ColorTools.GetSolidColorBrushByHexStr(rarityButton.Tag.ToString());
            innerPassiveNode.SetXmlInfoByPath("Rarity", rarityButton.Name.Split('_').Last());
            MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_PASSIVE_INTO);
        }
Exemplo n.º 3
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 "BtnFormation":
                new SubWindows.Global_InputInfoWithSearchWindow((string selectedItem) =>
                {
                    waveNode.SetXmlInfoByPath("Formation", selectedItem);

                    string FORMATION_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.STAGE_INFO, $"FORMATION");
                    BtnFormation.ToolTip  = $"{FORMATION_WORD} : {DM.LocalizedGameDescriptions.GetDescriptionForFormation(selectedItem)}";

                    LblFormation.Content = $"{FORMATION_WORD} : {DM.LocalizedGameDescriptions.GetDescriptionForFormation(selectedItem)}";
                    BtnFormation.Content = "          ";
                }, SubWindows.InputInfoWithSearchWindow_PRESET.FORMATION).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                break;

            case "BtnUnits":
                List <string> selectedEnemies = new List <string>();
                waveNode.ActionXmlDataNodesByPath("Unit", (DM.XmlDataNode unitNode) =>
                {
                    selectedEnemies.Add($"{DM.LocalizedGameDescriptions.GetDescriptionForEnemy(unitNode.innerText)}:{unitNode.innerText}");
                });

                new SubWindows.Global_AddItemToListWindow((string addedEnemyID) =>
                {
                    waveNode.AddXmlInfoByPath("Unit", addedEnemyID);
                }, (string deletedEnemyID) => {
                    waveNode.RemoveXmlInfosByPath("Unit", deletedEnemyID, deleteOnce: true);
                }, selectedEnemies, SubWindows.AddItemToListWindow_PRESET.ENEMIES).ShowDialog();

                List <DM.XmlDataNode> unitNodes = waveNode.GetXmlDataNodesByPathWithXmlInfo("Unit");
                string unitStr = "";
                if (unitNodes.Count > 0)
                {
                    unitNodes.ForEach((DM.XmlDataNode unitNode) =>
                    {
                        unitStr += $" {DM.LocalizedGameDescriptions.GetDescriptionForEnemy(unitNode.innerText)}:{unitNode.innerText} /";
                    });
                    unitStr = unitStr.Trim('/');
                    if (!string.IsNullOrEmpty(unitStr.Trim()))
                    {
                        BtnUnits.ToolTip = unitStr;

                        LblUnits.Content = unitStr;
                        BtnUnits.Content = "          ";
                    }
                }
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Reflect text chagnes in TextBox
        /// </summary>
        private void ReflectTextChangeInTextBox(object sender, TextChangedEventArgs e)
        {
            if (innerEnemyNode == null)
            {
                return;
            }

            TextBox tbx = sender as TextBox;

            switch (tbx.Name)
            {
            case "TbxNameID":
                #region Add new name ID if not exist
                string PREV_NAME_ID = innerEnemyNode.GetInnerTextByPath("NameID");
                innerEnemyNode.SetXmlInfoByPath("NameID", tbx.Text);
                List <DM.XmlDataNode> foundLocalizeCharNamesNameID = DM.EditGameData_EnemyInfo.LocalizedCharactersName.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Name",
                                                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", innerEnemyNode.GetInnerTextByPath("NameID") }
                });
                if (foundLocalizeCharNamesNameID.Count <= 0 && !string.IsNullOrEmpty(tbx.Text))
                {
                    DM.EditGameData_EnemyInfo.LocalizedCharactersName.rootDataNode.subNodes.Add(DM.EditGameData_EnemyInfo.MakeNewCharactersNameBase(tbx.Text, TbxEnemyName.Text));
                }
                #endregion
                #region Remove prev name ID if not exist
                if (!DM.EditGameData_EnemyInfo.StaticEnemyUnitInfo.rootDataNode.CheckIfGivenPathWithXmlInfoExists("Enemy/NameID", PREV_NAME_ID))
                {
                    DM.EditGameData_EnemyInfo.LocalizedCharactersName.rootDataNode.RemoveXmlInfosByPath("Name",
                                                                                                        attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", PREV_NAME_ID }
                    });
                }
                #endregion


                MainWindow.mainWindow.UpdateDebugInfo();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_CHAR_NAME);
                break;

            case "TbxEnemyName":
                List <DM.XmlDataNode> foundLocalizeCharNames = DM.EditGameData_EnemyInfo.LocalizedCharactersName.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Name",
                                                                                                                                                               attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", innerEnemyNode.GetInnerTextByPath("NameID") }
                });
                if (foundLocalizeCharNames.Count > 0)
                {
                    foundLocalizeCharNames[0].innerText = tbx.Text;
                }
                else if (!string.IsNullOrEmpty(innerEnemyNode.GetInnerTextByPath("NameID")))
                {
                    DM.EditGameData_EnemyInfo.LocalizedCharactersName.rootDataNode.subNodes.Add(DM.EditGameData_EnemyInfo.MakeNewCharactersNameBase(TbxNameID.Text, tbx.Text));
                }
                MainWindow.mainWindow.UpdateDebugInfo();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_CHAR_NAME);
                break;

            case "TbxMinHeight":
                innerEnemyNode.SetXmlInfoByPath("MinHeight", tbx.Text);
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                break;

            case "TbxMaxHeight":
                innerEnemyNode.SetXmlInfoByPath("MaxHeight", tbx.Text);
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                break;

            case "TbxEnemyUniqueID":
                innerEnemyNode.attribute["ID"] = tbx.Text;
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_ENEMY_INFO);
                break;
            }
            MainWindow.mainWindow.UpdateDebugInfo();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Reflect text chagnes in TextBox
        /// </summary>
        private void ReflectTextChangeInTextBox(object sender, TextChangedEventArgs e)
        {
            if (innerStageNode == null)
            {
                return;
            }

            TextBox tbx = sender as TextBox;

            switch (tbx.Name)
            {
            case "TbxStageName":
                innerStageNode.SetXmlInfoByPath("Name", tbx.Text);
                if (DM.EditGameData_StageInfo.LocalizedStageName.rootDataNode.CheckIfGivenPathWithXmlInfoExists("Name",
                                                                                                                attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", innerStageNode.GetAttributesSafe("id") }
                }))
                {
                    List <DM.XmlDataNode> foundXmlDataNode = DM.EditGameData_StageInfo.LocalizedStageName.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Name",
                                                                                                                                                        attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", innerStageNode.GetAttributesSafe("id") }
                    });

                    if (foundXmlDataNode.Count > 0)
                    {
                        foundXmlDataNode[0].innerText = tbx.Text;
                    }
                }
                else
                {
                    DM.EditGameData_StageInfo.LocalizedStageName.rootDataNode.subNodes.Add(DM.EditGameData_StageInfo.MakeNewStageNameBase(
                                                                                               innerStageNode.GetAttributesSafe("id"),
                                                                                               innerStageNode.GetInnerTextByPath("Name")));
                }
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.LOCALIZED_STAGE_NAME);
                MainWindow.mainWindow.UpdateDebugInfo();
                break;

            case "TbxStageUniqueID":
                string PREV_STAGE_ID = innerStageNode.attribute["id"];
                #region Stage info localizing ID refrect
                if (DM.EditGameData_StageInfo.LocalizedStageName.rootDataNode.CheckIfGivenPathWithXmlInfoExists("Name",
                                                                                                                attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", PREV_STAGE_ID }
                }))
                {
                    List <DM.XmlDataNode> foundXmlDataNode = DM.EditGameData_StageInfo.LocalizedStageName.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Name",
                                                                                                                                                        attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", PREV_STAGE_ID }
                    });

                    if (foundXmlDataNode.Count > 0)
                    {
                        foundXmlDataNode[0].attribute["ID"] = tbx.Text;
                    }
                }
                #endregion
                innerStageNode.attribute["id"] = tbx.Text;
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_STAGE_INFO);
                MainWindow.mainWindow.UpdateDebugInfo();
                break;
            }
        }
Exemplo n.º 6
0
        private void SelectItemButtonEvents(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "BtnBookIcon":
                new SubWindows.Global_InputInfoWithSearchWindow((string selectedItem) =>
                {
                    string ICON_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.BOOK_INFO, $"ICON");

                    innerBookNode.SetXmlInfoByPath("BookIcon", selectedItem);
                    BtnBookIcon.ToolTip = $"{ICON_WORD} : {selectedItem}";

                    LblBookIcon.Content = $"{ICON_WORD} : {selectedItem}";
                    BtnBookIcon.Content = "          ";
                }, SubWindows.InputInfoWithSearchWindow_PRESET.BOOK_ICON).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_DROP_BOOK_INFO);
                break;

            case "BtnChapter":
                new SubWindows.Global_ListSeleteWindow((string selectedChapterDes) => {
                    string CHAPTER_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.CARD_INFO, $"Chapter");
                    innerBookNode.SetXmlInfoByPath("Chapter", selectedChapterDes.Split(':').Last());
                    BtnChapter.ToolTip = $"{CHAPTER_WORD} : {selectedChapterDes}";

                    LblChapter.Content = $"{CHAPTER_WORD} : {selectedChapterDes}";
                    BtnChapter.Content = "          ";
                }, SubWindows.Global_ListSeleteWindow_PRESET.CHAPTERS).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_DROP_BOOK_INFO);
                break;

            case "BtnSelectKeyPage":
                List <string> keyPageList = new List <string>();
                innerBookNode.ActionXmlDataNodesByPath("DropItem", (DM.XmlDataNode dropItemNode) =>
                {
                    keyPageList.Add(DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForKeyBook(dropItemNode.innerText));
                });
                new SubWindows.Global_AddItemToListWindow((string addedItem) =>
                {
                    innerBookNode.AddXmlInfoByPath("DropItem", addedItem,
                                                   attributePairsToSet: new Dictionary <string, string>()
                    {
                        { "Type", "Equip" }
                    });
                }, (string deletedItem) => {
                    innerBookNode.RemoveXmlInfosByPath("DropItem", deletedItem, deleteOnce: true);
                }, keyPageList, SubWindows.AddItemToListWindow_PRESET.CRITICAL_BOOKS).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_DROP_BOOK_INFO);
                InitLbxKeyPage();
                break;

            case "BtnSelectCards":
                List <string> cardList = new List <string>();
                DM.EditGameData_DropBookInfo.StaticCardDropTableInfo.rootDataNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "ID", innerBookNode.GetAttributesSafe("ID"),
                                                                                                                        (DM.XmlDataNode cardDropTableNode) => {
                    cardDropTableNode.ActionXmlDataNodesByPath("Card", (DM.XmlDataNode cardNode) =>
                    {
                        cardList.Add(DM.FullyLoclalizedGameDescriptions.GetFullDescriptionForCard(cardNode.innerText));
                    });
                });
                new SubWindows.Global_AddItemToListWindow((string addedItem) =>
                {
                    List <DM.XmlDataNode> cardDropTablesToCheck = DM.EditGameData_DropBookInfo.StaticCardDropTableInfo.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable",
                                                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
                    {
                        { "ID", innerBookNode.GetAttributesSafe("ID") }
                    });
                    if (cardDropTablesToCheck.Count <= 0)
                    {
                        DM.EditGameData_DropBookInfo.StaticCardDropTableInfo.rootDataNode.AddXmlInfoByPath("DropTable",
                                                                                                           attributePairsToSet: new Dictionary <string, string>()
                        {
                            { "ID", innerBookNode.GetAttributesSafe("ID") }
                        });
                    }

                    DM.EditGameData_DropBookInfo.StaticCardDropTableInfo.rootDataNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "ID", innerBookNode.GetAttributesSafe("ID"),
                                                                                                                            (DM.XmlDataNode cardDropTableNode) => {
                        cardDropTableNode.AddXmlInfoByPath("Card", addedItem);
                    });
                }, (string deletedItem) => {
                    DM.EditGameData_DropBookInfo.StaticCardDropTableInfo.rootDataNode.ActionXmlDataNodesByAttributeWithPath("DropTable", "ID", innerBookNode.GetAttributesSafe("ID"),
                                                                                                                            (DM.XmlDataNode cardDropTableNode) => {
                        cardDropTableNode.RemoveXmlInfosByPath("Card", deletedItem);
                    });
                }, cardList, SubWindows.AddItemToListWindow_PRESET.CARDS).ShowDialog();
                MainWindow.mainWindow.ChangeDebugLocation(MainWindow.DEBUG_LOCATION.STATIC_CARD_DROP_TABLE_INFO);
                InitLbxCards();
                break;
            }
        }