Skip to content

Commit b4f759f

Browse files
authored
Merge pull request #14 from modio/v2048.1.0
Syncing v2048.1.0
2 parents ada341f + 42180c2 commit b4f759f

32 files changed

+298
-104
lines changed

.github/workflows/push-modio-docs.yml

-31
This file was deleted.

Experimental/modio-ui.unitypackage

3.34 MB
Binary file not shown.

Platform/Mobile/MobilePurchaseHelper.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_ANDROID || UNITY_IOS
2-
#if MODIO_IN_APP_PURCHASING
1+
#if (UNITY_IOS || UNITY_ANDROID) && MODIO_MOBILE_IAP
32
using System;
43
using System.Collections.Generic;
54
using System.Linq;
@@ -111,4 +110,3 @@ public static void QueuePurchase(Product product, Action completeValidation)
111110
}
112111
}
113112
#endif
114-
#endif

Platform/Mobile/MobilePurchasingExample.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#if (UNITY_IOS || UNITY_ANDROID)
2-
#if MODIO_IN_APP_PURCHASING
3-
1+
#if (UNITY_IOS || UNITY_ANDROID) && MODIO_MOBILE_IAP
42
using System;
53
using System.Collections.Generic;
64
using ModIO;
@@ -185,4 +183,3 @@ public void OnPurchaseFailed(Product product, PurchaseFailureDescription failure
185183
}
186184
}
187185
#endif
188-
#endif

Platform/Mobile/PurchaseData.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#if UNITY_IOS || UNITY_ANDROID
2-
#if MODIO_IN_APP_PURCHASING
3-
1+
#if (UNITY_IOS || UNITY_ANDROID) && MODIO_MOBILE_IAP
42
using System;
53
using UnityEngine.Purchasing;
64

@@ -16,4 +14,3 @@ public class PurchaseData
1614
}
1715
}
1816
#endif
19-
#endif

Platform/Steam/Facepunch/ModioPlatformFacepunch.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static void SetAsPlatform()
1515
ActivePlatform = new ModioPlatformFacepunch();
1616
}
1717

18-
public async void PerformSso(TermsHash? displayedTerms, Action<bool> onComplete, string optionalThirdPartyEmailAddressUsedForAuthentication = null)
18+
public async void PerformSso(TermsHash? displayedTerms, Action<Result> onComplete, string optionalThirdPartyEmailAddressUsedForAuthentication = null)
1919
{
2020
#if UNITY_FACEPUNCH
2121

@@ -25,10 +25,7 @@ public async void PerformSso(TermsHash? displayedTerms, Action<bool> onComplete,
2525
ModIOUnity.AuthenticateUserViaSteam(base64Ticket,
2626
optionalThirdPartyEmailAddressUsedForAuthentication,
2727
displayedTerms,
28-
result =>
29-
{
30-
onComplete(result.Succeeded());
31-
});
28+
onComplete);
3229
#endif
3330
}
3431

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_position: 0
77
---
88

