Exemplo n.º 1
0
        public int EnterTeam(WebPlayer webPlayer)
        {
            var ret = -1;
            var py  = this.GetPlayer(webPlayer.Id);

            if (py != null)
            {
                ret = 2;//已经在房间中
                return(ret);
            }
            //广播加入
            var tpb = webPlayer.GetIBehaviour <TeamPlayerBv>();

            tpb.TeamId = this.TeamId;
            tpb.TeamPlayer_Data.TeamId = this.TeamId;

            SendToAllPlayer(Msg_Json.Create_Msg_Json(NetOpCode.TeamPlayerJoin_Msg, new TeamPlayerJoin_Msg {
                TeamPlayer_Data = tpb.TeamPlayer_Data
            }));


            Dict_Rp.Add(webPlayer.Id, webPlayer);
            Log.Debug($"{webPlayer.Id}加入队伍:{TeamId}");

            ret = 1;
            return(ret);
        }
Exemplo n.º 2
0
 //解散小队
 public void DisBand()
 {
     foreach (var vk in this.Dict_Rp)
     {
         vk.Value.SendAsync(Msg_Json.Create_Msg_Json(NetOpCode.TeamDisband_Msg, new TeamDisband_Msg()));
     }
     this.CloseTeam();
 }
Exemplo n.º 3
0
 protected override void Run(WebPlayer webpy, RoomPlayerBv rpb, TableRoom tr, JObject message)
 {
     if (tr.RoomState == ERoomState.ERoom_InGame ||
         tr.RoomState == ERoomState.ERoom_GameOver)
     {
         GetNextFrame_Req getNextFrame_Req = message.ToObject <GetNextFrame_Req>();
         GetNextFrame_Res getNextFrame_Res = new GetNextFrame_Res();
         var tmp_fms = tr.ServerPlayer.PlayerRecoder.GetCurToEndFrame(getNextFrame_Req.CurFrameId);
         foreach (var fm in tmp_fms)
         {
             getNextFrame_Res.ListFrame.Add(fm);
         }
         webpy.SendAsync(Msg_Json.Create_Msg_Json(NetOpCode.GetNextFrame_Res, getNextFrame_Res));
     }
 }
Exemplo n.º 4
0
        public int ExitTeam(WebPlayer webPlayer)
        {
            var ret = -1;
            var py  = this.GetPlayer(webPlayer.Id);

            if (py == null)
            {
                return(ret);
            }
            ret = 1;
            RemovePlayer(webPlayer.Id);
            Log.Debug($"{webPlayer.Id}退出队伍:{TeamId}");
            var tpb = webPlayer.GetIBehaviour <TeamPlayerBv>();

            SendToAllPlayer(Msg_Json.Create_Msg_Json(NetOpCode.TeamPlayerLeave_Msg, new TeamPlayerLeave_Msg {
                TeamPlayer_Data = tpb.TeamPlayer_Data
            }));
            return(ret);
        }