| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.IO;
- using Base;
- namespace Model
- {
- [ObjectEvent]
- public class GlobalConfigComponentEvent : ObjectEvent<GlobalConfigComponent>, IAwake
- {
- public void Awake()
- {
- this.GetValue().Awake();
- }
- }
- /// <summary>
- /// 全局配置
- /// </summary>
- public class GlobalConfigComponent : Component
- {
- public GlobalProto GlobalProto;
-
- public void Awake()
- {
- {
- #if UNITY_EDITOR
- string filePath = @"./GlobalProto.txt";
- #else
- string filePath = @"../GlobalProto.txt";
- #endif
- if (!File.Exists(filePath))
- {
- throw new ConfigException("没有找到配置文件GlobalProto.txt");
- }
- this.GlobalProto = MongoHelper.FromJson<GlobalProto>(File.ReadAllLines(filePath)[0]);
- }
- }
- }
- }
|