99
<a href="https://mod.io"><img src="https://mod.io/images/branding/modio-logo-bluewhite.svg" alt="mod.io" width="360" align="right"/></a>
10-
# mod.io Unity Plugin v2024.7.1
10+
# mod.io Unity Plugin v2024.8
1111
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/modio/modio-unity/blob/master/LICENSE)
1212
[![Discord](https://img.shields.io/discord/389039439487434752.svg?label=Discord&logo=discord&color=7289DA&labelColor=2C2F33)](https://discord.mod.io)
1313
[![Master docs](https://img.shields.io/badge/docs-master-green.svg)](https://docs.mod.io/unity/)
@@ -26,10 +26,17 @@ mod.io enables game developers of all sizes to integrate user-generated content
2626
The mod.io Unity Engine plugin is the simplest and fastest way to integrate UGC into your Unity **2020.3+** game. It handles all of the common tasks, allowing game developers to quickly and easily implement a solution that enables players to access and discover user-generated content for their games.
2727

2828
A custom built [ready-made UI](#browser-ui) for mod discovery is included, along with installation and collection management, and a full-featured [C# interface](#getting-started) which connects to the [mod.io REST API](https://docs.mod.io).
29+
> [!WARNING]
30+
> The Browser UI is scheduled for deprecation, and may not receive updates.
31+
> This is to be replaced with the [Component UI / Template UI](#component-ui)
2932
3033
## Platform Support
3134
To access console platforms and documentation, see [Supporting Console Platforms](https://docs.mod.io/platforms/).
3235

36+
> [!WARNING]
37+
> To enable Mobile In-App Purchasing you need to define the `MODIO_MOBILE_IAP` in Project Settings > Player > Script Compilation > Scripting Define Symbols
38+
> This will also require the Unity.Purchasing package to be installed.
39+
3340
| Platform | Support |
3441
|-----------------|:-------:|
3542
| Windows ||
@@ -91,6 +98,9 @@ If you have any questions or need some help join our [Discord](https://discord.m
9198
The mod.io Unity Engine plugin comes with a prebuilt UI, a drop-in, instant solution for browsing and installing your game's mods.
9299

93100
If you want to skip implementing your own UI, head to the [Browser UI](#browser-ui) section for setup and usage instructions. However, we recommend following the guide below to better understand how the plugin works.
101+
> [!WARNING]
102+
> The Browser UI is scheduled for deprecation, and may not receive updates.
103+
> This is to be replaced with the [Component UI / Template UI](#component-ui)
94104
95105
## Getting Started
96106

@@ -1240,6 +1250,10 @@ namespace ModIO
12401250

12411251
## Browser UI
12421252

1253+
> [!WARNING]
1254+
> The Browser UI is scheduled for deprecation, and may not receive updates.
1255+
> This is to be replaced with the [Component UI / Template UI](#component-ui)
1256+
12431257
> [!IMPORTANT]
12441258
> The Browser UI relies on the *config file* that is configured during the [setup instructions](#setup) above. Ensure you have completed all of those steps before proceeding.
12451259
@@ -1261,6 +1275,13 @@ When a user authenticates, the Browser UI will localize mod.io's terms of use ba
12611275

12621276
To avoid the plugin conflicting with an existing solution, in the case of right-to-left languages you will need to apply your current implementation for mixed RTL and LTR text to the terms text-elements in the browser.
12631277

1278+
## Component UI
1279+
The Component UI is an experimental module that allows for a more easily integrated and customised Mod Browsing UI.
1280+
This can be accessed via the `modio-ui.unitypackage` provided in the plugin in the `experimental` folder.
1281+
A Readme is provided in the package.
1282+
> [!IMPORTANT]
1283+
> This will be replacing the functionality provided by the Browser UI, once the Browser UI is deprecated.
1284+
12641285
# Marketplace
12651286
The mod.io SDK supports full monetization features, allowing you to sell a per-game virtual currency to your players that they can use to purchase mods, with a share of the revenue split between creators and your studio. Every platform requires specific setup for monetization features to work, with regards to the virtual currency configuration and API calls.
12661287

Runtime/Classes/SearchFilter.cs

+11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class SearchFilter
2626
internal List<string> tags = new List<string>();
2727
internal List<long> users = new List<long>();
2828
internal bool showMatureContent = false;
29+
internal int platformStatus = 0; // 0 = null
2930

3031
[SerializeField] internal RevenueType revenueType = RevenueType.Free;
3132
[SerializeField] internal int stock = Mods_DontShowSoldOut;
@@ -216,6 +217,16 @@ public IReadOnlyList<long> GetUserIds()
216217
return users;
217218
}
218219

220+
/// <summary>
221+
/// Adds a specific platform status to the filter to show mods that are either pending
222+
/// or both pending and live. This is primarily to be used in QA of mods.
223+
/// </summary>
224+
/// <param name="status">Platform verified status to show mods of</param>
225+
public void AddPlatformStatus(SearchFilterPlatformStatus status)
226+
{
227+
platformStatus = Convert.ToInt32(status);
228+
}
229+
219230
/// <summary>
220231
/// You can use this method to check if a search filter is setup correctly before using it
221232
/// in a GetMods request.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace ModIO
2+
{
3+
public enum SearchFilterPlatformStatus
4+
{
5+
PendingOnly = 1,
6+
LiveAndPending = 2,
7+
}
8+
9+
internal static class SearchFilterPlatformStatusExtension
10+
{
11+
public static string GetString(this SearchFilterPlatformStatus status) => status switch
12+
{
13+
SearchFilterPlatformStatus.PendingOnly => "pending_only",
14+
SearchFilterPlatformStatus.LiveAndPending => "live_and_pending",
15+
_ => string.Empty,
16+
};
17+
}
18+
}

Runtime/Enums/SearchFilterPlatformStatus.cs.meta

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/ModIO.Implementation/Classes/ExtractOperation.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async Task<Result> ExtractAll()
132132
catch(Exception e)
133133
{
134134
Logger.Log(LogLevel.Error,
135-
$"Unhandled exception extracting file. MODFILE [{modId}_{fileId}. Exception: {e.Message}");
135+
$"Unhandled exception extracting file. MODFILE [{modId}_{fileId}. \n{e}");
136136
cancel = true;
137137
}
138138
}
@@ -154,7 +154,7 @@ async Task<Result> ExtractAll()
154154
catch(Exception e)
155155
{
156156
Logger.Log(LogLevel.Error,
157-
$"Unhandled exception extracting file. MODFILE [{modId}_{fileId}. Exception: {e.Message}");
157+
$"Unhandled exception extracting file. MODFILE [{modId}_{fileId}. \n{e}");
158158
cancel = true;
159159
}
160160
}
@@ -233,7 +233,7 @@ internal async Task<Result> IsThereEnoughSpaceForExtracting()
233233
catch(Exception e)
234234
{
235235
Logger.Log(LogLevel.Error,
236-
$"Unhandled exception trying to read archive's extract size. MODFILE [{modId}_{fileId}. Exception: {e.Message}");
236+
$"Unhandled exception trying to read archive's extract size. MODFILE [{modId}_{fileId}. \n{e}");
237237
return ResultBuilder.Create(ResultCode.IO_FileCouldNotBeRead);
238238
}
239239
}

Runtime/ModIO.Implementation/Classes/ModCollectionManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public static async void SaveRegistry()
8080
if(!result.Succeeded())
8181
{
8282
Logger.Log(LogLevel.Error,
83-
"ModCollectionManager was unable to save the Registry to disk"
84-
+ " because DataStorage.SaveSystemRegistry failed");
83+
$"ModCollectionManager was unable to save the Registry to disk"
84+
+ $" because DataStorage.SaveSystemRegistry failed: {result.message}");
8585
}
8686
}
8787

Runtime/ModIO.Implementation/Classes/ModIOUnityImplementation.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
using UnityEngine;
1818
using GameObject = ModIO.Implementation.API.Objects.GameObject;
1919

20-
#if UNITY_IOS || UNITY_ANDROID
21-
#if MODIO_IN_APP_PURCHASING
20+
#if (UNITY_IOS || UNITY_ANDROID) && MODIO_MOBILE_IAP
2221
using Plugins.mod.io.Platform.Mobile;
2322
using Newtonsoft.Json.Linq;
2423
#endif
25-
#endif
2624

2725
namespace ModIO.Implementation
2826
{
@@ -442,7 +440,7 @@ public static async Task Shutdown(Action shutdownComplete)
442440
catch (Exception e)
443441
{
444442
shuttingDown = false;
445-
Logger.Log(LogLevel.Error, $"Exception caught when shutting down plugin: {e.Message} - inner={e.InnerException?.Message} - stacktrace: {e.StackTrace}");
443+
Logger.Log(LogLevel.Error, $"Exception caught when shutting down plugin: \n{e}");
446444
}
447445

448446

@@ -3418,8 +3416,8 @@ public static async Task<ResultAnd<Entitlement[]>> SyncEntitlements()
34183416
#elif UNITY_STANDALONE && !UNITY_EDITOR
34193417
config = API.Requests.SyncEntitlements.SteamRequest();
34203418
requestTask = WebRequestManager.Request<SyncEntitlements.ResponseSchema>(config);
3421-
#elif (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
3422-
#if MODIO_IN_APP_PURCHASING
3419+
#elif ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) && MODIO_MOBILE_IAP
3420+
34233421
var purchaseData = MobilePurchaseHelper.GetNextPurchase();
34243422
var walletResponse = await ModIOUnityAsync.GetUserWalletBalance();
34253423
if (!walletResponse.result.Succeeded())
@@ -3431,7 +3429,6 @@ public static async Task<ResultAnd<Entitlement[]>> SyncEntitlements()
34313429
config = API.Requests.SyncEntitlements.AppleRequest(purchaseData.Payload);
34323430

34333431
requestTask = WebRequestManager.Request<SyncEntitlements.ResponseSchema>(config);
3434-
#endif
34353432
#else
34363433
return ResultAnd.Create<Entitlement[]>(ResultBuilder.Create(ResultCode.User_NotAuthenticated), null);
34373434
#endif
@@ -3455,10 +3452,8 @@ public static async Task<ResultAnd<Entitlement[]>> SyncEntitlements()
34553452
entitlements = ResponseTranslator.ConvertEntitlementObjectsToEntitlements(task.value.data);
34563453
ResponseCache.ReplaceEntitlements(entitlements);
34573454
ResponseCache.ClearWalletFromCache();
3458-
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
3459-
#if MODIO_IN_APP_PURCHASING
3455+
#if ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) && MODIO_MOBILE_IAP
34603456
MobilePurchaseHelper.CompleteValidation(entitlements);
3461-
#endif
34623457
#endif
34633458

34643459
ModIOUnityEvents.OnUserEntitlementsChanged();

Runtime/ModIO.Implementation/Classes/ModIOVersion.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ internal struct ModIOVersion : System.IComparable<ModIOVersion>
55
{
66
// ---------[ Singleton ]---------
77
/// <summary>Singleton instance for current version.</summary>
8-
public static readonly ModIOVersion Current = new ModIOVersion(2024, 8, 1, "");
8+
public static readonly ModIOVersion Current = new ModIOVersion(2024, 8, 0, "");
99

1010
// ---------[ Fields ]---------
1111
/// <summary>Main Version number.</summary>

Runtime/ModIO.Implementation/Classes/TaskQueueRunner.cs

+4-11
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ async void AutoRun()
6363
catch(Exception e)
6464
{
6565
Logger.Log(LogLevel.Warning, $"[TQR] Unhandled exception "
66-
+ $" thrown in AutoRun. Exception: "
67-
+ $"{e.Message} - Inner Exception: "
68-
+ $"{e.InnerException?.Message}");
66+
+ $" thrown in AutoRun. \n{e}");
6967
}
7068
}
7169
isAutoRunning = false;
@@ -102,8 +100,7 @@ public async Task PerformTasks()
102100
catch(Exception e)
103101
{
104102
Logger.Log(LogLevel.Warning, $"[TQR] Unhandled exception thrown in "
105-
+ $"PerformTasks operation. Exception: {e.Message}"
106-
+ $" - Inner Exception: {e.InnerException?.Message}");
103+
+ $"PerformTasks operation. \n{e}");
107104
}
108105
}
109106

@@ -217,9 +214,7 @@ static async Task RunTasksAsync(List<TaskQueueItem> items, bool synchronizedJobs
217214
catch(Exception e)
218215
{
219216
Logger.Log(LogLevel.Warning, $"[TQR] Unhandled exception thrown in"
220-
+ $" synchronized RunTasksAsync() operation."
221-
+ $" Exception: {e.Message} - Inner Exception:"
222-
+ $" {e.InnerException?.Message}");
217+
+ $" synchronized RunTasksAsync() operation. \n{e}");
223218
}
224219
}
225220
}
@@ -246,9 +241,7 @@ static async Task RunTasksAsync(List<TaskQueueItem> items, bool synchronizedJobs
246241
catch(Exception e)
247242
{
248243
Logger.Log(LogLevel.Warning, $"[TQR] Unhandled exception thrown in"
249-
+ $" non-synchronized RunTasksAsync() operation."
250-
+ $" Exception: {e.Message} - Inner Exception:"
251-
+ $" {e.InnerException?.Message}");
244+
+ $" non-synchronized RunTasksAsync() operation.\n{e}");
252245
}
253246
}
254247

Runtime/ModIO.Implementation/Implementation.API/Classes/ResponseCache.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,14 @@ static async void ClearWalletFromCacheAfterDelay()
600600
cancellationTokenSource.Cancel();
601601

602602
cancellationTokenSource = new CancellationTokenSource();
603-
await Task.Delay(modLifetimeInCache, cancellationTokenSource.Token); // 60 second cache
604-
wallet = null;
603+
try
604+
{
605+
await Task.Delay(modLifetimeInCache, cancellationTokenSource.Token); // 60 second cache
606+
wallet = null;
607+
}
608+
catch (TaskCanceledException)
609+
{
610+
}
605611
}
606612

607613
static async void ClearModsFromCacheAfterDelay(List<ModId> modIds)

0 commit comments

Comments
 (0)