Ejemplo n.º 1
0
    /// <summary>
    /// 打开大转盘旋转开关
    /// </summary>
    /// <param name="data"></param>
    public void StartTurn(TransferData data)
    {
        int giftIndex   = data.GetValue <int>("giftIndex");
        int surPlusTime = data.GetValue <int>("time");
        int totalTime   = data.GetValue <int>("timeTotal");

        //string message = data.GetValue<string>("message");
        //int giftCallBackNum = data.GetValue<int>("giftCallBackNum");
        //GiftType giftType = data.GetValue<GiftType>("giftType");

        //GetComponent<UILotteryWheelInfo>().SetGiftCallBackData(giftIndex, message, surPlusTime, totalTime, giftCallBackNum, giftType);
        //GetComponent<UILotteryWheelInfo>().SetGiftCallBackData(giftIndex, message, surPlusTime, totalTime);
        GetComponent <UILotteryWheelInfo>().SetGiftCallBackData(giftIndex, surPlusTime, totalTime);

        //surPlusTimeText.SafeSetText(surPlusTime.ToString());
        //surPlusTotalTimeText.SafeSetText(totalTime.ToString());

        for (int i = 0; i < giftRawImage.Length; ++i)
        {
            UIGiftInfo info = giftRawImage[i].gameObject.GetComponent <UIGiftInfo>();
            if (info.GetUIGiftIndex() == giftIndex)
            {
                choiceTargetIndex = info.GetUIGiftIndex();
                choiceTargetNum   = i + 1;
                if (choiceTargetNum == 12)
                {
                    choiceTargetNum = 0;
                }
            }
        }
        if (!isStartTurn)
        {
            isStartTurn = true;
        }
    }
Ejemplo n.º 2
0
 public string GetTargetGiftName()
 {
     for (int i = 0; i < giftRawImage.Length; ++i)
     {
         UIGiftInfo info = giftRawImage[i].gameObject.GetComponent <UIGiftInfo>();
         if (info.GetUIGiftIndex() == choiceTargetIndex)
         {
             return(info.GetName());
         }
     }
     return(null);
 }
Ejemplo n.º 3
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;
    }