OperaComponentSystem.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using UnityEngine;
  3. namespace ET.Client
  4. {
  5. [FriendOf(typeof(OperaComponent))]
  6. public static class OperaComponentSystem
  7. {
  8. [ObjectSystem]
  9. public class OperaComponentAwakeSystem : AwakeSystem<OperaComponent>
  10. {
  11. protected override void Awake(OperaComponent self, params object[] param)
  12. {
  13. self.mapMask = LayerMask.GetMask("Map");
  14. }
  15. }
  16. [ObjectSystem]
  17. public class OperaComponentUpdateSystem : UpdateSystem<OperaComponent>
  18. {
  19. protected override void Update(OperaComponent self)
  20. {
  21. if (Input.GetMouseButtonDown(1))
  22. {
  23. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  24. RaycastHit hit;
  25. if (Physics.Raycast(ray, out hit, 1000, self.mapMask))
  26. {
  27. C2M_PathfindingResult c2MPathfindingResult = new C2M_PathfindingResult();
  28. c2MPathfindingResult.Position = hit.point;
  29. self.ClientScene().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
  30. }
  31. }
  32. if (Input.GetKeyDown(KeyCode.R))
  33. {
  34. CodeLoader.Instance.LoadHotfix();
  35. EventSystem.Instance.Load();
  36. Log.Debug("hot reload success!");
  37. }
  38. if (Input.GetKeyDown(KeyCode.T))
  39. {
  40. C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
  41. self.ClientScene().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
  42. }
  43. }
  44. }
  45. }
  46. }