// ------[ INITIALIZATION ]------
        public void OnEnable(SerializedProperty serializedEditableModProfile, ModProfile baseProfile, UserProfile user)
        {
            this.editableProfileProperty = serializedEditableModProfile;
            this.profile       = baseProfile;
            this.isUndoEnabled = (baseProfile != null);

            isTagsExpanded = false;
            isKVPsExpanded = false;

            // - Game Profile -
            ModManager.GetGameProfile((g) => { this.gameProfile = g; isRepaintRequired = true; },
                                      null);

            // - Configure Properties -
            logoProperty = editableProfileProperty.FindPropertyRelative("logoLocator");

            // - Load Textures -
            if (logoProperty.FindPropertyRelative("isDirty").boolValue == true)
            {
                logoLocation = logoProperty.FindPropertyRelative("value.url").stringValue;
                logoTexture  = CacheClient.ReadImageFile(logoLocation);
                if (logoTexture != null)
                {
                    lastLogoWriteTime = (new FileInfo(logoLocation)).LastWriteTime;
                }
            }
            else if (profile != null)
            {
                logoLocation = profile.logoLocator.GetSizeURL(LOGO_PREVIEW_SIZE);
                logoTexture  = ApplicationImages.LoadingPlaceholder;

                ModManager.GetModLogo(profile, LOGO_PREVIEW_SIZE,
                                      (t) => { logoTexture = t; isRepaintRequired = true; },
                                      WebRequestError.LogAsWarning);
            }
            else
            {
                logoLocation = string.Empty;
                logoTexture  = null;
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
 public static void SaveGameProfile(GameProfile profile)
 {
     CacheClient.WriteJsonObjectFile(gameProfileFilePath, profile);
 }
Exemplo n.º 4
0
 /// <summary>Stores the game's profile in the cache.</summary>
 public static bool SaveGameProfile(GameProfile profile)
 {
     Debug.Assert(profile != null);
     return(IOUtilities.WriteJsonObjectFile(gameProfileFilePath, profile));
 }
Exemplo n.º 5
0
        /// <summary>Stores the game's profile in the cache.</summary>
        public static bool SaveGameProfile(GameProfile profile)
        {
            Debug.Assert(profile != null);

            return(LocalDataStorage.WriteJSONFile(gameProfileFilePath, profile));
        }