private void LoadFriends() { Online.Friends.Get((success, list) => { Loading.Hide(); if (success) { friends.Clear(); friends.AddRange(list); // add me :) friends.Add(new Online.Friends.Friendship() { id = "0", avatar = Profile.Avatar.Json, level = Profile.GetLevelsPassed().ToString(), nickname = Profile.Nickname, status = Profile.Status, username = Profile.Username }); SortFriends(); for (int i = 0; i < friends.Count; i++) { itemPrefab.Clone <UIFriendItem>().Setup(friends[i], i + 1).gameObject.SetActive(true); } UiShowHide.ShowAll(transform); } else { Back(); } }); }
// Use this for initialization private IEnumerator Start() { UiShowHide.ShowAll(transform); buyButton.onClick.AddListener(() => { Game.SpendGems(GlobalConfig.Shop.heartPrice, () => { Profile.Hearts += GlobalConfig.ProfilePreset.hearts; Back(); GlobalAnalytics.SinkGem(GlobalConfig.Shop.heartPrice, "profile", "heart"); }); }); price.SetText(GlobalConfig.Shop.heartPrice.ToString()); var wait = new WaitForSeconds(1); while (true) { hearts.SetText(Profile.Hearts.ToString()); int seconds = Online.Timer.GetRemainSeconds(GlobalConfig.Heart.timerId, GlobalConfig.Heart.interval); title.SetFormatedText(seconds / 60, seconds % 60); yield return(wait); } }
private void Start() { UpdateVisual(); sendButton.SetInteractable(false); UiShowHide.ShowAll(transform); sendButton.onClick.AddListener(() => { if (Rateus.Current > 4) { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111014, true, false, ok => { if (ok) { SocialAndSharing.RateUs(); } Back(); }); } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111126, true, true, ok => { if (ok) { Application.OpenURL(GlobalConfig.Socials.contactSurveyUrl); } Back(); }); } }); }
// 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 Hide() { if (instance != null) { UiShowHide.HideAll(instance.transform); Destroy(instance.gameObject, 1); instance = null; } }
// Use this for initialization private void Start() { #if UNITY_EDITOR { int[] items = new int[5] { 0, 0, 0, 0, 0 }; for (int i = 0; i < 1000; i++) { Init(); rewards.x = (rewards.x + 10) / 10 + 19 + RandomReward; rewards.y = (rewards.y + 10) / 10 + 29 + RandomReward; rewards.z = (rewards.z + 10) / 10 + 39 + RandomReward; rewards.x = rewards.x % 5; rewards.y = rewards.y % 5; rewards.z = rewards.z % 5; items[rewards.x]++; items[rewards.y]++; items[rewards.z]++; } string d = "Rewards:"; d += "Bombs[" + items[0] + "] "; d += "Scissors[" + items[1] + "] "; d += "gems[" + items[2] + "] "; d += "hammer[" + items[3] + "] "; d += "hearts[" + items[4] + "] "; Debug.Log(d); } #endif descStart.SetActive(true); descAgain.SetActive(false); Init(); UiShowHide.ShowAll(transform); stopButton.onClick.AddListener(() => { stopButton.SetInteractable(false); Init(); rewards.x = (rewards.x + 10) / 10 + 19 + RandomReward; rewards.y = (rewards.y + 10) / 10 + 29 + RandomReward; rewards.z = (rewards.z + 10) / 10 + 39 + RandomReward; columns[0].destination = -100 * rewards.x; columns[1].destination = -100 * rewards.y; columns[2].destination = -100 * rewards.z; for (int i = 0; i < columns.Length; i++) { SetImagesMaterial(columns[i], blurMaterial); } }); }
private void Start() { updateButton.onClick.AddListener(() => { Application.OpenURL(GlobalConfig.Market.storeUrl); Application.Quit(); }); if (instance != null) { UiShowHide.ShowAll(transform); } }
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; } }); }
// Use this for initialization private IEnumerator Start() { AudioManager.SetMusicVolumFactor(0.7f); instance = this; transform.SetAsFirstSibling(); foreach (AnimationState state in backgroundAnimator) { state.time = Random.Range(0, 120); break; } heartsButton.onClick.AddListener(() => { if (Profile.Hearts < GlobalConfig.ProfilePreset.hearts) { Game.Instance.OpenPopup <Popup_BuyHearts>(); } }); gemsButton.onClick.AddListener(() => { Game.Instance.OpenPopup <Popup_Shop>(); }); profileButton.onClick.AddListener(() => { Game.Instance.OpenPopup <Popup_Profile>(); }); updateButton.onClick.AddListener(() => { Application.OpenURL(GlobalConfig.Market.storeUrl); }); settingsButton.onClick.AddListener(() => { Game.Instance.OpenPopup <Popup_Settings>(); }); UiShowHide.ShowAll(transform); var wait = new WaitForSeconds(0.5f); while (true) { avatar.Setup(Profile.Avatar.Current); updateButton.gameObject.SetActive(GlobalConfig.Update.mode != GlobalConfig.Data.Update.Mode.Null); nickNameLabel.SetText(Profile.Nickname); gems.SetText(Profile.Gems.ToString("#,0")); heartsCount.SetText(Profile.Hearts.ToString()); if (Profile.Hearts < GlobalConfig.ProfilePreset.hearts) { int seconds = Online.Timer.GetRemainSeconds(GlobalConfig.Heart.timerId, GlobalConfig.Heart.interval); heartsTime.text = (seconds / 60).ToString("00") + ":" + (seconds % 60).ToString("00"); heartsTime.gameObject.SetActive(true); heartsFull.gameObject.SetActive(false); } else { heartsTime.gameObject.SetActive(false); heartsFull.gameObject.SetActive(true); } yield return(wait); } }
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); } }
// Use this for initialization private IEnumerator Start() { UiShowHide.ShowAll(transform); yield return(new WaitForSeconds(1)); hint.gameObject.SetActive(true); hint.SetText(LocalizationService.Get(111045 + HintId++ % 5)); var wait = new WaitForSeconds(0.5f); while (true) { if (PurchaseOffer.RemainedTime < 0) { Exit(false); } yield return(wait); } }
private void Start() { musicToggle.isOn = AudioManager.MusicVolume < 1; soundToggle.isOn = AudioManager.SoundVolume < 1; musicToggle.onValueChanged.AddListener((on) => AudioManager.MusicVolume = on ? 0 : 100); soundToggle.onValueChanged.AddListener((on) => AudioManager.SoundVolume = on ? 0 : 100); resetButton.onClick.AddListener(() => Game.Instance.OpenPopup <Popup_Confirm>().Setup(111061, true, true, yes => { if (yes) { Profile.Reset(); } })); surveyButton.onClick.AddListener(() => Application.OpenURL(GlobalConfig.Socials.contactSurveyUrl)); supportButton.onClick.AddListener(() => SocialAndSharing.SendEmail( GlobalConfig.Socials.contactEmailUrl, "Support - " + Application.identifier + " - " + Application.version, "OS:" + SystemInfo.operatingSystem + "|<br>Model:" + SystemInfo.deviceModel + "|<br>Username:"******"|<br>DeviceId:" + Core.DeviceId + "|<br>Group:" + GlobalConfig.Group + "|_____________________<br><br><br><br>")); purchasedButton.onClick.AddListener(() => { Loading.Show(); PurchaseSystem.QueryPurchases(PurchaseProvider.Market, (success, json) => { Loading.Hide(); if (success) { var data = JsonUtility.FromJson <PurchasedData>(json); CheckPurchasedList(data, 0); } }); }); UiShowHide.ShowAll(transform); }
private IEnumerator Start() { var index = PurchaseOffer.GetOfferIndex(Profile.Gems); if (index.Between(0, GlobalConfig.Shop.offers.Count - 1)) { var item = combinedItem.Clone <UiShopItem>(); item.Setup(GlobalConfig.Shop.offers[index].sku, success => { PurchaseOffer.SetPurchaseResult(success); item.gameObject.SetActive(success == false); }); } foreach (var item in GlobalConfig.Shop.combinedPackages) { combinedItem.Clone <UiShopItem>().Setup(item.sku); } foreach (var item in GlobalConfig.Shop.gemPackages) { gemsItem.Clone <UiShopItem>().Setup(item.sku); } gemsItem.transform.parent.SetAsLastSibling(); Destroy(combinedItem.gameObject); Destroy(gemsItem.gameObject); UiShowHide.ShowAll(transform); var wait = new WaitForSeconds(0.5f); while (true) { gemsLabel.SetText(Profile.Gems.ToString("#,0")); yield return(wait); } }
private IEnumerator Start() { UiShowHide.ShowAll(transform); if (doOpenChest) { //yield return new WaitForSeconds(0.5f); chest.Open(); } yield return(new WaitUntil(() => chest.IsOpened)); yield return(new WaitForSeconds(1)); while (window.anchoredPosition.sqrMagnitude > 5) { window.anchoredPosition = Vector3.Lerp(window.anchoredPosition, Vector3.zero, Time.deltaTime * 10); yield return(new WaitForEndOfFrame()); } //if (rgems > 0) { var wait = new WaitForEndOfFrame(); while (true) { if (rtime < 1) { rtime += Time.deltaTime; gemsLabel.SetText("+" + Mathf.RoundToInt(Mathf.Lerp(0, rgems, rtime))); bombsLabel.SetText("+" + Mathf.RoundToInt(Mathf.Lerp(0, rbombs, rtime))); hammersLabel.SetText("+" + Mathf.RoundToInt(Mathf.Lerp(0, rhammers, rtime))); missilesLabel.SetText("+" + Mathf.RoundToInt(Mathf.Lerp(0, rmissiles, rtime))); } yield return(wait); } } }
private void Start() { titleLabel.SetFormatedText(GlobalConfig.Friends.rewardGems); descLabel.SetFormatedText(GlobalConfig.Friends.maxCount); inviteButton.onClick.AddListener(() => { var str = string.Format(GlobalConfig.Socials.invitationText, Profile.Username, GlobalConfig.Market.storeUrl); SocialAndSharing.ShareText(str); }); addButton.onClick.AddListener(() => { var username = usernameInput.text.CleanFromCode(); if (username.HasContent(2)) { Loading.Show(); addButton.SetInteractable(false); Online.Friends.Add(username, (success, friend) => { Loading.Hide(); Back(); if (success && onSuccessFunc != null) { onSuccessFunc(friend); } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111124, true, false, null); } }); } }); UiShowHide.ShowAll(transform); }
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); } }
// Will be called before destroying this object. return time of closing animation public virtual float PreClose() { return(UiShowHide.HideAll(transform)); }
// Use this for initialization private IEnumerator Start() { UiShowHide.ShowAll(transform); avatar.Setup(Profile.Avatar.Current); nicknameInput.text = Profile.HasNickname ? Profile.Nickname : Profile.Username; nicknamePrice.transform.parent.gameObject.SetActive(Profile.HasNickname); nicknamePrice.SetText(GlobalConfig.Shop.nicknamePrice.ToString()); nicknameButton.onClick.AddListener(() => { if (nicknameInput.text.ComputeMD5(Core.Salt) != "AC9CD53769E38CBBD8707CA1108BA10D") { var nickname = nicknameInput.text.Trim().CleanFromCode().CleanForPersian(); #if UNITY_EDITOR_off SendNickname(nickname); #else if (nickname != Profile.Username && nickname.HasContent(3) && nickname.IsLetterOrDigit() && BadWordsFinder.HasBadWord(nickname) == false) { if (Profile.HasNickname) { Game.SpendGems(GlobalConfig.Shop.nicknamePrice, () => SendNickname(nickname)); } else { SendNickname(nickname); } } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111001, false, true, null); } #endif } else { GlobalConfig.DebugMode = true; } }); statusInput.text = Profile.Status; statusPrice.transform.parent.gameObject.SetActive(Profile.HasStatus); statusPrice.SetText(GlobalConfig.Shop.statusPrice.ToString()); statusButton.onClick.AddListener(() => { var status = statusInput.text.Trim().CleanFromCode().CleanForPersian(); #if UNITY_EDITOR_off SendStatus(status); #else if (status.HasContent(3) && status.IsLetterOrDigit() && BadWordsFinder.HasBadWord(status) == false) { if (Profile.HasStatus) { Game.SpendGems(GlobalConfig.Shop.statusPrice, () => SendStatus(status)); } else { SendStatus(status); } } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111002, false, true, null); } #endif }); hairSlider.minValue = 0; hairSlider.maxValue = 360; hairSlider.value = Profile.Avatar.Angle; hairSlider.onValueChanged.AddListener(value => { Profile.Avatar.Angle = value.ToInt(); avatar.Setup(Profile.Avatar.Current); Game.Instance.CurrentState.Broadcast(Messages.Type.AvatarChanged, Profile.Avatar.Current); }); for (int i = 0; i < GlobalFactory.Balls.Count; i++) { if (GlobalFactory.Balls.GetSprite(i) != null) { itemPrefab.Clone <UiProfileBallItem>().Setup(i).gameObject.SetActive(true); } } yield return(new WaitForSeconds(0.1f)); ballsScroller.content.anchoredPosition = Vector2.down * (UiProfileBallItem.unlockedPosition.y + 100); }
// Use this for initialization private IEnumerator Start() { var rewards = PlayModel.GetReward(); int rewardStars = PlayModel.GetRewardStars(); // verify that player has been passed this level if (Profile.IsLevelPassed(PlayModel.level.season, PlayModel.level.index)) { rewards.gems = rewards.bombs = rewards.hammers = rewards.missiles = 0; } Profile.SetLevelStars(PlayModel.level.season, PlayModel.level.index, rewardStars); int totalBalls = PlayModel.result.totalBalls + PlayModel.level.startBallCount; desc.SetFormatedText(PlayModel.result.totalTurn.ToString(), PlayModel.result.totalBlocks.ToString(), totalBalls); if (rewards.exist) { continueButton.gameObject.SetActive(true); nextLevelButton.gameObject.SetActive(false); goHomeButton.gameObject.SetActive(false); } else { continueButton.gameObject.SetActive(false); nextLevelButton.gameObject.SetActive(true); goHomeButton.gameObject.SetActive(true); } nextLevelButton.onClick.AddListener(() => { base.Back(); nextTaskFunc?.Invoke(true); }); goHomeButton.onClick.AddListener(() => { base.Back(); nextTaskFunc?.Invoke(false); }); continueButton.onClick.AddListener(() => { continueButton.gameObject.SetActive(false); Profile.EarnGems(rewards.gems); Profile.Bombs += rewards.bombs; Profile.Hammers += rewards.hammers; Profile.Missiles += rewards.missiles; Game.Instance.OpenPopup <Popup_Rewards>().Setup(0, rewards.gems, rewards.bombs, rewards.hammers, rewards.missiles, true, true, () => { continueButton.gameObject.SetActive(false); nextLevelButton.gameObject.SetActive(true); goHomeButton.gameObject.SetActive(true); }); GlobalAnalytics.SourceGem(rewards.gems, "level"); }); UiShowHide.ShowAll(transform); var wait = new WaitForSeconds(0.3f); yield return(wait); yield return(wait); yield return(wait); stars[0].SetActive(rewardStars > 0); yield return(wait); stars[1].SetActive(rewardStars > 1); yield return(wait); stars[2].SetActive(rewardStars > 2); yield return(wait); // Incentive text { var index = BaloonIndex++ % 25; var incentiveStr = LocalizationService.Get(111090 + index); if (BaloonIndex < 25 || Random.Range(0, 100) < rewardStars * 25) { baloon.SetText(incentiveStr); baloon.gameObject.SetActive(true); } } }
private void Start() { UiShowHide.ShowAll(transform); }
public Popup_PreLose Setup(bool displayHomeButton, System.Action <AbilityType> callback) { callbackFunc = callback; UpdateTexts(); bombButton.onClick.AddListener(() => { if (Profile.Bombs > 0) { Profile.Bombs--; Profile.Skill -= GlobalConfig.Difficulty.loseFactor / 1; callback(AbilityType.Bomb); base.Back(); } else { BuyBooster(GlobalConfig.ProfilePreset.bombs, GlobalConfig.Shop.bombPrice, "bomb", count => Profile.Bombs += count); } }); hammerButton.onClick.AddListener(() => { if (Profile.Hammers > 0) { Profile.Hammers--; Profile.Skill -= GlobalConfig.Difficulty.loseFactor / 3; callback(AbilityType.Hammer); base.Back(); } else { BuyBooster(GlobalConfig.ProfilePreset.hammers, GlobalConfig.Shop.hammerPrice, "hammer", count => Profile.Hammers += count); } }); missleButton.onClick.AddListener(() => { if (Profile.Missiles > 0) { Profile.Missiles--; Profile.Skill -= GlobalConfig.Difficulty.loseFactor / 2; callback(AbilityType.Missle); base.Back(); } else { BuyBooster(GlobalConfig.ProfilePreset.missles, GlobalConfig.Shop.misslePrice, "scissor", count => Profile.Missiles += count); } }); homeButton.onClick.AddListener(() => { if (PlayModel.onPreLose != null) { PlayModel.onPreLose(ok => { if (ok) { Back(); } }); } else { Back(); } }); backButton.SetActive(displayHomeButton == false); homeContent.SetActive(displayHomeButton == true); UiShowHide.ShowAll(transform); return(this); }