Skip to content

Commit 589445d

Browse files
authored
Merge pull request #18 from modio/v2024.11
Syncing v2024.11
2 parents 38efd3b + 48405a6 commit 589445d

File tree

135 files changed

+5062
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+5062
-367
lines changed

Editor/ModIO.EditorCode/SettingsAssetEditor.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class SettingsAssetEditor : Editor
1515
SerializedProperty useCommandLineArgumentOverrides;
1616
SerializedProperty _showMonetizationUIProperty;
1717
SerializedProperty _showEnabledModToggleProperty;
18+
SerializedProperty _fallbackToEmailProperty;
1819

1920
void OnEnable()
2021
{
@@ -29,6 +30,7 @@ void OnEnable()
2930
var uiSettingsProperty = serializedObject.FindProperty("uiSettings");
3031

3132
_showMonetizationUIProperty = uiSettingsProperty.FindPropertyRelative("ShowMonetizationUI");
33+
_fallbackToEmailProperty = serverSettingsProperty.FindPropertyRelative("fallbackToEmailAuth");
3234
_showEnabledModToggleProperty = uiSettingsProperty.FindPropertyRelative("ShowEnabledModToggle");
3335
}
3436

@@ -58,13 +60,20 @@ public override void OnInspectorGUI()
5860
EditorGUILayout.Space();
5961

6062
EditorGUILayout.DelayedIntField(gameId, new GUIContent("Game ID"));
63+
6164
using (EditorGUI.ChangeCheckScope passwordChange = new EditorGUI.ChangeCheckScope())
6265
{
6366
string tempPassword = EditorGUILayout.PasswordField("API Key", gameKey.stringValue);
6467
if (passwordChange.changed)
6568
gameKey.stringValue = tempPassword;
6669
}
6770

71+
EditorGUILayout.PropertyField(_fallbackToEmailProperty);
72+
if (_fallbackToEmailProperty.boolValue)
73+
{
74+
EditorGUILayout.HelpBox("This may cause certification failures on platforms", MessageType.Warning);
75+
}
76+
6877
if (myTarget.serverSettings.gameId == 0 || string.IsNullOrWhiteSpace(myTarget.serverSettings.gameKey))
6978
{
7079
EditorGUILayout.Space();
@@ -108,7 +117,7 @@ public override void OnInspectorGUI()
108117

109118
EditorGUILayout.BeginHorizontal();
110119

111-
if (GUILayout.Button("Insert URL for Test API"))
120+
if (GUILayout.Button("Insert URL for Staging API"))
112121
SetURLTest();
113122

114123
if (GUILayout.Button("Insert URL for Production API"))
@@ -153,7 +162,7 @@ void SetURLTest()
153162

154163
internal static string GetURLProduction(int gameId) => $"https://g-{gameId}.modapi.io/v1";
155164

156-
static string GetURLTest(int gameId) => "https://api.test.mod.io/v1";
165+
static string GetURLTest(int gameId) => "https://api-staging.moddemo.io/v1";
157166

158167
static bool IsURLProduction(string url) => Regex.IsMatch(url, @"https:\/\/g-\d*.modapi.io\/v1");
159168
}

Experimental/modio-ui.unitypackage

2.44 MB
Binary file not shown.

Platform/Mobile/Android/ModioPlatformExampleGoogleGames.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using UnityEngine;
22

3-
#if UNITY_ANDROID
3+
#if UNITY_ANDROID && !MODIO_OCULUS
44
using GooglePlayGames;
55
#endif
66

