Ejemplo n.º 1
0
 public GiftType GetTargetGiftType()
 {
     for (int i = 0; i < giftRawImage.Length; ++i)
     {
         UIGiftInfo info = giftRawImage[i].gameObject.GetComponent <UIGiftInfo>();
         if (info.GetUIGiftIndex() == choiceTargetIndex)
         {
             return(info.GetUIGiftType());
         }
     }
     return(GiftType.Null);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 大转盘
    /// </summary>
    private void LotteryWheel()
    {
        if (choiceTotalCircle >= totalCircle && choiceNum == choiceTargetNum)
        {
            oncetimer         = 0;
            choiceTotalCircle = 0;
            DeleteShadowEffect();
            m_UIWelfareActivitiesWindow.OnLotteryWheelComplete();
            isStartTurn     = false;
            onceChoiceTimer = 0.1f;

            Debug.LogWarning(choiceTargetNum - 1);
            int rotateAnimationIndex;

            if ((choiceTargetNum - 1) == -1)
            {
                rotateAnimationIndex = 11;
                //rotateAnimation.transform.SetParent(giftRawImage[11].transform);
            }
            else
            {
                rotateAnimationIndex = choiceTargetNum - 1;
                //rotateAnimation.transform.SetParent(giftRawImage[choiceTargetNum - 1].transform);
            }

            rotateAnimation.transform.SetParent(giftRawImage[rotateAnimationIndex].transform);
            rotateAnimation.transform.SetAsLastSibling();
            rotateAnimation.transform.localPosition = Vector2.zero;
            rotateAnimation.SafeSetActive(true);
            moveAnimation.transform.position = giftRawImage[rotateAnimationIndex].transform.position;
            UIGiftInfo uiGiftInfo = giftRawImage[rotateAnimationIndex].transform.GetComponent <UIGiftInfo>();

            if (uiGiftInfo.GetUIGiftType() == GiftType.Null)
            {
                AudioEffectManager.Instance.Play("notGetPrize");
            }
            else
            {
                AudioEffectManager.Instance.Play("getPrize");
            }

            TextureManager.Instance.LoadHead(uiGiftInfo.GetURL(), (Texture2D texture2d) =>
            {
                moveAnimation.transform.GetComponent <RawImage>().texture = texture2d;
                giftImage.texture = texture2d;
            }, true);


            rotateAnimation.DORestart();
            giftShaddingImage.SafeSetActive(true);
            giftShaddingImage.color = Color.clear;
        }
        else
        {
            AddShadowEffect();
            if (choiceTotalCircle < reduceAndAddCircle)
            {
                if (onceChoiceTimer > onceMaxChoiceTimer)
                {
                    onceChoiceTimer = Mathf.Lerp(onceChoiceTimer, onceMaxChoiceTimer, 1 * Time.deltaTime);
                }
            }
            else if (choiceTotalCircle > totalCircle - reduceAndAddCircle)
            {
                if (onceChoiceTimer < onceMinChoiceTimer)
                {
                    onceChoiceTimer = Mathf.Lerp(onceChoiceTimer, onceMinChoiceTimer, 0.5f * Time.deltaTime);
                }
            }

            if (oncetimer > onceChoiceTimer)
            {
                AudioEffectManager.Instance.Play("dudu");
                choiceNum++;
                choiceNum %= giftRawImage.Length;
                oncetimer  = 0;
                if (choiceNum == choiceTargetNum)
                {
                    choiceTotalCircle++;
                }
            }
        }
        oncetimer += Time.deltaTime;
    }