protected override void Run(Session session, M2C_SetLandlord message) { UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); Gamer gamer = gamerComponent.Get(message.UserID); if (gamer != null) { HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); if (gamer.UserID == gamerComponent.LocalGamer.UserID) { //本地玩家添加手牌 handCards.AddCards(message.LordCards); } else { //其他玩家设置手牌数 handCards.SetHandCardsNum(20); } } foreach (var _gamer in gamerComponent.GetAll()) { HandCardsComponent handCardsComponent = _gamer.GetComponent <HandCardsComponent>(); GamerUIComponent gamerUIComponent = _gamer.GetComponent <GamerUIComponent>(); if (_gamer.UserID == message.UserID) { handCardsComponent.AccessIdentity = Identity.Landlord; gamerUIComponent.SetIdentity(Identity.Landlord); } else { handCardsComponent.AccessIdentity = Identity.Farmer; gamerUIComponent.SetIdentity(Identity.Farmer); } } //重置玩家UI提示 foreach (var _gamer in gamerComponent.GetAll()) { _gamer.GetComponent <GamerUIComponent>().ResetPrompt(); } //切换地主牌精灵 GameObject lordPokers = uiRoom.GameObject.Get <GameObject>("Desk").Get <GameObject>("LordPokers"); for (int i = 0; i < lordPokers.transform.childCount; i++) { Sprite lordCardSprite = CardHelper.GetCardSprite(message.LordCards[i].GetName()); lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordCardSprite; } //显示切换游戏模式按钮 uiRoom.GetComponent <UIRoomComponent>().Interaction.GameStart(); }
public void SetFlowGame(Actor_GameFlow message, GamerComponent gamerComponent) { Gamer[] gamers = gamerComponent.GetAll(); for (int i = 0; i < gamers.Length; i++) { if (gamers[i] == null) { continue; } if (gamers[i].UserID == PlayerInfoComponent.Instance.uid) { playerList.Insert(i, winPlayer); } } for (int i = 0; i < gamers.Length; i++) { Gamer gamer = gamers[i]; GameObject gameObject = this.playerList[i]; Image headImage = gameObject.transform.Find("head").GetComponent <Image>(); Text nameText = gameObject.transform.Find("name").GetComponent <Text>(); Text goldText = gameObject.transform.Find("Text_gold").GetComponent <Text>(); HeadManager.setHeadSprite(headImage, gamer.PlayerInfo.Icon); nameText.text = gamer.PlayerInfo.Name; goldText.text = 0 + ""; } winPlayer.transform.Find("hupaiType").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_gameresult", "gameresult_liuju"); }
protected override void Run(Session session, Actor_Gameover_Ntt message) { UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); Identity localGamerIdentity = gamerComponent.LocalGamer.GetComponent <HandCardsComponent>().AccessIdentity; UI uiEndPanel = LandlordsEndFactory.Create(UIType.LandlordsEnd, uiRoom, message.Winner == localGamerIdentity); LandlordsEndComponent landlordsEndComponent = uiEndPanel.GetComponent <LandlordsEndComponent>(); foreach (var gamer in gamerComponent.GetAll()) { gamer.GetComponent <GamerUIComponent>().UpdatePanel(); gamer.GetComponent <HandCardsComponent>().Hide(); landlordsEndComponent.CreateGamerContent( gamer, message.Winner, message.BasePointPerMatch, message.Multiples, message.GamersScore[gamer.UserID]); } LandlordsRoomComponent landlordsRoomComponent = uiRoom.GetComponent <LandlordsRoomComponent>(); landlordsRoomComponent.Interaction.Gameover(); landlordsRoomComponent.ResetMultiples(); }
public void Awake() { ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); //倒计时 this.timeText = rc.Get <GameObject>("TimeText").GetComponent <Text>(); StartTimeDown(); //4个玩家 UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); this.gamers = gamerComponent.GetAll(); plays = new List <Text>(); for (int i = 1; i < 5; i++) { plays.Add(rc.Get <GameObject>("Play" + i).GetComponent <Text>()); } //退出 this.cancelBtn = rc.Get <GameObject>("CancelBtn").GetComponent <Button>(); this.sureBtn = rc.Get <GameObject>("SureBtn").GetComponent <Button>(); cancelBtn.onClick.Add(OnCancel); sureBtn.onClick.Add(OnSure); cancelCount = 0; SetPlayInfo(); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); }
protected override void Run(Session session, Actor_GameStart_Ntt message) { UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.LandlordsRoom); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); //初始化玩家UI foreach (var gamer in gamerComponent.GetAll()) { GamerUIComponent gamerUI = gamer.GetComponent <GamerUIComponent>(); gamerUI.GameStart(); HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); if (handCards != null) { handCards.Reset(); } else { handCards = gamer.AddComponent <HandCardsComponent, GameObject>(gamerUI.Panel); } handCards.Appear(); if (gamer.UserID == gamerComponent.LocalGamer.UserID) { //本地玩家添加手牌 handCards.AddCards(message.GamerCards); } else { //设置其他玩家手牌数 handCards.SetHandCardsNum(message.GamerCardsNum[gamer.UserID]); } } //显示牌桌UI GameObject desk = uiRoom.GameObject.Get <GameObject>("Desk"); desk.SetActive(true); GameObject lordPokers = desk.Get <GameObject>("LordPokers"); //重置地主牌 Sprite lordSprite = CardHelper.GetCardSprite("None"); for (int i = 0; i < lordPokers.transform.childCount; i++) { lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordSprite; } LandlordsRoomComponent uiRoomComponent = uiRoom.GetComponent <LandlordsRoomComponent>(); //清空选中牌 uiRoomComponent.Interaction.Clear(); //设置初始倍率 uiRoomComponent.SetMultiples(1); }
protected override void Run(Session session, M2C_GamerReconnect_ANtt message) { UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); uiRoom.GameObject.Get <GameObject>("ReadyButton").SetActive(false); foreach (var gamer in gamerComponent.GetAll()) { //初始化玩家身份 Identity gamerIdentity = message.GamersIdentity[gamer.UserID]; HandCardsComponent gamerHandCards = gamer.GetComponent <HandCardsComponent>(); GamerUIComponent gamerUI = gamer.GetComponent <GamerUIComponent>(); gamerHandCards.AccessIdentity = gamerIdentity; gamerUI.SetIdentity(gamerIdentity); //初始化出牌 if (message.DeskCards.Key == gamer.UserID && gamerIdentity != Identity.None) { Card[] deskCards = message.DeskCards.Value; if (deskCards != null) { gamerHandCards.PopCards(deskCards); } } else if (message.LordCards == null && message.GamerGrabLandlordState.ContainsKey(gamer.UserID)) { gamer.GetComponent <GamerUIComponent>().SetGrab(message.GamerGrabLandlordState[gamer.UserID]); } } //初始化界面 UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>(); uiRoomComponent.SetMultiples(message.Multiples); //当抢完地主时才能显示托管按钮 if (message.LordCards != null) { uiRoomComponent.Interaction.GameStart(); } //初始化地主牌 if (message.LordCards != null) { GameObject lordPokers = uiRoom.GameObject.Get <GameObject>("Desk").Get <GameObject>("LordPokers"); for (int i = 0; i < lordPokers.transform.childCount; i++) { Sprite lordCardSprite = CardHelper.GetCardSprite(message.LordCards[i].GetName()); lordPokers.transform.GetChild(i).GetComponent <Image>().sprite = lordCardSprite; } } }
/// <summary> /// 继续游戏 /// </summary> public void ContinueGamer() { players?.SetActive(false); this.changeTableBtn.gameObject.SetActive(true); this.readyBtn.gameObject.SetActive(true); this.desk.SetActive(false); this.trustship.SetActive(false); //碰刚按钮隐藏 this.giveUpBtn.gameObject.SetActive(false); this.huBtn.gameObject.SetActive(false); this.gangBtn.gameObject.SetActive(false); this.pengBtn.gameObject.SetActive(false); this.head.GetComponentInParent <RectTransform>().gameObject.SetActive(true); players.SetActive(false); isTreasureFinish = true; treasure.SetActive(false); faceCardObj.SetActive(false); //剩余牌数 restText.text = $""; GamerComponent gamerComponent = this.GetParent <UI>().GetComponent <GamerComponent>(); gamerComponent.IsPlayed = false; Gamer[] gamers = gamerComponent.GetAll(); foreach (var gamer in gamers) { if (gamer == null) { continue; } gamer?.GetComponent <HandCardsComponent>()?.ClearAll(); gamer?.GetComponent <GamerUIComponent>()?.zhuang.SetActive(false); gamer?.RemoveComponent <HandCardsComponent>(); } foreach (var face in FacePanel) { GameHelp.DeleteAllItem(face.gameObject); } }
/// <summary> /// 显示中间的指针 /// </summary> /// <param name="userId"></param> public void ShowTurn(long userId) { GamerComponent gamerComponent = this.GetParent <UI>().GetComponent <GamerComponent>(); foreach (var _gamer in gamerComponent.GetAll()) { HandCardsComponent cardsComponent = _gamer.GetComponent <HandCardsComponent>(); if (_gamer.UserID == userId) { cardsComponent.ShowBg(); } else { cardsComponent.CloseBg(); } } //时间重新开始 StartTime(); }
public void setData(Actor_GamerHuPai data, GamerComponent gamerComponent, int BeiLv) { this.huPaiNeedData = data; Gamer[] gamers = gamerComponent.GetAll(); Gamer huPaiGamer = gamerComponent.Get(data.Uid); for (int i = 0; i < gamers.Length; i++) { if (gamers[i] == null) { continue; } if (gamers[i].UserID == data.Uid) { playerList.Insert(i, winPlayer); } } int huaCount = 0; //设置胡牌的花数 List <int> dataHuPaiTypes = data.HuPaiTypes; for (int j = 0; j < dataHuPaiTypes.Count; j++) { Consts.HuPaiType huPaiType = (Consts.HuPaiType)dataHuPaiTypes[j]; int count; Logic_NJMJ.getInstance().HuPaiHuaCount.TryGetValue(huPaiType, out count); //胡牌花 huaCount += count; } //硬花 huaCount += data.YingHuaCount; //软花 huaCount += data.RuanHuaCount; huaCount += data.BixiaHuCount; //基数 huaCount += 20; //砸2 huaCount *= 2; //设置胡牌的人 for (int i = 0; i < gamers.Length; i++) { Gamer gamer = gamers[i]; GameObject gameObject = this.playerList[i]; Image headImage = gameObject.transform.Find("head").GetComponent <Image>(); Text nameText = gameObject.transform.Find("name").GetComponent <Text>(); Text goldText = gameObject.transform.Find("Text_gold").GetComponent <Text>(); //headImage.sprite = CommonUtil.getSpriteByBundle("playericon", gamer.PlayerInfo.Icon); HeadManager.setHeadSprite(headImage, gamer.PlayerInfo.Icon); nameText.text = gamer.PlayerInfo.Name + ""; //胡牌的ui if (gamer.UserID == data.Uid) { Text huaCountText = gameObject.Get <GameObject>("Text").GetComponent <Text>(); GameObject allhuashutype = gameObject.Get <GameObject>("Allhuashutype"); Text obj1 = allhuashutype.transform.GetChild(0).GetComponent <Text>(); Text obj2 = allhuashutype.transform.GetChild(1).GetComponent <Text>(); Text obj3 = allhuashutype.transform.GetChild(2).GetComponent <Text>(); obj1.gameObject.SetActive(true); obj2.gameObject.SetActive(true); obj3.gameObject.SetActive(true); obj1.text = $"硬花{data.YingHuaCount}"; obj2.text = $"软花{data.RuanHuaCount}"; obj3.text = $"基数{20}"; //胡牌类型 for (int j = 0; j < dataHuPaiTypes.Count; j++) { Consts.HuPaiType huPaiType = (Consts.HuPaiType)dataHuPaiTypes[j]; int count; string name; Logic_NJMJ.getInstance().HuPaiHuaCount.TryGetValue(huPaiType, out count); Logic_NJMJ.getInstance().HuPaiHuaName.TryGetValue(huPaiType, out name); Text obj = allhuashutype.transform.GetChild(j + 3).gameObject.GetComponent <Text>(); obj.gameObject.SetActive(true); obj.text = $"{name}{count}"; } if (data.BixiaHuCount > 0) { Text obj4 = allhuashutype.transform.GetChild(dataHuPaiTypes.Count + 3).GetComponent <Text>(); obj4.gameObject.SetActive(true); obj4.text = $"比下胡{data.BixiaHuCount}"; Text obj5 = allhuashutype.transform.GetChild(dataHuPaiTypes.Count + 4).GetComponent <Text>(); obj5.gameObject.SetActive(true); obj5.text = "砸2"; } else { Text obj4 = allhuashutype.transform.GetChild(dataHuPaiTypes.Count + 3).GetComponent <Text>(); obj4.gameObject.SetActive(true); obj4.text = "砸2"; } huaCountText.text = huaCount + ""; if (data.IsZiMo) { goldText.text = BeiLv * huaCount * 3 + ""; } else { goldText.text = BeiLv * huaCount + ""; } } else { if (data.IsZiMo) { if (BeiLv * huaCount == 0) { goldText.text = "0"; } else { goldText.text = "-" + BeiLv * huaCount + ""; } } else { if (gamer.UserID == data.FangPaoUid) { if (BeiLv * huaCount == 0) { goldText.text = "0"; } else { goldText.text = "-" + BeiLv * huaCount + ""; } nameText.color = Color.yellow; } } } } if (huPaiNeedData.IsZiMo) { winPlayer.transform.Find("hupaiType").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_gameresult", "gameresult_hu"); } SetHuPaiPlayerData(); }
public static async void StartGame(Actor_StartGame message, bool isReconnect) { Log.Debug($"收到开始"); try { UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); if (uiRoom == null) { uiRoom = Game.Scene.GetComponent <UIComponent>().Create(UIType.UIRoom); } Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIReady); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIGameResult); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>(); UIRoomComponent.ISGaming = true; uiRoomComponent.ContinueGamer(); //好友房设置将退出变成解散 if (UIRoomComponent.IsFriendRoom) { uiRoomComponent.SetFriendSetting(PlayerInfoComponent.Instance.uid); uiRoomComponent.SetCurrentJuCount(message.CurrentJuCount); } //先掷骰子 if (!isReconnect) { uiRoomComponent.exitBtn.interactable = false; uiRoomComponent.players.SetActive(true); GameObject DiceAnim = uiRoomComponent.dice.Get <GameObject>("DiceAnim"); GameObject DiceBottom = uiRoomComponent.dice.Get <GameObject>("DiceBottom"); Image Dice1 = DiceBottom.transform.Find("Dice1").GetComponent <Image>(); Image Dice2 = DiceBottom.transform.Find("Dice2").GetComponent <Image>(); DiceAnim.SetActive(true); SoundsHelp.Instance.playSound_ShaiZi(); await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(2000); DiceAnim.SetActive(false); DiceBottom.SetActive(true); int number1 = RandomHelper.RandomNumber(1, 7); Dice1.sprite = CommonUtil.getSpriteByBundle("Image_Dice", "num_" + number1); int number2 = RandomHelper.RandomNumber(1, 7); Dice2.sprite = CommonUtil.getSpriteByBundle("Image_Dice", "num_" + number2); await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(1000); //发牌动画 List <MahjongInfo> myCard = null; foreach (var gameData in message.GamerDatas) { foreach (var mahjong in gameData.handCards) { mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight; } foreach (var mahjong in gameData.faceCards) { mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight; } foreach (var gamer in gamerComponent.GetAll()) { if (gamer.UserID != gameData.UserID) { continue; } // if (gamer.UserID == PlayerInfoComponent.Instance.uid) // { // myCard = new List<MahjongInfo>(gameData.handCards); // } gamer.gameData = gameData; GamerUIComponent gamerUi = gamer.GetComponent <GamerUIComponent>(); gamerUi.GameStart(); gamer.IsBanker = gameData.IsBanker; HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); if (handCards != null) { handCards.Reset(); } else { handCards = gamer.AddComponent <HandCardsComponent, GameObject, int, int>(gamerUi.Panel, gamerUi.Index, gameData.SeatIndex); } handCards.myCard = new List <MahjongInfo>(gameData.handCards); } } for (int i = 0; i < 4; i++) { foreach (var gamer in gamerComponent.GetAll()) { HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); if (PlayerInfoComponent.Instance.uid == gamer.UserID) { handCards.StartDealCardAnim(true); } else { handCards.StartDealCardAnim(false); } await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(400); } } //自己的牌翻一下 foreach (var gamer in gamerComponent.GetAll()) { if (gamer.UserID == PlayerInfoComponent.Instance.uid) { HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); handCards.FanPai(); } } await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(500); DiceBottom.SetActive(false); } uiRoomComponent.StartGame(message.restCount); uiRoomComponent.exitBtn.interactable = true; // uiRoomComponent.SetRoomType(message.RoomType); foreach (var gameData in message.GamerDatas) { foreach (var mahjong in gameData.handCards) { mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight; } foreach (var mahjong in gameData.faceCards) { mahjong.m_weight = (Consts.MahjongWeight)mahjong.weight; } foreach (var gamer in gamerComponent.GetAll()) { if (gamer.UserID != gameData.UserID) { continue; } GamerUIComponent gamerUi = gamer.GetComponent <GamerUIComponent>(); gamerUi.GameStart(); HandCardsComponent handCards = gamer.GetComponent <HandCardsComponent>(); if (handCards != null) { handCards.Reset(); } else { handCards = gamer.AddComponent <HandCardsComponent, GameObject, int, int>(gamerUi.Panel, gamerUi.Index, gameData.SeatIndex); } //设置庄家 gamer.IsBanker = gameData.IsBanker; gamerUi.SetZhuang(); //当前出牌玩家 if (gamer.IsBanker) { gamerComponent.CurrentPlayUid = gamer.UserID; } if (gamer.UserID == gamerComponent.LocalGamer.UserID) { //本地玩家添加手牌 uiRoomComponent.SetTreasureTime(gameData.OnlineSeconds); handCards.AddCards(gameData.handCards); handCards.ShowBg(); } else { handCards.AddOtherCards(gamer.IsBanker); } handCards.SetFaceCards(gameData.faceCards); foreach (var card in gameData.faceCards) { gamerUi.SetBuHua(card.weight); } } } //时间倒计时 foreach (var gamer in gamerComponent.GetAll()) { if (gamer.IsBanker) { uiRoomComponent.ShowTurn(gamer.UserID); } } uiRoom.GameObject.SetActive(true); UIRoomComponent.ISGaming = true; uiRoomComponent?.tip?.SetActive(true); uiRoomComponent.tip.GetComponentInChildren <Image>().sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "shangji_tip"); await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(3000); if (uiRoomComponent != null) { if (uiRoomComponent.tip != null) { uiRoomComponent?.tip?.SetActive(false); } } } catch (Exception e) { Log.Error(e); } }
public static async Task GamerEnterRoom(Actor_GamerEnterRoom message) { try { //玩家还在结算画面 if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIGameResult) != null || UIRoomComponent.ISGaming) { return; } Log.Info($"收到玩家进入"); //第一次进入创建UIRoom if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom) == null) { CommonUtil.ShowUI(UIType.UIRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIMain); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICreateFriendRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIJoinRoom); } if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady) == null) { CommonUtil.ShowUI(UIType.UIReady); } UINetLoadingComponent.closeNetLoading(); UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); UI uiReady = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); UIRoomComponent roomComponent = uiRoom.GetComponent <UIRoomComponent>(); roomComponent.ContinueGamer(); roomComponent.enterRoomMsg = message; roomComponent.SetRoomType(message.RoomType, message.Multiples); Gamer[] gamers = gamerComponent.GetAll(); //清空座位 for (int i = 0; i < gamers.Length; i++) { if (gamers[i] == null) { continue; } if (gamers[i].UserID != 0) { Log.Debug("删除gamer"); roomComponent.RemoveGamer(gamers[i].UserID); } } GamerInfo localGamer = null; for (int i = 0; i < message.Gamers.Count; i++) { if (message.Gamers[i].UserID == PlayerInfoComponent.Instance.uid) { localGamer = message.Gamers[i]; gamerComponent.LocalGamer = GamerFactory.Create(localGamer.UserID, localGamer.IsReady, localGamer.playerInfo); break; } } if (localGamer == null) { return; } roomComponent.localGamer = localGamer; //好友房处理 if (message.RoomType == 3) { UIRoomComponent.IsFriendRoom = true; roomComponent.JuCount = message.JuCount; uiReady?.GetComponent <UIReadyComponent>()?.ClosePropt(); uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(true); uiReady?.GetComponent <UIReadyComponent>()?.ShowWeChat(message.RoomId.ToString()); roomComponent.RoomConfig.Multiples = message.Multiples; roomComponent.SetFriendSetting(message.MasterUserId); if (message.CurrentJuCount > 0) { uiReady?.GetComponent <UIReadyComponent>()?.CloseBtn(); roomComponent.exitBtn.interactable = false; } } else { uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(false); UIRoomComponent.IsFriendRoom = false; } for (int i = 0; i < message.Gamers.Count; i++) { GamerInfo gamerInfo = message.Gamers[i]; Gamer gamer; if (gamerInfo.UserID == localGamer.UserID) { gamer = gamerComponent.LocalGamer; } else { gamer = GamerFactory.Create(gamerInfo.UserID, gamerInfo.IsReady, gamerInfo.playerInfo); } UIReadyComponent uiReadyComponent = uiReady.GetComponent <UIReadyComponent>(); GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>(); //排序 int index = gamerInfo.SeatIndex - localGamer.SeatIndex; if (index < 0) { index += 4; } //设置准备 if (uiReadyComponent != null) { if (gamer?.PlayerInfo != null) { gamerUiComponent?.SetHeadPanel(uiReadyComponent.HeadPanel[index], index); gamerUiComponent?.SetFace(roomComponent.FacePanel[index]); uiReady?.GetComponent <UIReadyComponent>()?.SetPanel(gamer, index); //根据座位的indax添加玩家 roomComponent?.AddGamer(gamer, index); } } } SoundsHelp.Instance.playSound_JinRu(); } catch (Exception e) { Log.Error(e); } }