コード例 #1
0
        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("DataTableMgr.CollectDataFromDBC collectData Row:{0} failed!", index);
                    LogSystem.Assert(ret, info);
                    if (ret)
                    {
                        m_DataContainer.Add(data);
                    }
                    else
                    {
                        result = false;
                    }
                }
            }

            return(result);
        }
コード例 #2
0
ファイル: ClickNpcManager.cs プロジェクト: Klanly/UnityClient
        public void Init()
        {
            m_NpcInfos.Clear();
            DBC dlgCfg = new DBC();

            if (dlgCfg.Load(HomePath.GetAbsolutePath(FilePathDefine_Client.C_ClickNpc)))
            {
                for (int index = 0; index < dlgCfg.RowNum; index++)
                {
                    DBC_Row node = dlgCfg.GetRowByIndex(index);
                    if (null != node)
                    {
                        ClickNpcInfo info = new ClickNpcInfo();
                        info.LinkId         = DBCUtil.ExtractNumeric <int>(node, "LinkId", 0, true);
                        info.StoryId        = DBCUtil.ExtractNumeric <int>(node, "StoryId", 0, false);
                        info.UIName         = DBCUtil.ExtractString(node, "UIName", "", false);
                        info.Currency       = DBCUtil.ExtractNumeric <int>(node, "Currency", 0, true);
                        info.CurrencySprite = DBCUtil.ExtractString(node, "CurrencySprite", "", false);
                        if (!m_NpcInfos.ContainsKey(info.LinkId))
                        {
                            m_NpcInfos.Add(info.LinkId, info);
                        }
                    }
                }
            }
        }
コード例 #3
0
        private ScriptInstanceInfo NewStoryInstance(int storyId, bool logIfNotFound)
        {
            ScriptInstanceInfo instInfo = GetUnusedStoryInstanceInfoFromPool(storyId);

            if (null == instInfo)
            {
                Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(WorldSystem.Instance.GetCurSceneId());
                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_Client.C_RootPath + cfg.m_StoryDslFile[i]);
                        filePath[i] = filePath[i].Replace('\\', '/');
                    }
                    StoryConfigManager.Instance.LoadStoryIfNotExist(storyId, 0, filePath);
                    StoryInstance inst = StoryConfigManager.Instance.NewStoryInstance(storyId, 0);

                    if (inst == null)
                    {
                        if (logIfNotFound)
                        {
                            LogSystem.Error("Can't load story config, story:{0} scene:{1} !", storyId, WorldSystem.Instance.GetCurSceneId());
                        }
                        return(null);
                    }
                    ScriptInstanceInfo res = new ScriptInstanceInfo();
                    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, WorldSystem.Instance.GetCurSceneId());
                    }
                    return(null);
                }
            }
            else
            {
                instInfo.m_IsUsed = true;
                return(instInfo);
            }
        }
コード例 #4
0
ファイル: WordFilter.cs プロジェクト: myl2232/ArkCrossEngine
        public void Load(string dictPath)
        {
            return;

            string path = HomePath.GetAbsolutePath(dictPath);

            if (path != string.Empty)
            {
                List <string> wordList = new List <string>();
                Array.Clear(MEMORYLEXICON, 0, MEMORYLEXICON.Length);
                string[] words = System.IO.File.ReadAllLines(path, System.Text.Encoding.UTF8);
                foreach (string word in words)
                {
                    string key = this.ToDBC(word);
                    wordList.Add(key);
                    //繁体转简体,暂不考虑
                    //wordList.Add(Microsoft.VisualBasic.Strings.StrConv(key, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0));
                }
                Comparison <string> cmp = delegate(string key1, string key2)
                {
                    return(key1.CompareTo(key2));
                };
                wordList.Sort(cmp);
                for (int i = wordList.Count - 1; i > 0; i--)
                {
                    if (wordList[i].ToString() == wordList[i - 1].ToString())
                    {
                        wordList.RemoveAt(i);
                    }
                }
                foreach (var word in wordList)
                {
                    WordGroup group = MEMORYLEXICON[(int)word[0]];
                    if (group == null)
                    {
                        group = new WordGroup();
                        MEMORYLEXICON[(int)word[0]] = group;
                    }
                    group.Add(word.Substring(1));
                }
            }
        }
コード例 #5
0
 public void Init(string mapFile, NpcManager npcMgr, ISpatialSystem spatialSys)
 {
     npc_manager_    = npcMgr;
     spatial_system_ = spatialSys;
     cell_manager_.Init(HomePath.GetAbsolutePath(mapFile));
 }