Skip to content

Commit 9188a16

Browse files
authored
Merge pull request #11 from VirtueSky/dev
Dev
2 parents 9c30f80 + fda5b00 commit 9188a16

29 files changed

+1537
-76
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
### 1: Download the repo and drop it into folder `Assets`
2424
### 2: Add the line below to `Packages/manifest.json`
2525

26-
for version `2.9.5`
26+
for version `2.9.6`
2727
```csharp
28-
"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#2.9.5",
28+
"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#2.9.6",
2929
```
3030

3131
## Includes modules

VirtueSky/ControlPanel/CPAppsFlyerDrawer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class CPAppsFlyerDrawer
99
{
1010
private static AppsFlyerSetting _setting;
1111
private static UnityEditor.Editor _editor;
12+
private static Vector2 scroll = Vector2.zero;
1213

1314
public static void OnEnable()
1415
{
@@ -28,6 +29,7 @@ public static void OnDrawAppsFlyer()
2829
GUILayout.BeginVertical();
2930
GUILayout.Label("APPSFLYER", EditorStyles.boldLabel);
3031
GUILayout.Space(10);
32+
scroll = EditorGUILayout.BeginScrollView(scroll);
3133
CPUtility.DrawButtonInstallPackage("Install AppsFlyer", "Remove AppsFlyer",
3234
ConstantPackage.PackageNameAppFlyer, ConstantPackage.MaxVersionAppFlyer);
3335
CPUtility.DrawButtonInstallPackage("Install AppsFlyer Revenue Generic", "Remove AppsFlyer Revenue Generic",
@@ -115,6 +117,7 @@ public static void OnDrawAppsFlyer()
115117
}
116118

117119
GUILayout.Space(10);
120+
EditorGUILayout.EndScrollView();
118121
GUILayout.EndVertical();
119122
}
120123
}

VirtueSky/ControlPanel/ConstantControlPanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ namespace VirtueSky.ControlPanel.Editor
33
public class ConstantControlPanel
44
{
55
public static int WIDTH_CONTENT_BUTTON_STATE_CONTROL_PANEL = 210;
6-
public static int POSITION_X_START_CONTENT = WIDTH_CONTENT_BUTTON_STATE_CONTROL_PANEL + 10;
6+
public static int POSITION_X_START_CONTENT = WIDTH_CONTENT_BUTTON_STATE_CONTROL_PANEL + 5;
77
}
88
}

VirtueSky/ControlPanel/ConstantPackage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
public class ConstantPackage
44
{
5-
public const string VersionSunflower = "2.9.5";
5+
public const string VersionSunflower = "2.9.6";
66
public const string PackageNameInAppPurchase = "com.unity.purchasing";
77
public const string MaxVersionInAppPurchase = "4.12.2";
88
public const string PackageNameNewtonsoftJson = "com.unity.nuget.newtonsoft-json";
@@ -108,7 +108,7 @@ public class ConstantPackage
108108
public const string PackageNameCoffeeUIParticle = "com.coffee.ui-particle";
109109

110110
public const string MaxVersionCoffeeUIParticle =
111-
"https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.6.2";
111+
"https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.9.1";
112112

113113
public const string PackageNameAppleSignIn = "com.lupidan.apple-signin-unity";
114114

VirtueSky/ControlPanel/ControlPanelWindowEditor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ private void OnGUI()
6060
DrawButton();
6161
EditorGUILayout.EndScrollView();
6262
Handles.DrawAAPolyLine(4, new Vector3(ConstantControlPanel.POSITION_X_START_CONTENT, 0),
63-
new Vector3(210, position.height));
63+
new Vector3(ConstantControlPanel.POSITION_X_START_CONTENT, position.height));
64+
6465
GUILayout.EndVertical();
6566
DrawContent();
6667
GUILayout.EndHorizontal();

VirtueSky/GameService/Runtime/AppleAuthentication.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using AppleAuth.Extensions;
1010
using AppleAuth.Interfaces;
1111
using AppleAuth.Native;
12+
1213
#endif
1314

1415

