コード例 #1
0
 protected override void Run(Session session, Actor_VoteDissolveSelect message)
 {
     try
     {
         MatchRoom matchRoom = MatchRoomComponent.Ins.GetRoomUserIdIn(message.UserId);
         if (matchRoom != null)
         {
             matchRoom.PlayerVoteDissolveRoom(message.UserId, message.IsConsent);//玩家投票
         }
     }
     catch (Exception e)
     {
         Log.Error(e);
         throw;
     }
 }
コード例 #2
0
 //进入投票状态
 public static void RommEnterVoteDissolve(this MatchRoom matchRoom, long userId)
 {
     if (matchRoom.IsVoteDissolveIn)
     {
         return;                                                     //已经在投票状态 无法再次投票
     }
     matchRoom.IsVoteDissolveIn = true;                              //状态改为投票中
     matchRoom.VoteTimeResidue  = FiveStarOverTime.DissolveOverTime; //更改投票 超时剩余时间
     MatchRoomComponent.Ins.VoteInRooms.Add(matchRoom);              //把自己房间 加入到 投票超时房间里面
     //让游戏服的房间暂停游戏
     ActorHelp.SendeActor(matchRoom.GameServeRoomActorId, new Actor_PauseRoomGame()
     {
         IsPause = true
     });
     matchRoom.VoteDissolveResult = new Actor_VoteDissolveRoomResult(); //new 出发送个客户端的投票结果
     matchRoom.VoteDissolveResult.SponsorUserId = userId;               //记录发起人的UserId
     matchRoom.PlayerVoteDissolveRoom(userId, true);                    //发起投票解散房间
 }