Example #1
0
        private void OnGetRejoionData(object obj, DdzbaseEventArgs args)
        {
            var data = args.IsfObjData;

            if (data.ContainsKey(NewRequestKey.KeyState) &&
                data.GetInt(NewRequestKey.KeyState) == GlobalConstKey.StatusChoseBanker)
            {
                if (!DDzUtil.IsServDataContainAllKey(
                        new[]
                {
                    NewRequestKey.KeyCurrp, NewRequestKey.KeyQt,
                    NewRequestKey.KeyMinScore
                }, data))
                {
                    SetAllBtnsActive(false);
                    return;
                }


                //当前谁发言
                int curCallSeat = data.GetInt(NewRequestKey.KeyCurrp);
                if (App.GetGameData <GlobalData>().GetSelfSeat == curCallSeat)
                {
                    ServDataTemp = data;
                    RefreshUiInfo();
                }
                else
                {
                    SetAllBtnsActive(false);
                }
            }
        }
Example #2
0
        //检测最后一手牌全出
        private void endchupaiV(bool isRejoin, List <int> Tcards, ISFSObject lastOutData)
        {
            //Debug.Log("<color=#0021FFFF>" + "检测最后一手牌全出" + "</color>");
            _cardManager.FindCds(Tcards.ToArray(), lastOutData);
            var tishiGpCunt = _cardManager.GetTishiGroupList.Count;

            if (tishiGpCunt > 0)
            {
                DDzUtil.ActiveBtn(TiShiBtn, DisTiShiBtn);
                //如果不是重连则自动提示,重连现在自动提示牌不提起来,有些问题,需要查一下,先保证不出错,重连时就不自动预提示了,需要手动点提示
                if (tishiGpCunt == 1)
                {
                    //如果直接一手牌全出,则自动出牌
                    if (_cardManager.GetTishiGroupList[0].Length == Tcards.Count)
                    {
                        foreach (var purecdvalue in Tcards.ToArray())
                        {
                            HdCdctrlInstance.JustUpCd(purecdvalue);
                        }
                        OnChuPaiClick();
                    }
                }
                if (!isRejoin)
                {
                    OnTishiClick();
                }
            }
            else
            {
                //DDzUtil.DisableBtn(TiShiBtn, DisTiShiBtn);
                HdCdctrlInstance.RepositionAllHdCds();
                HideAllBtns();
            }
        }
Example #3
0
        /// <summary>
        /// 显示按钮,并disable所有按钮
        /// </summary>
        private void DisableAllBtns()
        {
            //DDzUtil.DisableBtn(BuYaoBtn, DisBuYaoBtn);
            DDzUtil.DisableBtn(TiShiBtn, DisTiShiBtn);
            DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);

            var hdcdSplitGp = new CdSplitStruct(HdCdsListTemp.ToArray());

            //如果含有炸弹则跳过
            if (hdcdSplitGp.FourCds.Count < 1)
            {
                var canOutType = CheckCanOutCdsOneTime(hdcdSplitGp);
                //防止发送消息不成功,直接点亮出牌按钮,让玩家有再次发送的机会
                if (canOutType != CardType.None && canOutType != CardType.Exception)
                {
                    HdCdctrlInstance.UpAllHandCds();
                    DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }

            var args = new HdCdCtrlEvtArgs(HdCdctrlInstance.GetUpCdList().ToArray());

            OnHdCdsCtrlEvent(null, args);
            _onoffIchosecCds = true;
        }
Example #4
0
        /// <summary>
        /// 最终检测手牌
        /// </summary>
        /// <param name="isgetcdsWithoutCompare">是不是在没有其他人出牌情况下</param>
        private void FinalOutCdsCheck(bool isgetcdsWithoutCompare)
        {
            //经过智能检索后最后检查一遍抬出的牌是否合法----start---

            var finalType = PokerRuleUtil.GetCdsType(HdCdctrlInstance.GetUpCdList().ToArray());

            if (finalType != CardType.None && finalType != CardType.Exception)
            {
                //如果选出的牌型不是那种单牌,或者对子的小牌型,就先关闭智能选牌
                if (isgetcdsWithoutCompare && finalType != CardType.C1 && finalType != CardType.C2)
                {
                    _onoffIchosecCds = false;
                }
                else if (!isgetcdsWithoutCompare)
                {
                    _onoffIchosecCds = false;
                }

                DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
            }
            else
            {
                DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
            }

            //------------end
        }
