示例#1
0
        public override ConfigDict GetConfig()
        {
            ConfigDict dict = new ConfigDict();

            dict.Add("max_value", max_value);
            dict.Add("axis", axis);
            return(dict);
        }
示例#2
0
        /// <summary>
        /// 解析Json配置文件
        /// </summary>
        private void AnalysisJson(string jsonPath)
        {
            //参数检查
            if (string.IsNullOrEmpty(jsonPath))
            {
                return;
            }

            TextAsset     configText = null;
            KeyValuesInfo configInfo = null;

            //开始解析Json
            try
            {
                configText = Loader.LoadAsset <TextAsset>(jsonPath);
                configInfo = JsonUtility.FromJson <KeyValuesInfo>(configText.text);
            }
            catch (Exception e)
            {
                throw e;
            }

            //将配置信息保存到字典
            foreach (KeyValuesNode node in configInfo._configInfo)
            {
                ConfigDict.Add(node._key, node._value);
            }
        }