Beispiel #1
0
        private Sprite LoadSprite(Poker poker, bool isSmallPoker)
        {
            string pathK = string.Format("download/{0}/source/uisource/gameuisource/poker/RealityPoker.drb", ConstDefine.GAME_NAME);

            Poker pokerItem = poker;

            if (isSmallPoker)
            {
                pathK = string.Format("download/{0}/source/uisource/gameuisource/poker.drb", ConstDefine.GAME_NAME);
            }
            else
            {
                int size = poker.size;
                if (size == 1)
                {
                    size = 14;
                }
                else if (size == 14)
                {
                    size = 99;
                }
                else if (size == 15)
                {
                    size = 100;
                }
                pokerItem = new Poker(poker.index, size, poker.color, niuniu.proto.NN_ENUM_POKER_STATUS.POKER_STATUS_UPWARD);
            }

            Sprite currSprite = null;
            string pokerName  = "16_1";

            pokerName = pokerItem.size == 0 ? "16_1" : pokerItem.ToString();

            currSprite = null;
            currSprite = AssetBundleManager.Instance.LoadSprite(pathK, pokerName);
            return(currSprite);
        }
Beispiel #2
0
        //-----计算牛-------------------

        public List <Poker> CalculateNiu(List <Poker> pokerList, out bool whetherNiu)
        {
            whetherNiu = false;

            //求3张组合
            List <Poker[]> lst_CombinationNew = MyNiuNiuCombination <Poker> .GetCombination(pokerList.ToArray(), 3);

            if (lst_CombinationNew.Count == 0)
            {
                Debug.Log("没有3张牌的组合");
            }

            for (int i = 0; i < lst_CombinationNew.Count; i++)
            {
                int sum = 0;
                for (int j = 0; j < lst_CombinationNew[i].Length; j++)
                {
                    sum += Mathf.Clamp(lst_CombinationNew[i][j].size, 0, 10);
                }

                //对10取余 等于0 说明有牛
                if ((sum % 10) == 0)
                {
                    Debug.Log("有牛");
                    Debug.Log("这三张牌大小为:" + lst_CombinationNew[i][0].size + " " + lst_CombinationNew[i][1].size + " " + lst_CombinationNew[i][2].size);

                    whetherNiu = true;

                    for (int j = 0; j < pokerList.Count; ++j)
                    {
                        //pokerList[j] 是否在 lst_CombinationNew[i]中
                        for (int k = 0; k < lst_CombinationNew[i].Length; ++k)
                        {
                            if (lst_CombinationNew[i][k].index == pokerList[j].index)
                            {
                                //判断是否前移
                                for (int t = j; t > 0; --t)
                                {
                                    //前一位不在lst_CombinationNew[i]zhong中 那么前移
                                    bool isZai = false;
                                    for (int y = 0; y < lst_CombinationNew[i].Length; ++y)
                                    {
                                        if (lst_CombinationNew[i][y].index == pokerList[t - 1].index)
                                        {
                                            isZai = true;
                                        }
                                    }

                                    if (!isZai)
                                    {
                                        Poker temp = pokerList[t];
                                        pokerList[t]     = pokerList[t - 1];
                                        pokerList[t - 1] = temp;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }


                                break;
                            }
                        }
                    }

                    return(pokerList);
                }
            }


            //pokerSubscript = SumNiuNiu(pokerList, pokerSubscript, out whetherNiu);


            return(pokerList);
        }