Example #5
0
        /// <summary>
        /// 设置总结算数据
        /// </summary>
        public void SetData(ISFSObject data)
        {
            ISFSArray userArray = data.GetSFSArray("users");

            DDzUtil.ClearPlayerGrid(GridGob);
            int bigWinnerSeat = -1;
            int bigScore      = -1;

            for (int i = 0; i < userArray.Count; i++)
            {
                var gob = GridGob.AddChild(ItemsOrgGob);
                gob.SetActive(true);
                var userInfo   = userArray.GetSFSObject(i);
                var resultItem = gob.GetComponent <ResultItem>();
                resultItem.SetUserInfo(userInfo);
                int tempScore = userInfo.GetInt("gold");
                if (tempScore > bigScore)
                {
                    bigScore      = tempScore;
                    bigWinnerSeat = userInfo.GetInt("seat");
                }
            }

            GridGob.GetComponent <UIGrid>().repositionNow = true;

            if (_bigWinnerImg != null)
            {
                var gdata         = App.GetGameData <DdzGameData>();
                var bigWinnerInfo = gdata.GetOnePlayerInfo(bigWinnerSeat, true);
                YxFramwork.Common.DataBundles.PortraitDb.SetPortrait(bigWinnerInfo.AvatarX, _bigWinnerImg,
                                                                     bigWinnerInfo.SexI);
            }

            InfoAbout(data);
        }
Example #6
0
        /// <summary>
        /// 当轮到某人要准备要叫分时
        /// </summary>
        protected void OnTypeGrabSpeaker(object obj, DdzbaseEventArgs args)
        {
            var data = args.IsfObjData;

            if (!DDzUtil.IsServDataContainAllKey(
                    new[]
            {
                RequestKey.KeySeat, NewRequestKey.KeyTttype
            }, data))
            {
                return;
            }

            if (App.GetGameData <GlobalData>().GetSelfSeat != data.GetInt(RequestKey.KeySeat))
            {
                SetAllBtnsActive(false);
                return;
            }

            if (ServDataTemp == null)
            {
                ServDataTemp = new SFSObject();
            }

            ServDataTemp = data;
            //把与"qt"相同引用值的 "ttype" 的值赋值过来
            ServDataTemp.PutInt(NewRequestKey.KeyQt, data.GetInt(NewRequestKey.KeyTttype));
            RefreshUiInfo();
        }
        public override void RefreshUiInfo()
        {
            if (_oneRoundRecordData == null)
            {
                return;
            }

            OneRoundUiGob.SetActive(true);
            GameContinueBtn.SetActive(true);
            DDzUtil.ClearPlayerGrid(PlayerRecordGrid);

            var boom = 0;

            if (_oneRoundRecordData.ContainsKey("boom"))
            {
                boom = _oneRoundRecordData.GetInt("boom");
            }
            //var superBoom = _oneRoundRecordData.GetInt("sboom");
            // var rocket = _oneRoundRecordData.GetInt("rocket");
            // var spring = _oneRoundRecordData.GetInt(NewRequestKey.KeySpring);
            // var modeSize = _oneRoundRecordData.GetInt(GlobalConstKey.C_Score);//得分
            //var nextLandSeat = _oneRoundRecordData.GetInt("bkp");//下一个地主座位
            var ante = _oneRoundRecordData.GetInt("ante");



            //BoomLabel.text = boom.ToString(CultureInfo.InvariantCulture);

            // SpringLabel.text = spring.ToString(CultureInfo.InvariantCulture);

            //QdzLabel.text = modeSize.ToString(CultureInfo.InvariantCulture);



            //赋值用户成绩列表
            var usersrecord = GetUsersRecord(_oneRoundRecordData);
            var usersLen    = usersrecord.Length;

            for (var i = 0; i < usersLen; i++)
            {
                if (usersrecord[i] == null)
                {
                    continue;
                }

                var data = usersrecord[i];

/*                if (data.Seat == App.GetGameData<GlobalData>().GetSelfSeat)
 *              {
 *                  GetRewordLabel.text = data.Gold.ToString(CultureInfo.InvariantCulture);
 *                  int rate = data.Seat == _dizhuSeat ? Math.Abs(data.Dz) / ante : Math.Abs(data.Nm) / ante;
 *                  TotalBeiLabel.text = string.Format("共{0}倍", rate);
 *              }*/

                AddUserItemInfo(data);
            }
            PlayerRecordGrid.GetComponent <UIGrid>().repositionNow = true;
        }
Example #8
0
        /// <summary>
        /// 当有人叫分抢地主时
        /// </summary>
        protected void OnTypeGrab(object sender, DdzbaseEventArgs args)
        {
            var data = args.IsfObjData;

            if (!DDzUtil.IsServDataContainAllKey(
                    new[]
            {
                RequestKey.KeySeat, RequestKey.KeyScore
            }, data))
            {
                Debug.LogError("有人叫分时,信息key不全");
                return;
            }

            var seat  = data.GetInt(RequestKey.KeySeat);
            var score = data.GetInt(RequestKey.KeyScore);

            if (UserDataTemp != null && UserDataTemp.GetInt(RequestKey.KeySeat) == seat)
            {
                //叫的分值
                switch (score)
                {
                case 0:
                {
                    SetSpeakSpState(true, SpkBuJiao);
                    break;
                }

                case 1:
                {
                    SetSpeakSpState(true, Spk1Fen);
                    break;
                }

                case 2:
                {
                    SetSpeakSpState(true, Spk2Fen);
                    break;
                }

                case 3:
                {
                    SetSpeakSpState(true, Spk3Fen);
                    break;
                }

                default:
                {
                    Debug.LogError("叫了一个超出预估的分值,所以不显示");
                    SetSpeakSpState(false);
                    break;
                }
                }
            }
        }
Example #9
0
        /// <summary>
        /// 设置用户信息
        /// </summary>
        /// <param name="overinfo">总结算给的用户信息</param>
        public void SetUserInfo(ISFSObject overinfo)
        {
            var userSeat = overinfo.GetInt("seat");
            var userInfo = App.GetGameData <GlobalData>().GetUserInfo(userSeat);

            if (userInfo == null)
            {
                throw new Exception("GlobalData里没有相关座位用户信息");
            }

            //名字
            UserName.text = userInfo.GetUtfString(RequestKey.KeyName);

            if (userInfo.ContainsKey(RequestKey.KeyId))
            {
                IdLabel.text = "ID:" + userInfo.GetInt(RequestKey.KeyId).ToString(CultureInfo.InvariantCulture);
            }

            //头像
            DDzUtil.LoadRealHeadIcon(userInfo.GetUtfString("avatar"), userInfo.GetShort("sex"), UserIcon);

            //单局最高得分
            BestScore.text = overinfo.GetInt("max").ToString(CultureInfo.InvariantCulture);

            //胜负局数
            WinAndLose.text = overinfo.GetInt("win") + "胜" + overinfo.GetInt("lost") + "负";

            //总积分
            AllScore.text = overinfo.GetInt("gold").ToString(CultureInfo.InvariantCulture);

            if (overinfo.ContainsKey("boom"))
            {
                BombNum.text = overinfo.GetInt("boom").ToString(CultureInfo.InvariantCulture);
            }


            FzSprite.SetActive(false);
            BigWinner.SetActive(false);
            if (overinfo.ContainsKey(RequestKey.KeyId))
            {
                var userid = overinfo.GetInt(RequestKey.KeyId);

                LocalPosLabel.text = GpsInfListener.GetContryInfo(userid);

                FzSprite.SetActive(userid == App.GetGameData <GlobalData>().GetOwerId);
            }
        }
Example #10
0
        //------------------------------------------------------------------------------------------------
        /// <summary>
        /// 当上一次玩家出牌不是自己时
        /// </summary>
        /// <param name="lastOutData">最后一次出牌的信息</param>
        /// <param name="isRejoin">标记是否是重连进入的</param>
        private void OnNotSelfOutCds(ISFSObject lastOutData, bool isRejoin = false)
        {
            //DDzUtil.ActiveBtn(BuYaoBtn, DisBuYaoBtn);
            DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
            //玩家剩余最后4张牌,牌型三带一,最后一次出牌信息三带二,特殊改为玩家三带二计算(特殊情况)
            var lastcdType = CardType.None;

            lastcdType = PokerRuleUtil.GetCdsType(lastOutData.GetIntArray(RequestKey.KeyCards));
            if (HdCdsListTemp.ToArray().Length == 4 && lastcdType == CardType.C32)
            {
                var sortedLastOutCd = PokerRuleUtil.GetSortedValues(HdCdsListTemp.ToArray());
                var dictoNum        = new Dictionary <int, int>();
                foreach (var cd in sortedLastOutCd)
                {
                    if (!dictoNum.ContainsKey(cd))
                    {
                        dictoNum[cd] = 1;
                        continue;
                    }
                    dictoNum[cd]++;
                }
                var dictoNumTwo = dictoNum;
                foreach (var cd in dictoNum.Keys.Where(cd => dictoNum[cd] == 1))
                {
                    dictoNumTwo[cd]++;
                    break;
                }
                List <int> TempHdCdsListTemp = new List <int>();
                foreach (var item in dictoNumTwo)
                {
                    for (int i = 0; i < item.Value; i++)
                    {
                        TempHdCdsListTemp.Add(item.Key);
                    }
                }
                endchupaiV(isRejoin, TempHdCdsListTemp, lastOutData);
            }
            else
            {
                endchupaiV(isRejoin, HdCdsListTemp, lastOutData);
            }

            var args = new HdCdCtrlEvtArgs(HdCdctrlInstance.GetUpCdList().ToArray());

            OnHdCdsCtrlEvent(null, args);
            _onoffIchosecCds = true;
        }
Example #11
0
        //--------------------------------end

        /// <summary>
        /// 根据缓存的信息刷新用户信息ui
        /// </summary>
        public override void RefreshUiInfo()
        {
            if (UserDataTemp != null)
            {
                if (UserDataTemp.ContainsKey(RequestKey.KeyName))
                {
                    NameLabel.text = UserDataTemp.GetUtfString(RequestKey.KeyName);
                }

                if (UserDataTemp.ContainsKey(RequestKey.KeyId))
                {
                    IdLabel.text = UserDataTemp.GetInt(RequestKey.KeyId).ToString(CultureInfo.InvariantCulture);
                }


                short sex = 0;
                if (UserDataTemp.ContainsKey(NewRequestKey.KeySex))
                {
                    sex = UserDataTemp.GetShort(NewRequestKey.KeySex);
                }

                if (UserDataTemp.ContainsKey(NewRequestKey.KeyAvatar))
                {
                    DDzUtil.LoadRealHeadIcon(UserDataTemp.GetUtfString(NewRequestKey.KeyAvatar), sex, HeadTexture);
                }
                else
                {
                    DDzUtil.LoadDefaultHeadIcon(sex, HeadTexture);
                }

                if (UserDataTemp.ContainsKey(NewRequestKey.KeyTtGold))
                {
                    ScoreLabel.text =
                        UserDataTemp.GetLong(NewRequestKey.KeyTtGold).ToString(CultureInfo.InvariantCulture);
                }

                if (!App.GetGameData <GlobalData>().IsStartGame &&
                    UserDataTemp.ContainsKey(RequestKey.KeyState))
                {
                    GameReadySp.gameObject.SetActive(UserDataTemp.GetBool(RequestKey.KeyState));
                }
            }
        }
Example #12
0
        /// <summary>
        /// 设置总结算数据
        /// </summary>
        public void SetData(ISFSObject data)
        {
            string time = DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day +
                          "  " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;

            Timedatelabel.text = time;

            SetidAndRoundInfo();


            ISFSArray userArray = data.GetSFSArray("users");

            DDzUtil.ClearPlayerGrid(GridGob);

            int        maxScore = 0;
            ResultItem useritem = null;

            for (int i = 0; i < userArray.Count; i++)
            {
                var gob = NGUITools.AddChild(GridGob, ItemsOrgGob);
                gob.SetActive(true);
                var resultItem = gob.GetComponent <ResultItem>();
                var isfData    = userArray.GetSFSObject(i);
                resultItem.SetUserInfo(isfData);

                var curScore = isfData.GetInt("gold");
                if (curScore != 0 && maxScore <= curScore)
                {
                    maxScore = curScore;
                    useritem = resultItem;
                }
            }

            //确定大赢家图标
            if (useritem != null)
            {
                useritem.BigWinner.SetActive(true);
            }

            GridGob.GetComponent <UIGrid>().repositionNow = true;
        }
Example #13
0
        /// <summary>
        /// 点击提示按钮
        /// </summary>
        public void OnTishiClick()
        {
            HdCdctrlInstance.RepositionAllHdCds();
            var oneTishiGroup = _cardManager.GetOneTishiGroup();

            if (oneTishiGroup == null || oneTishiGroup.Length < 1)
            {
                return;
            }
            foreach (var purecdvalue in oneTishiGroup)
            {
                HdCdctrlInstance.JustUpCd(purecdvalue);
            }

            //如果提示成功,把智能选牌关闭
            _onoffIchosecCds = false;

            //_mayoutCdsTemp = (int[]) oneTishiGroup.Clone();
            //有提示牌组,点亮出牌按钮
            DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
        }
