结构大修改,改成朴实无华的结构,不过度架构。能跑就行
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
using NBF.Fishing2;
|
||||
using Log = NBC.Log;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class Map2C_ChangeMapHandler : Message<Map2C_ChangeMap>
|
||||
{
|
||||
protected override async FTask Run(Session session, Map2C_ChangeMap message)
|
||||
{
|
||||
Log.Info($"收到地图切换消息=={message.MapId}");
|
||||
// await MapHelper.ChangeMap(message.MapId);
|
||||
|
||||
// await MapHelper.CreateRoomTest(message.MapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9aca13592484450582e818dd128a23c2
|
||||
timeCreated: 1756301493
|
||||
@@ -0,0 +1,32 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
using NBC;
|
||||
using Log = NBC.Log;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class Map2C_RoleEnterMapNotifyHandler : Message<Map2C_RoleEnterRoomNotify>
|
||||
{
|
||||
protected override async FTask Run(Session session, Map2C_RoleEnterRoomNotify message)
|
||||
{
|
||||
Log.Info($"收到进入房间推送 id={message.Info.Id} ");
|
||||
var map = App.Main.GetComponent<Map>();
|
||||
if (map == null || !map.IsRoomMap)
|
||||
{
|
||||
Log.Info("房间不是好友房间,不处理进入请求");
|
||||
return;
|
||||
}
|
||||
|
||||
var info = message.Info;
|
||||
var unit = map.GetUnit(info.Id);
|
||||
if (unit == null)
|
||||
{
|
||||
unit = map.CreateMapUnit(info);
|
||||
}
|
||||
|
||||
await unit.CreateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0934eeab5b8445b824f1337f774379e
|
||||
timeCreated: 1757251141
|
||||
@@ -0,0 +1,27 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
using NBC;
|
||||
using Log = NBC.Log;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public class Map2C_RoleExitMapNotifyHandler : Message<Map2C_RoleExitRoomNotify>
|
||||
{
|
||||
protected override async FTask Run(Session session, Map2C_RoleExitRoomNotify message)
|
||||
{
|
||||
Log.Info($"收到离开房间推送 id={message.Id} ");
|
||||
var map = App.Main.GetComponent<Map>();
|
||||
if (map == null)
|
||||
{
|
||||
Log.Info("地图不存在,不处理退出请求");
|
||||
return;
|
||||
}
|
||||
if (map.Units.Remove(message.Id, out var unit))
|
||||
{
|
||||
unit.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18ae467167c44db1873fee88067d2f9a
|
||||
timeCreated: 1757251193
|
||||
Reference in New Issue
Block a user