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

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

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