GlobalConfigComponent.cs 488 B

123456789101112131415161718192021222324
  1. namespace Model
  2. {
  3. [ObjectEvent]
  4. public class GlobalConfigComponentSystem : ObjectSystem<GlobalConfigComponent>, IAwake
  5. {
  6. public void Awake()
  7. {
  8. this.Get().Awake();
  9. }
  10. }
  11. public class GlobalConfigComponent : Component
  12. {
  13. public static GlobalConfigComponent Instance;
  14. public GlobalProto GlobalProto;
  15. public void Awake()
  16. {
  17. Instance = this;
  18. string configStr = ConfigHelper.GetGlobal();
  19. this.GlobalProto = MongoHelper.FromJson<GlobalProto>(configStr);
  20. }
  21. }
  22. }