ET框架是熊猫大大写的双端框架,游戏客户端和服务端都是用C#语言来编写
新起一个服务名比如叫做Activity
1.配置文件StartSceneConfig
2. SceneFactory
switch (scene.SceneType)
{
case SceneType.Activity:
break;
}
定义SceneType枚举类型
public enum SceneType: uint
{
Activity = 66,
}
3.在InnerMessage.proto文件中定义消息
//ResponseType Activity2Other_Test
message Other2Activity_Test //IActorRequest
{
int32 RpcId = 90;
string testMessage = 1;
}
message Activity2Other_Test // IActorResponse
{
int32 RpcId = 90;
int32 Error = 91;
string Message = 92;
string responseMessage = 2;
}
4.导入配置文件和Proto文件
5.发送消息及编写消息的处理类
StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(unit.DomainZone(), "Activity");
Activity2Other_Test test = (Activity2Other_Test)await ActorMessageSenderComponent.Instance.Call(startSceneConfig.InstanceId, new Other2Activity_Test() { testMessage="12345" });
Log.Debug("###############" + test.responseMessage);
namespace ET.Server
{
[ActorMessageHandler(SceneType.Activity)]
public class Other2Activity_TestHandler: AMActorRpcHandler<Scene,Other2Activity_Test,Activity2Other_Test>
{
protected override async ETTask Run(Scene scene, Other2Activity_Test request, Activity2Other_Test response)
{
Log.Debug("%%%%%%%%%%%%$$$$$####@@@@@@@@@@@"+request.testMessage);
Log.Debug("&&"+scene.Name);
response.responseMessage = "67890";
await ETTask.CompletedTask;
}
}
}