示例#1
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);
        }
示例#2
0
        private StoryInstanceInfo NewStoryInstance(int storyId, bool logIfNotFound)
        {
            StoryInstanceInfo instInfo = GetUnusedStoryInstanceInfoFromPool(storyId);

            if (null == instInfo)
            {
                int sceneResId       = m_CurScene.SceneResId;
                Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneResId);
                if (null != cfg)
                {
                    int      ct       = cfg.m_StoryDslFile.Count;
                    string[] filePath = new string[ct];
                    for (int i = 0; i < ct; i++)
                    {
                        filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Server.C_RootPath + cfg.m_StoryDslFile[i]);
                    }
                    StoryConfigManager.Instance.LoadStoryIfNotExist(storyId, sceneResId, filePath);
                    StoryInstance inst = StoryConfigManager.Instance.NewStoryInstance(storyId, sceneResId);

                    if (inst == null)
                    {
                        if (logIfNotFound)
                        {
                            LogSystem.Error("Can't load story config, story:{0} scene:{1} !", storyId, sceneResId);
                        }
                        return(null);
                    }
                    StoryInstanceInfo res = new StoryInstanceInfo();
                    res.m_StoryId       = storyId;
                    res.m_StoryInstance = inst;
                    res.m_IsUsed        = true;

                    AddStoryInstanceInfoToPool(storyId, res);
                    return(res);
                }
                else
                {
                    if (logIfNotFound)
                    {
                        LogSystem.Error("Can't find story config, story:{0} scene:{1} !", storyId, sceneResId);
                    }
                    return(null);
                }
            }
            else
            {
                instInfo.m_IsUsed = true;
                return(instInfo);
            }
        }
示例#3
0
        private SkillInstanceInfo NewSkillInstance(int skillId)
        {
            SkillInstanceInfo instInfo = GetUnusedSkillInstanceInfoFromPool(skillId);

            if (null == instInfo)
            {
                SkillLogicData skillData = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_SKILL, skillId) as SkillLogicData;
                if (null != skillData)
                {
                    string filePath = HomePath.GetAbsolutePath(FilePathDefine_Server.C_SkillDslPath + skillData.SkillDataFile);
                    SkillConfigManager.Instance.LoadSkillIfNotExist(skillId, filePath);
                    SkillInstance inst = SkillConfigManager.Instance.NewSkillInstance(skillId);

                    if (null != inst)
                    {
                        SkillInstanceInfo res = new SkillInstanceInfo();
                        res.m_SkillId       = skillId;
                        res.m_SkillInstance = inst;
                        res.m_IsUsed        = true;

                        AddSkillInstanceInfoToPool(skillId, res);
                        return(res);
                    }
                    else
                    {
                        LogSystem.Error("Can't find skill dsl or skill dsl error, skill:{0} !", skillId);
                        return(null);
                    }
                }
                else
                {
                    LogSystem.Error("Can't find skill config, skill:{0} !", skillId);
                    return(null);
                }
            }
            else
            {
                instInfo.m_IsUsed = true;
                return(instInfo);
            }
        }