Пример #1
0
    public void UnlockAchievement(AchievementID achievement)
    {
        AchievementItemController item = achievementItems[(int)achievement];

        if (item.unlocked)
        {
            return;
        }

        ShowNotification();
        PlayerPrefs.SetInt(item.achievement.id, 1);
        item.unlocked = true;
        item.RefreshView();
    }
Пример #2
0
    public void UnlockAchievement(Achievements achievement)
    {
        AchievementItemController item = achievementItems[(int)achievement];

        if (item.unlocked)
        {
            return;
        }

        ListOf.Revision.Add();
        PlayerPrefs.SetInt(item.achievement.id, ListOf.Constants.DefaultPositiveValue);
        ChangeAchievementToShow(achievement);
        ShowNotification();

        item.unlocked = true;
        item.RefreshView();
    }
Пример #3
0
 private void LoadAchievementsTable()
 {
     foreach (AchievementItemController item in achievementItems)
     {
         DestroyImmediate(item.gameObject);
     }
     achievementItems.Clear();
     foreach (Achievement achievement in database.achievements)
     {
         GameObject obj = Instantiate(achievementItemPrefab, scrollViewContent);
         AchievementItemController item = obj.GetComponent <AchievementItemController>();
         bool unlocked = PlayerPrefs.GetInt(achievement.id, 0) == 1;
         item.unlocked    = unlocked;
         item.achievement = achievement;
         item.RefreshView();
         achievementItems.Add(item);
     }
 }
Пример #4
0
    [ContextMenu("LoadAchievementTable")]     //for loading achievements in editor
    private void LoadAchievementTable()
    {
        //for loading achievements in editor
        foreach (AchievementItemController controller in achievementItems)
        {
            DestroyImmediate(controller.gameObject);
        }

        achievementItems.Clear();

        foreach (Achievement achievement in database.achievements)
        {
            GameObject obj = Instantiate(achievementItemPrefab, content);
            AchievementItemController controller = obj.GetComponent <AchievementItemController>();
            bool unlocked = PlayerPrefs.GetInt(achievement.id, ListOf.Constants.DefaultNegativeValue) == 1;             //from UnlockAchievement()
            controller.unlocked    = unlocked;
            controller.achievement = achievement;
            controller.RefreshView();

            //for loading achievements in editor
            achievementItems.Add(controller);
        }
    }