首次提交
This commit is contained in:
115
Assets/Scripts/Fishing/Helper/MapHelper.cs
Normal file
115
Assets/Scripts/Fishing/Helper/MapHelper.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
// 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
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 开始进入地图
|
||||
// /// </summary>
|
||||
// public static async FTask<int> 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<ObjectWait>().Wait<Wait_SceneChangeFinish>();
|
||||
// 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<MapUnitInfo> units)
|
||||
// {
|
||||
// LoadingPanel.Show();
|
||||
//
|
||||
// var oldMap = App.Main.GetComponent<Map>();
|
||||
// await oldMap.UnLoadMap();
|
||||
//
|
||||
// var map = App.Main.AddComponent<Map>();
|
||||
// map.MapId = mapId;
|
||||
// map.RoomCode = roomCode;
|
||||
// map.SelfId = Game.SelfId;
|
||||
// foreach (var mapUnitInfo in units)
|
||||
// {
|
||||
// map.CreateMapUnit(mapUnitInfo);
|
||||
// }
|
||||
//
|
||||
// await map.LoadMap();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 卸载旧场景
|
||||
// /// </summary>
|
||||
// /// <param name="self"></param>
|
||||
// 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<ObjectWait>().Notify(new Wait_SceneChangeFinish());
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region Unit
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 加载所有unit单位
|
||||
// /// </summary>
|
||||
// /// <param name="self"></param>
|
||||
// public static async FTask LoadAllUnit(this Map self)
|
||||
// {
|
||||
// foreach (var (_, unit) in self.Units)
|
||||
// {
|
||||
// await unit.CreateView();
|
||||
// }
|
||||
//
|
||||
// var cameraComponent = self.Scene.GetComponent<CameraComponent>();
|
||||
// if (cameraComponent != null)
|
||||
// {
|
||||
// cameraComponent.Mode = CameraShowMode.FPP;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user