/// <summary> /// 发送猜牌时的结果 /// </summary> public static void SendGuessCard(GuessInfo guessInfo) { byte[] byt = Incode.IncodeSecondaryCommand(TYPE, (int)SecondCommands.GUESS, DataDo.Object2Json(guessInfo)); NetStart.SendContend(byt); }
//界面打开 初始化 建一副牌 发牌 掷骰子(选首玩家) 开始执行逻辑(摸排(放置一边) //猜牌(选牌,选指定值,判定) 摊牌(归位) 下一位) 没牌直接猜 没有未知手牌(pass) 结束回合(回到房间界面) public override void DoCommand() { int command = BitConverter.ToInt32(bytes, 8); switch (command) { case 0: Initialize(); break; case 1: OpenGameScene(); Debug.Log("开始游戏,跳转场景"); break; case 2: byte[] sd = Decode.DecodSecondContendBtye(bytes); currentRoom = DataDo.Json2Object <RoomInfo>(sd); //必须在此时获取一次,里面携带玩家手牌信息 GamePanel.Get().DealWithCards(currentRoom); Debug.Log("显示手牌"); break; case 3: int[] dice = new int[2]; dice[0] = BitConverter.ToInt32(bytes, 12); dice[1] = BitConverter.ToInt32(bytes, 16); Debug.Log("dice[0] :" + dice[0] + " dice[1] :" + dice[1]); GamePanel.Get().SetForthgoer(dice[0] + dice[1]); GamePanel.Get().CreatDice(dice); break; case 4: Next(); //房间独立线程发出的 break; case 5: Debug.Log("接收到摸排结果"); byte[] content = Decode.DecodSecondContendBtye(bytes); GamePanel.Get().DisplayDraw(BitConverter.ToInt32(content, 0), DataDo.Json2Object <BaseCard>(content.Skip(4).ToArray())); break; case 6: Debug.Log("猜对了 将该牌公布"); GamePanel.Get().KitheCard_T(DataDo.Json2Object <GuessInfo>(Decode.DecodSecondContendBtye(bytes))); break; case 7: Debug.Log("猜错了 将该牌公布"); GuessInfo guessInfo = DataDo.Json2Object <GuessInfo>(Decode.DecodSecondContendBtye(bytes)); GamePanel.Get().KitheCard_F(guessInfo.whoIndex, guessInfo.delateIndex, guessInfo.lineCardSeatIndex); break; case 8: Debug.Log("-------------------公布玩家自选的手牌"); GamePanel.Get().OpenSelfSelect(DataDo.Json2Object <SingleDraw>(Decode.DecodSecondContendBtye(bytes))); break; case 9: Debug.Log("公布牌"); GamePanel.Get().OpenCards(BitConverter.ToInt32(bytes, 12)); break; case 10: Debug.Log("-----------------执行出局命令"); GamePanel.Get().DoOut(BitConverter.ToInt32(bytes, 12)); break; case 11: Debug.Log("-------------------游戏结束"); List <int> exitList = DataDo.Json2Object <List <int> >(Decode.DecodSecondContendBtye(bytes)); GamePanel.Get().GameOver(exitList); break; case 12: Debug.Log("-------------------创建自选计时器"); GamePanel.Get().CreatSelectSelfCardTimer(); break; case 13: Debug.Log("-------------------继续猜牌"); GamePanel.Get().DoContinue(); break; case 14: break; case 15: Debug.Log("-------------------接收到移动万能牌的命令"); Info info = DataDo.Json2Object <Info>(Decode.DecodSecondContendBtye(bytes)); GamePanel.Get().DoMoveLineCard(info.myId, DataDo.Json2Object <List <LineCardMoveInfo> >(info.content)); break; case 16: Debug.Log("-------------------玩家离线"); GamePanel.Get().OffLine(BitConverter.ToInt32(bytes, 12)); break; } }