Beispiel #1
0
        // ---------[ GAME PROFILE ]---------
        public static void GetGameProfile(Action <GameProfile> onSuccess,
                                          Action <WebRequestError> onError)
        {
            GameProfile cachedProfile = CacheClient.LoadGameProfile();

            if (cachedProfile != null)
            {
                onSuccess(cachedProfile);
            }
            else
            {
                Action <GameProfile> onGetProfile = (profile) =>
                {
                    CacheClient.SaveGameProfile(profile);
                    if (onSuccess != null)
                    {
                        onSuccess(profile);
                    }
                };

                APIClient.GetGame(onGetProfile,
                                  onError);
            }
        }