Ejemplo n.º 1
0
    /// <summary>
    /// this could change depending on the game and the atlas used
    /// </summary>
    /// <param name="achivement"></param>
    /// <param name="index"></param>
    /// <returns></returns>
    string GetRewardIconName(FMAchievementItem achivement, int index)
    {
        FMRewardItem reward = FMPlayfabReward.GetRewardFromKey(achivement.RewardKeys[index]);

        //default
        if (index == -1 || reward == null)
        {
            Debug.Log("reward null en " + achivement.Key);
            return("achievement");
        }

        switch (reward.RewardTypeValue)
        {
        case "co":
        case "pc":
            return("coin");

        case "item":
            return("achievement");
        }
        return("");
    }
Ejemplo n.º 2
0
    /// <summary>
    /// get title achievements
    /// </summary>
    /// <param name="res"></param>
    public void StoreItemsFromJson(GetTitleDataResult res)
    {
        Items.Clear();
        var titleAchievements = JSON.Parse(res.Data["fm_achievements"]);

        for (int i = 0; i < titleAchievements.Count; i++)
        {
            var item = new FMAchievementItem();
            item.Key   = titleAchievements[i]["key"].Value;
            item.Title = titleAchievements[i]["title"].Value;

            item.AmountRequired = new int[titleAchievements[i]["count"].AsArray.Count];
            item.RewardKeys     = new string[titleAchievements[i]["reward_keys"].Count];
            for (int j = 0; j < titleAchievements[i]["reward_keys"].Count; j++)
            {
                item.RewardKeys[j]     = titleAchievements[i]["reward_keys"][j].Value;
                item.AmountRequired[j] = titleAchievements[i]["count"][j].AsInt;
            }
            item.Statistic = titleAchievements[i]["statistic_name"].Value;
            item.iconName  = titleAchievements[i]["icon"].Value;

            Items.Add(item);
        }
    }