Exemplo n.º 1
0
        /// <summary>
        /// 检测叫分状态
        /// </summary>
        /// <param name="roomData"></param>
        private void CheckCallScoreState()
        {
            for (int i = 0; i < 3; i++)
            {
                var vo = DataCenterComponent.Instance.userInfo.getUserBySeatID(i);

                if (vo != null)
                {
                    //判断当前玩家是否准备

                    int realSeatID = DDZGameHelper.ChangeSeat(vo.seatID);

                    int callScore = vo.point;

                    if (callScore > -1)
                    {
                        this.DDZOpTipPlugin.CallScoreById(realSeatID, callScore);
                    }

                    if (realSeatID == 0)
                    {
                        DDZGameConfigComponent.Instance.PreCallScore = callScore;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 玩家抢地主广播
        /// </summary>
        /// <param name="resp"></param>
        public void OtherQdz_Ntt(Actor_OtherQdz_Ntt resp)
        {
            //显示谁抢了多少分
            int realSeatID = DDZGameHelper.ChangeSeat(resp.ChairId);

            //如果是自己叫分,则隐藏掉操作面板
            if (realSeatID == 0)
            {
                this.DDZCallScorePlugin.Hide();
            }

            //清除倒计时时钟
            this.DDZPlayerHeadPlugin.ClearClockByID(realSeatID);

            int score = resp.Score;

            this.DDZOpTipPlugin.CallScoreById(realSeatID, score);

            //缓存分数,用于判断下次叫分是否灰掉

            if (score != 0)
            {
                DDZGameConfigComponent.Instance.PreCallScore = score;
            }

            //播放叫分音效
            SoundComponent.Instance.PlayClip(soundInfo.DDZ_male_Call_prefix + score);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 检测准备状态
        /// </summary>
        /// <param name="roomData"></param>
        private void CheckReadyState()
        {
            bool needShowWaitTip = false;

            for (int i = 0; i < 3; i++)
            {
                var vo = DataCenterComponent.Instance.userInfo.getUserBySeatID(i);

                if (vo != null)
                {
                    //判断当前玩家是否准备

                    int realSeatID = DDZGameHelper.ChangeSeat(vo.seatID);

                    bool isReady = vo.IsReady == 1 ? true : false;

                    this.DDZReadyPlugin.SetReadyByIndex(realSeatID, isReady);

                    if (realSeatID == 0 && !isReady)
                    {
                        this.DDZReadyPlugin.Show();
                    }
                }

                if (vo == null)
                {
                    needShowWaitTip = true;
                }
            }

            this.DDZReadyPlugin.SetEnterTipState(needShowWaitTip);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 显示手牌
        /// </summary>
        /// <param name="handCard"></param>
        public async void ShowHandCard(DDZCard handCard, bool hasAni = false)
        {
            if (handCard == null)
            {
                return;
            }

            this.ReSelect();

            this.HideHandCard();

            if (hasAni)
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_dealcard);
            }

            horizontalLayoutGroup.spacing = handCard.Card.Length > 17 ? DDZGameConfigComponent.Instance.handCardSortWidth : DDZGameConfigComponent.Instance.handCardNormalSortWidth;

            for (int i = 0; i < handCard.Card.Length; i++)
            {
                var cardValue = handCard.Card[i];

                DDZPokerItem item = handCardDic[i];

                if (hasAni)
                {
                    await Task.Delay(100);
                }

                int realId = DDZGameHelper.ChangeSeat(DDZGameConfigComponent.Instance.LordID);

                item.GetComponent <DDZPokerItemUIComponent>().SetPokerImageSprite(cardValue, realId == 0);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 设置玩家的手牌数目
        /// </summary>
        /// <param name="seatId"></param>
        /// <param name="cardNum"></param>
        public void SetCardNum(int seatId, int cardNum)
        {
            int realSeatId = DDZGameHelper.ChangeSeat(seatId);

            DDZGamer gamer = GamersDic[realSeatId];

            gamer.GetComponent <DDZGamerUIComponent>().SetCardNum(cardNum);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 请求叫地主
        /// </summary>
        /// <param name="_Score">叫分 0-不抢</param>
        public async void RequestAskScore(int _Score = 0)
        {
            var resp = (G2C_DDZAskScore_Res)await SessionComponent.Instance.Session.Call(
                new C2G_DDZAskScore_Req()
            {
                GameId = DDZGameHelper.CurrentGameInfo.GameId,
                AreaId = GameHelper.AreaList[DDZGameHelper.CurrentGameInfo.GameId][0].AreaId,
                UserId = GamePrefs.GetUserId(),
                RoomId = DDZGameHelper.RoomId,
                Score  = _Score
            });

            if (resp.Error != 0)
            {
                Game.PopupComponent.ShowMessageBox(resp.Message);
                return;
            }

            //流局
            if (resp.NextChairId == -1)
            {
                Log.Debug("当前是流局啦!!!!");

                this.DDZCallScorePlugin.Hide();

                DDZGameConfigComponent.Instance.ActiveChairId = -1;

                this.DDZOpTipPlugin.Reset();

                return;
            }

            //显示叫了几分
            int realSeatID = DDZGameHelper.ChangeSeat(resp.ChairId);

            this.DDZOpTipPlugin.CallScoreById(realSeatID, _Score);

            //把叫分面板隐藏掉

            this.DDZCallScorePlugin.Hide();

            //如果下一个玩家的操作是出牌
            if (resp.DoType < 2)
            {
                //下一个玩家操作
                int nextSeatID = DDZGameHelper.ChangeSeat(resp.NextChairId);

                //高亮显示头像
                DDZGameConfigComponent.Instance.ActiveChairId = resp.NextChairId;

                Log.Debug("玩家" + nextSeatID + "操作!!");
            }

            //播放音效
            SoundComponent.Instance.PlayClip(soundInfo.DDZ_male_Call_prefix + _Score);
        }
Exemplo n.º 7
0
        /// <summary>
        /// byte列表转int列表(牌的Value)
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static List <int> CardFromByteToValue(List <byte> list)
        {
            List <int> intList = new List <int>();

            for (int i = 0; i < list.Count; i++)
            {
                intList.Add(DDZGameHelper.GetPokerNum(list[i]));
            }

            return(intList);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 广播玩家离开房间
        /// </summary>
        /// <param name="Ntt"></param>
        public void ExitRoom_Ntt(Actor_QuitDDZHRoom_Ntt Ntt)
        {
            //清除准备标识
            var vo = DataCenterComponent.Instance.userInfo.getUserByUserID(Ntt.UserId);

            var myVo = DataCenterComponent.Instance.userInfo.getMyUserVo();

            var limitGold = 0;

            //如果通知自己退出房间,则直接将自已踢出房间至大厅

            if (vo.userID == myVo.userID && myVo.gold <= limitGold)
            {
                Game.PopupComponent.ShowTips(DataCenterComponent.Instance.tipInfo.SelfGoldNotEnoughTip);

                this._BackHall = true;

                this.FastQuitGame();

                return;
            }

            if (vo.userID == myVo.userID && (Ntt.Message1.Contains("金额不足") || Ntt.Message1.Contains("系统检测到")))
            {
                Game.PopupComponent.ShowTips(Ntt.Message1);

                this._BackHall = true;

                this.FastQuitGame();

                return;
            }

            if (vo != null)
            {
                int realSeatID = DDZGameHelper.ChangeSeat(vo.seatID);

                this.DDZReadyPlugin.SetReadyByIndex(realSeatID, false);
            }
            else
            {
                Log.Error("异常了!!!");
            }

            if (DataCenterComponent.Instance.userInfo.isExist(Ntt.UserId))
            {
                DataCenterComponent.Instance.userInfo.deleteUser(Ntt.UserId);
            }
            //重绘坐位玩家
            this.DDZPlayerHeadPlugin.SetOnSeatPlayer();

            this.CheckSeatIsFull();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 显示地主标识
        /// </summary>
        /// <param name="seatId"></param>
        public void SetLordHeadIcon(int seatId)
        {
            this.ClearAllLordHeadIcon();

            int realSeatID = DDZGameHelper.ChangeSeat(seatId);

            DDZGamer gamer = GamersDic[realSeatID];

            //gamer.GetComponent<DDZGamerUIComponent>().LandlordFlag.SetActive(true);

            gamer.GetComponent <DDZGamerUIComponent>().SetPlayerLordIcon(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 玩家轮循广播
        /// </summary>
        /// <param name="resp"></param>
        public async void DDZTurnPlayer_Ntt(Actor_DDZTurnPlayer_Ntt resp)
        {
            //剩余时间
            DDZGameConfigComponent.Instance.ActiveOpTime = resp.LeftTime;

            //判断当前游戏状态
            if (resp.State == (int)DDZ_GameState.CallScore)
            {
                Log.Debug("游戏状态:抢地主");

                int realSeatID = DDZGameHelper.ChangeSeat(resp.OperateId);

                if (realSeatID == 0)
                {
                    this.DDZCallScorePlugin.Show(resp.LeftTime);
                }

                //高亮显示头像
                DDZGameConfigComponent.Instance.ActiveChairId = resp.OperateId;
            }
            else if (resp.State == (int)DDZ_GameState.DaPai)
            {
                Log.Debug("游戏状态:出牌");

                int realSeatID = DDZGameHelper.ChangeSeat(resp.OperateId);

                //清除之前出牌界面
                this.DDZOutCardPlugin.ClearByIndex(realSeatID);

                if (realSeatID == 0)
                {
                    //弹出交互操作BAR
                    this.DDZInteractivePlugin.Show(resp.LeftTime);
                }

                //高亮显示头像
                DDZGameConfigComponent.Instance.ActiveChairId = resp.OperateId;

                //隐藏操作提示

                this.DDZOpTipPlugin.HideByIndex(realSeatID);

                //检测连续两个都是不出,则清屏
                await Task.Delay(200);

                this.DDZOpTipPlugin.CheckClearALL(realSeatID);
            }
            else if (resp.State == (int)DDZ_GameState.JieSuan)
            {
                Log.Debug("游戏状态:结算");
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 显示玩家高亮效果
        /// </summary>
        /// <param name="seatId"></param>
        public void SetActivePlayerHead(int seatId)
        {
            this.ClearAllActivePlayerIcon();

            int realSeatID = DDZGameHelper.ChangeSeat(seatId);

            if (realSeatID > -1)
            {
                DDZGamer gamer = GamersDic[realSeatID];

                gamer.GetComponent <DDZGamerUIComponent>().SetActivePlayerIcon(true);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 设置扑克牌
        /// </summary>
        /// <param name="poker"></param>
        public void SetPokerImageSprite(byte pokerId, bool isDiZhu = false)
        {
            this.Panel.SetActive(true);

            this.pokerId = pokerId;

            this.isDiZhu = isDiZhu;

            this.pokerInt = PokerCardsHelper.GetPokerOfInt(pokerId);

            this.pokerValue = DDZGameHelper.GetPokerNum(pokerId);

            _poker.sprite = SpriteHelper.GetPokerSprite(PokerCardsHelper.GetPokerOfInt(pokerId));

            this._dizhu.SetActive(isDiZhu);
        }
Exemplo n.º 13
0
        public void FastQuitGame()
        {
            //正常退出,则清除

            Game.PopupComponent.CloseNoticeUI();

            ClearReBackData();

            DDZGameHelper.Reset();

            DDZUIFactory.gameScene.Remove();

            UI overUI = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIDDZOverPanel);

            if (overUI != null)
            {
                DDZUIFactory.overPanel.Remove();
            }

            this.Reset();

            DataCenterComponent.Instance.userInfo.deleteAllUserExcptMe();

            if (DDZConfig.GameScene.PlayerListsPanel != null)
            {
                Game.PopupComponent.ClosePlayerListPanel();
            }

            if (_BackHall)
            {
                Game.EventSystem.Run(EventIdType.SubGameReBackLobby);

                //音乐切换为大厅

                SoundHelper.SubGameExitResetSound();

                SoundComponent.Instance.Stop(CurrentSoundName);

                var _soundVolume = PlayerPrefs.GetFloat("SoundVolume", 1);

                SoundComponent.Instance.PlayMusic(DataCenterComponent.Instance.soundInfo.bg_hall, 0, _soundVolume, true);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 座位玩家UI显示
        /// </summary>
        public void SetOnSeatPlayer()
        {
            this.ClearOnSeatPlayer();

            var _list = DataCenterComponent.Instance.userInfo.getOnSeatUsers();

            for (int i = 0; i < _list.Count; i++)
            {
                var userVo = _list[i];

                int realSeatId = DDZGameHelper.ChangeSeat(userVo.seatID);

                if (realSeatId < 3)
                {
                    DDZGamer gamer = GamersDic[realSeatId];

                    gamer.GetComponent <DDZGamerUIComponent>().SetPlayerUI(userVo);
                }
            }
        }
Exemplo n.º 15
0
        public void InitData()
        {
            if (DDZGameHelper.settle != null)
            {
                foreach (var item in DDZGameHelper.settle.PlayerData)
                {
                    var playerData = item;

                    int realSeatID = DDZGameHelper.ChangeSeat(playerData.ChairId);

                    //if (realSeatID == i)
                    // {
                    var item1 = _rf.Get <GameObject>("Item" + realSeatID);

                    var _ref = item1.GetComponent <ReferenceCollector>();

                    var WinScore = _ref.Get <GameObject>("WinScore").GetComponent <Text>();

                    var LoseScore = _ref.Get <GameObject>("LoseScore").GetComponent <Text>();


                    if (playerData.Score > 0)
                    {
                        WinScore.gameObject.SetActive(true);

                        LoseScore.gameObject.SetActive(false);

                        WinScore.text = "+" + playerData.Score;
                    }
                    else
                    {
                        WinScore.gameObject.SetActive(false);

                        LoseScore.gameObject.SetActive(true);

                        LoseScore.text = playerData.Score.ToString();
                    }
                    //}
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 将出的牌绘制出来
        /// </summary>
        /// <param name="seatID"></param>
        /// <param name="_card"></param>
        public void PlayCardBySeatID(int seatID, DDZCard _card)
        {
            if (_card.Card == null)
            {
                return;
            }

            var curOutList = this.outCardDic[seatID];

            this.ClearOutList(curOutList);

            for (int i = 0; i < _card.Card.Length; i++)
            {
                var cardValue = _card.Card[i];

                DDZPokerItem item = curOutList[i];

                int lordID = DDZGameHelper.ChangeSeat(DDZGameConfigComponent.Instance.LordID);

                item.GetComponent <DDZPokerItemUIComponent>().SetPokerImageSprite(cardValue, lordID == seatID);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 结束,摊牌
        /// </summary>
        /// <param name="list"></param>
        public void ShowHand(List <DDZCard> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                DDZCard cardData = list[i];

                var vo = DataCenterComponent.Instance.userInfo.getUserByUserID(cardData.UserId);

                if (vo != null && cardData != null)
                {
                    int realSeatID = DDZGameHelper.ChangeSeat(vo.seatID);

                    this.PlayCardBySeatID(realSeatID, cardData);

                    //重回时,赋值上一手的出牌.临时
                    if (realSeatID == 2 && cardData != null)
                    {
                        DDZGameConfigComponent.Instance.preOutCard = cardData;
                    }
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 第一个抢地主的人通知
        /// </summary>
        /// <param name="resp"></param>
        public void FirstQdz_Req_Ntt(Actor_FirstQdz_Req_Ntt resp)
        {
            //第一个抢地主的人
            int realSeatID = DDZGameHelper.ChangeSeat(resp.ChairId);

            //赋值
            DDZGameConfigComponent.Instance.ActiveOpTime = 15;

            //高亮显示头像
            DDZGameConfigComponent.Instance.ActiveChairId = resp.ChairId;

            if (realSeatID == 0)
            {
                this.DDZCallScorePlugin.Show(15);
            }
            else
            {
                Log.Debug("当前是座位:" + realSeatID + "抢地主中!");
            }

            //隐藏准备界面
            this.DDZReadyPlugin.Reset();
        }
Exemplo n.º 19
0
        /// <summary>
        /// 玩家出牌广播
        /// </summary>
        /// <param name="resp"></param>
        public async void OtherPlayCard_Ntt(Actor_OtherPlayCard_Ntt resp)
        {
            //获取真实座位ID
            int realSeatID = DDZGameHelper.ChangeSeat(resp.ChairId);

            //如果是自己出牌,则隐藏掉操作面板,并且刷新自己的手牌
            if (realSeatID == 0)
            {
                this.DDZInteractivePlugin.Hide();

                //手动移除掉手牌
                if (resp.PlayCard != null && resp.PlayCard.Card != null)
                {
                    this.DDZHandCardPlugin.RemoveCard(resp.PlayCard);
                }

                //将手牌位置重置

                this.DDZHandCardPlugin.ReSelect();
            }

            //清除倒计时时钟
            this.DDZPlayerHeadPlugin.ClearClockByID(realSeatID);

            //如果出的牌为空,表示要不起

            if (resp.PlayCard == null || resp.PlayCard.Card == null)
            {
                //清除该区域出的牌
                this.DDZOutCardPlugin.ClearByIndex(realSeatID);

                //播放要不起音效,自己就不用了播放
                if (realSeatID != 0)
                {
                    SoundComponent.Instance.PlayClip(soundInfo.DDZ_male_pass + ETModel.RandomHelper.RandomNumber(1, 3));
                }

                //显示要不起提示
                this.DDZOpTipPlugin.ShowOpTipById(realSeatID, 0);

                return;
            }

            //播放出牌音效
            SoundComponent.Instance.PlayClip(soundInfo.DDZ_sound_discard);

            //将出的牌显示出来
            this.DDZOutCardPlugin.PlayCardBySeatID(realSeatID, resp.PlayCard);

            //保存上家牌
            DDZGameConfigComponent.Instance.preOutCard = resp.PlayCard;

            //刷新倍数

            DDZGameConfigComponent.Instance.Times = resp.Times;

            this.DDZTopPlugin.SetBeiSu();

            //播放读牌音效
            this.PlayOutCardSound(resp.PlayCard, realSeatID);

            //更新玩家的手牌数量

            for (int i = 0; i < 3; i++)
            {
                int cardNum = resp.SurCardsNum[i];

                this.DDZPlayerHeadPlugin.SetCardNum(i, cardNum);

                int realSeatId = DDZGameHelper.ChangeSeat(i);

                //判断谁的手牌只有1张或者两张,播放警告语音

                if (realSeatId != -1)
                {
                    if (cardNum == 1 || cardNum == 2)
                    {
                        await Task.Delay(1000);

                        if (!this.CheckHadPlaySound(realSeatId, cardNum))
                        {
                            SoundComponent.Instance.PlayClip(soundInfo.DDZ_male_warning_prefix + cardNum);

                            this.SaveHadPlaySound(realSeatId, cardNum);
                        }
                    }
                }

                //显示警报器
                if (realSeatId != 0)
                {
                    if (cardNum == 1 || cardNum == 2)
                    {
                        this.DDZOpTipPlugin.ShowWarnById(realSeatId);
                    }
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 斗地主房间结算通知
        /// </summary>
        /// <param name="resp"></param>
        public async void DDZhSettlement_Req_Ntt(Actor_DDZhSettlement_Req_Ntt resp)
        {
            DDZGameHelper.IsStartGame = false;

            DDZGameHelper.settle = resp;

            //摊牌
            var showHandData = resp.ShowHand.ToList();

            this.DDZOutCardPlugin.ShowHand(showHandData);

            //将手牌全部清掉
            this.DDZHandCardPlugin.Reset();

            //清除操作提示

            this.DDZOpTipPlugin.Reset();

            //刷新所有玩家数据
            if (DDZGameHelper.settle != null)
            {
                foreach (var item in DDZGameHelper.settle.PlayerData)
                {
                    var vo = DataCenterComponent.Instance.userInfo.getUserByUserID(item.UserId);

                    if (vo != null)
                    {
                        vo.gold = item.Gold;

                        vo.score = (int)item.Score;
                    }
                }
            }

            //刷新座位玩家
            DDZPlayerHeadPlugin.SetOnSeatPlayer();

            //播放角色胜利失败特效

            await Task.Delay(500);

            int lordID = DDZGameHelper.ChangeSeat(DDZGameConfigComponent.Instance.LordID);

            var myVO = DataCenterComponent.Instance.userInfo.getMyUserVo();

            /*
             * if (lordID == 0)
             * {
             *  //如果我是地主
             *
             *  if (myVO.score > 0)
             *  {
             *      this.DDZFXLayerPlugin.PlayFX(DDZ_FX_TYPE.LordWin, 0);
             *  }
             *  else
             *  {
             *      this.DDZFXLayerPlugin.PlayFX(DDZ_FX_TYPE.LordLost, 0);
             *  }
             * }
             * else
             * {
             *  //如果我是农民
             *
             *  if (myVO.score > 0)
             *  {
             *      this.DDZFXLayerPlugin.PlayFX(DDZ_FX_TYPE.NMWin, 0);
             *  }
             *  else
             *  {
             *      this.DDZFXLayerPlugin.PlayFX(DDZ_FX_TYPE.NMLost, 0);
             *  }
             * }
             */

            //根据玩家的分数情况,切换至对应的胜利,失败状态

            if (DDZGameHelper.settle != null)
            {
                foreach (var item in DDZGameHelper.settle.PlayerData)
                {
                    var playerData = item;

                    int realSeatID = DDZGameHelper.ChangeSeat(playerData.ChairId);

                    DDZGamer gamer = DDZPlayerHeadPlugin.GamersDic[realSeatID];

                    if (playerData.Score > 0)
                    {
                        gamer.GetComponent <DDZGamerUIComponent>().SetHeadTransformByIndex(1);
                    }
                    else
                    {
                        gamer.GetComponent <DDZGamerUIComponent>().SetHeadTransformByIndex(2);
                    }
                }
            }


            //显示结算界面
            if (DDZGameHelper.IsJoinRoom)
            {
                await Task.Delay(3000);

                DDZUIFactory.overPanel.Create();
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 房间详情返回
        /// </summary>
        /// <param name="resp"></param>
        private void On_G2C_GetRoomInfo_Res(G2C_GetRoomInfo_Res resp)
        {
            DDZGameHelper.IsGetRoomDetails = true;

            DDZRoomData roomData = resp.RoomData.DdzRoomData;

            //将游戏配置参数保存
            DDZGameConfigComponent.Instance.SaveConfig(roomData);

            //保存倒计时
            DDZGameConfigComponent.Instance.LeftTime = resp.RoomData.LeftTime;

            //保存自己的信息,并刷新一次

            DataCenterComponent.Instance.userInfo.deleteAllUserExcptMe();

            var myVo = DataCenterComponent.Instance.userInfo.getMyUserVo();

            for (int i = 0; i < roomData.PlayerData.count; i++)
            {
                var playerData = roomData.PlayerData[i];

                // 保存谁是地主
                if (playerData.IsLord)
                {
                    DDZGameConfigComponent.Instance.LordID = playerData.ChairId;
                }

                if (!DataCenterComponent.Instance.userInfo.isExist(playerData.UserId))
                {
                    UserVO vo = new UserVO
                    {
                        userID = playerData.UserId,

                        headId = playerData.HeadId,

                        sex = playerData.Gender,

                        seatID = playerData.ChairId,

                        gold = playerData.Gold,

                        nickName = playerData.NickeName,

                        IsLord = playerData.IsLord ? 1 : 0,

                        IsReady = playerData.IsPrepare ? 1:0,

                        point = playerData.QdzJiaoFen //-1 没抢 1,2,3 0:不叫
                    };

                    DataCenterComponent.Instance.userInfo.addUser(vo);
                }
                else
                {
                    var vo = DataCenterComponent.Instance.userInfo.getUserByUserID(playerData.UserId);

                    vo.seatID = playerData.ChairId;

                    vo.IsLord = playerData.IsLord ? 1 : 0;

                    vo.gold = playerData.Gold;

                    vo.IsReady = playerData.IsPrepare?1:0;

                    vo.point = playerData.QdzJiaoFen;
                }
            }

            //显示座位玩家
            DDZPlayerHeadPlugin.SetOnSeatPlayer();

            //刷新倍数,底注

            this.DDZTopPlugin.SetBeiSu();

            this.DDZTopPlugin.SetBaseScore();

            //刷新底牌
            this.DDZTopPlugin.ShowDP(roomData.DpCards);

            //显示各个玩家的手牌数量

            if (roomData.SurCardsNum != null)
            {
                for (int i = 0; i < roomData.SurCardsNum.count; i++)
                {
                    int cardNum = roomData.SurCardsNum[i];

                    this.DDZPlayerHeadPlugin.SetCardNum(i, cardNum);
                }
            }

            //绘制玩家手牌
            if (roomData.Card != null)
            {
                this.DDZHandCardPlugin.ShowHandCard(roomData.Card);

                //刷新最新的手牌
                DDZGameConfigComponent.Instance.myHandCard = roomData.Card;
            }

            //绘制各玩家上一手的出牌

            if (roomData.PlayLastCircleCards != null)
            {
                var playLastCircleCards = roomData.PlayLastCircleCards.ToList();

                this.DDZOutCardPlugin.ShowHand(playLastCircleCards);
            }

            #region 处理各阶段状态

            DDZGameHelper.IsStartGame = (roomData.GameState == 0) ? false : true;

            //判断当前的游戏状态
            if (roomData.GameState == (int)DDZ_GameState.NoStart)
            {
                Log.Debug("当前游戏状态:未开局");

                this.CheckReadyState();
            }
            else if (roomData.GameState == (int)DDZ_GameState.Ready)
            {
                Log.Debug("当前游戏状态:准备");

                this.CheckReadyState();
            }
            else if (roomData.GameState == (int)DDZ_GameState.FaPai)
            {
                Log.Debug("当前游戏状态:发牌");
            }
            else if (roomData.GameState == (int)DDZ_GameState.CallScore)
            {
                Log.Debug("当前游戏状态:叫地主");

                //检测之前的叫分状态
                this.CheckCallScoreState();

                //采用服务器的倒计时
                DDZGameConfigComponent.Instance.ActiveOpTime = resp.RoomData.LeftTime;

                DDZGameConfigComponent.Instance.ActiveChairId = roomData.ActiveChairId;

                int realID = DDZGameHelper.ChangeSeat(roomData.ActiveChairId);

                if (realID == 0)
                {
                    this.DDZCallScorePlugin.Show(resp.RoomData.LeftTime);
                }
            }
            else if (roomData.GameState == (int)DDZ_GameState.DaPai)
            {
                Log.Debug("当前游戏状态:打牌");

                //采用服务器的倒计时
                DDZGameConfigComponent.Instance.ActiveOpTime = resp.RoomData.LeftTime;

                //判断当前活动玩家是否是自己,如果是:弹出抢分.

                DDZGameConfigComponent.Instance.ActiveChairId = roomData.ActiveChairId;

                int realID = DDZGameHelper.ChangeSeat(roomData.ActiveChairId);

                if (realID == 0)
                {
                    this.DDZInteractivePlugin.Show(resp.RoomData.LeftTime);
                }
            }
            else if (roomData.GameState == (int)DDZ_GameState.JieSuan)
            {
                Log.Debug("当前游戏状态:结算");
            }
            #endregion
        }
Exemplo n.º 22
0
        public void _InitData()
        {
            var myVo = DataCenterComponent.Instance.userInfo.getMyUserVo();

            for (int i = 0; i < 3; i++)
            {
                var item = _rf.Get <GameObject>("Item" + i);

                var _ref = item.GetComponent <ReferenceCollector>();

                var Status = _ref.Get <GameObject>("Status").GetComponent <Image>();

                var HeadBox = _ref.Get <GameObject>("HeadBox").GetComponent <Image>();

                var PlayerHead = _ref.Get <GameObject>("PlayerHead").GetComponent <Image>();

                var PlayerName = _ref.Get <GameObject>("PlayerName").GetComponent <Text>();

                var WinScore = _ref.Get <GameObject>("WinScore").GetComponent <Text>();

                var LoseScore = _ref.Get <GameObject>("LoseScore").GetComponent <Text>();

                var bg = _ref.Get <GameObject>("bg").GetComponent <Image>();

                var baseScore = _ref.Get <GameObject>("baseScore").GetComponent <Text>();

                var besu = _ref.Get <GameObject>("besu").GetComponent <Text>();

                if (DDZGameHelper.settle != null)
                {
                    var playerData = DDZGameHelper.settle.PlayerData[i];

                    int realSeatID = DDZGameHelper.ChangeSeat(playerData.ChairId);

                    PlayerHead.sprite = SpriteHelper.GetPlayerHeadSpriteName(playerData.HeadId);

                    PlayerName.text = playerData.NickeName;

                    Status.sprite = playerData.IsLord ? SpriteHelper.GetSprite("ddzgame", "DDZ_dizhu2") : SpriteHelper.GetSprite("ddzgame", "DDZ_nm");

                    Status.gameObject.SetActive(true);

                    besu.text = DDZGameHelper.settle.Beishu[realSeatID].ToString();



                    if (playerData.Score > 0)
                    {
                        WinScore.gameObject.SetActive(true);

                        LoseScore.gameObject.SetActive(false);

                        WinScore.text = "+" + playerData.Score;
                    }
                    else
                    {
                        WinScore.gameObject.SetActive(false);

                        LoseScore.gameObject.SetActive(true);

                        LoseScore.text = playerData.Score.ToString();
                    }

                    //判断自己的分数为正还是为负
                    if (myVo != null)
                    {
                        if (myVo.userID == playerData.UserId)
                        {
                            PlayerName.color = Color.yellow;

                            baseScore.color = Color.yellow;

                            besu.color = Color.yellow;

                            if (playerData.Score >= 0)
                            {
                                Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shengli");

                                //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_win);

                                Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglidi");

                                winLab.SetActive(true);

                                LoseLab.SetActive(false);

                                bg.gameObject.SetActive(true);

                                bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglitiao");
                            }
                            else
                            {
                                Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibai");

                                //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_lose);

                                Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibaidi");

                                winLab.SetActive(false);

                                LoseLab.SetActive(true);

                                bg.gameObject.SetActive(true);

                                bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_sibaitiao");
                            }

                            Title.SetNativeSize();
                        }
                    }
                }
            }

            if (DDZGameHelper.settle != null)
            {
                baseScoreLab.text = "X" + DDZGameHelper.settle.OtherData[0].ToString();

                bombScoreLab.text = "X" + DDZGameHelper.settle.OtherData[1].ToString();

                FlowerScoreLab.text = "X" + DDZGameHelper.settle.OtherData[2].ToString();
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 玩家准备广播
        /// </summary>
        /// <param name="resp"></param>
        public void OtherPrepare_Ntt(Actor_OtherPrepare_Ntt ntt)
        {
            int realSeatID = DDZGameHelper.ChangeSeat(ntt.ChairId);

            this.DDZReadyPlugin.SetReadyByIndex(realSeatID, true);
        }