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

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

        a.Lock();
    }
Exemple #11
0
 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 ();
 }