public override void OnInspectorGUI() { cloud = target as SteamworksRemoteStorageManager; Rect hRect = EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(""); Rect bRect = new Rect(hRect); bRect.width = hRect.width / 2f; tabPage = GUI.Toggle(bRect, tabPage == 0, "Settings", EditorStyles.toolbarButton) ? 0 : tabPage; bRect.x += bRect.width; tabPage = GUI.Toggle(bRect, tabPage == 1, "Events", EditorStyles.toolbarButton) ? 1 : tabPage; EditorGUILayout.EndHorizontal(); if (tabPage == 0) { if (!DropAreaGUI("... Drop Data Libraries Here ...")) { DrawDataLibList(); } } else { EditorGUILayout.PropertyField(FileReadAsyncComplete); EditorGUILayout.PropertyField(FileWriteAsyncComplete); } serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Loads the data from a given address /// Note that the load operation will only establish the result as the active data if its prefix matches /// </summary> /// <param name="address"></param> /// <returns></returns> public void Load(SteamworksRemoteStorageManager.FileAddress address) { if (!string.IsNullOrEmpty(address.fileName) && address.fileName.StartsWith(filePrefix)) { activeFile = SteamworksRemoteStorageManager.FileReadSteamDataFile(address); activeFile.WriteToLibrary(this); } }
/// <summary> /// Loads the data for the current active file if any /// Note that this will overwrite the data current stored in the library /// </summary> /// <returns>True if the operation completed, false if skiped such as for a blank active file</returns> public void Load() { if (activeFile != null) { activeFile = SteamworksRemoteStorageManager.FileReadSteamDataFile(activeFile.address); activeFile.WriteToLibrary(this); } }
/// <summary> /// Saves the current library data to the current active file /// </summary> /// <returns></returns> public void Save() { if (activeFile == null) { Debug.Log(""); } activeFile.linkedLibrary = this; SteamworksRemoteStorageManager.FileWrite(activeFile); }
/// <summary> /// Loads the data for the current active file if any /// Note that this will overwrite the data current stored in the library /// </summary> /// <returns>True if the operation completed, false if skiped such as for a blank active file</returns> public void LoadAsync() { if (activeFile != null) { SteamworksRemoteStorageManager.FileReadAsync(activeFile.address).Complete = results => { activeFile = results; activeFile.WriteToLibrary(this); }; } }
/// <summary> /// Saves the current library data to the current active file /// </summary> /// <returns></returns> public void SaveAsync() { activeFile.linkedLibrary = this; var file = SteamworksRemoteStorageManager.FileWriteAsync(activeFile); if (file.result != Steamworks.EResult.k_EResultFail) { file.Complete = results => { activeFile = results; }; } }
/// <summary> /// Loads the data from a given address /// Note that the load operation will only establish the result as the active data if its prefix matches /// </summary> /// <param name="address"></param> /// <returns></returns> public void LoadAsync(SteamworksRemoteStorageManager.FileAddress address) { if (!string.IsNullOrEmpty(address.fileName) && address.fileName.StartsWith(filePrefix)) { var nDataFile = SteamworksRemoteStorageManager.FileReadAsync(address); if (nDataFile.result != Steamworks.EResult.k_EResultFail) { nDataFile.Complete = results => { activeFile = results; activeFile.WriteToLibrary(this); }; } } }
public void Load(string fileName) { if (fileName.StartsWith(filePrefix)) { var result = SteamworksRemoteStorageManager.FileReadSteamDataFile(fileName); activeFile = result; result.WriteToLibrary(this); } else { var result = SteamworksRemoteStorageManager.FileReadSteamDataFile(filePrefix + fileName); activeFile = result; result.WriteToLibrary(this); } }
public void LoadAsync(string fileName) { if (fileName.StartsWith(filePrefix)) { SteamworksRemoteStorageManager.FileReadAsync(fileName).Complete = fileResult => { activeFile = fileResult; fileResult.WriteToLibrary(this); }; } else { SteamworksRemoteStorageManager.FileReadAsync(filePrefix + fileName).Complete = fileResult => { activeFile = fileResult; fileResult.WriteToLibrary(this); }; } }
/// <summary> /// Saves the file with a new name. /// Note that if the provided file name does not start with the filePrefix defined then it will be added /// </summary> /// <param name="fileName">The name to save as /// Note that if the provided file name does not start with the filePrefix defined then it will be added</param> /// <returns></returns> public void SaveAsAsync(string fileName) { if (string.IsNullOrEmpty(fileName)) { return; } if (!fileName.StartsWith(filePrefix)) { fileName = filePrefix + fileName; } var file = SteamworksRemoteStorageManager.FileWriteAsync(fileName, this); if (file.result != Steamworks.EResult.k_EResultFail) { file.Complete = results => { activeFile = results; }; } }
/// <summary> /// Saves the file with a new name. /// Note that if the provided file name does not start with the filePrefix defined then it will be added /// </summary> /// <param name="fileName">The name to save as /// Note that if the provided file name does not start with the filePrefix defined then it will be added</param> /// <returns></returns> public void SaveAs(string fileName) { if (string.IsNullOrEmpty(fileName)) { return; } if (!fileName.StartsWith(filePrefix)) { fileName = filePrefix + fileName; } var result = SteamworksRemoteStorageManager.FileWrite(fileName, this); if (result) { Debug.Log("[SteamDataLibrary.SaveAs] Saved '" + fileName + "' successfully."); } else { Debug.LogWarning("[SteamDataLibrary.SaveAs] Failed to save '" + fileName + "' to Steam Remote Storage.\nPlease consult https://partner.steamgames.com/doc/api/ISteamRemoteStorage#FileWrite for more information."); } }