Exemple #1
0
    // Use this for initialization
    private IEnumerator Start()
    {
        UIBackground.Show();
        LeagueLogics.info = GlobalConfig.Leagues[LeagueLogics.LeagueIndex];

        title.SetText(LeagueLogics.info.name);
        descLabel.SetText(LeagueLogics.info.desc);
        iconImage.sprite = GlobalFactory.Leagues.GetCupSprite(LeagueLogics.info.playType);
        boardButton.SetInteractable(false);
        playButton.SetInteractable(false);

        medalButton.onClick.AddListener(() => Game.Instance.OpenPopup <Popup_MedalInfo>().Setup(LeagueLogics.info));
        rewardButton.onClick.AddListener(() => OnRewardButton(LeagueLogics.info));
        boardButton.onClick.AddListener(() => Game.Instance.OpenPopup <State_Leaderboards>().Setup(LeagueLogics.info.id));
        rewardsButton.onClick = medalButton.onClick;

        playButton.onClick.AddListener(() =>
        {
            if (LeagueLogics.SetPlayerModel())
            {
                base.Back();
                UIBackground.Hide();
                Game.Instance.OpenState <State_Playing>();
            }
        });

        if (LeagueLogics.data == null)
        {
            Loading.Show();
            Online.League.GetData(LeagueLogics.info.id, (success, res) =>
            {
                Loading.Hide();
                if (success)
                {
                    LeagueLogics.data = res;
                    UpdateView();
                    UiShowHide.ShowAll(transform);
                }
                else
                {
                    base.Back();
                }
            });
        }
        else
        {
            UiShowHide.ShowAll(transform);
        }

        tutorial.Display(1, true, 111060, null);

        var wait = new WaitForSeconds(1);

        while (true)
        {
            UpdateView();
            yield return(wait);
        }
    }
Exemple #2
0
    private void Start()
    {
        Loading.Show();
        UIBackground.Show();
        var info = GlobalConfig.Leagues[leagueIndex];

        title.SetText(info.name);
        prefabItem.gameObject.SetActive(false);
        playButton.onClick.AddListener(() => Game.Instance.OpenPopup <Popup_LeagueInfo>().Setup(leagueIndex, leaderboard));

        Online.League.GetLeaderboard(info.id, 0, 100, (succeed, board) =>
        {
            Loading.Hide();
            if (succeed)
            {
                UpdatePlayerToList(board);

                board.last.Sort((x, y) => y.score - x.score);
                board.current.Sort((x, y) => y.score - x.score);

                for (int i = 0; i < board.last.Count; i++)
                {
                    board.last[i].rank = i + 1;
                }

                for (int i = 0; i < board.current.Count; i++)
                {
                    board.current[i].rank = i + 1;
                }

                for (int i = 0; i < legends.Length; i++)
                {
                    legends[i].Setup(info.id, i < board.last.Count ? board.last[i] : new Online.League.Profile(), false);
                }

                foreach (var item in board.current)
                {
                    prefabItem.Clone <UiLeaderboardItem>().Setup(info.id, item).gameObject.SetActive(true);
                }
                Destroy(prefabItem.gameObject);

                leaderboard = board;
                UiShowHide.ShowAll(transform);
            }
            else
            {
                Back();
                return;
            }
        });
    }
Exemple #3
0
    private void Start()
    {
        friendsDesc.SetFormatedText(GlobalConfig.Friends.rewardGems);

        friendsButton.onClick.AddListener(() =>
        {
            if (Profile.HasNickname)
            {
                Game.Instance.OpenState <State_Friends>();
            }
            else
            {
                Game.Instance.OpenPopup <Popup_Confirm>().Setup(111121, true, false, ok =>
                {
                    if (ok)
                    {
                        Game.Instance.OpenPopup <Popup_Profile>().SetOnClose(() =>
                        {
                            if (Profile.HasNickname)
                            {
                                Game.Instance.OpenPopup <Popup_Confirm>().Setup(111122, true, false, null);
                            }
                        });
                    }
                });
            }
        });

        UIBackground.Show();
        if (Profile.IsLoggedIn)
        {
            UiShowHide.ShowAll(transform);
        }
        else
        {
            Loading.Show();
            Profile.Sync(false, success =>
            {
                Loading.Hide();
                if (success)
                {
                    UiShowHide.ShowAll(transform);
                }
                else
                {
                    Back();
                }
            });
        }
    }
