Ejemplo n.º 1
0
        public override bool TakeAction()
        {
            LWGetWorldSinglePvpRank package = new LWGetWorldSinglePvpRank()
            {
                UserId   = m_UserId,
                ServerId = int.Parse(ConfigUtils.GetSetting("Server.Id"))
            };

            WorldServerSender.Send("LWGetWorldSinglePvpRankHandler", package, delegate(RemotePackage callback)
            {
                var res = RemoteCommunication.ParseRemotePackage <WLGetWorldSinglePvpRank>(callback.Message as byte[]);
                m_ResponsePacket.MyRank  = res.MyRank;
                m_ResponsePacket.MyScore = res.MyScore;
                for (int i = 0; i < res.PlayerInfo.Count; i++)
                {
                    m_ResponsePacket.PlayerInfo.Add(new PBPlayerInfo()
                    {
                        Id           = res.PlayerInfo[i].Id,
                        Name         = res.PlayerInfo[i].Name,
                        PortraitType = res.PlayerInfo[i].PortraitType,
                    });
                    m_ResponsePacket.ServerId.Add(res.ServerId[i]);
                    m_ResponsePacket.Score.Add(res.Score[i]);
                }
                var buff = CustomActionDispatcher.GeneratePackageStream(actionGetter.GetActionId(), ProtoBufUtils.Serialize(m_ResponsePacket));
                GameSession.Get(m_UserId).SendAsync(buff, 0, buff.Length);
            });
            return(true);
        }
Ejemplo n.º 2
0
        private static void RegisterLobbyServer()
        {
            RequestParam param = new RequestParam();

            param.Add("Port", ConfigUtils.GetSetting("Game.Port"));
            WorldServerSender.Send("LWRegisterLobbyServerHandler", param, callback =>
            {
                TraceLog.ReleaseWrite("RegisterLobbyServer OK.");
            });
        }
Ejemplo n.º 3
0
        public static bool StopSingleMatch(int userId)
        {
            bool success = false;
            LWCancelSinglePvpMatching package = new LWCancelSinglePvpMatching();

            package.PlayerId = userId;
            WorldServerSender.Send("LWCancelSinglePvpMatchingHandler", package, delegate(RemotePackage callback)
            {
                var res = RemoteCommunication.ParseRemotePackage <WLCancelSinglePvpMatching>(callback.Message as byte[]);
                success = res.Success;
            });
            return(success);
        }
Ejemplo n.º 4
0
        public static bool StartSingleMatch(int userId)
        {
            bool success = false;
            LWStartSinglePvpMatching package = new LWStartSinglePvpMatching();

            package.RoomPlayerInfo = GetPlayerRoomData(userId);
            WorldServerSender.Send("LWStartSinglePvpMatchingHandler", package, delegate(RemotePackage callback)
            {
                var res = RemoteCommunication.ParseRemotePackage <WLStartSinglePvpMatching>(callback.Message as byte[]);
                success = res.Success;
            });
            return(success);
        }