EnterMapHelper.cs 789 B

123456789101112131415161718192021222324252627
  1. using System;
  2. namespace ET.Client
  3. {
  4. public static class EnterMapHelper
  5. {
  6. public static async ETTask EnterMapAsync(Scene clientScene)
  7. {
  8. try
  9. {
  10. G2C_EnterMap g2CEnterMap = await clientScene.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
  11. clientScene.GetComponent<PlayerComponent>().MyId = g2CEnterMap.MyId;
  12. // 等待场景切换完成
  13. await clientScene.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
  14. EventSystem.Instance.Publish(clientScene, new EventType.EnterMapFinish());
  15. }
  16. catch (Exception e)
  17. {
  18. Log.Error(e);
  19. }
  20. }
  21. }
  22. }