Ejemplo n.º 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);
        }
    }
Ejemplo n.º 2
0
 public static void StartPlaying(System.Action nextTask)
 {
     UIBackground.Hide();
     Game.Instance.ClosePopup(true);
     Game.Instance.OpenState <State_Playing>();
     GlobalAnalytics.Levels.Start(season.id, index);
     CheckCinematics(CinematicConfig.Point.Start, nextTask);
 }
Ejemplo n.º 3
0
 private LTDescr Hide()
 {
     if (!_isBattleCut)
     {
         _uiBackground.Hide(0.5f, null);
     }
     return(base.transform.LTValue(1f, 0f, 0.5f).setEase(LeanTweenType.linear).setOnUpdate(delegate(float x)
     {
         _uiForeground.alpha = x;
         _listHPGauges[0].panel.alpha = x;
         _listHPGauges[1].panel.alpha = x;
     }));
 }
Ejemplo n.º 4
0
    private IEnumerator Start()
    {
        scoreLabel.SetText("0");

        int totalBalls = PlayModel.result.totalBalls + PlayModel.level.startBallCount;

        descLabel.SetFormatedText(PlayModel.result.totalTurn.ToString(), PlayModel.result.totalBlocks.ToString(), totalBalls);

        inviteButton.onClick.AddListener(() =>
        {
            var str = string.Format(GlobalConfig.Socials.invitationText, Profile.Username, GlobalConfig.Market.storeUrl);
            SocialAndSharing.ShareText(str);
        });

        replayButton.onClick.AddListener(() =>
        {
            onReplayFunc(() =>
            {
                base.Back();
                UIBackground.Hide();
                Game.Instance.ClosePopup(true);
                Game.Instance.OpenState <State_Playing>();
            });
        });

        baloon.gameObject.SetActive(false);
        UiShowHide.ShowAll(transform);
        yield return(new WaitForSeconds(0.5f));

        // Incentive  text
        {
            var index        = BaloonIndex++ % 25;
            var incentiveStr = LocalizationService.Get(111090 + index);
            baloon.SetText(incentiveStr);
            baloon.gameObject.SetActive(true);
        }

        float t = 0;
        float curscore = 0, maxscore = PlayModel.GetScore();
        var   wait = new WaitForEndOfFrame();

        while (t < 1)
        {
            t       += Time.deltaTime * 0.75f;
            curscore = Mathf.Lerp(0, maxscore, t);
            scoreLabel.SetText(Mathf.RoundToInt(curscore).ToString());
            yield return(wait);
        }
    }
Ejemplo n.º 5
0
    private IEnumerator Start()
    {
        GlobalFactory.Theme.Select(PlayModel.level.theme);
        sounds = GlobalFactory.Theme.Selected.sounds.Clone <ThemeSounds>(transform);

        backgroundImage.sprite = GlobalFactory.Theme.Selected.playingBackground;
        endTurnButton.gameObject.SetActive(false);
        endTurnButton.onClick.AddListener(() => transform.Broadcast(Messages.Type.EndTurn));
        pauseButton.onClick.AddListener(() => Game.Instance.OpenPopup <Popup_Settings>());

        abilityButton.transform.SetActiveChild(0);
        abilityButton.onClick.AddListener(() =>
        {
            Game.Instance.ClosePopup(true);
            Game.Instance.OpenPopup <Popup_PreLose>().Setup(false, ability => // check if player wants to use abilities
            {
                if (ability != AbilityType.Null)
                {
                    Game.Instance.OpenPopup <Popup_Effects>().Setup(ability, () => transform.Broadcast(Messages.Type.UseAbility, ability), CheckMission);
                }
            });
        });

        UIBackground.Hide();
        UiShowHide.ShowAll(transform);
        AudioManager.SetMusicVolumFactor(0.1f);

        yield return(new WaitWhile(() => Game.Instance.CurrentPopup));

        yield return(new WaitForSeconds(0.5f));

        if (PlayModel.IsLevels && PlayModel.level.season == 0 && PlayModel.level.index == 0)
        {
            tutorial.transform.GetChild(0).gameObject.SetActive(true);
            tutorial.transform.GetChild(1).gameObject.SetActive(false);
            tutorial.transform.GetChild(2).gameObject.SetActive(false);
            tutorial.Display(0, false, 111037, null);
        }
        else if (PlayModel.IsClassic || PlayModel.level.index > 1)
        {
            tutorial.transform.GetChild(0).gameObject.SetActive(false);
            tutorial.transform.GetChild(1).gameObject.SetActive(false);
            tutorial.transform.GetChild(2).gameObject.SetActive(true);
            tutorial.Display(0, true, 111044, null);
        }
    }
Ejemplo n.º 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);
        }
    }