Exemplo n.º 1
0
    /// <summary>
    /// Used to refresh the main ui.
    /// </summary>
    /// <param name="lotteryList"></param>
    /// <param name="isChooseHeroCard"></param>
    public void Refresh(SCLotteryList lotteryList, bool isChooseHeroCard)
    {
        isHeroChoose = isChooseHeroCard;
        scLotteryList = lotteryList;

        if (isChooseHeroCard)
        {
            NGUITools.SetActiveChildren(heroRelated.gameObject, isHeroChoose);
            NGUITools.SetActiveChildren(itemRelated.gameObject, false);

            var oneTimeCostValue = lotteryList.LotteryHeroCost;
            oneTimeCost.text = oneTimeCostValue.ToString(CultureInfo.InvariantCulture);
            tenTimeCost.text = (oneTimeCostValue * TenTimes).ToString(CultureInfo.InvariantCulture);
            var isElevenTimes = lotteryList.ListLotteryHeroInfo[0].TenLotteryGiveElevenHero;
            elevenTimesDesc.gameObject.SetActive(isElevenTimes);
            tenTimesDesc.gameObject.SetActive(!isElevenTimes);
            if (HeroPlayer.Textures.Count != 0 && HeroPlayer.Textures.Count != 1)
            {
                HeroPlayer.Play();
            }
            RefreshTimes(lotteryList.LastFreeLotteryTime, lotteryList.Get4StarHeroRestTimes);
        }
        else
        {
            NGUITools.SetActiveChildren(itemRelated.gameObject, !isHeroChoose);
            NGUITools.SetActiveChildren(heroRelated.gameObject, false);

            var oneTimeCostValue = lotteryList.LotteryItemCost;
            oneTimeCost.text = oneTimeCostValue.ToString(CultureInfo.InvariantCulture);
            tenTimeCost.text = (oneTimeCostValue * TenTimes).ToString(CultureInfo.InvariantCulture);
            var isElevenTimes = lotteryList.ListLotteryHeroInfo[0].TenLotteryGiveElevenHero;
            elevenTimesDesc.gameObject.SetActive(isElevenTimes);
            tenTimesDesc.gameObject.SetActive(!isElevenTimes);
            if (ItemPlayer.Textures.Count != 0 && ItemPlayer.Textures.Count != 1)
            {
                ItemPlayer.Play();
            }
            RefreshTimes(lotteryList.LastFreeLotteryTime, lotteryList.Get4StarHeroRestTimes);
        }
        totalFamous.text = PlayerModelLocator.Instance.Famous.ToString(CultureInfo.InvariantCulture);
        totalIngot.text = PlayerModelLocator.Instance.Diamond.ToString(CultureInfo.InvariantCulture);
    }
Exemplo n.º 2
0
 private void OnDisable()
 {
     UnInstallHandlers();
     StopAllCoroutines();
     scLotteryList = null;
     HeroPlayer.Reset();
     ItemPlayer.Reset();
 }