void TestCloud() { ICloud cloud = null; RemoteStoragePlatform remoteStorrage = RemoteStoragePlatform.All; cloud.CloudFileShareResult += (CloudFileShareResult x, bool y) => { }; cloud.CloudDownloadUGCResult += (CloudDownloadUGCResult x, bool y) => { }; b = cloud.Write(s, ba); i = cloud.Read(s, ba); b = cloud.Forget(s); b = cloud.Delete(s); cloud.Share(s); b = cloud.SetSyncPlatforms(s, remoteStorrage); b = cloud.Exists(s); b = cloud.Persisted(s); i = cloud.GetSize(s); l = cloud.Timestamp(s); remoteStorrage = cloud.GetSyncPlatforms(s); i = cloud.GetFileCount(); s = cloud.GetFileNameAndSize(i, out i); b = cloud.GetQuota(out i, out i); b = cloud.IsEnabledForAccount(); b = cloud.IsEnabledForApplication(); cloud.SetEnabledForApplication(b); cloud.UGCDownload(ugcHandle); b = cloud.GetUGCDetails(ugcHandle, out appID, out s, out i, out steamID); i = cloud.UGCRead(ugcHandle, ba); i = cloud.GetCachedUGCCount(); ugcHandle = cloud.GetUGCHandle(i); }
private void OnGUI() { GUILayout.Label(status); GUILayout.Label(achievementStatus); GUILayout.Label(hasLicense.ToString()); GUILayout.Label(SteamInterface.AppID.ToString()); if (GUILayout.Button("Unlock Achivement!")) { if (SteamInterface.Stats.SetAchievement("Your-Achievement-Name")) { achievementStatus = "Achievement Status: Successfully got an achievement!"; } } if (GUILayout.Button("Clear Achivement!")) { if (SteamInterface.Stats.ClearAchievement("Your-Achievement-Name")) { achievementStatus = "Achievement Status: Successfully cleared an achievement!"; } } if (GUILayout.Button("Get Achievement!")) { StatsGetAchievementResult result = SteamInterface.Stats.GetAchievement("Your-Achievement-Name"); if (result.result) { if (result.sender) { achievementStatus = "Achievement Status: achievement is unlocked!"; } else { achievementStatus = "Achievement Status: achievement is locked!"; } } } GUILayout.Space(24); if (GUILayout.Button("Write File")) { byte[] buffer = System.Text.Encoding.ASCII.GetBytes("Hello World again!!!"); GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned); try { System.IntPtr bufferPtr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); SteamInterface.Cloud.Write("test123.dat", bufferPtr, 128); } finally { bufferHandle.Free(); } } if (GUILayout.Button("Check Number of Files")) { ICloud cloud = SteamInterface.Cloud; Debug.Log("test123.dat Exists? " + cloud.Exists("test123.dat")); } if (GUILayout.Button("Read File")) { ICloud cloud = Steamworks.SteamInterface.Cloud; string _filename = "test123.dat"; int filesize = cloud.GetSize(_filename); Debug.Log("File Size: " + filesize); IntPtr hLocalRead = Marshal.AllocHGlobal(filesize); // I am guessing this could be a problem line int amountRead = cloud.Read(_filename, hLocalRead, filesize); // I am guessing this could be a problem line. Debug.Log("Amount Read: " + amountRead); String returnedString = Marshal.PtrToStringAnsi(hLocalRead); Debug.Log("Our Read Data is: " + returnedString); Marshal.FreeHGlobal(hLocalRead); } if (GUILayout.Button("Delete File")) { ICloud cloud = SteamInterface.Cloud; cloud.Delete("test123.dat"); cloud.Forget("test123.dat"); } GUILayout.Space(24); // NOTE! // Overlays might not work in the Unity editor, see the documentation for more information if (GUILayout.Button("Show overlay")) { // Will show the game overlay and show the Friends dialog. SteamInterface.Friends.ActivateGameOverlay(OverlayDialog.Friends); } if (GUILayout.Button("Show overlay (webpage)")) { // Will show the game overlay and open a web page. SteamInterface.Friends.ActivateGameOverlayToWebPage("http://ludosity.com"); } }