UILobbyComponentE.cs 763 B

1234567891011121314151617181920212223242526272829
  1. using Base;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. namespace Model
  5. {
  6. [EntityEvent(EntityEventId.UILobbyComponent)]
  7. public static class UILobbyComponentE
  8. {
  9. public static void Awake(this UILobbyComponent self)
  10. {
  11. ReferenceCollector rc = self.GetOwner<UI>().GameObject.GetComponent<ReferenceCollector>();
  12. GameObject createRoom = rc.Get<GameObject>("CreateRoom");
  13. GameObject joinRoom = rc.Get<GameObject>("JoinRoom");
  14. createRoom.GetComponent<Button>().onClick.Add(()=> self.OnCreateRoom());
  15. joinRoom.GetComponent<Button>().onClick.Add(()=>self.OnJoinRoom());
  16. }
  17. private static void OnCreateRoom(this UILobbyComponent self)
  18. {
  19. Log.Debug("create room");
  20. }
  21. private static void OnJoinRoom(this UILobbyComponent self)
  22. {
  23. }
  24. }
  25. }