一种快速的、轻量的、简单的本地序列化配置功能
A fast, lightweight, and simple local serialization configuration feature
核心用法:
Core usage:
【1】EasyConfigHandler.Data()
【2】EasyConfigHandler.Save(newConfig)
注意:内置缓存机制,故支持Update()等高频访问
Note: Built-in caching mechanism, therefore supports high-frequency access such as Update().
核心方法清单如下:
The list of core methods is as follows:
【1】 泛型接口(Generic Interface):IEasyConfigBase
【2】 泛型配置控制类(Generic Configuration Controller):EasyConfigHandler
The steps to use are as follows:
【Step1】
导入插件WPZ0325.EasyConfig,创建自定义配置类,比如“XXXXConfig”
Import the plugin WPZ0325.EasyConfig and create a custom configuration class, such as 'XXXXConfig'
【Step2】 根据需求自定义配置的数据结构
Data structures customized according to requirements
【Step3】
引入命名空间WPZ0325.EasyConfig,给配置类实现接口IEasyConfigBase,并设定配置的默认值
Introduce the namespace WPZ0325.EasyConfig, implement the IEasyConfigBase interface for the configuration class, and set the default values for the configuration.
【Step4】
在业务代码中直接使用EasyConfigHandler来获取配置数据或更新配置数据,如下图:
In the business code, directly use EasyConfigHandler to obtain or update configuration data, as shown in the figure below:
【Step5】
结束!
The end!
Additional explanation:
执行程序后StreamingAssets自动生成文件夹EasyConfigsRoot
After running the program, the StreamingAssets folder EasyConfigsRoot is automatically created.
该文件夹里面存放配置Json文件,用户可根据需要直接自定义编辑参数值即可
This folder contains configuration JSON files. Users can directly customize and edit the parameter values as needed.
