protected override async ETTask Run(Session session, C2R_Login request, R2C_Login response, Action reply) { // 随机分配一个Gate StartSceneConfig config = RealmGateAddressHelper.GetGate(session.DomainZone()); //Log.Debug($"gate address: {MongoHelper.ToJson(config)}"); // 向gate请求一个key,客户端可以拿着这个key连接gate G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await ActorMessageSenderComponent.Instance.Call( config.SceneId, new R2G_GetLoginKey() {Account = request.Account}); response.Address = config.OuterAddress; response.Key = g2RGetLoginKey.Key; response.GateId = g2RGetLoginKey.GateId; reply(); }
protected override async ETTask Run(Session session, C2G_EnterMap request, G2C_EnterMap response, Action reply) { Player player = session.GetComponent <SessionPlayerComponent>().Player; // 在map服务器上创建战斗Unit long mapInstanceId = StartSceneConfigCategory.Instance.GetBySceneName(session.DomainZone(), "Map").SceneId; M2G_CreateUnit createUnit = (M2G_CreateUnit)await ActorMessageSenderComponent.Instance.Call( mapInstanceId, new G2M_CreateUnit() { PlayerId = player.Id, GateSessionId = session.InstanceId }); player.UnitId = createUnit.UnitId; response.UnitId = createUnit.UnitId; reply(); }