ClientConfigComponent.cs 470 B

12345678910111213141516171819202122232425
  1. using System.IO;
  2. using Base;
  3. namespace Model
  4. {
  5. [ObjectEvent]
  6. public class ClientConfigComponentEvent : ObjectEvent<ClientConfigComponent>, IAwake
  7. {
  8. public void Awake()
  9. {
  10. this.GetValue().Awake();
  11. }
  12. }
  13. public class ClientConfigComponent : Component
  14. {
  15. public ClientConfig Config { get; private set; }
  16. public void Awake()
  17. {
  18. string s = File.ReadAllText("./ClientConfig.txt");
  19. this.Config = MongoHelper.FromJson<ClientConfig>(s);
  20. }
  21. }
  22. }