예제 #1
0
파일: GiftMenu.cs 프로젝트: hooei/BrainCube
    public void ReceiveButtonOnClick()
    {
        if (GameSystem.GetInstance().IsGiftAvailableNow)
        {
            coin = GameSystem.GetInstance().ReceiveGift();
            if (GameSystem.GetInstance().IsVIP)
            {
                coin /= 2;
            }
            int endIndex = -1;
            int index    = 0;
            foreach (GiftItem giftItem in giftItems)
            {
                if (giftItem.Number == coin && RandomTool.Int(2) == 1)
                {
                    endIndex = index;
                    break;
                }
                index++;
            }

            if (endIndex == -1)
            {
                index = 0;
                foreach (GiftItem giftItem in giftItems)
                {
                    if (giftItem.Number == coin)
                    {
                        endIndex = index;
                        break;
                    }
                    index++;
                }
            }
            timer        = 0;
            currentTimes = 0;
            jumpTimes    = 90;
            startIndex   = endIndex - jumpTimes % giftItems.Length;
            UpdateJumpInterval();
            if (startIndex < 0)
            {
                startIndex += giftItems.Length;
            }

            giftItemSelector.SetActive(true);
            startAnim = true;
        }
    }