Exemple #1
0
        private void SetPlayerInfo()
        {
            ResetPlayersItem();
            MahjongUserInfo    data        = null;
            MahjongPlayersData playersData = GameCenter.DataCenter.Players;

            for (int i = 0; i < playersData.CurrPlayerCount; i++)
            {
                data = playersData[i];
                PlayersItem[data.Chair].gameObject.SetActive(true);
                PlayersItem[data.Chair].SetDismissSelect(StateSprites[0]);
                PlayersItem[data.Chair].SetDismissInfo(data.NickM, playersData.GetPlayerHead(data.Chair));
            }
        }
 /// <summary>
 /// 投票解散
 /// </summary>
 private void Handup(ISFSObject data)
 {
     if (data.ContainsKey("cmd") && data.GetUtfString("cmd") == "dismiss")
     {
         int                type        = data.GetInt("type");
         string             username    = data.GetUtfString("username");
         MahjongPlayersData playersData = GameCenter.DataCenter.Players;
         for (int i = 0; i < GameCenter.DataCenter.MaxPlayerCount; i++)
         {
             if (playersData[i].NickM == username)
             {
                 GameCenter.EventHandle.Dispatch((int)UIEventProtocol.OnEventHandUp, new HandupEventArgs()
                 {
                     UserName   = username,
                     HandupType = (DismissFeedBack)type,
                     Chair      = i
                 });
                 break;
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 设置投票界面数据
        /// </summary>
        private void SetDismissInfo(HandupEventArgs Args)
        {
            var db = GameCenter.DataCenter;
            MahjongPlayersData playersData = db.Players;
            string             name        = playersData[Args.Chair].NickM.Replace(" ", "");

            mDismissUserMsg  = "玩家【" + name + "】申请解散房间,请等待其他玩家选择。";
            DismissUser.text = mDismissUserMsg;
            mStateCache      = new Dictionary <int, DismissFeedBack>();
            mStateCache.Add(Args.Chair, DismissFeedBack.Agree);
            int count = GameCenter.DataCenter.MaxPlayerCount;

            for (int i = 0; i < count; i++)
            {
                if (!mStateCache.ContainsKey(i))
                {
                    mStateCache.Add(i, DismissFeedBack.None);
                }
                PlayersItem[i].SetDismissSelect(GetSprite(mStateCache[i]));
            }
            ButtonsSetActive(playersData[0].NickM != Args.UserName);
            mTimer       = Args.Time == 0 ? mTimeTotal : Args.Time;
            mIsCountDown = true;
        }
        public void Open(SingleResultArgs args)
        {
            base.Open();
            mResultArgs = args;

            SetBtnState();
            for (int i = 0; i < PlayersItem.Length; i++)
            {
                PlayersItem[i].OnReset();
            }

            ItemsSort(args);
            SingleResultItem   item;
            MahjongPlayersData playersData = GameCenter.DataCenter.Players;

            for (int i = 0; i < args.Result.Count; i++)
            {
                item = PlayersItem[i];
                int chair = args.Result[i].Chair;
                item.gameObject.SetActive(true);
                item.Name      = args.Result[i].Name;
                item.HuInfoTxt = args.Result[i].HuInfo;
                item.HuTypeTxt = args.Result[i].UserHuType;
                //显示庄
                item.Banker = DataCenter.BankerChair == chair;
                //设置cpg
                var play = playersData.GetUserInfoFormBackup(chair);
                if (play == null)
                {
                    continue;
                }

                item.SetCpgCard(play.CpgDatas);
                //设置手牌
                var playerHardCards = play.HardCards;

                var  handCards   = item.SetCards(playerHardCards);
                bool huCardIsJue = false;

                if (GameCenter.DataCenter.ConfigData.Jue)
                {
                    var dic = MahjongUtility.MahjongFlagJueCheck(play.CpgDatas, playerHardCards, args.HuCard);
                    huCardIsJue = dic.ContainsKey(true);
                    var jueList = dic[huCardIsJue];
                    if (null != handCards && handCards.ObjList.Count > 0 && jueList.Count > 0)
                    {
                        for (int j = 0; j < jueList.Count; j++)
                        {
                            for (int k = 0; k < playerHardCards.Count; k++)
                            {
                                if (jueList[j] == playerHardCards[k])
                                {
                                    int value   = jueList[j];
                                    var cardObj = handCards.ObjList[k];
                                    if (cardObj != null && !GameCenter.DataCenter.IsLaizi(value))
                                    {
                                        var mah = cardObj.GetComponent <Mah2DObject>();
                                        mah.SetOther();
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                item.SetDetail(args.Result[i].HuFlag);
                //设置胡牌
                if (args.HuSeats.Contains(play.Seat))
                {
                    switch (args.ResultType)
                    {
                    case SingleResultArgs.HuResultType.HuSingle:
                        if (MahjongUtility.GameKey != "xlmj")
                        {
                            item.SetCard(args.Result[i].HuCard);
                        }
                        else
                        {
                            item.SetCards(play.HucardList);
                        }
                        break;

                    case SingleResultArgs.HuResultType.HuEndu:
                        //胡牌
                        var uiCards = item.SetCard(args.HuCard);
                        //扎码
                        if (DataCenter.Config.ResultShowZhongma)
                        {
                            item.SetCards(args.ZhongMa);
                        }
                        GameObject cardObj = null;
                        if (null != uiCards && uiCards.ObjList.Count > 0)
                        {
                            cardObj = uiCards.ObjList[0];
                        }
                        //设置宝牌
                        if (GameCenter.DataCenter.Game.BaoCard == args.HuCard)
                        {
                            if (cardObj != null)
                            {
                                var mah = cardObj.GetComponent <Mah2DObject>();
                                mah.SetLaizi();
                            }
                        }
                        if (GameCenter.DataCenter.ConfigData.Jue && huCardIsJue)
                        {
                            if (cardObj != null)
                            {
                                var mah = cardObj.GetComponent <Mah2DObject>();
                                mah.SetOther();
                            }
                        }
                        break;
                    }
                }
                string info;
                //排序
                item.SortCardGroup();
                //总分
                info = MahjongUtility.GetShowNumberFloat(args.Result[i].Gold).ToString();
                item.SetItem(TextType.TotalSocre, info);
                //胡牌分
                info = MahjongUtility.GetShowNumberFloat(args.Result[i].HuGold).ToString();
                item.SetItem(TextType.HupaiScore, info);
                //杠分
                info = MahjongUtility.GetShowNumberFloat(args.Result[i].GangGlod).ToString();
                item.SetItem(TextType.GangScore, info);

                //漂分
                var piaoValue = MahjongUtility.GetShowNumberFloat(args.Result[i].PiaoGlod);
                item.SetItem(TextType.PiaoScore, piaoValue);
                //扑分
                var puValue = MahjongUtility.GetShowNumberFloat(args.Result[i].PuGlod);
                item.SetItem(TextType.PuScore, puValue);
                //扎鸟分
                var niaoValue = MahjongUtility.GetShowNumberFloat(args.Result[i].NiaoGold);
                item.SetItem(TextType.NiaoSocre, niaoValue);
            }

            var owner = GameCenter.DataCenter.Players[0];

            if (owner != null)
            {
                bool isMeWin = args.HuSeats.Contains(owner.Seat);
                if (isMeWin)
                {
                    MahjongUtility.PlayEnvironmentSound("win");
                }
            }

            //设置当前轮数,开房模式下才会有
            if (DataCenter.Room.RoomType == MahRoomType.FanKa)
            {
                DataCenter.Room.RealityRound++;
                if (DataCenter.Room.LoopType == MahGameLoopType.Circle)
                {
                    if (DataCenter.Room.NextBaner == DataCenter.FristBankerSeat && DataCenter.BankerSeat != DataCenter.FristBankerSeat)
                    {
                        DataCenter.Room.CurrRound++;
                    }
                }
                else
                {
                    DataCenter.Room.CurrRound++;
                }
            }
            OtherSet();
        }