예제 #1
0
        // ---------[ MOD PROFILES ]---------
        public static void GetModProfile(int modId,
                                         Action <ModProfile> onSuccess,
                                         Action <WebRequestError> onError)
        {
            var cachedProfile = CacheClient.LoadModProfile(modId);

            if (cachedProfile != null)
            {
                if (onSuccess != null)
                {
                    onSuccess(cachedProfile);
                }
            }
            else
            {
                // - Fetch from Server -
                Action <ModProfile> onGetMod = (profile) =>
                {
                    CacheClient.SaveModProfile(profile);
                    if (onSuccess != null)
                    {
                        onSuccess(profile);
                    }
                };

                APIClient.GetMod(modId,
                                 onGetMod,
                                 onError);
            }
        }