示例#1
0
 private void OnRewardButton(GlobalConfig.Data.League info)
 {
     if (LeagueLogics.data == null && LeagueLogics.data.end_rank > 0)
     {
         return;
     }
     Loading.Show();
     rewardButton.SetInteractable(false);
     Online.League.SetRewarded(info.id, done =>
     {
         Loading.Hide();
         if (done)
         {
             var subleague = GlobalFactory.Leagues.GetByScore(info, LeagueLogics.data.end_score);
             Profile.EarnGems(subleague.rewardGems);
             Game.Instance.OpenPopup <Popup_Rewards>().Setup(0, subleague.rewardGems, 0, 0, 0, true, false, () => Rateus.AddJoy(2));
             LeagueLogics.data.end_score = LeagueLogics.data.end_rank = 0;
             GlobalAnalytics.SourceGem(subleague.rewardGems, "league");
         }
         else
         {
             rewardButton.SetInteractable(true);
         }
     });
 }
示例#2
0
        public static int GetSubIndex(GlobalConfig.Data.League league, int score)
        {
            int res = 0;

            for (int i = 1; i < league.subleagus.Count; i++)
            {
                if (score >= league.subleagus[i].startScore)
                {
                    res = i;
                }
            }
            return(res);
        }
示例#3
0
    public Popup_MedalInfo Setup(GlobalConfig.Data.League info)
    {
        for (int i = 0; i < nameLabel.Length; i++)
        {
            nameLabel[i].SetText(info.subleagus[i].name);
        }

        for (int i = 0; i < infoLabel.Length; i++)
        {
            infoLabel[i].SetFormatedText(info.subleagus[i].startScore);
        }

        for (int i = 0; i < rewardLabel.Length; i++)
        {
            rewardLabel[i].SetText(info.subleagus[i].rewardGems.ToString());
        }

        return(this);
    }
示例#4
0
        public static GlobalConfig.Data.League.SubLeague GetNextByScore(GlobalConfig.Data.League league, int score)
        {
            var index = Mathf.Clamp(GetSubIndex(league, score) + 1, 0, league.subleagus.Count);

            return(league.subleagus[index]);
        }
示例#5
0
 public static Sprite GetMedal(GlobalConfig.Data.League league, int score)
 {
     return(GetMedalSprite(GetSubIndex(league, score)));
 }