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);
        }
    }
Example #2
0
    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);
        }
    }
Example #3
0
    //Increment achievement
    public static void IncrementAchievement(string key)
    {
        BasicAchievement a = GetAchievement(key);

        if (a != null)
        {
            a.Increment();
        }
    }
Example #4
0
    //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);
        }
    }
Example #5
0
 // 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();
 }
Example #6
0
    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.
//			}
        }
    }
Example #7
0
 //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;
     }
 }
Example #8
0
 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);
     }
 }
Example #9
0
    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);
        }
    }
Example #10
0
    public static void LockAchievement(string key)
    {
        BasicAchievement a = GetAchievement(key);

        a.Lock();
    }
Example #11
0
 public static void DisplayPopup(BasicAchievement a)
 {
     AchievementHelper.DisplayPopup(a);
 }
Example #12
0
 // 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 ();
 }