public static void DisplayPopup(BasicAchievement a) { myGameObject.GetComponent <AchievementHelper>().CancelInvoke(); myGameObject.GetComponent <AchievementHelper>().Invoke("ClearCurrent", 1f); if (numberOut + 1 > max) { myGameObject.GetComponent <AchievementHelper>().ClearCurrent(); } if (current != null) { location = defaultLocation; location.y -= (distance * numberOut); } else { location = defaultLocation; } current = (GameObject)Instantiate(defaultPopup, location, defaultPopup.transform.rotation); numberOut++; myPopup = current.GetComponent <AchievementPopup>(); if (a.IsIncremental && progressBarEnabled) { myPopup.SetValues(a.Name, a.Progress, a.Icon, progressBarEnabled); } else { myPopup.SetValues("Achievement Unlocked", a.Name, a.Icon); } }
public static void DisplayPopup(BasicAchievement a) { myGameObject.GetComponent<AchievementHelper>().CancelInvoke(); myGameObject.GetComponent<AchievementHelper>().Invoke ("ClearCurrent", 1f); if(numberOut +1 > max) { myGameObject.GetComponent<AchievementHelper>().ClearCurrent(); } if(current != null) { location = defaultLocation; location.y -= (distance * numberOut); } else { location = defaultLocation; } current = (GameObject)Instantiate (defaultPopup,location,defaultPopup.transform.rotation); numberOut++; myPopup = current.GetComponent<AchievementPopup>(); if(a.IsIncremental && progressBarEnabled) { myPopup.SetValues(a.Name,a.Progress,a.Icon,progressBarEnabled); } else { myPopup.SetValues("Achievement Unlocked",a.Name,a.Icon); } }
//Increment achievement public static void IncrementAchievement(string key) { BasicAchievement a = GetAchievement(key); if (a != null) { a.Increment(); } }
//Increment achievement and show progress. public static void IncrementAchievement(string key, bool showPopup) { BasicAchievement a = GetAchievement(key); if (a != null) { a.Increment(); } if (showPopup && a.IsLocked) { DisplayPopup(a); } }
// Use this for initialization public void Start() { myAchievement = (!isIncremental) ? new BasicAchievement(key, myName, description, lockedTexture, unlockedTexture) : new BasicAchievement(key, myName, description, lockedTexture, unlockedTexture, goal); if (string.IsNullOrEmpty(myAchievement.Name)) { this.gameObject.SetActive(false); return; } AchievementManager.AddAchievement(myAchievement); //Add Achievement to system. Refresh(); }
public static void UnlockAchievement(string key) { BasicAchievement a = GetAchievement(key); if (a.IsLocked) { a.Unlock(); DisplayPopup(a); // if(enableGoogle) // { // GoogleAchievementHandler.UnlockGoogleAchievement(key); //Comment out if not using google. // } } }
//Call this to add an achivement. public static void AddAchievement(BasicAchievement a) { if (achievements == null) { achievements = new List <BasicAchievement>(); } if (!achievements.Contains(a)) { achievements.Add(a); } else { achievements[achievements.IndexOf(a)] = a; } }
public void CommitChanges() { if (myAchievement != null) { if (isIncremental) { myAchievement.CommitToPlayerPrefs(key, myName, description, lockedTexture, unlockedTexture, goal); } else { myAchievement.CommitToPlayerPrefs(key, myName, description, lockedTexture, unlockedTexture); } } else { myAchievement = (!isIncremental) ? new BasicAchievement(key, myName, description, lockedTexture, unlockedTexture) : new BasicAchievement(key, myName, description, lockedTexture, unlockedTexture, goal); } }
public void CommitChanges() { if(myAchievement != null) { if(isIncremental) { myAchievement.CommitToPlayerPrefs(key, myName,description,lockedTexture,unlockedTexture,goal) ; } else { myAchievement.CommitToPlayerPrefs(key, myName,description,lockedTexture,unlockedTexture) ; } } else { myAchievement = (!isIncremental) ? new BasicAchievement(key,myName,description,lockedTexture,unlockedTexture) : new BasicAchievement(key,myName,description,lockedTexture,unlockedTexture,goal); } }
public static void LockAchievement(string key) { BasicAchievement a = GetAchievement(key); a.Lock(); }
public static void DisplayPopup(BasicAchievement a) { AchievementHelper.DisplayPopup(a); }
// Use this for initialization public void Start() { myAchievement = (!isIncremental) ? new BasicAchievement(key,myName,description,lockedTexture,unlockedTexture) : new BasicAchievement(key,myName,description,lockedTexture,unlockedTexture,goal); if(string.IsNullOrEmpty(myAchievement.Name)) { this.gameObject.SetActive(false); return; } AchievementManager.AddAchievement(myAchievement); //Add Achievement to system. Refresh (); }