// using System; // using System.Collections.Generic; // using Fantasy; // using Fantasy.Async; // using NBC; // using Fantasy.Entitas; // using UnityEngine; // using Log = NBC.Log; // using Object = System.Object; // // namespace NBF.Fishing2 // { // public static class MapHelper // { // #region Map // // /// // /// 开始进入地图 // /// // public static async FTask EnterMap(int mapId, string roomCode = "") // { // try // { // var root = Game.Main; // // var response = (G2C_EnterMapResponse)await Net.Call(new C2G_EnterMapRequest() // { // MapId = mapId, // RoomCode = roomCode // }); // Log.Info($"进入地图请求返回={response.ErrorCode}"); // // await ChangeMap(response.MapId, response.RoomCode, response.Units); // // 等待场景切换完成 // // await root.GetComponent().Wait(); // Log.Info($"等待场景切换结束"); // await root.EventComponent.PublishAsync(new EnterMapFinish()); // LoadingPanel.Hide(); // } // catch (Exception e) // { // Log.Error(e); // return ErrorCode.Error; // } // // return ErrorCode.Success; // } // // // public static async FTask ChangeMap(int mapId, string roomCode, List units) // { // LoadingPanel.Show(); // // var oldMap = App.Main.GetComponent(); // await oldMap.UnLoadMap(); // // var map = App.Main.AddComponent(); // map.MapId = mapId; // map.RoomCode = roomCode; // map.SelfId = Game.SelfId; // foreach (var mapUnitInfo in units) // { // map.CreateMapUnit(mapUnitInfo); // } // // await map.LoadMap(); // } // // // /// // /// 卸载旧场景 // /// // /// // public static async FTask UnLoadMap(this Map self) // { // await FTask.CompletedTask; // } // // public static async FTask LoadMap(this Map self) // { // var sceneName = "Map1"; // //加载场景== // await SceneHelper.LoadScene(sceneName); // await self.LoadAllUnit(); // FishingPanel.Show(); // // // 通知等待场景切换的协程 // App.Main.GetComponent().Notify(new Wait_SceneChangeFinish()); // } // // #endregion // // #region Unit // // /// // /// 加载所有unit单位 // /// // /// // public static async FTask LoadAllUnit(this Map self) // { // foreach (var (_, unit) in self.Units) // { // await unit.CreateView(); // } // // var cameraComponent = self.Scene.GetComponent(); // if (cameraComponent != null) // { // cameraComponent.Mode = CameraShowMode.FPP; // } // } // // #endregion // } // }