@@ -93,17 +94,22 @@ protected override void Login()
9394
serverCode.Value = identityToken;
9495
authorizationCodeVariable.Value = authorizationCode;
9596
userIdVariable.Value = userId;
97+
nameVariable.Value = $"{fullName.GivenName} {fullName.FamilyName}";
9698
status.SetSuccessful();
9799
}
98100
else
99101
{
102+
serverCode.Value = "";
103+
userIdVariable.Value = "";
100104
status.SetFailed();
101105
}
102106
},
103107
error =>
104108
{
105109
// Something went wrong
106110
var authorizationErrorCode = error.GetAuthorizationErrorCode();
111+
serverCode.Value = "";
112+
userIdVariable.Value = "";
107113
status.SetFailed();
108114
});
109115
#endif

VirtueSky/GameService/Runtime/GooglePlayGamesAuthentication.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@
33
using GooglePlayGames.BasicApi;
44
#endif
55

6+
using System.Threading.Tasks;
67
using UnityEngine;
8+
using VirtueSky.Events;
79
using VirtueSky.Inspector;
810

911
namespace VirtueSky.GameService
1012
{
1113
[EditorIcon("icon_authentication")]
1214
public class GooglePlayGamesAuthentication : ServiceAuthentication
1315
{
16+
[SerializeField] private EventNoParam getNewServerCodeEvent;
17+
1418
protected override void Init()
1519
{
1620
#if UNITY_ANDROID && VIRTUESKY_GPGS
1721
serverCode.Value = "";
1822
status.SetNotLoggedIn();
1923
PlayGamesPlatform.Activate();
2024
loginEvent.AddListener(Login);
25+
getNewServerCodeEvent.AddListener(OnGetNewServerCode);
2126
#endif
2227
}
28+
#if UNITY_ANDROID && VIRTUESKY_GPGS
29+
private async void OnGetNewServerCode()
30+
{
31+
if (!PlayGamesPlatform.Instance.IsAuthenticated()) return;
32+
(serverCode.Value, status.Value) = await GetNewServerCode();
33+
}
2334

35+
private Task<(string, StatusLogin)> GetNewServerCode()
36+
{
37+
var taskSource = new TaskCompletionSource<(string, StatusLogin)>();
38+
39+
PlayGamesPlatform.Instance.RequestServerSideAccess(true,
40+
code => taskSource.SetResult((code, StatusLogin.Successful)));
41+
return taskSource.Task;
42+
}
43+
#endif
2444
protected override void Login()
2545
{
2646
#if UNITY_ANDROID && VIRTUESKY_GPGS
@@ -34,6 +54,7 @@ protected override void Login()
3454
{
3555
Debug.Log("Authorization code: " + code);
3656
serverCode.Value = code;
57+
nameVariable.Value = PlayGamesPlatform.Instance.GetUserDisplayName();
3758
status.SetSuccessful();
3859
});
3960
}
@@ -48,6 +69,7 @@ protected override void Login()
4869
{
4970
Debug.Log("Authorization code: " + code);
5071
serverCode.Value = code;
72+
nameVariable.Value = PlayGamesPlatform.Instance.GetUserDisplayName();
5173
status.SetSuccessful();
5274
});
5375
}

VirtueSky/GameService/Runtime/ServiceAuthentication.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ public abstract class ServiceAuthentication : MonoBehaviour
1212
[SerializeField] private bool dontDestroyOnLoad;
1313
[SerializeField] protected StatusLoginVariable status;
1414
[SerializeField] protected StringVariable serverCode;
15+
[SerializeField] protected StringVariable nameVariable;
1516
[SerializeField] protected EventNoParam loginEvent;
1617

17-
private void Start()
18-
{
19-
Init();
20-
}
21-
2218
protected virtual void Awake()
2319
{
2420
if (dontDestroyOnLoad)
@@ -27,6 +23,11 @@ protected virtual void Awake()
2723
}
2824
}
2925

26+
private void Start()
27+
{
28+
Init();
29+
}
30+
3031
protected abstract void Init();
3132
protected abstract void Login();
3233
#if UNITY_EDITOR

0 commit comments

Comments
 (0)