Ejemplo n.º 1
0
        private List <ChipData> GetChipDatas(int gold)
        {
            var             rates     = Data.AnteRate;
            var             count     = rates.Count;
            List <ChipData> chipDatas = new List <ChipData>();

            for (int i = count - 1; i >= 0; i--)
            {
                var itemValue = rates[i];
                if (gold >= itemValue)
                {
                    var chipCount = gold / itemValue;
                    for (int j = 0; j < chipCount; j++)
                    {
                        ChipData item = new ChipData()
                        {
                            Type  = i,
                            Value = itemValue
                        };
                        chipDatas.Add(item);
                    }
                    gold -= chipCount * itemValue;
                }
                if (gold == 0)
                {
                    break;
                }
            }
            return(chipDatas);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 下注筹码区域倍率处理
        /// </summary>
        private void OnGetAnteRate(List <int> anteList)
        {
            _curSelectindex = -1;
            var chipCount = Chips.Length;
            var anteCount = anteList.Count;

            for (int i = 0; i < chipCount; i++)
            {
                bool state    = i > anteCount;
                var  chipItem = Chips[i];
                chipItem.gameObject.SetActive(!state);
                if (state)
                {
                    continue;
                }
                ChipData itemData = new ChipData()
                {
                    Type  = i,
                    Value = anteList[i],
                };
                chipItem.UpdateView(itemData);
            }
            OnSelectChip(Chips[0]);
            var count = Math.Min(anteCount, chipCount);

            if (BetChipGridCells.Count > count)
            {
                ChipsGrid.cellWidth = BetChipGridCells[count];
            }
            ChipsGrid.repositionNow = true;
        }