Exemple #4
0
    private void Start()
    {
        season = GlobalFactory.Seasons.Get(CurrentSeason);

        chestButton.onClick.AddListener(() =>
        {
            if (seasonState == SeasonState.CanClaimReward)
            {
                var reward = season.finalReward.GetResult();
                Profile.SetSeasonRewarded(season.id, 1);
                Profile.EarnGems(reward.gems);
                Profile.Bombs    += reward.bombs;
                Profile.Hammers  += reward.hammers;
                Profile.Missiles += reward.missiles;
                Game.Instance.OpenPopup <Popup_Rewards>().Setup(0, reward.gems, reward.bombs, reward.hammers, reward.missiles, false, false, () => Rateus.AddJoy(4, () => nextButton.onClick.Invoke()));
                GlobalAnalytics.SourceGem(reward.gems, "season");
            }
            else
            {
                tutorial.Display(0, false, 111041, null);
            }
        });

        nextButton.onClick.AddListener(() =>
        {
            season = GlobalFactory.Seasons.Get(++CurrentSeason);
            UpdateVisual();
            DisplayLevels();
        });

        prevButton.onClick.AddListener(() =>
        {
            var prevSeason = GlobalFactory.Seasons.Get(CurrentSeason - 1);
            if (prevSeason != null)
            {
                CurrentSeason--;
                season = prevSeason;
                UpdateVisual();
                DisplayLevels();
            }
        });

        UpdateVisual();
        DisplayLevels();
        UIBackground.Show();
        UiShowHide.ShowAll(transform);
    }
        public IEnumerator StartBattleJudge()
        {
            AudioSource source   = SingletonMonoBehaviour <SoundManager> .Instance.seSourceObserver[5].source;
            AudioClip   clip     = SoundFile.LoadSE(GetFanfare());
            float       waitTime = clip.length / 3f;

            if (!_isBattleCut)
            {
                _uiBackground.Show(0.5f, null);
            }
            yield return(new WaitForSeconds(0.5f));

            ShowHPGauge(_listHPGauges[0]);
            ShowHPGauge(_listHPGauges[1]);
            yield return(new WaitForSeconds(0.5f));

            _listHPGauges.ForEach(delegate(BtlCut_UICircleHPGauge x)
            {
                x.PlayNonColor().setDelay(0.5f);
            });
            if (_iWinRank == BattleWinRankKinds.S)
            {
                TrophyUtil.Unlock_At_BattleResultOnlySally();
                ShowCongratulation();
            }
            _uiJudgeLabel.SetActive(isActive: true);
            KCV.Utils.SoundUtils.PlaySE(SEFIleInfos.BattleNightMessage);
            yield return(new WaitForSeconds(0.3f));

            _traRankBase.SetActive(isActive: true);
            KCV.Utils.SoundUtils.PlaySE(SEFIleInfos.BattleNightMessage);
            yield return(new WaitForSeconds(0.8f));

            _uiRankTex.SetActive(isActive: true);
            KCV.Utils.SoundUtils.PlaySE(SEFIleInfos.BattleNightMessage);
            source.PlayOneShot(clip);
            yield return(new WaitForSeconds(waitTime));

            Hide();
            yield return(new WaitForSeconds(0.5f));
        }
Exemple #6
0
    private IEnumerator Start()
    {
        UIBackground.Show();
        UiShowHide.ShowAll(transform);

        onlineButton.onClick.AddListener(() =>
        {
            if (Profile.GetSeasonRewarded(0) > 0)
            {
                Game.Instance.OpenState <State_SelectLeague>();
            }
            else
            {
                tutorial.Display(0, false, 111034, null);
            }
        });

        classicButton.onClick.AddListener(() =>
        {
            if (ClassicLogics.SetPlayModel())
            {
                UIBackground.Hide();
                Game.Instance.OpenState <State_Playing>();
            }
        });

        if (Profile.IsFirstSession)
        {
            levelsButton.GetComponent <Animation>().Play();
        }
        levelsButton.onClick.AddListener(() => Game.Instance.OpenState <State_Levels>());

        luckyButton.onClick.AddListener(() =>
        {
            var seconds = Online.Timer.GetRemainSeconds(GlobalConfig.Luckyspin.timerId, GlobalConfig.Luckyspin.interval);
            if (seconds > 0)
            {
                Game.Instance.OpenPopup <Popup_Confirm>().SetText(111018, TimeToString(seconds)).Setup(true, false, null);
            }
            else
            {
                Online.Timer.Set(GlobalConfig.Luckyspin.timerId, GlobalConfig.Luckyspin.interval);
                Game.Instance.OpenPopup <Popup_LuckySpine>();
            }
        });


        if (Profile.IsFirstSession == false &&
            Profile.Version < GlobalConfig.Instance.version &&
            GlobalConfig.Update.mode == GlobalConfig.Data.Update.Mode.Null &&
            GlobalConfig.Update.rewardGems > 0)
        {
            Profile.Version = GlobalConfig.Instance.version;
            Game.Instance.OpenPopup <Popup_Confirm>().Setup(111129, true, false, ok =>
            {
                Game.Instance.OpenPopup <Popup_Rewards>().Setup(0, GlobalConfig.Update.rewardGems, 0, 0, 0, true, false, () => Profile.EarnGems(GlobalConfig.Update.rewardGems));
                GlobalAnalytics.SourceGem(GlobalConfig.Update.rewardGems, "update");
            });
        }

        var displayed = tutorial.Display(1, true, 111031, () => tutorial.Display(0, true, 111032, null));

        if (displayed == false)
        {
            tutorial.DisplayJoke(1);
        }

        var wait = new WaitForSeconds(1);

        while (true)
        {
            var seconds = Online.Timer.GetRemainSeconds(GlobalConfig.Luckyspin.timerId, GlobalConfig.Luckyspin.interval);
            if (seconds > 0)
            {
                luckyTimeLabel.transform.SetActiveChild(1);
                var h = seconds / 3600;
                var m = (seconds % 3600) / 60;
                var s = seconds % 60;
                luckyTimeLabel.SetFormatedText(h, m, s);
            }
            else
            {
                luckyTimeLabel.transform.SetActiveChild(0);
            }

            yield return(wait);
        }
    }