Example #14
0
        /// <summary>
        /// 显示投票信息内容
        /// </summary>
        /// <param invotename="handType"></param>
        /// <param invotename="userName"></param>
        /// <param name="data"></param>
        private void ShowHandUpContent(ISFSObject data)
        {
            var handType   = data.GetInt("type");
            var invotename = data.GetUtfString(Username);

            if (invotename == null)
            {
                return;
            }
            switch (handType)
            {
            //发起
            case 2:
                _hasvoteStart = true;
                ResetData(invotename);
                break;

            //拒绝;如果有人拒绝则投票失败,隐藏投票界面
            case -1:
                _hasvoteStart          = false;
                NameToType[invotename] = handType;
                StartCoroutine(HideHandUpPanel(2f));
                break;

            //同意
            case 3:
                NameToType[invotename] = handType;
                break;
            }


            var i = 0;

            //其他人按顺序下排
            foreach (var userName in NameToType.Keys)
            {
                if (i >= _playerInfo.Length)
                {
                    break;
                }

                var userdata = App.GetGameData <GlobalData>().GetPlayerUserData(userName);
                if (userdata == null)
                {
                    Debug.LogError("没有找到对应id的玩家信息");
                    return;
                }

                DDzUtil.SetUserHeadTexture(userdata, _playerInfo[i].HandTexture);

                var playerName = userdata.GetUtfString(RequestKey.KeyName);
                _playerInfo[i].gameObject.SetActive(true);
                _playerInfo[i].PlayerName.text = playerName;
                _playerInfo[i].HandTypeSp.gameObject.SetActive(true);
                switch (NameToType[userName])
                {
                case 0:
                    _playerInfo[i].HandTypeSp.gameObject.SetActive(false);
                    break;

                case -1:
                    _playerInfo[i].HandTypeSp.spriteName = "public_021";
                    break;

                case 3:
                    _playerInfo[i].HandTypeSp.spriteName = "public_020";
                    break;

                case 2:

                    PlayerHdupStr.text = playerName + "     申请解散房间  请等待其他玩家选择";
                    _playerInfo[i].HandTypeSp.spriteName = "public_020";
                    break;
                }
                _playerInfo[i].HandTypeSp.MakePixelPerfect();
                i++;
            }


/*
 *          //先把发起人找到,放到第一排
 *          foreach (var sname in NameToType.Keys)
 *          {
 *              if (NameToType[sname] == 2)
 *              {
 *                  PlayerHdupStr.text = sname+ "     申请解散房间  请等待其他玩家选择";
 *                  break;
 *              }
 *          }
 *
 *          //其他人按顺序下排
 *          foreach (var sname in NameToType.Keys)
 *          {
 *              switch (NameToType[sname])
 *              {
 *                  case 0:
 *                      ContentLabel.text += "[581e1e]玩家" + " [" + sname + "] " + " 正在选择[-]\n";
 *                      break;
 *                  case -1:
 *                      ContentLabel.text += "[581e1e]玩家" + " [" + sname + "] " + " [FF0000FF]选择拒绝[-]\n";
 *                      break;
 *                  case 3:
 *                      ContentLabel.text += "[581e1e]玩家" + " [" + sname + "] " + " [009013FF]选择同意[-]\n";
 *                      break;
 *              }
 *          }*/
        }
Example #15
0
        /// <summary>
        /// 叫地主
        /// </summary>
        /// <param name="args"></param>
        private void OnTypeGrab(DdzbaseEventArgs args)
        {
            var data = args.IsfObjData;
            int seat = data.GetInt(RequestKey.KeySeat);


            if (Info == null)
            {
                return;
            }
            var gdata      = App.GetGameData <DdzGameData>();
            int playerSeat = Info.Seat;

            if (seat == gdata.GetEarlyHand(playerSeat))
            {
                SetSpeakSprite(string.Empty, false);
            }

            if (seat != playerSeat)
            {
                return;
            }

            //检验相关数据是否正确
            if (!DDzUtil.IsServDataContainAllKey(
                    new[]
            {
                RequestKey.KeySeat, RequestKey.KeyScore
            }, data))
            {
                return;
            }

            if (ShowSpeakSp == null)
            {
                return;
            }
            var score = data.GetInt(RequestKey.KeyScore);

            string spriteName;
            bool   robModel = gdata.RobModel;

            //设置图片
            if (robModel)
            {
                if (score > 0)
                {
                    //有人叫地主
                    spriteName = score == 1 ? SpkJiaoDz : SpkQiangDz;
                }
                else
                {
                    //不抢
                    spriteName = SpkBuQiangDz;
                }
            }
            else
            {
                spriteName = score == 0 ? SpkBuJiao : score + Fen;
            }

            SetSpeakSprite(spriteName);
        }
