public static void Show() { if (instance == null) { instance = Resources.Load <UIBackground>("Menus/UIBackground").Clone <UIBackground>(Game.Instance.Canvas.transform); } }
// 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); } }
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); }
public static void Hide() { if (instance != null) { UiShowHide.HideAll(instance.transform); Destroy(instance.gameObject, 1); instance = null; } }
//function called when dark theme button is pressed private void DarkThemeButton_Click(object sender, RoutedEventArgs e) { //creates dark theme user interface UserInterface darkTheme = new CreateDarkUserInterface(); UIBackground darkBackground = darkTheme.MakeBackground(mainScreen); Toolbar darkToolbar = darkTheme.MakeToolbar(ButtonBar); SongLabel darkSongLabel = darkTheme.MakeSongLabel(CurrentSongLabel); }
//function called when light theme button is pressed private void LightThemeButton_Click(object sender, RoutedEventArgs e) { //creates light theme user interface UserInterface lightTheme = new CreateLightUserInterface(); //returned values aren't used, just needed them to properly access the functions to make the changes UIBackground lightBackground = lightTheme.MakeBackground(mainScreen); Toolbar lightToolbar = lightTheme.MakeToolbar(ButtonBar); SongLabel lightSongLabel = lightTheme.MakeSongLabel(CurrentSongLabel); }
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; } }); }
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(); } }); } }
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); } }
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); }
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); } }
public void Dispose() { Heart?.Dispose(); Hearts?.Dispose(); Stage?.Dispose(); PenguinSliding?.Dispose(); PenguinWalking?.Dispose(); PenguinWithBoard?.Dispose(); UIBackground?.Dispose(); Grzesiek?.Dispose(); DOG?.Dispose(); Alex?.Dispose(); Kamil?.Dispose(); Marcin?.Dispose(); Marek?.Dispose(); Tymon?.Dispose(); PenguinIcons?.Dispose(); }
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); } }