Пример #1
0
        public static IEnumerator WWWLoadConfigFile(InitConfigDelegate pCallback)
        {
            WWW www = new WWW(GetConfigURL());

            yield return(www);

#if UNITY_EDITOR
            Debug.Log("Config Json : " + www.text);
#endif
            if (string.IsNullOrEmpty(www.error))
            {
                _ConfigInfo = xLitJson.JsonMapper.ToObject <STConfig>(www.text);
                if (pCallback != null)
                {
                    pCallback(true, "<color=#00ff00>Successfully! WWW Load Config File URL : " + GetConfigURL() + "</color>");
                }
            }
            else
            {
                if (pCallback != null)
                {
                    pCallback(false, "<color=#ff0000>Faild! WWW Load Config File URL : " + GetConfigURL() + "</color>");
                }
            }
        }
Пример #2
0
        public static bool EditorLoadConfig()
        {
            string   fullPath = Path.Combine(Application.dataPath, GetConfigFileName());
            FileInfo fileInfo = new FileInfo(fullPath);

            if (fileInfo.Exists == false)
            {
                return(false);
            }
            string str = File.ReadAllText(fullPath, Encoding.UTF8);

            _ConfigInfo = xLitJson.JsonMapper.ToObject <STConfig>(str);
            return(_ConfigInfo != null ? true : false);
        }
Пример #3
0
        public static bool EditorCreateConfigFile()
        {
            string   fullPath = Application.dataPath + "/xLIB/def_config.json";
            FileInfo fileInfo = new FileInfo(fullPath);

            if (fileInfo.Exists == false)
            {
                return(false);
            }
            string str = File.ReadAllText(fullPath, Encoding.UTF8);

            _ConfigInfo = xLitJson.JsonMapper.ToObject <STConfig>(str);
            return(_ConfigInfo != null ? true : false);
        }