Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

配置文件格式 #2

Open
SAYUII opened this issue Mar 21, 2020 · 2 comments
Open

配置文件格式 #2

SAYUII opened this issue Mar 21, 2020 · 2 comments

Comments

@SAYUII
Copy link

SAYUII commented Mar 21, 2020

拜读了代码,没学过as的提个小建议,配置文件可以使用properties格式,在程序开始时加载好所有配置,如果读不到就赋默认值,这样就不用担心配置文件与程序版本不兼容,不用每次增加配置都要改cfg的下标,没有编程经验的人看起来比较清晰,类似这种
#背景颜色
stage.backgroundColor=0x003C61
#文本颜色
stage.textColor=0xffffff

@SAYUII SAYUII changed the title 配置文件格式问题 配置文件格式 Mar 21, 2020
@LePtC
Copy link
Owner

LePtC commented Apr 29, 2020

这个格式很好呀,不过不知道怎么在as里实现emmm

@SAYUII
Copy link
Author

SAYUII commented Apr 29, 2020

加载程序时以=为分隔符形成一个全局map,然后需要用的的地方就去读这个map,比如上述例子
map.get("stage.backgroundColor")
map.get("stage.textColor")
这样读起来比较清晰,不用根据index去对照配置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants