艹
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Network.Route;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class G2M_RequestAddressableIdHandler : RouteRPC<Scene, G2M_RequestAddressableId, M2G_ResponseAddressableId>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2M_RequestAddressableId request, M2G_ResponseAddressableId response, Action reply)
|
||||
{
|
||||
// 1、因为是测试代码,所以默认每次请求这个协议我都创建一个新的Unit来做Addressable。
|
||||
var unit = Entity.Create<Unit>(scene, false, true);
|
||||
// 2、给Unit添加AddressableMessageComponent组件,并执行Register(),向AddressableScene注册自己当前的位置。
|
||||
await unit.AddComponent<AddressableMessageComponent>().Register();
|
||||
// 3、返回给Gate服务器AddressableId
|
||||
response.AddressableId = unit.Id;
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public class G2M_CreateSubSceneRequestHandler : RouteRPC<Scene, G2M_CreateSubSceneRequest, M2G_CreateSubSceneResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2M_CreateSubSceneRequest request, M2G_CreateSubSceneResponse response, Action reply)
|
||||
{
|
||||
// 下面的SceneType传的是666,其实并没有这个类型,这个是我随便写的。
|
||||
var subScene = Scene.CreateSubScene(scene, 6666);
|
||||
// 返回subScene的运行时id
|
||||
response.SubSceneRouteId = subScene.RouteId;
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Network.Route;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class G2SubScene_AddressableIdRequestHandler : RouteRPC<SubScene, G2SubScene_AddressableIdRequest, SubScene2G_AddressableIdResponse>
|
||||
{
|
||||
protected override async FTask Run(SubScene subScene, G2SubScene_AddressableIdRequest request, SubScene2G_AddressableIdResponse response, Action reply)
|
||||
{
|
||||
Log.Debug($"G2SubScene_AddressableIdRequestHandler {subScene.SceneType}");
|
||||
// 1、因为是测试代码,所以默认每次请求这个协议我都创建一个新的Unit来做Addressable。
|
||||
var unit = Entity.Create<Unit>(subScene, false, true);
|
||||
// 2、给Unit添加AddressableMessageComponent组件,并执行Register(),向AddressableScene注册自己当前的位置。
|
||||
await unit.AddComponent<AddressableMessageComponent>().Register();
|
||||
// 3、返回给Gate服务器AddressableId
|
||||
response.AddressableId = unit.Id;
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public class G2SubScene_SentMessageHandler : Route<Scene, G2SubScene_SentMessage>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2SubScene_SentMessage message)
|
||||
{
|
||||
Log.Debug($"接受到来自Gate的消息 SceneType:{scene.SceneType} Message:{message.Tag}");
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user