Exemplo n.º 1
0
    private void OnBattleResult()
    {
        if (_model.IsShowingAnimation)
        {
            return;
        }

        if (_model.IsGetBattleResult == false)
        {
            return;
        }

        VisitBattleResultData model = GetData <VisitBattleResultData>();

        if (model.Star > 0)
        {
            ShowBattleComment();
        }
        else
        {
            _currentPanel.Destroy();
            _currentPanel = new VisitFinalEstimateFailPanel();
            _currentPanel.Init(this);
            _currentPanel.Show(0);
            _battleFinalBg.Show();
            _battleFinalBg.transform.SetSiblingIndex(0);
        }
    }
Exemplo n.º 2
0
    public override void Init()
    {
        base.Start();
        VisitBattleResultData data = GetData <VisitBattleResultData>();

        GlobalData.CardModel.UpdateUserCards(data.UserCards.ToArray());
        View.SetData(data, GlobalData.PlayerModel);
    }
    public void SetData(VisitBattleResultData data, PlayerModel playerModel)
    {
        transform.Find("StarAndGrade/Star").GetComponent <VisitStarComponent>().ShowStar(data.Star);
        // transform.Find("StarAndGrade/Text").GetComponent<Text>().text = "应援热度:<b> " + data.Cap + "</b>";
        transform.Find("StarAndGrade/Text/Text").GetComponent <Text>().text = data.Cap.ToString();
        var propContainer = transform.Find("Reward/Props");
        var cardContainer = transform.Find("Cards");

        for (int i = 0; i < data.RewardList.Count; i++)
        {
            GameObject item = InstantiatePrefab("VisitBattle/FinalEstimate/VisitBattleRewardItem");
            item.transform.SetParent(propContainer, false);

            DrawActivityDropItemVo extReward;
            data.DrawActivityDropItemDict.TryGetValue(i, out extReward);

            item.transform.gameObject.AddComponent <VisitBattleRewardItem>().SetData(data.RewardList[i], extReward);
            item.GetComponent <ItemShowEffect>().OnShowEffect(0.3f + i * 0.2f);
        }

        PlayerVo player = playerModel.PlayerVo;

        _levelText.text  = "Lv." + player.Level;
        _expAddText.text = "+" + data.Exp + " exp";

        var isOnVip = GlobalData.PlayerModel.PlayerVo.IsOnVip;

        _vip.gameObject.SetActive(isOnVip);

        _userNameText.text = I18NManager.Get("Battle_Name", player.UserName);

        int lastNeedExp = player.NeedExp;

        _expText.text = player.CurrentLevelExp + "/" + player.NeedExp;

        progressBar.DeltaX   = 0;
        progressBar.Progress = (int)((float)player.CurrentLevelExp / player.NeedExp * 100);

        bool isLevelup = playerModel.AddExp(data.Exp);

        int rate = (int)((float)player.CurrentLevelExp / player.NeedExp * 100);

        if (isLevelup)
        {
            if (player.Level >= 100)
            {
                _expText.text = "MAX";
            }
            else
            {
                DOTween.To(() => progressBar.Progress, x => progressBar.Progress = x, 100, 0.3f).SetDelay(0.9f)
                .onComplete =
                    () =>
                {
                    _expText.text        = player.CurrentLevelExp + "/" + player.NeedExp;
                    progressBar.DeltaX   = 0;
                    progressBar.Progress = 0;
                    DOTween.To(() => progressBar.Progress, x => progressBar.Progress = x, rate, 0.3f)
                    .SetDelay(1.3f);
                    Util.TweenTextNum(_expText, 0.3f, player.CurrentLevelExp, "", "/" + player.NeedExp);
                    _levelText.text = "Lv." + player.Level;
                };

                Util.TweenTextNum(_expText, 0.3f, lastNeedExp, "", "/" + lastNeedExp);
            }
        }
        else
        {
            if (player.Level >= 100)
            {
                _expText.text = "MAX";
            }
            else
            {
                DOTween.To(() => progressBar.Progress, x => progressBar.Progress = x, rate, 0.3f).SetDelay(0.9f);
                Util.TweenTextNum(_expText, 0.3f, player.CurrentLevelExp, "", "/" + player.NeedExp);
            }
        }

        for (int i = 0; i < data.UserCards.Count; i++)
        {
            GameObject item = InstantiatePrefab("Battle/FinalEstimate/RewardHeroCard");
            item.transform.SetParent(cardContainer, false);
            item.AddComponent <ItemShowEffect>().OnShowEffect(1 + i * 0.2f);

            var cardData = GlobalData.CardModel.GetUserCardById(data.UserCards[i].CardId);
            item.transform.GetComponent <RewardHeroCard>().SetData(cardData, data.CardExp);
        }

        StartCoroutine(StarRotation());
    }
Exemplo n.º 4
0
 public void SetData(VisitBattleResultData data, VisitLevelVo level)
 {
     transform.Find("Bg/StarAndGrade/Text/Text").GetComponent <Text>().text = data.Cap.ToString();
     //transform.Find("TitleText").GetComponent<Text>().text = level.LevelName;
 }