Example #16
0
        public override void RefreshUiInfo()
        {
            if (!AllowReady || !FinishAnim)
            {
                StartCoroutine(ShowUiInfoLater());          //延迟显示结算界面
                return;
            }
            if (OneRoundRecordData == null)
            {
                return;
            }

            OneRoundUiGob.SetActive(true);
            DDzUtil.ClearPlayerGrid(PlayerRecordGrid);


            var boom = OneRoundRecordData.GetInt("boom");

            var rocket   = OneRoundRecordData.GetInt("rocket");
            var spring   = OneRoundRecordData.GetInt(NewRequestKey.KeySpring);
            var modeSize = OneRoundRecordData.GetInt(GlobalConstKey.C_Score);//得分

            var ante = OneRoundRecordData.GetInt("ante");

            BoomLabel.text = (boom + rocket).ToString(CultureInfo.InvariantCulture);

            SpringLabel.text = spring.ToString(CultureInfo.InvariantCulture);

            QdzLabel.text = modeSize.ToString(CultureInfo.InvariantCulture);

            var usersLen = _userRecords.Length;

            for (var i = 0; i < usersLen; i++)
            {
                if (_userRecords[i] == null)
                {
                    continue;
                }

                var data = _userRecords[i];
                if (data.Seat == App.GetGameData <DdzGameData>().SelfSeat)
                {
                    GetRewordLabel.text = data.Gold.ToString(CultureInfo.InvariantCulture);
                    int rate = data.Seat == _dizhuSeat?Mathf.Abs(data.Dz) / ante : Mathf.Abs(data.Nm) / ante;

                    TotalBeiLabel.text = string.Format("共{0}倍", rate);
                }

                AddUserItemInfo(data);
            }

            var grid = PlayerRecordGrid.GetComponent <UIGrid>();

            grid.repositionNow = true;
            grid.Reposition();

            ISFSArray usersrecord = OneRoundRecordData.GetSFSArray("users");

            foreach (ISFSObject go in usersrecord)
            {
                int seat = go.GetInt("seat");
                if (seat == App.GameData.SelfSeat)
                {
                    int  gold     = go.GetInt("gold");
                    bool isWinner = gold >= 0;
                    SetWinEffect(isWinner);
                    break;
                }
            }
        }
Example #17
0
        /// <summary>
        /// 当玩家有对手牌进行点击操作时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OnHdCdsCtrlEvent(object sender, HdCdCtrlEvtArgs args)
        {
            //如果不该自己行动
            if (!ChuPaiBtn.activeSelf && !DisChuPaiBtn.activeSelf)
            {
                return;
            }

            //如果没有选牌
            if (args.SelectedCds.Length == 0)
            {
                DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
                _onoffIchosecCds = true;
                return;
            }

            var selectedCds = args.SelectedCds;
            var lastOutCds  = _lastOutData.GetIntArray(RequestKey.KeyCards);

            //如果直接全选了所有手牌,且不是关别家的牌是自己主动出的情况下,检查能不能一次全出
            if (selectedCds.Length == HdCdsListTemp.Count && _lastOutData.GetInt(RequestKey.KeySeat) == App.GetGameData <GlobalData>().GetSelfSeat)
            {
                var canOutType = CheckCanOutCdsOneTime(new CdSplitStruct(HdCdsListTemp.ToArray()));
                if (canOutType != CardType.None && canOutType != CardType.Exception)
                {
                    HdCdctrlInstance.UpAllHandCds();
                    DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }



            //-----------------------start 智能选牌过程-------有赖子,或者开关关闭则不用智能选牌----------------------------
            bool isgetcdsWithoutCompare = false;//标记是不是在自己出动出牌时做出的智能选牌

            int[] mayOutCds      = null;
            bool  selCdshasLaizi = PokerRuleUtil.CheckHaslz(selectedCds);

            if (!selCdshasLaizi && _onoffIchosecCds)
            {
                if (_lastOutData.GetInt(RequestKey.KeySeat) == App.GetGameData <GlobalData>().GetSelfSeat)
                {
                    mayOutCds = _checkCardTool.GetcdsWithOutCompare(selectedCds, HdCdsListTemp.ToArray());
                    isgetcdsWithoutCompare = true;
                }
                else
                {
                    //DDzUtil.ActiveBtn(BuYaoBtn, DisBuYaoBtn);
                    mayOutCds = _checkCardTool.ChkCanoutCdListWithLastCdList(selectedCds,
                                                                             _cardManager.GetTishiGroupDic, lastOutCds);
                }
            }
            //---------------------------------------------------------------------------------------end


            /*            //---start---------------使智能选牌出了相同的牌型,不重复执行-----------------------
             *          var haschosemayOutCds = DDzUtil.IsTwoArrayEqual(HdCdsCtrl.SortCds(_mayoutCdsTemp), HdCdsCtrl.SortCds(mayOutCds));
             *          _mayoutCdsTemp = mayOutCds;
             *          //如果上次智能选牌和本次相同,则直接取消一次智能选牌
             *          if (haschosemayOutCds)
             *          {
             *              mayOutCds = null;
             *          }
             *          //----------------------------------------------------------------------------------end*/



            if (mayOutCds == null || mayOutCds.Length == 0)
            {
                bool isMatch;

                //如果_lastOutData不是自己出牌
                if (_lastOutData.GetInt(RequestKey.KeySeat) != App.GetGameData <GlobalData>().GetSelfSeat)
                {
                    var lastoutcds = new List <int>();
                    lastoutcds.AddRange(lastOutCds);
                    var cardTypeDic = _cardManager.CheckCanGuanCds(selectedCds, selCdshasLaizi, lastoutcds.ToArray());
                    isMatch = cardTypeDic != null && cardTypeDic.Count > 0;
                }
                else
                {
                    var cardTypeDic = _cardManager.CheckCanGuanCds(selectedCds, selCdshasLaizi, null);
                    isMatch = cardTypeDic != null && cardTypeDic.Count > 0;
                }

                //Debug.LogError("isMatch: " + isMatch);
                if (isMatch)
                {
                    HdCdctrlInstance.UpCdList(selectedCds);
                }
                else
                {
                    DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }
            else
            {
                if (!ChooseMayOutCards(mayOutCds, selectedCds))
                {
                    DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }

            FinalOutCdsCheck(isgetcdsWithoutCompare);
        }
Example #18
0
        //显示GpsInfo
        public void OnShowGpsInfo()
        {
            var leftSeat  = App.GetGameData <GlobalData>().GetLeftPlayerSeat;
            var rightSeat = App.GetGameData <GlobalData>().GetRightPlayerSeat;

            if (!_userinfoDic.ContainsKey(leftSeat) || !_userinfoDic.ContainsKey(rightSeat))
            {
                YxMessageBox.Show(Infostr1);
                return;
            }

            GpsUiGob.SetActive(true);

            DDzUtil.LoadRealHeadIcon(_userinfoDic[leftSeat].HeadImgAvatar, _userinfoDic[leftSeat].Sex, HeadTextureLeft);
            DDzUtil.LoadRealHeadIcon(_userinfoDic[rightSeat].HeadImgAvatar, _userinfoDic[rightSeat].Sex, HeadTextureRight);

            NameLabelLeft.text  = _userinfoDic[leftSeat].Name;
            NameLabelRight.text = _userinfoDic[rightSeat].Name;

            foreach (var seat in _userinfoDic.Keys)
            {
                if (seat == leftSeat)
                {
                    /*                 LeftGpsInfo.text = string.Format("IP:{0}\nID:{1}\n所在地:{2}\n{3}", _userinfoDic[seat].Ip,
                     *                   _userinfoDic[seat].Id, _userinfoDic[seat].Country, (_userinfoDic[seat].GpsX!=-1f) ? "已经提供位置信息" : "未提供位置信息\n请开启位置服务,并给予应用相应权限");*/


                    LeftGpsInfo.text = string.Format("所在地:{0}\n{1}",
                                                     _userinfoDic[seat].Country, (_userinfoDic[seat].GpsX != -1f) ? "已经提供位置信息" : "未提供位置信息");
                }
                else if (seat == rightSeat)
                {
/*                    RightGpsInfo.text = string.Format("IP:{0}\nID:{1}\n所在地:{2}\n{3}", _userinfoDic[seat].Ip,
 *                      _userinfoDic[seat].Id, _userinfoDic[seat].Country, (_userinfoDic[seat].GpsX != -1f) ? "已经提供位置信息" : "未提供位置信息\n请开启位置服务,并给予应用相应权限");*/

                    RightGpsInfo.text = string.Format(" 所在地:{0}\n{1}",
                                                      _userinfoDic[seat].Country, (_userinfoDic[seat].GpsX != -1f) ? "已经提供位置信息" : "未提供位置信息");
                }
            }

            if (_userinfoDic[leftSeat].GpsX == -1 || _userinfoDic[rightSeat].GpsX == -1)
            {
                DistanceLabel.text = "距离:0 米";
                return;
            }

            var distance = Distince(_userinfoDic[leftSeat].GpsX, _userinfoDic[leftSeat].GpsY, _userinfoDic[rightSeat].GpsX, _userinfoDic[rightSeat].GpsY);

            string des = "";

            if (distance < 1000)
            {
                if (distance < 100)
                {
                    des = "<=100m";
                }
                else
                {
                    des = string.Format("距离:{0:F}米", distance);
                }
            }
            else
            {
                des = string.Format("距离:{0:F} 千米", distance / 1000f);
            }
            DistanceLabel.text = des;
        }
Example #19
0
        /// <summary>
        ///  在有别家出牌的情况下 智能检测出牌
        /// </summary>
        /// <param name="selectCds">已经框选出来的牌值</param>
        /// <param name="canOutCardListDic">提示牌组和对应的类型</param>
        /// <param name="compareCds">要去比较的牌,上家牌</param>
        public int[] ChkCanoutCdListWithLastCdList(int[] selectCds, Dictionary <int[], CardType> canOutCardListDic, int[] compareCds)
        {
            if (canOutCardListDic == null || canOutCardListDic.Count < 1)
            {
                return(null);
            }

            //检查选出的牌是不是就是提示牌组中的某组牌
            var selcdsPureSortValues = PokerRuleUtil.GetSortedValues(selectCds);
            var selCdsType           = PokerRuleUtil.GetCdsType(selectCds);
            var selcdsLen            = selectCds.Length;

            foreach (var canoutCds in canOutCardListDic.Keys)
            {
                if (selcdsLen == canoutCds.Length && selCdsType == canOutCardListDic[canoutCds])
                {
                    if (DDzUtil.IsTwoArrayEqual(selcdsPureSortValues, PokerRuleUtil.GetSortedValues(canoutCds)))
                    {
                        return(canoutCds);
                    }
                }

                //检查选的牌是不是提示牌组的子集
                if (DDzUtil.IsSubsetArray(PokerRuleUtil.GetSortedValues(canoutCds), selcdsPureSortValues))
                {
                    return(canoutCds);
                }
            }



            //检查提示牌组中有没有

            //DDzUtil.IsTwoArrayEqual()


/*            var listTemp = new List<int>();
 *
 *          //如果是提示牌的子集 直接返回相应的提示牌组
 *          var posbFitCdsList = new List<int[]>();
 *          foreach (var canOutcds in canOutCardList)
 *          {
 *              listTemp.Clear();
 *              listTemp.AddRange(canOutcds);
 *
 *              bool findNotMatch = false;
 *              for (int i = 0; i < selectCds.Length; i++)
 *              {
 *                  if (listTemp.Contains(selectCds[i]) || listTemp.Contains(HdCdsCtrl.GetValue(selectCds[i])))
 *                  {
 *                      posbFitCdsList.Add(canOutcds);
 *                      listTemp.Remove(selectCds[i]);
 *                  }
 *                  else
 *                  {
 *                      findNotMatch = true;
 *                      break;
 *                  }
 *              }
 *
 *              if (!findNotMatch) return canOutcds;
 *          }
 *
 #region 进一步查找可能的牌
 *          //如果框选的牌中,含有有符合提示的牌组中的某张牌 ,则看下是不是  三带的情况的牌组
 *          if (posbFitCdsList.Count > 0)
 *          {
 *              var compareType = _getCdsType(PokerRuleUtil.GetSortedValues(compareCds));
 *              //如果不是三带的类型 就不用检测了
 *              if (compareType != CardType.C31 && compareType != CardType.C32) return null;
 *
 *              foreach (var posbFitCds in posbFitCdsList)
 *              {
 *                  //排除不是三顺和三条的提示牌
 *                  if (_getCdsType(PokerRuleUtil.GetSortedValues(posbFitCds)) != CardType.C3) continue;
 *
 *                  //拼凑可能合法的牌组
 *                  listTemp.Clear();
 *                  listTemp.AddRange(selectCds);
 *                  for (int i = 0; i < posbFitCds.Length; i++)
 *                  {
 *                      listTemp.Remove(posbFitCds[i]);
 *                  }
 *
 *                  for (int i = 0; i < posbFitCds.Length; i++)
 *                  {
 *                      listTemp.Add(posbFitCds[i]);
 *                  }
 *
 *                  var finalCds = PokerRuleUtil.GetSortedValues(listTemp.ToArray());
 *
 *                  if (finalCds.Length == compareCds.Length && _getCdsType(finalCds) == compareType)
 *                      return finalCds;
 *              }
 *          }
 #endregion*/

            return(null);
        }