//void RecevEnterGoldNotEnough(MsgGlobal msg) //{ // Debug.Log("金币不够使用道具"); // UIManagers.Instance.EnqueueTip("金币不足"); // NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EGoldNotEnough); //} void RecevGoldEnterSuc(MsgGlobal msg) { Debug.Log("RecevEnterSuc"); //思想:Module层控制数据,View层纯显示 GameManager.Instance.ClearCurGame(); MsgGuandanRoom data = msg.guandan_room; if (data.gold_ready_player != null) { var playerReadyList = data.gold_ready_player.pid; if (playerReadyList != null) { GoldFiledManager.Instance.UpdateReadyPlayer(playerReadyList); } } if (data.gold_playground.type == (uint)EJoinRoomType.EEnter) { UIManagers.Instance.EnqueueTip("加入房间成功"); } else { UIManagers.Instance.EnqueueTip("加入房间成功"); } GoldFiledManager.Instance.UpdateGoldPlayerGroundData(msg.guandan_room.gold_playground); RoomInfo.Instance.GetRoomInfo(data.room_info); PlayerInfo.Instance.mPlayerData.roomCode = data.room_info.roomCode; RoomInfo.Instance.UpdatePlayersDic(data.player_info); NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ERoomJoin_Suc); }
public void SendTalkServer(string voiceName, uint time) { MsgGlobal mGl = new MsgGlobal(); MsgGuandanRoom msg = mGl.guandan_room; msg.voiceName = voiceName; msg.msg_talk = new MsgTalk(); msg.msg_talk.time = time; TCPNetWork.GetInstance().SendMsgToServer(ServerMsgKey.CLIENT_TALK, mGl); }
void RecevTotalBureau(MsgGlobal msg) { if (RoomInfo.Instance.mRoom == null) { Debug.Log("Room 为null"); return; } MsgGuandanRoom data = msg.guandan_room; Debug.Log("总结算"); ArgsMsgTotalScore scoreArgs = new ArgsMsgTotalScore(); scoreArgs.List = data.game_totalScore; NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ETotalBureauOverGame, scoreArgs); }
void RoomJoinSUC(MsgGlobal msg) { SDKManager.Instance.shareRoomCode = PlayerInfo.Instance.mPlayerData.roomCode; SDKManager.Instance.isWechatCallback = 0; //思想:Module层控制数据,View层纯显示 RoomInfo.Instance.mRoomId = msg.room_id; MsgGuandanRoom data = msg.guandan_room; RoomInfo.Instance.GetRoomInfo(data.room_info); PlayerInfo.Instance.mPlayerData.roomCode = data.room_info.roomCode; RoomInfo.Instance.UpdatePlayersDic(data.player_info); RoomInfo.Instance.mSameIpArgs.list.Clear(); if (data.same_ip_player != null && data.same_ip_player.Count == 4) { for (int i = 0; i < data.same_ip_player.Count; i++) { RoomInfo.Instance.mSameIpArgs.list.Add(data.same_ip_player[i]); } Debug.Log("IP 冲突" + data.same_ip_player.Count + "人数"); } NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ERoomJoin_Suc); }
void RoomJoinNewPlayer(MsgGlobal msg) { MsgGuandanRoom data = msg.guandan_room; //Test============================================ string str = "====="; for (int i = 0; i < data.player_info.Count; i++) { str += data.player_info[i].name + "&&&"; } Debug.Log(str); //Test============================================ RoomInfo.Instance.UpdatePlayersDic(data.player_info); NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ERoomJoin_other_join); if (GoldFiledManager.Instance.mIsGoldFiled) //金币场不作准备 { return; } if (data.same_ip_player != null && data.same_ip_player.Count == 4) { ArgsSameIpPlayer args = new ArgsSameIpPlayer(); for (int i = 0; i < data.same_ip_player.Count; i++) { args.list.Add(data.same_ip_player[i]); } NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ESameIpPlayer, args); } else if (RoomInfo.Instance.GetRealPlayerCount() == 3) { NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ESendCanReadyGame); } }
void RevcCanPutOutCard(MsgGlobal msg) { SelfCardsManager.Instance.initTonghuashunTip(); MsgGuandanRoom data = msg.guandan_room; NotificaPlayerPut(data.action.action_id, data.action.last_operation_pid, data.action.action_type, data.ybq); //玩家出牌箭头指示 (更新玩家出牌状态) //游戏中胜利是否判断 var gameOverInfo = data.game_over_info; bool isGameOver = gameOverInfo.Count > 0; if (isGameOver) { PlayingGameInfo.Instance.mGameOverInfoList = gameOverInfo; //用于记录 ,临时退出 } PlayingGameInfo.Instance.mPlayingStatus = EPlayingStatus.EBureau; var selfId = PlayerInfo.Instance.mPlayerPid; ArgsCanputOutCard args = new ArgsCanputOutCard(); args.playerId = (uint)data.action.action_id; //当前出牌玩家id args.cards = data.action.last_card; //出牌信息 args.putOutType = data.action.last_ct; //玩家出牌类型 args.lastPlayerId = (uint)data.action.last_action_id; args.actionType = data.action.action_type; //玩家是否是借风之类 args.lastOperationPId = data.action.last_operation_pid; // 上一次打出牌的玩家id(非不出) args.sendCardInfo = data.send_card_info; // 每个玩家都要对比手牌数量 args.DjCards = data.djCards; SelfCardsManager.Instance.mIsRecevCardTip = false; SelfCardsManager.Instance.mMsgAction = data.action; NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ECanPutOutCard, args); //结算(出头游) var gameCleanInfo = data.player_clean_info; if (gameCleanInfo != null) { Debug.Log("=========玩家" + gameCleanInfo.player_id + "胜利" + gameCleanInfo.rank + "游"); var posType = RoomInfo.Instance.GetPlayerPositionType(gameCleanInfo.player_id); PlayingGameInfo.Instance.AddLastCleanPlayerDic(posType); ArgsGameCleanInfo e = new ArgsGameCleanInfo(); e.playerId = gameCleanInfo.player_id; e.rank = gameCleanInfo.rank; NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EGameClean, e); } if (isGameOver) { ArgsMsgGameOverMsg argsGameOver = new ArgsMsgGameOverMsg(); for (int i = 0; i < gameOverInfo.Count; i++) { var itemInfo = gameOverInfo[i]; argsGameOver.mGameOverList.Add(itemInfo); if (itemInfo.player_id == selfId) //是自己的情况,计算加分 { PlayingGameInfo.Instance.mScore += (int)itemInfo.goal; } else { RoomInfo.Instance.GetPlayerInfoById(itemInfo.player_id).goal += (int)itemInfo.goal; } } //展示最后出的手牌 if (data.game_over_card != null) { var lastCard = data.game_over_card.send_card_info; if (lastCard != null && lastCard.Count > 0) { for (int i = 0; i < lastCard.Count; i++) { argsGameOver.mShowLastCard.Add(lastCard[i]); } } } argsGameOver.mIsTotalOver = PlayingGameInfo.Instance.mGameInfo.game_index == RoomInfo.Instance.mRoom.game_num; NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EGameBureauOver, argsGameOver); } }