修改提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using NBF.Fishing2;
|
||||
using RootMotion.FinalIK;
|
||||
using Log = NBC.Log;
|
||||
@@ -9,7 +10,6 @@ namespace NBF
|
||||
{
|
||||
public class Fishing
|
||||
{
|
||||
public FPlayer Player { get; private set; }
|
||||
private static Fishing _instance;
|
||||
|
||||
public static Fishing Instance
|
||||
@@ -22,6 +22,10 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
public MapRoom OldMap { get; private set; }
|
||||
|
||||
public MapRoom Map { get; private set; }
|
||||
|
||||
|
||||
public async FTask<bool> Go(int mapId, string roomCode = "")
|
||||
{
|
||||
@@ -37,6 +41,11 @@ namespace NBF
|
||||
RoomCode = roomCode
|
||||
});
|
||||
Log.Info($"进入地图请求返回={response.ErrorCode}");
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Notices.Error("enter room error");
|
||||
return false;
|
||||
}
|
||||
LoadingPanel.Show();
|
||||
await ChangeMap(response.MapId, response.RoomCode, response.Units);
|
||||
LoadingPanel.Hide();
|
||||
@@ -46,18 +55,17 @@ namespace NBF
|
||||
|
||||
public async FTask ChangeMap(int mapId, string roomCode, List<MapUnitInfo> units)
|
||||
{
|
||||
OldMap = Map;
|
||||
Map = Entity.Create<MapRoom>(Game.Main,true, true);
|
||||
Map.Code = roomCode;
|
||||
Map.Map = mapId;
|
||||
var sceneName = "Map1";
|
||||
//加载场景==
|
||||
await SceneHelper.LoadScene(sceneName);
|
||||
CreateUnit();
|
||||
}
|
||||
|
||||
|
||||
private void CreateUnit()
|
||||
{
|
||||
var gameObject = PrefabsHelper.CreatePlayer(SceneSettings.Instance.Node);
|
||||
Player = gameObject.GetComponent<FPlayer>();
|
||||
CameraManager.Instance.Mode = CameraShowMode.FPP;
|
||||
foreach (var mapUnitInfo in units)
|
||||
{
|
||||
Map.AddUnit(mapUnitInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user