@@ -10,11 +10,11 @@ public class ModioPlatformExampleGoogleGames : MonoBehaviour
1010
{
1111
private void Awake()
1212
{
13-
#if UNITY_ANDROID
13+
#if UNITY_ANDROID && !MODIO_OCULUS
1414
// Enable debug logging for Play Games Platform
1515
PlayGamesPlatform.DebugLogEnabled = true;
1616
PlayGamesPlatform.Activate();
17-
17+
1818
// Authenticate with Play Games Services
1919
PlayGamesPlatform.Instance.Authenticate((success) =>
2020
{

Platform/Mobile/Android/ModioPlatformExampleGoogleSignIn.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using UnityEngine;
22

3-
#if UNITY_ANDROID
3+
#if UNITY_ANDROID && !MODIO_OCULUS
44
using System;
55
using System.Collections.Generic;
66
using System.Threading.Tasks;
@@ -16,12 +16,12 @@ public class ModioPlatformExampleGoogleSignIn : MonoBehaviour
1616

1717
private void Awake()
1818
{
19-
#if UNITY_ANDROID
19+
#if UNITY_ANDROID && !MODIO_OCULUS
2020
SignInSilently();
2121
#endif
2222
}
2323

24-
#if UNITY_ANDROID
24+
#if UNITY_ANDROID && !MODIO_OCULUS
2525
async void SignInSilently()
2626
{
2727
if (Application.isEditor)

Platform/Mobile/Android/ModioPlatformGoogleGames.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
#if UNITY_ANDROID
3+
#if UNITY_ANDROID && !MODIO_OCULUS
44
using GooglePlayGames;
55
using UnityEngine;
66
#endif
@@ -13,10 +13,10 @@ public static void SetAsPlatform()
1313
{
1414
ActivePlatform = new ModioPlatformGoogleGames();
1515
}
16-
16+
1717
public void PerformSso(TermsHash? displayedTerms, Action<Result> onComplete, string optionalThirdPartyEmailAddressUsedForAuthentication = null)
1818
{
19-
#if UNITY_ANDROID
19+
#if UNITY_ANDROID && !MODIO_OCULUS
2020
GetIdToken(token =>
2121
{
2222
ModIOUnity.AuthenticateUserViaGoogle(token,
@@ -26,8 +26,8 @@ public void PerformSso(TermsHash? displayedTerms, Action<Result> onComplete, str
2626
});
2727
#endif
2828
}
29-
30-
#if UNITY_ANDROID
29+
30+
#if UNITY_ANDROID && !MODIO_OCULUS
3131
void GetIdToken(Action<string> onReceivedAuthCode)
3232
{
3333
if (Application.isEditor)

Platform/Mobile/Android/ModioPlatformGoogleSignIn.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ModIO.Implementation.Platform
55
public class ModioPlatformGoogleSignIn : ModioPlatform, IModioSsoPlatform
66
{
77
private string idToken;
8-
8+
99
public static void SetAsPlatform(string idToken)
1010
{
1111
ActivePlatform = new ModioPlatformGoogleSignIn
@@ -15,7 +15,7 @@ public static void SetAsPlatform(string idToken)
1515
}
1616
public void PerformSso(TermsHash? displayedTerms, Action<Result> onComplete, string optionalThirdPartyEmailAddressUsedForAuthentication = null)
1717
{
18-
#if UNITY_ANDROID
18+
#if UNITY_ANDROID && !MODIO_OCULUS
1919
ModIOUnity.AuthenticateUserViaGoogle(idToken,
2020
optionalThirdPartyEmailAddressUsedForAuthentication,
2121
displayedTerms,

Platform/Mobile/iOS/ModioPlatformIos.cs

+23-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Text;
44

55
#if UNITY_IOS
6+
using ModIO.Platform.Mobile.iOS;
67
using AppleAuth;
78
using AppleAuth.Enums;
89
using AppleAuth.Extensions;
@@ -46,15 +47,35 @@ void GetToken(Action<string> onReceivedIdToken)
4647
}
4748
}
4849
#endif
50+
public override bool TryGetAvailableDiskSpace(out long availableFreeSpace)
51+
{
52+
#if UNITY_IOS
53+
try
54+
{
55+
availableFreeSpace = NativeIosBridge.GetAvailableDiskSpace();
56+
return true;
57+
}
58+
catch (Exception e)
59+
{
60+
availableFreeSpace = 0;
61+
Logger.Log(LogLevel.Error, $"An Error occurred when trying to get available disk space. {e}");
62+
return false;
63+
}
64+
#else
65+
availableFreeSpace = 0;
66+
return false;
67+
#endif
68+
69+
}
4970
public void PerformSso(TermsHash? displayedTerms, Action<Result> onComplete,
50-
string optionalThirdPartyEmailAddressUsedForAuthentication = null)
71+
string optionalThirdPartyEmailAddressUsedForAuthentication = null)
5172
{
5273
#if UNITY_IOS
5374
GetToken((idToken) =>
5475
{
5576
ModIOUnity.AuthenticateUserViaApple(idToken,
5677
optionalThirdPartyEmailAddressUsedForAuthentication,
57-
displayedTerms,
78+
displayedTerms,
5879
onComplete);
5980
});
6081
#endif
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace ModIO.Platform.Mobile.iOS
4+
{
5+
#if UNITY_IOS
6+
7+
public static class NativeIosBridge
8+
{
9+
[DllImport("__Internal")]
10+
public static extern long GetAvailableDiskSpace();
11+
}
12+
#endif
13+
14+
}

Platform/Mobile/iOS/NativeIosBridge.cs.meta

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

Platform/Oculus.meta

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using UnityEngine;
2+
3+
#if MODIO_OCULUS
4+
using Oculus.Platform;
5+
using Oculus.Platform.Models;
6+
#endif
7+
8+
namespace ModIO.Implementation.Platform
9+
{
10+
public class ModioPlatformExampleOculus : MonoBehaviour
11+
{
12+
#if MODIO_OCULUS
13+
void Awake()
14+
{
15+
// Oculus takes a fair bit of time to initialize and perform the entitlement check. By calling this
16+
// we're telling the plugin to wait until it's ready.
17+
ModioPlatform.SetInitializing();
18+
19+
// Ensure you have your game's App Id set up in the Oculus Settings object provided by the Meta Platform SDK
20+
Core.AsyncInitialize().OnComplete(OnInitialize);
21+
}
22+
23+
void OnInitialize(Message<PlatformInitialize> message)
24+
{
25+
if (message.IsError)
26+
{
27+
Logger.Log(LogLevel.Error, $"initializing Oculus Platform: {message.GetError().Message}");
28+
return;
29+
}
30+
31+
Logger.Log(LogLevel.Verbose, $"Oculus Platform initialized successfully");
32+
33+
Entitlements.IsUserEntitledToApplication().OnComplete(OnEntitled);
34+
}
35+
36+
void OnEntitled(Message message)
37+
{
38+
if (message.IsError)
39+
{
40+
Logger.Log(LogLevel.Error, $"Error checking Oculus Platform entitlement: {message.GetError().Message}");
41+
return;
42+
}
43+
44+
Logger.Log(LogLevel.Verbose, $"Oculus Platform verified entitlement successfully");
45+
46+
ModioPlatformOculus.SetAsPlatform();
47+
}
48+
#endif
49+
}
50+
}

Platform/Oculus/ModioPlatformExampleOculus.cs.meta

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

0 commit comments

Comments
 (0)