コード例 #1
0
        /// <summary>
        /// Get description for formation
        /// </summary>
        /// <param name="formationID"></param>
        /// <returns></returns>
        public static string GetDescriptionForFormation(string formationID)
        {
            List <XmlDataNode> formationNodes = DM.GameInfos.staticInfos["FormationInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Formation",
                                                                                                                                        attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", formationID }
            });

            if (formationNodes.Count > 0)
            {
                XmlDataNode FORMATION_NODE     = formationNodes[0];
                string      NUM_OF_PEOPLE_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.GLOBAL_WINDOW, $"NUM_OF_PEOPLE");

                List <XmlDataNode> positionNodes = FORMATION_NODE.GetXmlDataNodesByPath("Position");
                string             postionDes    = "";
                foreach (XmlDataNode positionNode in positionNodes)
                {
                    positionNode.ActionXmlDataNodesByPath("Vector", (XmlDataNode vector) => {
                        postionDes += $"x({vector.GetAttributesSafe("x")}) y({vector.GetAttributesSafe("y")}),";
                    });
                }
                postionDes = postionDes.Trim(',');
                return($"{NUM_OF_PEOPLE_WORD}:{positionNodes.Count} - {postionDes}:{formationID}");
            }
            else
            {
                return($"Formation ID :{formationID}");
            }
        }
コード例 #2
0
        /// <summary>
        /// Make new wav info base by basic node in game data
        /// </summary>
        /// <returns></returns>
        public static XmlDataNode MakeNewWaveInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage",
                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
            {
                { "id", "2" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode STAGE_NODE_TO_USE = baseBookUseNode[0];

                List <XmlDataNode> baseWaveNode = STAGE_NODE_TO_USE.GetXmlDataNodesByPath("Wave");
                if (baseWaveNode.Count > 0)
                {
                    XmlDataNode baseWaveNodeToUse = baseWaveNode[0].Copy();
                    baseWaveNodeToUse.SetXmlInfoByPath("Formation", "");
                    baseWaveNodeToUse.RemoveXmlInfosByPath("Unit");
                    return(baseWaveNodeToUse);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }