com.typhoon.unitysdk 1.1.23 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/Editor/ApplyTool.cs +53 -2
- package/Editor/EditorIcons.cs +4 -0
- package/Editor/ExportModule.cs +24 -0
- package/Editor/PublishProcess.cs +1 -0
- package/Editor/PublishResult.cs +6 -1
- package/Editor/PublishSetting.cs +2 -0
- package/Editor/PublishSettingGUIDrawer.cs +21 -2
- package/Editor/PublishTool.cs +3 -2
- package/Editor/PublishWindow.cs +15 -0
- package/Editor/Texture/icon_yandex_games.png +0 -0
- package/Editor/Texture/icon_yandex_games.png.meta +147 -0
- package/Editor/UniEditor.cs +100 -28
- package/Editor/YandexGamesConfig.cs +130 -0
- package/Editor/{EditorKit.cs.meta → YandexGamesConfig.cs.meta} +11 -11
- package/Runtime/AppChannel.cs +8 -0
- package/Runtime/BaseSdk.cs +7 -0
- package/Runtime/GamePauser.cs +16 -0
- package/Runtime/Interface.cs +11 -3
- package/Runtime/LabelOverride.cs +1 -1
- package/Runtime/SdkLite.cs +32 -0
- package/Runtime/SdkTestInUnity.cs +7 -0
- package/Runtime/YandexGamesLifecycle.cs +41 -0
- package/Runtime/YandexGamesLifecycle.cs.meta +11 -0
- package/Sources~/Package/YandexGames.unitypackage +0 -0
- package/Sources~/Package/YandexGames.unitypackage.manifest +543 -0
- package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
- package/package.json +1 -1
- package/Editor/EditorKit.cs +0 -67
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace TyphoonUnitySDK
|
|
8
|
+
{
|
|
9
|
+
public static class YandexGamesConfigGUIDrawer
|
|
10
|
+
{
|
|
11
|
+
public static Dictionary<string, Func<YandexGamesConfig, bool>> OverrideDrawGUIFunc =
|
|
12
|
+
new Dictionary<string, Func<YandexGamesConfig, bool>>()
|
|
13
|
+
{
|
|
14
|
+
{ "m_Script", DrawProperty_m_Script },
|
|
15
|
+
{ "PackageVersion", DrawProperty_PackageVersion },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
private static bool DrawProperty_m_Script(YandexGamesConfig arg)
|
|
20
|
+
{
|
|
21
|
+
var tmpEnable = GUI.enabled;
|
|
22
|
+
GUI.enabled = true;
|
|
23
|
+
GUILayout.Space(6);
|
|
24
|
+
GUIDrawer.DrawKeynotes("①支持Unity 2021.3.18+ , 2022.3+ , 2023.2+ , Unity 6");
|
|
25
|
+
GUIDrawer.DrawKeynotes("②剔除第三方SDK,避免与渠道冲突或不兼容");
|
|
26
|
+
GUIDrawer.DrawKeynotes("③先应用后再打包,避免参数写入失败");
|
|
27
|
+
GUILayout.Space(6);
|
|
28
|
+
GUI.enabled = tmpEnable;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public static bool DrawProperty_PackageVersion(YandexGamesConfig arg)
|
|
33
|
+
{
|
|
34
|
+
GUILayout.BeginHorizontal();
|
|
35
|
+
GUILayout.Label("Package Version", GUILayout.Width(218));
|
|
36
|
+
arg.PackageVersion = EditorGUILayout.TextField("", arg.PackageVersion);
|
|
37
|
+
if (GUILayout.Button("自动版本号", GUILayout.Width(100)))
|
|
38
|
+
{
|
|
39
|
+
arg.PackageVersion = UniEditor.AutoVersionSting(arg.PackageVersion);
|
|
40
|
+
EditorUtility.SetDirty(arg);
|
|
41
|
+
GUI.FocusControl("");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
GUILayout.EndHorizontal();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/*绘制GUI*/
|
|
50
|
+
public static void DrawGUI()
|
|
51
|
+
{
|
|
52
|
+
var config = YandexGamesConfig.Default;
|
|
53
|
+
GUIDrawer.DrawProperty(config, (property) =>
|
|
54
|
+
{
|
|
55
|
+
if (OverrideDrawGUIFunc.TryGetValue(property, out var match))
|
|
56
|
+
{
|
|
57
|
+
return match.Invoke(config);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return false;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public class YandexGamesConfig : ScriptableObject
|
|
66
|
+
{
|
|
67
|
+
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/YandexGamesConfig.asset";
|
|
68
|
+
|
|
69
|
+
private static YandexGamesConfig _instance = null;
|
|
70
|
+
|
|
71
|
+
public static YandexGamesConfig Default
|
|
72
|
+
{
|
|
73
|
+
get
|
|
74
|
+
{
|
|
75
|
+
if (_instance == null)
|
|
76
|
+
{
|
|
77
|
+
_instance = AssetDatabase.LoadAssetAtPath<YandexGamesConfig>(ConfigPath);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (_instance == null)
|
|
81
|
+
{
|
|
82
|
+
_instance = CreateInstance<YandexGamesConfig>();
|
|
83
|
+
var folder = Path.GetDirectoryName(ConfigPath);
|
|
84
|
+
if (!Directory.Exists(folder))
|
|
85
|
+
{
|
|
86
|
+
Directory.CreateDirectory(folder);
|
|
87
|
+
AssetDatabase.Refresh();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
AssetDatabase.CreateAsset(_instance, ConfigPath);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return _instance;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
[LabelOverride("插页广告展示最小间隔(秒)(>=0)", 220)]
|
|
99
|
+
public int IntersInterval = 45;
|
|
100
|
+
|
|
101
|
+
[LabelOverride("激励视频播放后跳过下一次插页广告", 220)]
|
|
102
|
+
public bool SkipIntersAfterShowRewardFlag = true;
|
|
103
|
+
|
|
104
|
+
[LabelOverride("Product Icon", 220)]
|
|
105
|
+
public Texture2D ProductIcon;
|
|
106
|
+
|
|
107
|
+
[LabelOverride("Product Name (非中文)", 220)]
|
|
108
|
+
public string ProductName = string.Empty;
|
|
109
|
+
|
|
110
|
+
[LabelOverride("Company Name (非中文)", 220)]
|
|
111
|
+
public string CompanyName = string.Empty;
|
|
112
|
+
|
|
113
|
+
public string PackageVersion = "1.0.0";
|
|
114
|
+
|
|
115
|
+
[LabelOverride("导出目录 (非中文,可选)", 220)]
|
|
116
|
+
public string ExportPath = "";
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
public void Save()
|
|
120
|
+
{
|
|
121
|
+
EditorUtility.SetDirty(this);
|
|
122
|
+
AssetDatabase.SaveAssets();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public void SaveConfig()
|
|
126
|
+
{
|
|
127
|
+
Save();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 71f11db4d01d81d4892801f511150fec
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/Runtime/AppChannel.cs
CHANGED
|
@@ -65,9 +65,17 @@ namespace TyphoonUnitySDK
|
|
|
65
65
|
/// 喜中游
|
|
66
66
|
/// </summary>
|
|
67
67
|
XiZhongYou = 12,
|
|
68
|
+
|
|
68
69
|
/// <summary>
|
|
69
70
|
/// 华为鸿蒙
|
|
70
71
|
/// </summary>
|
|
71
72
|
HuaweiHarmony = 13,
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// YandexGames
|
|
77
|
+
/// </summary>
|
|
78
|
+
YandexGames = 14,
|
|
79
|
+
|
|
72
80
|
}
|
|
73
81
|
}
|
package/Runtime/BaseSdk.cs
CHANGED
|
@@ -346,5 +346,12 @@ namespace TyphoonUnitySDK
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
#endregion
|
|
349
|
+
|
|
350
|
+
public virtual SystemLanguage GetSystemLanguage()
|
|
351
|
+
{
|
|
352
|
+
SdkDebug.Log(
|
|
353
|
+
$"[BaseSdk] GetSystemLanguage... return Application.systemLanguage:{Application.systemLanguage}");
|
|
354
|
+
return Application.systemLanguage;
|
|
355
|
+
}
|
|
349
356
|
}
|
|
350
357
|
}
|
package/Runtime/GamePauser.cs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
using System.Collections.Generic;
|
|
2
|
+
using System.Linq;
|
|
2
3
|
using UnityEngine;
|
|
4
|
+
using UnityEngine.EventSystems;
|
|
3
5
|
|
|
4
6
|
/// <summary>
|
|
5
7
|
/// 游戏暂停器
|
|
@@ -11,6 +13,8 @@ public class GamePauser
|
|
|
11
13
|
private float TimeScaleBeforePause { get; set; }
|
|
12
14
|
private bool AudioListenerStateBeforePause { get; set; }
|
|
13
15
|
|
|
16
|
+
private Dictionary<EventSystem, bool> DictEventSystemState { get; set; }
|
|
17
|
+
|
|
14
18
|
/// <summary>
|
|
15
19
|
/// 新增暂停标记
|
|
16
20
|
/// </summary>
|
|
@@ -66,8 +70,11 @@ public class GamePauser
|
|
|
66
70
|
IsPaused = true;
|
|
67
71
|
TimeScaleBeforePause = Time.timeScale;
|
|
68
72
|
AudioListenerStateBeforePause = AudioListener.pause;
|
|
73
|
+
var systems = Object.FindObjectsByType<EventSystem>(
|
|
74
|
+
FindObjectsSortMode.None);
|
|
69
75
|
Time.timeScale = 0f;
|
|
70
76
|
AudioListener.pause = true;
|
|
77
|
+
DictEventSystemState = systems.ToDictionary(e => e, e => e.enabled);
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
private void Resume()
|
|
@@ -80,5 +87,14 @@ public class GamePauser
|
|
|
80
87
|
IsPaused = false;
|
|
81
88
|
Time.timeScale = TimeScaleBeforePause;
|
|
82
89
|
AudioListener.pause = AudioListenerStateBeforePause;
|
|
90
|
+
foreach (var pair in DictEventSystemState)
|
|
91
|
+
{
|
|
92
|
+
if (pair.Key == null)
|
|
93
|
+
{
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
pair.Key.enabled = pair.Value;
|
|
98
|
+
}
|
|
83
99
|
}
|
|
84
100
|
}
|
package/Runtime/Interface.cs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
3
4
|
|
|
4
5
|
namespace TyphoonUnitySDK
|
|
5
6
|
{
|
|
@@ -8,7 +9,7 @@ namespace TyphoonUnitySDK
|
|
|
8
9
|
/// </summary>
|
|
9
10
|
public interface ISdk : IOnCreate, IInitSdk, ILogin, IExitGame, IBannerAD, IVideoAD, IIntersAD, IFloatIconAD,
|
|
10
11
|
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast, ITrack, IQuitGameWithKeep,
|
|
11
|
-
IRequestProductInfosAsync, IPay
|
|
12
|
+
IRequestProductInfosAsync, IPay,IGetSystemLanguage
|
|
12
13
|
{
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -191,7 +192,6 @@ namespace TyphoonUnitySDK
|
|
|
191
192
|
|
|
192
193
|
#endregion
|
|
193
194
|
|
|
194
|
-
|
|
195
195
|
#region ShowToast
|
|
196
196
|
|
|
197
197
|
/// <summary>
|
|
@@ -213,7 +213,6 @@ namespace TyphoonUnitySDK
|
|
|
213
213
|
|
|
214
214
|
#endregion
|
|
215
215
|
|
|
216
|
-
|
|
217
216
|
#region 退出挽留
|
|
218
217
|
|
|
219
218
|
public interface IQuitGameWithKeep
|
|
@@ -259,4 +258,13 @@ namespace TyphoonUnitySDK
|
|
|
259
258
|
}
|
|
260
259
|
|
|
261
260
|
#endregion
|
|
261
|
+
|
|
262
|
+
#region 获取系统语言
|
|
263
|
+
|
|
264
|
+
public interface IGetSystemLanguage
|
|
265
|
+
{
|
|
266
|
+
SystemLanguage GetSystemLanguage();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#endregion
|
|
262
270
|
}
|
package/Runtime/LabelOverride.cs
CHANGED
package/Runtime/SdkLite.cs
CHANGED
|
@@ -37,6 +37,7 @@ namespace TyphoonUnitySDK
|
|
|
37
37
|
OnHide?.Invoke();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
|
|
40
41
|
#region 生命周期
|
|
41
42
|
|
|
42
43
|
/// <summary>
|
|
@@ -53,6 +54,19 @@ namespace TyphoonUnitySDK
|
|
|
53
54
|
MiniGameLifecycle = lifecycle;
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// YandexGames渠道生命周期相关函数
|
|
59
|
+
/// </summary>
|
|
60
|
+
public static IYandexGamesLifecycle YandexGamesLifecycle { get; set; }
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// 覆盖YandexGames生命周期
|
|
64
|
+
/// </summary>
|
|
65
|
+
public static void OverrideYandexGamesLifecycle(IYandexGamesLifecycle lifecycle)
|
|
66
|
+
{
|
|
67
|
+
YandexGamesLifecycle = lifecycle;
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
#endregion
|
|
57
71
|
|
|
58
72
|
/*绑定SDK实例*/
|
|
@@ -69,6 +83,7 @@ namespace TyphoonUnitySDK
|
|
|
69
83
|
{ AppChannel.MiniGame, "TyphoonUnitySDK.MiniGameSdk" }, //微游
|
|
70
84
|
{ AppChannel.XiZhongYou, "TyphoonUnitySDK.XiZhongYouSdk" }, //喜中游
|
|
71
85
|
{ AppChannel.HuaweiHarmony, "TyphoonUnitySDK.HuaweiHarmonySdk" }, //华为鸿蒙
|
|
86
|
+
{ AppChannel.YandexGames, "TyphoonUnitySDK.YandexGamesSdk" }, //YandexGames
|
|
72
87
|
};
|
|
73
88
|
|
|
74
89
|
//支付回调类名
|
|
@@ -960,5 +975,22 @@ namespace TyphoonUnitySDK
|
|
|
960
975
|
}
|
|
961
976
|
|
|
962
977
|
#endregion
|
|
978
|
+
|
|
979
|
+
#region 系统语言
|
|
980
|
+
|
|
981
|
+
public virtual SystemLanguage GetSystemLanguage()
|
|
982
|
+
{
|
|
983
|
+
#if UNITY_EDITOR
|
|
984
|
+
if (SdkTestInUnity.Instance.UseTestSystemLanguageFlag)
|
|
985
|
+
{
|
|
986
|
+
return SdkTestInUnity.Instance.SystemLanguage;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
return Application.systemLanguage;
|
|
990
|
+
#endif
|
|
991
|
+
return _sdk.GetSystemLanguage();
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
#endregion
|
|
963
995
|
}
|
|
964
996
|
}
|
|
@@ -12,6 +12,13 @@ using UnityEditor;
|
|
|
12
12
|
public class SdkTestInUnity : ScriptableObject
|
|
13
13
|
{
|
|
14
14
|
private const string ASSET_PATH = "Assets/Typhoon_Gen/TyphoonSDK/Editor/SdkTestInUnity.asset";
|
|
15
|
+
|
|
16
|
+
[Header("系统语言")]
|
|
17
|
+
[LabelOverride("使用测试参数")]
|
|
18
|
+
public bool UseTestSystemLanguageFlag = false;
|
|
19
|
+
[LabelOverride("系统语言")]
|
|
20
|
+
public SystemLanguage SystemLanguage = SystemLanguage.English;
|
|
21
|
+
|
|
15
22
|
[Header("登录")]
|
|
16
23
|
[LabelOverride("登录回调")]
|
|
17
24
|
public bool LoginResult = true;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
namespace TyphoonUnitySDK
|
|
2
|
+
{
|
|
3
|
+
public interface IYandexGamesLifecycle
|
|
4
|
+
{
|
|
5
|
+
void OnPauseGame(bool isPaused);
|
|
6
|
+
void OnCloseAnyAdv();
|
|
7
|
+
void OnOpenAnyAdv();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// yandex games 生命周期
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class YandexGamesLifecycle : IYandexGamesLifecycle
|
|
14
|
+
{
|
|
15
|
+
private GamePauser GamePauser { get; } = new GamePauser();
|
|
16
|
+
private const string TAG_ON_PAUSE_GAME = "TAG_ON_PAUSE_GAME";
|
|
17
|
+
private const string TAG_ANY_ADV = "TAG_ANY_ADV";
|
|
18
|
+
|
|
19
|
+
public void OnPauseGame(bool isPaused)
|
|
20
|
+
{
|
|
21
|
+
if (isPaused)
|
|
22
|
+
{
|
|
23
|
+
GamePauser.AddPauseTag(TAG_ON_PAUSE_GAME);
|
|
24
|
+
}
|
|
25
|
+
else
|
|
26
|
+
{
|
|
27
|
+
GamePauser.RemovePauseTag(TAG_ON_PAUSE_GAME);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public void OnCloseAnyAdv()
|
|
32
|
+
{
|
|
33
|
+
GamePauser.RemovePauseTag(TAG_ANY_ADV);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void OnOpenAnyAdv()
|
|
37
|
+
{
|
|
38
|
+
GamePauser.AddPauseTag(TAG_ANY_ADV);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
Binary file
|