예제 #1
0
        /**
         * @brief 私有提取函数
         *
         * @return
         */
        private List <Data_ActionInfo> ExtractAction(DBC_Row node, string prefix)
        {
            List <Data_ActionInfo> data = new List <Data_ActionInfo>();

            List <string> childList = DBCUtil.ExtractNodeByPrefix(node, prefix);

            if (childList.Count == 0)
            {
                return(data);
            }

            foreach (string child in childList)
            {
                if (string.IsNullOrEmpty(child))
                {
                    continue;
                }

                string outModelPath;
                string outSoundId;
                if (!_ParseModelPath(child, out outModelPath, out outSoundId))
                {
                    string info = "[Err]:ActionConfigProvider.ExtractAction anim name error:" + child;
                    throw new Exception(info);
                }

                Data_ActionInfo action = new Data_ActionInfo();
                action.m_AnimName = m_ActionPrefix + outModelPath;
                action.m_SoundId  = outSoundId;
                data.Add(action);
            }

            return(data);
        }
예제 #2
0
        /**
         * @brief 从Xml节点中读取字符串数组
         *
         * @param node xml节点
         * @param nodeName 节点名字
         * @param defualtVal 默认值
         * @param isMust 是否强制不能为空
         *
         * @return
         */
        public static List <string> ExtractStringList(DBC_Row node, string nodeName, string defualtVal, bool isMust)
        {
            List <string> result = new List <string>();

            if (node == null || !node.HasFields)
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractStringList Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }

                return(result);
            }

            string nodeText = node.SelectFieldByName(nodeName);

            if (Helper.StringIsNullOrEmpty(nodeText))
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractStringList Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }
            }
            else
            {
                result = Converter.ConvertStringList(nodeText);
            }

            return(result);
        }
예제 #3
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_Level      = DBCUtil.ExtractNumeric <int>(node, "Level", 0, true);
     m_ConsumeExp = DBCUtil.ExtractNumeric <int>(node, "ConsumeExp", 0, true);
     m_RebornTime = DBCUtil.ExtractNumeric <int>(node, "RebornTime", 0, true);
     return(true);
 }
예제 #4
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_Id          = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
     m_Description = DBCUtil.ExtractString(node, "Description", "", true);
     m_AttrData.CollectDataFromDBC(node);
     return(true);
 }
예제 #5
0
        /**
         * @brief 从Xml节点中读取字符串
         *
         * @param node xml节点
         * @param nodeName 节点名字
         * @param defualtVal 默认值
         * @param isMust 是否强制不能为空
         *
         * @return
         */
        public static string ExtractString(DBC_Row node, string nodeName, string defualtVal, bool isMust)
        {
            string result = defualtVal;

            if (node == null || !node.HasFields || node.SelectFieldByName(nodeName) == null)
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtactString Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }

                return(result);
            }

            string nodeText = node.SelectFieldByName(nodeName);

            if (Helper.StringIsNullOrEmpty(nodeText))
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtactString Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }
            }
            else
            {
                result = nodeText;
            }

            return(result);
        }
예제 #6
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id              = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            m_Type            = DBCUtil.ExtractNumeric <int>(node, "Type", 0, true);
            m_IntroTime       = DBCUtil.ExtractNumeric <int>(node, "IntroTime", 0, true);
            m_ScenePath       = DBCUtil.ExtractString(node, "ScenePath", "", true);
            m_UnitFile        = DBCUtil.ExtractString(node, "UnitFile", "", true);
            m_ObstacleFile    = DBCUtil.ExtractString(node, "ObstacleFile", "", true);
            m_SceneLogicFile  = DBCUtil.ExtractString(node, "SceneLogicFile", "", true);
            m_BlockInfoFile   = DBCUtil.ExtractString(node, "BlockInfoFile", "", true);
            m_ClientSceneFile = DBCUtil.ExtractString(node, "ClientSceneFile", "", true);
            m_TiledDataScale  = DBCUtil.ExtractNumeric <float>(node, "TiledDataScale", 0, true);

            List <float> coords = DBCUtil.ExtractNumericList <float>(node, "ReachableSet", 0, false);

            if (coords.Count > 0)
            {
                m_ReachableSet = new Vector3[coords.Count / 2];
                for (int i = 0; i < coords.Count - 1; i += 2)
                {
                    m_ReachableSet[i / 2] = new Vector3(coords[i], 0, coords[i + 1]);
                }
            }
            else
            {
                m_ReachableSet = null;
            }
            return(true);
        }
예제 #7
0
 public void CollectDataFromDBC(DBC_Row node)
 {
     m_AddHpMax     = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddHpMax", 0, false), out m_HpMaxType);
     m_AddRageMax   = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddRageMax", 0, false), out m_HpMaxType);
     m_AddNpMax     = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddNpMax", 0, false), out m_NpMaxType);
     m_AddEpMax     = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddEpMax", 0, false), out m_EpMaxType);
     m_AddCrgMax    = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddCrgMax", 0, false), out m_CrgMaxType);
     m_AddAd        = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddAd", 0, false), out m_AdType);
     m_AddDp        = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddDp", 0, false), out m_DpType);
     m_AddRps       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddRps", 0, false), out m_RpsType);
     m_AddCrg       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddCrg", 0, false), out m_CrgType);
     m_AddCht       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddCht", 0, false), out m_ChtType);
     m_AddRange     = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddRange", 0, false), out m_RangeType);
     m_AddDps       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddDps", 0, false), out m_DpsType);
     m_AddDamRange  = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddDamRange", 0, false), out m_DamRangeType);
     m_AddCri       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddCri", 0, false), out m_CriType);
     m_AddPow       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddPow", 0, false), out m_PowType);
     m_AddAndp      = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddAndp", 0, false), out m_AndpType);
     m_AddHpRecover = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddHpRecover", 0, false), out m_HpRecoverType);
     m_AddNpRecover = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddNpRecover", 0, false), out m_NpRecoverType);
     m_AddEpRecover = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddEpRecover", 0, false), out m_EpRecoverType);
     m_AddAp        = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddAp", 0, false), out m_ApType);
     m_AddTay       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddTay", 0, false), out m_TayType);
     m_AddSpd       = CalcRealValue(DBCUtil.ExtractNumeric <int>(node, "AddSpd", 0, false), out m_SpdType);
 }
예제 #8
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            ImpactId          = DBCUtil.ExtractNumeric <int>(node, "Id", -1, true);
            ImpactLogicId     = DBCUtil.ExtractNumeric <int>(node, "LogicId", -1, true);
            ImpactDescription = DBCUtil.ExtractString(node, "Description", "", false);
            ImpactType        = DBCUtil.ExtractNumeric <int>(node, "ImpactType", -1, true);
            ImpactTime        = DBCUtil.ExtractNumeric <int>(node, "ImpactTime", -1, true);
            BuffDataId        = DBCUtil.ExtractNumeric <int>(node, "BuffDataId", -1, false);
            MaxRank           = DBCUtil.ExtractNumeric <int>(node, "MaxRank", -1, false);
            Effect            = DBCUtil.ExtractString(node, "Effect", "", false);
            ActionId          = DBCUtil.ExtractNumeric <int>(node, "ActionId", -1, false);
            IsDeadDisappear   = DBCUtil.ExtractBool(node, "IsDeadDisappear", false, false);
            CanBeCancel       = DBCUtil.ExtractBool(node, "CanBeCancel", false, false);
            IsAbsorbHurt      = DBCUtil.ExtractBool(node, "IsAbsorbHurt", false, false);
            IsReflect         = DBCUtil.ExtractBool(node, "IsReflect", false, false);
            IsDamageDisappear = DBCUtil.ExtractBool(node, "IsDamageDisappear", false, false);
            IsFightDisappear  = DBCUtil.ExtractBool(node, "IsFightDisappear", false, false);
            IsShootDisappear  = DBCUtil.ExtractBool(node, "IsShootDisappear", false, false);
            IsSkillDisappear  = DBCUtil.ExtractBool(node, "IsSkillDisappear", false, false);

            ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, false);
            ExtraParams.Clear();
            if (ParamNum > 0)
            {
                for (int i = 0; i < ParamNum; ++i)
                {
                    string key = "Param" + i.ToString();
                    ExtraParams.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }

            return(true);
        }
예제 #9
0
        /**
         * @brief 提取数据
         *
         * @param file 文件路径
         *
         * @return
         */
        public bool CollectDataFromDBC(string file, string rootLabel)
        {
            bool result = true;

            DBC document = new DBC();

            document.Load(HomePath.GetAbsolutePath(file));

            for (int index = 0; index < document.RowNum; index++)
            {
                DBC_Row node = document.GetRowByIndex(index);
                if (node != null)
                {
                    TData  data = new TData();
                    bool   ret  = data.CollectDataFromDBC(node);
                    string info = string.Format("DataTempalteMgr.CollectDataFromXml collectData Row:{0} failed!", index);
                    LogSystem.Assert(ret, info);
                    if (ret)
                    {
                        m_DataContainer.Add(data.GetId(), data);
                    }
                    else
                    {
                        result = false;
                    }
                }
            }

            return(result);
        }
예제 #10
0
        public float AOERange;                    // 技能AOE范围

        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            SkillId              = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            SkillDataFile        = DBCUtil.ExtractString(node, "LogicDataFile", "", true);
            SkillIcon            = DBCUtil.ExtractString(node, "Icon", "", true);
            SkillDescription     = DBCUtil.ExtractString(node, "Description", "", true);
            SkillTrueDescription = DBCUtil.ExtractString(node, "TrueDescription", "", true);
            ActivateLevel        = DBCUtil.ExtractNumeric <int>(node, "ActivateLevel", 0, true);
            SkillPassivity       = (Passivity)DBCUtil.ExtractNumeric <int>(node, "Passivity", 0, true);
            SkillCoefficient     = DBCUtil.ExtractNumeric <float>(node, "SkillCoefficient", 0, true);
            TargetType           = (TargType)DBCUtil.ExtractNumeric <int>(node, "TargetType", 0, true);
            TargetSelectType     = (TargSelectType)DBCUtil.ExtractNumeric <int>(node, "TargetSelectType", 0, true);
            CoolDownTime         = DBCUtil.ExtractNumeric <float>(node, "CD", 0, true);
            CostHp             = DBCUtil.ExtractNumeric <int>(node, "CostHp", 0, false);
            CostEnergy         = DBCUtil.ExtractNumeric <int>(node, "CostEnergy", 0, false);
            CostEnergyCore     = DBCUtil.ExtractNumeric <int>(node, "CostEnergyCore", 0, false);
            CostItemId         = DBCUtil.ExtractNumeric <int>(node, "CostItemId", 0, false);
            RangeIndicatorType = (RangeType)DBCUtil.ExtractNumeric <int>(node, "RangeIndicatorType", 0, false);
            SkillRangeAsset    = DBCUtil.ExtractString(node, "SkillRangeAsset", "", false);
            AOERangeAsset      = DBCUtil.ExtractString(node, "AOERangeAsset", "", false);
            SkillAssetStdRange = DBCUtil.ExtractNumeric <float>(node, "SkillAssetStdRange", 0, false);
            AOEAssetStdRange   = DBCUtil.ExtractNumeric <float>(node, "AOEAssetStdRange", 0, false);
            SkillRange         = DBCUtil.ExtractNumeric <float>(node, "SkillRange", 0, false);
            AOERange           = DBCUtil.ExtractNumeric <float>(node, "AOERange", 0, false);

            return(true);
        }
예제 #11
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            m_AttrData.CollectDataFromDBC(node);

            return(true);
        }
예제 #12
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_Id       = DBCUtil.ExtractNumeric <int>(node, "ID", 0, true);
     m_Critical = (int)(DBCUtil.ExtractNumeric <float>(node, "Critical", 0, true) * c_IntRate);
     m_C        = (int)(DBCUtil.ExtractNumeric <float>(node, "C", 0, true) * c_IntRate * 10);
     return(true);
 }
예제 #13
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_EquipmentId   = DBCUtil.ExtractNumeric <int>(node, "EquipmentId", 0, true);
     m_EquipmentName = DBCUtil.ExtractString(node, "EquipmentName", "", true);
     m_UiModel       = DBCUtil.ExtractString(node, "UiModel", "", false);
     m_AttrData.CollectDataFromDBC(node);
     return(true);
 }
예제 #14
0
        /**
         * @brief 从Xml节点中抽取所有以prefix为前缀的节点
         *
         * @param node xml节点
         * @param prefix 前缀字符串
         *
         * @return
         */
        public static List <string> ExtractNodeByPrefix(DBC_Row node, string prefix)
        {
            if (node == null || !node.HasFields)
            {
                return(null);
            }

            return(node.SelectFieldsByPrefix(prefix));
        }
예제 #15
0
 /**
  * @brief 提取数据
  *
  * @param node
  *
  * @return
  */
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_WeaponId     = DBCUtil.ExtractNumeric <int>(node, "Id", -1, true);
     m_WeaponName   = DBCUtil.ExtractString(node, "Name", "", true);
     m_ResourceName = DBCUtil.ExtractString(node, "ResourceName", "", false);
     m_WeaponType   = DBCUtil.ExtractNumeric <int>(node, "WeaponType", -1, false);
     m_EquipmentId  = DBCUtil.ExtractNumeric <int>(node, "EquipmentId", -1, false);
     return(true);
 }
예제 #16
0
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id       = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            m_UsagerId = DBCUtil.ExtractNumeric <int>(node, "UsagerId", 0, true);
            m_WeaponId = DBCUtil.ExtractNumeric <int>(node, "WeaponId", 0, true);
            string pos = DBCUtil.ExtractString(node, "MuzzlePos", "0 0 0", true);

            m_MuzzlePos = Converter.ConvertVector3D(pos);
            return(true);
        }
예제 #17
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_LevelupId      = DBCUtil.ExtractNumeric <int>(node, "LevelupId", 0, true);
     m_EquipmentId    = DBCUtil.ExtractNumeric <int>(node, "EquipmentId", 0, true);
     m_EquipmentName  = DBCUtil.ExtractString(node, "EquipmentName", "", true);
     m_Type           = DBCUtil.ExtractNumeric <int>(node, "Type", 0, true);
     m_Level          = DBCUtil.ExtractNumeric <int>(node, "Level", 0, true);
     m_UiModel        = DBCUtil.ExtractString(node, "UiModel", "", false);
     m_ConsumeItem    = DBCUtil.ExtractNumeric <int>(node, "ConsumeItem", 0, false);
     m_ConsumeMoney   = DBCUtil.ExtractNumeric <int>(node, "ConsumeMoney", 0, false);
     m_ConsumeYuanbao = DBCUtil.ExtractNumeric <int>(node, "ConsumeYuanbao", 0, false);
     m_AttrData.CollectDataFromDBC(node);
     return(true);
 }
예제 #18
0
 public bool CollectDataFromDBC(DBC_Row node)
 {
     m_Id       = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
     m_LogicId  = DBCUtil.ExtractNumeric <int>(node, "LogicId", 0, true);
     m_ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, true);
     if (m_ParamNum > 0)
     {
         m_Params = new string[m_ParamNum];
         for (int i = 0; i < m_ParamNum; ++i)
         {
             m_Params[i] = DBCUtil.ExtractString(node, "Param" + i, "", false);
         }
     }
     return(true);
 }
예제 #19
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id       = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            m_LinkId   = DBCUtil.ExtractNumeric <int>(node, "LinkId", 0, true);
            m_CampId   = DBCUtil.ExtractNumeric <int>(node, "CampId", 0, true);
            m_Pos      = Converter.ConvertVector3D(DBCUtil.ExtractString(node, "Pos", "0.0,0.0,0.0", true));
            m_RotAngle = DBCUtil.ExtractNumeric <float>(node, "RotAngle", 0.0f, true) * (float)Math.PI / 180;
            m_IsEnable = DBCUtil.ExtractBool(node, "IsEnable", false, true);
            m_AiLogic  = DBCUtil.ExtractNumeric <int>(node, "AiLogic", 0, false);
            for (int i = 0; i < c_MaxAiParamNum; ++i)
            {
                m_AiParam[i] = DBCUtil.ExtractString(node, "AiParam" + i, "", false);
            }

            return(true);
        }
예제 #20
0
        /**
         * @brief 返回文本,根据行、列号
         *
         * @param rowIndex
         * @param colIndex
         *
         * @return
         */
        public string GetField(int rowIndex, int colIndex)
        {
            if (rowIndex < 0 || rowIndex >= m_RowNum ||
                colIndex < 0 || colIndex >= m_ColumNum)
            {
                return("");
            }

            DBC_Row dbRow = GetRowByIndex(rowIndex);

            if (dbRow != null)
            {
                return(dbRow.SelectFieldByIndex(colIndex));
            }

            return("");
        }
예제 #21
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            ActionId        = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            ActionLogicId   = DBCUtil.ExtractNumeric <int>(node, "LogicId", 0, true);
            BreakLevel      = DBCUtil.ExtractNumeric <int>(node, "BreakLevel", 0, true);
            CallbackSection = DBCUtil.ExtractNumeric <int>(node, "CallbackSection", 0, true);
            CallbackPoint   = DBCUtil.ExtractNumeric <float>(node, "CallbackPoint", 0, true);
            SectionNumber   = DBCUtil.ExtractNumeric <int>(node, "SectionNum", 0, true);

            EffectNum = DBCUtil.ExtractNumeric <int>(node, "EffectNum", 0, true);
            EffectList.Clear();
            for (int i = 0; i < EffectNum; i++)
            {
                string           keySuffix   = i.ToString();
                ActionEffectInfo effect_info = new ActionEffectInfo();
                effect_info.EffectTime       = DBCUtil.ExtractNumeric <float>(node, "EffectTime" + keySuffix, 0, false);
                effect_info.SkeletonNodeName = DBCUtil.ExtractString(node, "SkeletonNodeName" + keySuffix, "", false);
                effect_info.EffectName       = DBCUtil.ExtractString(node, "EffectName" + keySuffix, "", false);
                EffectList.Insert(i, effect_info);
            }

            for (int i = 0; i < SectionNumber; i++)
            {
                string        keySuffix     = i.ToString();
                ActionSection actionSection = new ActionSection();
                actionSection.ActionType  = DBCUtil.ExtractNumeric <int>(node, "ActionType" + keySuffix, -1, true);
                actionSection.WapMode     = DBCUtil.ExtractString(node, "WapMode" + keySuffix, "ONCE", false);
                actionSection.IsUpperBody = DBCUtil.ExtractBool(node, "IsUpperBody" + keySuffix, false, false);
                actionSection.PlaySpeed   = DBCUtil.ExtractNumeric <float>(node, "PlaySpeed" + keySuffix, 1.0f, false);
                actionSection.PlayTime    = DBCUtil.ExtractNumeric <float>(node, "PlayTime" + keySuffix, 0, false);
                actionSection.MoveSpeed   = DBCUtil.ExtractNumeric <float>(node, "MoveSpeed" + keySuffix, 0, false);
                actionSection.MoveTowards = DBCUtil.ExtractNumeric <int>(node, "MoveTowards" + keySuffix, 0, false);
                SectionList.Insert(i, actionSection);
            }

            ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, false);
            if (ParamNum > 0)
            {
                for (int i = 0; i < ParamNum; ++i)
                {
                    string key = "Param" + i.ToString();
                    ExtraParams.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }
            return(true);
        }
예제 #22
0
        /**
         * @brief 返回文本根据行关键字和列名
         *
         * @param id
         * @param headerName
         *
         * @return
         */
        public string GetField(string id, string headerName)
        {
            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(headerName))
            {
                return("");
            }

            if (m_HashData != null && m_HashData.ContainsKey(id))
            {
                DBC_Row row = m_HashData[id];
                if (row != null)
                {
                    return(row.SelectFieldByName(headerName));
                }
            }

            return("");
        }
예제 #23
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id                  = DBCUtil.ExtractNumeric <int>(node, "Id", -1, true);
            m_Ground              = DBCUtil.ExtractString(node, "Ground", "", true);
            m_BeginArea           = DBCUtil.ExtractString(node, "BeginArea", "", true);
            m_EndArea             = DBCUtil.ExtractString(node, "EndArea", "", true);
            m_TriggerDir          = DBCUtil.ExtractNumeric <float>(node, "TriggerDir", -1, true);
            m_PushObjDeltaTime    = DBCUtil.ExtractNumeric <float>(node, "PushObjDeltaTime", -1, true);
            m_PushGroundDeltaTime = DBCUtil.ExtractNumeric <float>(node, "PushGroundDeltaTime", -1, true);
            m_OffsetAngle         = DBCUtil.ExtractNumeric <float>(node, "OffsetAngle", -1, true);
            m_ObjOffsetDis        = DBCUtil.ExtractNumeric <float>(node, "ObjOffsetDis", -1, true);
            m_GroundOffsetDis     = DBCUtil.ExtractNumeric <float>(node, "GroundOffsetDis", -1, true);
            m_ObjLifeTime         = DBCUtil.ExtractNumeric <float>(node, "ObjLifeTime", -1, true);
            m_GroundLifeTime      = DBCUtil.ExtractNumeric <float>(node, "GroundLifeTime", -1, true);
            m_Speed               = DBCUtil.ExtractNumeric <float>(node, "Speed", -1, true);
            m_MaxSpeed            = DBCUtil.ExtractNumeric <float>(node, "MaxSpeed", -1, true);
            m_Acceleration        = DBCUtil.ExtractNumeric <float>(node, "Acceleration", -1, true);

            ObjNum = DBCUtil.ExtractNumeric <int>(node, "ObjNum", 0, false);
            ObjList.Clear();
            if (ObjNum > 0)
            {
                for (int i = 0; i < ObjNum; ++i)
                {
                    string key = "Obj" + i.ToString();
                    ObjList.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }

            ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, false);
            ExtraParams.Clear();
            if (ParamNum > 0)
            {
                for (int i = 0; i < ParamNum; ++i)
                {
                    string key = "Param" + i.ToString();
                    ExtraParams.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }

            return(true);
        }
예제 #24
0
        /**
         * @brief 从Xml节点中读取数值类型,使用时,必须在函数中指明数值类型
         *          如: int id = ExtractNumeric<int>(xmlNode, "Id", -1, true);
         *
         * @param node xml节点
         * @param nodeName 节点名字
         * @param defualtVal 默认值
         * @param isMust 是否强制不能为空
         *
         * @return
         */
        public static T ExtractNumeric <T>(DBC_Row node, string nodeName, T defualtVal, bool isMust)
        {
            T result = defualtVal;

            if (node == null || !node.HasFields || node.SelectFieldByName(nodeName) == null)
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractNumeric Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }

                return(result);
            }

            string nodeText = node.SelectFieldByName(nodeName);

            if (Helper.StringIsNullOrEmpty(nodeText))
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractNumeric Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }
            }
            else
            {
                try
                {
                    result = (T)Convert.ChangeType(nodeText, typeof(T));
                }
                catch (System.Exception ex)
                {
                    string info = string.Format("ExtractNumeric Error node:{0} nodeName:{1} ex:{2} stacktrace:{3}",
                                                node.RowIndex, nodeName, ex.Message, ex.StackTrace);
                    LogSystem.Debug(info);
                    Helper.LogCallStack();
                }
            }

            return(result);
        }
예제 #25
0
        /**
         * @brief 从Xml节点中读取布尔值
         *
         * @param node xml节点
         * @param nodeName 节点名字
         * @param defualtVal 默认值
         * @param isMust 是否强制不能为空
         *
         * @return
         */
        public static bool ExtractBool(DBC_Row node, string nodeName, bool defualtVal, bool isMust)
        {
            bool result = defualtVal;

            if (node == null || !node.HasFields || node.SelectFieldByName(nodeName) == null)
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractBool Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }

                return(result);
            }

            string nodeText = node.SelectFieldByName(nodeName);

            if (Helper.StringIsNullOrEmpty(nodeText))
            {
                if (isMust)
                {
                    string errorInfo = string.Format("ExtractBool Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                    LogSystem.Assert(false, errorInfo);
                }
            }
            else
            {
                if (nodeText.Trim().ToLower() == "true" || nodeText.Trim().ToLower() == "1")
                {
                    result = true;
                }

                if (nodeText.Trim().ToLower() == "false" || nodeText.Trim().ToLower() == "0")
                {
                    result = false;
                }
            }

            return(result);
        }
예제 #26
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            Id       = DBCUtil.ExtractNumeric <int>(node, "Id", -1, true);
            Name     = DBCUtil.ExtractString(node, "Name", "", true);
            IsMusic  = DBCUtil.ExtractBool(node, "IsMusic", false, true);
            Priority = DBCUtil.ExtractNumeric <int>(node, "Priority", 1, false);
            Volume   = DBCUtil.ExtractNumeric <float>(node, "Volume", 1.0f, false);
            IsLoop   = DBCUtil.ExtractBool(node, "IsLoop", false, false);
            Position = Converter.ConvertVector3D(DBCUtil.ExtractString(node, "Position", "0,0,0", false));

            ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, false);
            ExtraParams.Clear();
            if (ParamNum > 0)
            {
                for (int i = 0; i < ParamNum; ++i)
                {
                    string key = "Param" + i.ToString();
                    ExtraParams.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }

            return(true);
        }
예제 #27
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            SoundId          = DBCUtil.ExtractNumeric <int>(node, "Id", -1, true);
            SoundDescription = DBCUtil.ExtractString(node, "Description", "", false);

            for (int i = 0; i < skillSoundCount; ++i)
            {
                string NodeName = "Sound" + i.ToString();
                m_SoundList.Add(DBCUtil.ExtractString(node, NodeName, "", false));
            }

            ParamNum = DBCUtil.ExtractNumeric <int>(node, "ParamNum", 0, false);
            ExtraParams.Clear();
            if (ParamNum > 0)
            {
                for (int i = 0; i < ParamNum; ++i)
                {
                    string key = "Param" + i.ToString();
                    ExtraParams.Insert(i, DBCUtil.ExtractString(node, key, "", false));
                }
            }

            return(true);
        }
예제 #28
0
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_ItemId       = DBCUtil.ExtractNumeric <int>(node, "ItemId", 0, true);
            m_ItemName     = DBCUtil.ExtractString(node, "ItemName", "", true);
            m_ItemTrueName = DBCUtil.ExtractString(node, "ItemTrueName", "", true);
            m_ItemType     = DBCUtil.ExtractString(node, "ItemType", "", true);
            m_IsLobbyItem  = DBCUtil.ExtractBool(node, "IsLobbyItem", false, true);
            m_Grade        = DBCUtil.ExtractNumeric <int>(node, "Grade", 0, true);
            m_UseLogicId   = DBCUtil.ExtractNumeric <int>(node, "UseLogicId", 0, true);
            List <string> strList = DBCUtil.ExtractStringList(node, "UseResultData", "", true);

            if (strList.Count > 0)
            {
                m_UseResultData = strList.ToArray();
            }
            List <int> list = DBCUtil.ExtractNumericList <int>(node, "AddBuffOnEquiping", 0, true);

            if (list.Count > 0)
            {
                m_AddBuffOnEquiping = list.ToArray();
            }
            list = DBCUtil.ExtractNumericList <int>(node, "AddSkillOnEquiping", 0, true);
            if (list.Count > 0)
            {
                m_AddSkillOnEquiping = list.ToArray();
            }
            m_ShowInShop = (0 != DBCUtil.ExtractNumeric <int>(node, "ShowInShop", 0, true));
            m_Model      = DBCUtil.ExtractString(node, "Model", "", true);
            m_UiModel    = DBCUtil.ExtractString(node, "UiModel", "", true);
            m_MaxStack   = DBCUtil.ExtractNumeric <int>(node, "MaxStack", 1, true);
            list         = DBCUtil.ExtractNumericList <int>(node, "ConsumeItems", 0, true);
            if (list.Count > 0)
            {
                m_ConsumeItems = list.ToArray();
            }
            else
            {
                m_ConsumeItems = new int[] { 0, 0, 0 };
            }
            m_ConsumeMoney = DBCUtil.ExtractNumeric <int>(node, "ConsumeMoney", 0, true);
            list           = DBCUtil.ExtractNumericList <int>(node, "PropertyRank", 0, true);
            if (list.Count > 0)
            {
                m_PropertyRank = list.ToArray();
            }
            else
            {
                m_PropertyRank = new int[] { 0, 0, 0, 0, 0 };
            }
            m_AddExp          = DBCUtil.ExtractNumeric <int>(node, "AddExp", 0, true);
            m_AddMoney        = DBCUtil.ExtractNumeric <int>(node, "AddMoney", 0, true);
            m_AddBuff         = DBCUtil.ExtractNumeric <int>(node, "AddBuffer", 0, true);
            m_Introduce       = DBCUtil.ExtractString(node, "Introduce", "", true);
            m_ItemSkillFirst  = DBCUtil.ExtractNumeric <int>(node, "ItemSkillFirst", 0, true);
            m_ItemSkillSecond = DBCUtil.ExtractNumeric <int>(node, "ItemSkillSecond", 0, true);
            m_ItemSkillThird  = DBCUtil.ExtractNumeric <int>(node, "ItemSkillThird", 0, true);
            m_NormalIcon      = DBCUtil.ExtractString(node, "NormalIcon", "", true);
            m_BigIcon         = DBCUtil.ExtractString(node, "BigIcon", "", true);
            m_AttrData.CollectDataFromDBC(node);
            return(true);
        }
예제 #29
0
        /**
         * @brief 提取数据
         *
         * @param node
         *
         * @return
         */
        public bool CollectDataFromDBC(DBC_Row node)
        {
            m_Id      = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
            m_Name    = DBCUtil.ExtractString(node, "Name", "", true);
            m_NpcType = DBCUtil.ExtractNumeric <int>(node, "NpcType", 0, true);
            m_Level   = DBCUtil.ExtractNumeric <int>(node, "Level", 0, true);
            m_Scale   = DBCUtil.ExtractNumeric <float>(node, "Scale", 1.0f, true);

            m_DropCount = DBCUtil.ExtractNumeric <int>(node, "DropCount", 0, false);
            m_DropExp   = DBCUtil.ExtractNumeric <int>(node, "DropExp", 0, false);
            m_DropMoney = DBCUtil.ExtractNumeric <int>(node, "DropMoney", 0, false);

            List <int> list = DBCUtil.ExtractNumericList <int>(node, "DropProbabilities", 0, false);

            if (list.Count > 0)
            {
                m_DropProbabilities = list.ToArray();
            }

            list = DBCUtil.ExtractNumericList <int>(node, "DropNpcs", 0, false);
            if (list.Count > 0)
            {
                m_DropNpcs = list.ToArray();
            }

            list = DBCUtil.ExtractNumericList <int>(node, "InteractSourceActions", 0, false);
            if (list.Count > 0)
            {
                m_InteractSourceActions = list.ToArray();
            }
            else
            {
                m_InteractSourceActions = new int[] { 0, 0 };
            }

            list = DBCUtil.ExtractNumericList <int>(node, "InteractTargetActions", 0, false);
            if (list.Count > 0)
            {
                m_InteractTargetActions = list.ToArray();
            }
            else
            {
                m_InteractTargetActions = new int[] { 0, 0 };
            }

            m_InteractionLogic = DBCUtil.ExtractNumeric <int>(node, "InteractionLogic", 0, false);
            List <string> strList = DBCUtil.ExtractStringList(node, "InteractResultData", "", false);

            if (strList.Count > 0)
            {
                m_InteractResultData = strList.ToArray();
            }

            m_AttrData.CollectDataFromDBC(node);
            m_ViewRange   = DBCUtil.ExtractNumeric <float>(node, "ViewRange", -1, true);
            m_GohomeRange = DBCUtil.ExtractNumeric <float>(node, "GohomeRange", -1, true);
            m_ReleaseTime = DBCUtil.ExtractNumeric <long>(node, "ReleaseTime", 0, true);
            m_HeadUiPos   = DBCUtil.ExtractNumeric <int>(node, "HeadUiPos", 0, true);

            m_SkillList  = DBCUtil.ExtractNumericList <int>(node, "SkillList", 0, false);
            m_ActionList = DBCUtil.ExtractNumericList <int>(node, "ActionId", 0, false);

            m_Model       = DBCUtil.ExtractString(node, "Model", "", false);
            m_DeathModel  = DBCUtil.ExtractString(node, "DeathModel", "", false);
            m_DeathEffect = DBCUtil.ExtractString(node, "DeathEffect", "", false);
            m_DeathSound  = DBCUtil.ExtractString(node, "DeathSound", "", false);
            m_DeadType    = DBCUtil.ExtractNumeric <int>(node, "DeadType", 0, false);
            m_Barrage     = DBCUtil.ExtractNumeric <int>(node, "Barrage", 0, false);

            m_AvoidanceRadius = DBCUtil.ExtractNumeric <int>(node, "AvoidanceRadius", 1, false);
            m_CanMove         = DBCUtil.ExtractBool(node, "CanMove", false, false);
            m_CanRotate       = DBCUtil.ExtractBool(node, "CanRotate", true, false);
            m_IsRange         = DBCUtil.ExtractBool(node, "IsRange", false, false);
            m_IsShine         = DBCUtil.ExtractBool(node, "IsShine", false, false);
            m_isBlaze         = DBCUtil.ExtractBool(node, "IsBlaze", false, false);
            m_IsHurtComa      = DBCUtil.ExtractBool(node, "IsHurtComa", false, false);

            m_BornTimeMs        = DBCUtil.ExtractNumeric <int>(node, "BornTimeMs", 0, false);
            m_BornEffect        = DBCUtil.ExtractString(node, "BornEffect", "", false);
            m_IsAttachControler = DBCUtil.ExtractBool(node, "IsAttachControler", false, false);
            m_AttachNodeName    = DBCUtil.ExtractString(node, "AttachNodeName", "", false);

            m_GunEndRelativePos = Converter.ConvertVector3D(DBCUtil.ExtractString(node, "GunEndRelativePos", "0.0,0.0,0.0", false));

            m_WeaponList = DBCUtil.ExtractNumericList <int>(node, "WeaponId", 0, false);

            string shapeType     = DBCUtil.ExtractString(node, "ShapeType", "", true);
            int    shapeParamNum = DBCUtil.ExtractNumeric <int>(node, "ShapeParamNum", 0, true);

            if (shapeParamNum > 0)
            {
                string[] shapeParams = new string[shapeParamNum];
                for (int i = 0; i < shapeParamNum; ++i)
                {
                    shapeParams[i] = DBCUtil.ExtractString(node, "ShapeParam" + i, "", false);
                }

                if (0 == string.Compare("Circle", shapeType, true))
                {
                    m_Shape = new Circle(new Vector3(0, 0, 0), float.Parse(shapeParams[0]));
                }
                else if (0 == string.Compare("Line", shapeType, true))
                {
                    Vector3 start = Converter.ConvertVector3D(shapeParams[0]);
                    Vector3 end   = Converter.ConvertVector3D(shapeParams[1]);
                    m_Shape = new Line(start, end);
                }
                else if (0 == string.Compare("Rect", shapeType, true))
                {
                    float width  = float.Parse(shapeParams[0]);
                    float height = float.Parse(shapeParams[1]);
                    m_Shape = new Rect(width, height);
                }
                else if (0 == string.Compare("Polygon", shapeType, true))
                {
                    Polygon polygon = new Polygon();
                    foreach (string s in shapeParams)
                    {
                        Vector3 pt = Converter.ConvertVector3D(s);
                        polygon.AddVertex(pt);
                    }
                    m_Shape = polygon;
                }
            }

            return(true);
        }
예제 #30
0
        /**
         * @brief 从文本文件流中读取
         *
         * @param sr
         *
         * @return
         */
        private bool LoadFromStream_Text(StreamReader sr)
        {
            //--------------------------------------------------------------
            //临时变量
            List <string> vRet    = null;
            string        strLine = "";

            //读第一行,标题行
            strLine = sr.ReadLine();
            //读取失败,即认为读取结束
            if (strLine == null)
            {
                return(false);
            }

            vRet = ConvertStringList(strLine, new string[] { "\t" });
            if (vRet == null || vRet.Count == 0)
            {
                return(false);
            }
            m_Header = vRet;

            //--------------------------------------------------------------
            //初始化
            int nRecordsNum = 0;
            int nFieldsNum  = vRet.Count;

            //--------------------------------------------------------------
            //开始读取
            DBC_Row dbcRow = null;

            do
            {
                vRet   = null;
                dbcRow = null;

                //读取一行
                strLine = sr.ReadLine();
                //读取失败,即认为读取结束
                if (strLine == null)
                {
                    break;
                }

                //是否是注释行
                if (strLine.StartsWith("#"))
                {
                    continue;
                }

                //分解
                vRet = ConvertStringList(strLine, new string[] { "\t" });

                //列数不对
                if (vRet.Count == 0)
                {
                    continue;
                }
                if (vRet.Count != nFieldsNum)
                {
                    //补上空格
                    if (vRet.Count < nFieldsNum)
                    {
                        int nSubNum = nFieldsNum - vRet.Count;
                        for (int i = 0; i < nSubNum; i++)
                        {
                            vRet.Add("");
                        }
                    }
                }

                //第一列不能为空
                if (string.IsNullOrEmpty(vRet[0]))
                {
                    continue;
                }

                dbcRow      = new DBC_Row(this, nRecordsNum);
                dbcRow.Data = vRet;

                m_DataBuf.Add(dbcRow);

                nRecordsNum++;
            } while (true);

            //--------------------------------------------------------
            //生成正式数据库
            m_ColumNum = nFieldsNum;
            m_RowNum   = nRecordsNum;

            //--------------------------------------------------------
            //创建索引
            CreateIndex();

            return(true);
        }