コード例 #1
0
    public void SaveAchievementsInfo()
    {
        string path = $"{Application.persistentDataPath}/achievements_info.json";

        var arr = new AchievementsInfo[dicAchievementsInfo.Count];
        int i   = 0;

        foreach (var info in dicAchievementsInfo)
        {
            arr[i] = info.Value;
            i++;
        }

        string json = JsonConvert.SerializeObject(arr);

        File.WriteAllText(path, json);
    }
コード例 #2
0
 public void Init(AchievementsData data, AchievementsInfo info)
 {
     this.data        = data;
     this.lbName.text = data.name;
     this.lbDesc.text = data.description;
     this.lbRwd.text  = data.amount.ToString();
     this.info        = info;
     if (info.isCleared == true && info.isClaimed == false)
     {
         this.btnClaim.gameObject.SetActive(true);
     }
     else if (info.isCleared == true && info.isClaimed == true)
     {
         this.iconClaimed.gameObject.SetActive(true);
     }
     else if (info.isCleared == false && info.isClaimed == false)
     {
         this.iconNotCleared.gameObject.SetActive(true);
     }
     else
     {
         this.btnClaim.gameObject.SetActive(false);
     }
 }