예제 #1
0
        public void OnLoad(string tag, LoadPath loadPath, DataSet data, Callback <string> callback)
        {
            CDebug.Log("load texture success " + loadPath.path);
            string str = "";

            if (StringCache.Instance.Contains(loadPath.path))
            {
                str = StringCache.Instance.Get(loadPath.path);
            }
            else
            {
                str = ByteConvert.BytesToString(data.bytes);
                StringCache.Instance.Add(loadPath.path, str);
            }

            Callback unload = () =>
            {
                str = "";
            };

            AddToUnloadTask(tag, unload);

            if (callback != null)
            {
                callback(str);
                callback = null;
            }
        }
예제 #2
0
        /// <summary>
        /// 加载并解析表
        /// </summary>
        public void Parse(bool useLocal = false)
        {
            string url;

            if (useLocal || !AppSetting.isRemote)
            {
                url = System.IO.Path.Combine(AppSetting.SourceDataPath, "setting/" + fileName);

                CDebug.Log("load tsv fileName " + url);
                //string content = LoadSettingNoLock(url);
                string content = ByteConvert.BytesToString(LoadSetting(url));
                //CDebug.Log(content);
                ParseString(content);
            }
            else
            {
                //CDebug.Log("--------------- setting/" + "setting/" + fileName);
                if (TaskManager.instance.localResPaths.ContainsKey("setting/" + fileName))
                {
                    var localPath = TaskManager.instance.localResPaths["setting/" + fileName];
                    TaskManager.instance.AddTask(localPath, "", (data) =>
                    {
                        string content = ByteConvert.BytesToString(data.bytes);
                        ParseString(content);
                    });
                }
            }
        }