public void ReceiveDemo(AchievementObject achievement) { AchievementUI achievementUI = CreateAchievementUI(achievement); achievementUI.ShowAndHide(() => DesroyAchievementUI(achievementUI)); audioSource.Play(); }
public void UpdateDetails(int _selectedShip, int _selectedType) { selectedShip = _selectedShip; selectedType = _selectedType; int shipIndex = gameData.shipsUIItems[selectedShip].types[selectedType].associatedShipIndex; if (GlobalData.instance.saveData.shipsInfo[shipIndex].isUnlocked) { achievementParent.SetActive(false); statsParent.SetActive(true); nameText.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].name); description.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].description); powerName.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].powerName); powerDescription.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].powerDescription); ShipConfig shipConfig = gameData.ships[shipIndex]; life.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_LIFE") + (int)(shipConfig.lifePrecent * 100) + "%"; dps.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_DAMAGE") + (int)(shipConfig.damagePrecent * 100) + "%"; mana.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_MANA") + (int)(shipConfig.manaPrecent * 100) + "%"; } else { AchievementUI achiev = gameData.achievementsUI[gameData.shipsUIItems[selectedShip].types[selectedType].associatedAchievementIndex]; achievementParent.SetActive(true); statsParent.SetActive(false); nameText.text = LocalizationManager.GetLocalizedText("SHIPS_DETAILS_LOCKED"); description.text = gameData.shipsUIItems[selectedShip].types[selectedType].associatedAchievementIndex < 12 ? LocalizationManager.GetLocalizedText("SHIPS_DETAILS_ACHIEVEMENT_REQUIRED") : LocalizationManager.GetLocalizedText("SHIPS_DETAILS_UPGRADE_REQUIRED"); achivementImage.sprite = achiev.icon; powerName.text = LocalizationManager.GetLocalizedText(achiev.name); powerDescription.text = LocalizationManager.GetLocalizedText(achiev.description); } }
public override void PostAddRecipes() { achievementUI = new AchievementUI(); achievementUI.Activate(); achievementInterface = new UserInterface(); achievementInterface.SetState(achievementUI); }
public AchievementUI CreateAchievementUI(AchievementObject achievement) { AchievementUI achievementUI = Instantiate(template, body.transform); achievementUI.Title = achievement.title; achievementUI.Description = achievement.description; return(achievementUI); }
public void Init(AchievementUI data, int _achievementIndex) { achievementIndex = _achievementIndex; icon.sprite = data.icon; titleLocaID = data.name; descriptionLocaID = data.description; unlocked.SetActive(GlobalData.instance.saveData.achievementsUnlocked.Contains(achievementIndex)); UpdateUI(); }
public void onGotoAchievement() { if (_displayIndex >= _finishedAchieves.Count) { ScreenManager.show(gameObject, false); ScreenManager.instance().show("AchievementUI", true, "SlideIn"); AchievementUI achievementUI = ScreenManager.instance().get("AchievementUI").GetComponent <AchievementUI>(); achievementUI.fromScreen = "GameMainUI"; achievementUI.showAchieveInfo(_finishedAchieves[_finishedAchieves.Count - 1]); } }
IEnumerator Fade() { for (int i = 0; i < countDownToHide; i++) { yield return(new WaitForSeconds(1f)); } Animation anim = currentAchievementPrefab.GetComponent <Animation>(); anim.Play("AchievementHide"); currentAchievementPrefab = null; Destroy(currentAchievementPrefab, 1f); }
private void SetAchievementInfo(GameObject achParent, GameObject achPrefab, AchievementObject achData) { achPrefab.transform.SetParent(achParent.transform); achPrefab.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); AchievementUI achievementPrefab = achPrefab.GetComponent <AchievementUI>(); achievementPrefab.SetTitle(achData.ach_Title); achievementPrefab.SetDescription(achData.ach_Description); achievementPrefab.SetReward(achData.ach_Reward); if (PlayerDataManager.instance.GetUnlockedAchievement(achData.ach_ID)) { achievementPrefab.ShowClaimButton(achData); } }
private void achievementUnlocked(Completition achievement) { if (currentAchievementPrefab == null) { StartCoroutine(Fade()); currentAchievementPrefab = Instantiate(achievementUIprefab, gameObject.transform); Animation anim = currentAchievementPrefab.GetComponent <Animation>(); anim.Play("AchievementUnlockedNew"); } else { countDownToHide = achievementStayDuration; Animation anim = currentAchievementPrefab.GetComponent <Animation>(); anim.Play("AchievementUnlocked"); } currentAchievementPrefab.achievementDescription.text = achievement._description; currentAchievementPrefab.achievmentTitle.text = achievement._name; currentAchievementPrefab.progressBar.transform.localScale = new Vector3(1, 1, 1); }
private void achievementUpdated(Completition achievement, int previousMilestone, int advancement) { if (currentAchievementPrefab == null) { StartCoroutine(Fade()); currentAchievementPrefab = Instantiate(achievementUIprefab, gameObject.transform); Animation anim = currentAchievementPrefab.GetComponent <Animation>(); anim.Play("AchievementUpdate"); } else { countDownToHide = achievementStayDuration; } currentAchievementPrefab.achievementDescription.text = achievement._description; currentAchievementPrefab.achievmentTitle.text = achievement._name; float normalizedStartingAdvancement = (float)(advancement - 1 - previousMilestone) / (float)(achievement.Milestone - previousMilestone); float normalizedAdvancement = (float)(advancement - previousMilestone) / (float)(achievement.Milestone - previousMilestone); StartCoroutine(LerpSize(currentAchievementPrefab.progressBar.transform, normalizedStartingAdvancement, normalizedAdvancement, progressBarDuration, progressBarDuration)); StartCoroutine(LerpSize(currentAchievementPrefab.progressBarTemp.transform, normalizedStartingAdvancement, normalizedAdvancement, progressBarDuration)); }
public async void Receive(AchievementObject achievement) { if (achievement.received) { return; } if (await DBUserAchievements.AchievementReceived(2, achievement.id)) { return; } DateTime receiveDate = DateTime.Now; bool result = await DBUserAchievements.Receive(2, achievement.id, receiveDate); if (result) { achievement.received = true; achievement.receiveDate = receiveDate; AchievementUI achievementUI = CreateAchievementUI(achievement); achievementUI.ShowAndHide(() => DesroyAchievementUI(achievementUI)); audioSource.Play(); } }
public void DesroyAchievementUI(AchievementUI achievementUI) { Destroy(achievementUI.gameObject); }
public override void Unload() { AchievementManager.GetInstance().unload(); achievementUI = null; achievementInterface = null; }
// Use this for initialization void Awake() { AchievementsPanel.SetActive(false); Instance = this; _achievementQueue = new List <Achievement>(); }
private void Start() { achievementUI = gameObject.GetComponent <AchievementUI>(); }