Ejemplo n.º 1
0
    public void UpdateUI(RebateDialDto rebateDialDto)
    {
        if (rebateDialDto != null)
        {
            if (rebateDialDto.position.Count > 0)
            {
                isPlayerAni = true;
                resultIndex = rebateDialDto.position[0] - 1;
                if (rebateDialInfoDto.canGetCount > 0)
                {
                    rebateDialInfoDto.canGetCount--;

                    drawCount.text = drawCount.text = "剩余次数(" + rebateDialInfoDto.canGetCount + ")";
                    rebateDialInfoDto.getCounted++;
                    alreadyTimes.text = rebateDialInfoDto.getCounted.ToString();
                }
                else
                {
                    drawBtn.interactable = false;
                }
                PlayerCache.SetWealthUpdate(rebateDialDto.items, false);
                StartCoroutine(StartPlayAni(rebateDialDto));
            }
        }
    }
Ejemplo n.º 2
0
    //立即抽奖按钮事件
    private void DrawOnclick()
    {
        //给服务器发送消息
        RebateDialDto rebateDialDto = rebateDialOperation.luckyDraw(PlayerCache.loginInfo.uid);

        UpdateUI(rebateDialDto);
    }
Ejemplo n.º 3
0
    //收到抽奖结果

    //转圈协程
    private IEnumerator StartPlayAni(RebateDialDto rebateDialDto)
    {
        drawBtn.interactable = false;
        while (isPlayerAni)
        {
            if (times == rolltimes)
            {
                endtime = 0.3f;
                if (AwardIndex < resultIndex)
                {
                    if (resultIndex - AwardIndex == 2)
                    {
                        endtime = 0.4f;
                    }
                    AwardIndex++;
                    LightImageTrams.position = AwardPosList[AwardIndex].position;
                }
                else
                {
                    times = 0;
                    long goldAward = 0;
                    for (int i = 0; i < rebateDialDto.position.Count; i++)
                    {
                        goldAward += AwardList[rebateDialDto.position[i] - 1].num;
                    }
                    if (rebateDialDto.position.Count > 1)
                    {
                        XUIMidMsg.QuickMsg("恭喜你连续抽" + rebateDialDto.position.Count + " 获得金币x" + goldAward);
                    }
                    else if (rebateDialDto.position.Count == 1)
                    {
                        XUIMidMsg.QuickMsg("恭喜抽中金币x" + goldAward);
                    }

                    isPlayerAni = false;
                    if (rebateDialInfoDto.canGetCount > 0)
                    {
                        drawBtn.interactable = true;
                    }
                    else
                    {
                        drawBtn.interactable = false;
                    }
                    PlayerCache.WealthUpdate();
                }
            }
            else//前几圈只是动画
            {
                endtime = 0.1f;
                if (AwardIndex == 8)
                {
                    AwardIndex = 0;
                    times++;
                }
                LightImageTrams.position = AwardPosList[AwardIndex].position;
                AwardIndex++;
                if (times == rolltimes)
                {
                    AwardIndex = 0;
                }
            }

            yield return(new WaitForSeconds(endtime));
        }
    }