com.typhoon.unitysdk 1.0.21 → 1.0.24
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/Editor/ApplyTool.cs +7 -4
- package/Editor/DouyinConfig.cs +1 -1
- package/Editor/PublishProcess.cs +4 -3
- package/Editor/PublishTool.cs +2 -1
- package/Editor/PublishWindow.cs +1 -1
- package/Editor/Texture/sdk_white4x4.png +0 -0
- package/Editor/Texture/sdk_white4x4.png.meta +144 -0
- package/Runtime/BaseSdk.cs +44 -3
- package/Runtime/GUIMessageBox.cs +129 -0
- package/Runtime/{UnityToJs.cs.meta → GUIMessageBox.cs.meta} +1 -1
- package/Runtime/Interface.cs +34 -2
- package/Runtime/Model.cs +25 -0
- package/Runtime/Model.cs.meta +11 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_BLACK.png +0 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_BLACK.png.meta +96 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_BLACK_ALPHA.png +0 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_BLACK_ALPHA.png.meta +144 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_GREEN_ALPHA.png +0 -0
- package/Runtime/Resources/TYPHOON_TEXTURE_TOAST_GREEN_ALPHA.png.meta +144 -0
- package/Runtime/RuntimeUtil.cs +23 -0
- package/Runtime/RuntimeUtil.cs.meta +11 -0
- package/Runtime/SDKInteractiveUI.cs +2 -13
- package/Runtime/SimulateRecordGame.cs +84 -0
- package/Runtime/SimulateRecordGame.cs.meta +11 -0
- package/Runtime/TyphoonSdk.cs +94 -0
- package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
- package/Sources~/Package/Douyin.unitypackage +0 -0
- package/Sources~/Package/Douyin.unitypackage.manifest +2 -6
- package/Sources~/Package/WxMini.unitypackage +0 -0
- package/Sources~/Package/WxMini.unitypackage.manifest +2 -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/Runtime/UnityToJs.cs +0 -66
package/Editor/ApplyTool.cs
CHANGED
|
@@ -25,7 +25,8 @@ namespace TyphoonUnitySDK
|
|
|
25
25
|
{ AppChannel.ChinaAndroid, new ApplyChinaAndroid() },
|
|
26
26
|
{ AppChannel.Test, new ApplyTest() },
|
|
27
27
|
{ AppChannel.WxMini, new ApplyWxMini() },
|
|
28
|
-
{ AppChannel.DouyinAndroid, new
|
|
28
|
+
{ AppChannel.DouyinAndroid, new ApplyDouyinAndroidOrIOS() },
|
|
29
|
+
{ AppChannel.DouyinIOS, new ApplyDouyinAndroidOrIOS() },
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
|
|
@@ -68,6 +69,7 @@ namespace TyphoonUnitySDK
|
|
|
68
69
|
//保存所有配置
|
|
69
70
|
setting.Save();
|
|
70
71
|
WxMiniConfig.Default.Save();
|
|
72
|
+
DouyinConfig.Default.Save();
|
|
71
73
|
InvokeOnApplyStart(setting);
|
|
72
74
|
if (!Applies.TryGetValue(setting.Channel, out var match))
|
|
73
75
|
{
|
|
@@ -255,7 +257,7 @@ namespace TyphoonUnitySDK
|
|
|
255
257
|
AppConfigAsset.Instance.DouyinVideoId = DouyinConfig.Default.VideoId;
|
|
256
258
|
AppConfigAsset.Instance.DouyinIntersId = DouyinConfig.Default.IntersId;
|
|
257
259
|
AppConfigAsset.Instance.DouyinBannerId = DouyinConfig.Default.BannerId;
|
|
258
|
-
|
|
260
|
+
|
|
259
261
|
EditorUtility.SetDirty(AppConfigAsset.Instance);
|
|
260
262
|
AssetDatabase.SaveAssets();
|
|
261
263
|
}
|
|
@@ -372,6 +374,7 @@ namespace TyphoonUnitySDK
|
|
|
372
374
|
"Assets/Typhoon_Gen/TyphoonSDK/Runtime",
|
|
373
375
|
"Assets/WX-WASM-SDK-V2",
|
|
374
376
|
"Assets/WebGLTemplates",
|
|
377
|
+
"Assets/Plugins/ByteGame",
|
|
375
378
|
};
|
|
376
379
|
|
|
377
380
|
|
|
@@ -432,8 +435,8 @@ namespace TyphoonUnitySDK
|
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
|
|
435
|
-
/*抖音android*/
|
|
436
|
-
public class
|
|
438
|
+
/*抖音android,IOS*/
|
|
439
|
+
public class ApplyDouyinAndroidOrIOS : IApply
|
|
437
440
|
{
|
|
438
441
|
public void Apply(PublishSetting setting)
|
|
439
442
|
{
|
package/Editor/DouyinConfig.cs
CHANGED
|
@@ -52,7 +52,7 @@ namespace TyphoonUnitySDK
|
|
|
52
52
|
var tmpEnable = GUI.enabled;
|
|
53
53
|
GUI.enabled = true;
|
|
54
54
|
GUILayout.Space(6);
|
|
55
|
-
GUIDrawer.DrawKeynotes("①仅支持Unity版本:2019.4.35,2021.3.14(最优,支持ASTC压缩,可减少Webgl运行消耗)");
|
|
55
|
+
GUIDrawer.DrawKeynotes("①仅支持Unity版本:2019.4.35(逐步放弃),2021.3.14(最优,支持ASTC压缩,可减少Webgl运行消耗)");
|
|
56
56
|
GUIDrawer.DrawKeynotes(" 详细以官方文档地址为准,链接如下:");
|
|
57
57
|
var url = "https://bytedance.feishu.cn/docx/doxcnTTjZHp8J6HzdrSbWu1aK5b";
|
|
58
58
|
GUIDrawer.DrawUrlLink($" {url}", () => Application.OpenURL(url));
|
package/Editor/PublishProcess.cs
CHANGED
package/Editor/PublishTool.cs
CHANGED
|
@@ -23,7 +23,8 @@ namespace TyphoonUnitySDK
|
|
|
23
23
|
{
|
|
24
24
|
{ PublishProcess.ChinaAndroidAAR, "TyphoonUnitySDK.PublishChinaAndroidAAR" },
|
|
25
25
|
{ PublishProcess.WxMini, "TyphoonUnitySDK.PublishWxMini" },
|
|
26
|
-
{ PublishProcess.DouyinAndroid, "TyphoonUnitySDK.PublishDouyinAndroid" }
|
|
26
|
+
{ PublishProcess.DouyinAndroid, "TyphoonUnitySDK.PublishDouyinAndroid" },
|
|
27
|
+
{ PublishProcess.DouyinIOS, "TyphoonUnitySDK.PublishDouyinIOS" }
|
|
27
28
|
|
|
28
29
|
};
|
|
29
30
|
|
package/Editor/PublishWindow.cs
CHANGED
|
Binary file
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ba1cda5949ba4524c8ee711b47d1fa6a
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 11
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 0
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
vTOnly: 0
|
|
27
|
+
grayScaleToAlpha: 0
|
|
28
|
+
generateCubemap: 6
|
|
29
|
+
cubemapConvolution: 0
|
|
30
|
+
seamlessCubemap: 0
|
|
31
|
+
textureFormat: 1
|
|
32
|
+
maxTextureSize: 2048
|
|
33
|
+
textureSettings:
|
|
34
|
+
serializedVersion: 2
|
|
35
|
+
filterMode: 1
|
|
36
|
+
aniso: 1
|
|
37
|
+
mipBias: 0
|
|
38
|
+
wrapU: 1
|
|
39
|
+
wrapV: 1
|
|
40
|
+
wrapW: 0
|
|
41
|
+
nPOTScale: 0
|
|
42
|
+
lightmap: 0
|
|
43
|
+
compressionQuality: 50
|
|
44
|
+
spriteMode: 1
|
|
45
|
+
spriteExtrude: 1
|
|
46
|
+
spriteMeshType: 1
|
|
47
|
+
alignment: 0
|
|
48
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
49
|
+
spritePixelsToUnits: 100
|
|
50
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
51
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
52
|
+
alphaUsage: 1
|
|
53
|
+
alphaIsTransparency: 1
|
|
54
|
+
spriteTessellationDetail: -1
|
|
55
|
+
textureType: 8
|
|
56
|
+
textureShape: 1
|
|
57
|
+
singleChannelComponent: 0
|
|
58
|
+
flipbookRows: 1
|
|
59
|
+
flipbookColumns: 1
|
|
60
|
+
maxTextureSizeSet: 0
|
|
61
|
+
compressionQualitySet: 0
|
|
62
|
+
textureFormatSet: 0
|
|
63
|
+
ignorePngGamma: 0
|
|
64
|
+
applyGammaDecoding: 0
|
|
65
|
+
platformSettings:
|
|
66
|
+
- serializedVersion: 3
|
|
67
|
+
buildTarget: DefaultTexturePlatform
|
|
68
|
+
maxTextureSize: 2048
|
|
69
|
+
resizeAlgorithm: 0
|
|
70
|
+
textureFormat: -1
|
|
71
|
+
textureCompression: 1
|
|
72
|
+
compressionQuality: 50
|
|
73
|
+
crunchedCompression: 0
|
|
74
|
+
allowsAlphaSplitting: 0
|
|
75
|
+
overridden: 0
|
|
76
|
+
androidETC2FallbackOverride: 0
|
|
77
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
78
|
+
- serializedVersion: 3
|
|
79
|
+
buildTarget: Standalone
|
|
80
|
+
maxTextureSize: 2048
|
|
81
|
+
resizeAlgorithm: 0
|
|
82
|
+
textureFormat: -1
|
|
83
|
+
textureCompression: 1
|
|
84
|
+
compressionQuality: 50
|
|
85
|
+
crunchedCompression: 0
|
|
86
|
+
allowsAlphaSplitting: 0
|
|
87
|
+
overridden: 0
|
|
88
|
+
androidETC2FallbackOverride: 0
|
|
89
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
90
|
+
- serializedVersion: 3
|
|
91
|
+
buildTarget: iPhone
|
|
92
|
+
maxTextureSize: 2048
|
|
93
|
+
resizeAlgorithm: 0
|
|
94
|
+
textureFormat: -1
|
|
95
|
+
textureCompression: 1
|
|
96
|
+
compressionQuality: 50
|
|
97
|
+
crunchedCompression: 0
|
|
98
|
+
allowsAlphaSplitting: 0
|
|
99
|
+
overridden: 0
|
|
100
|
+
androidETC2FallbackOverride: 0
|
|
101
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
102
|
+
- serializedVersion: 3
|
|
103
|
+
buildTarget: WebGL
|
|
104
|
+
maxTextureSize: 2048
|
|
105
|
+
resizeAlgorithm: 0
|
|
106
|
+
textureFormat: -1
|
|
107
|
+
textureCompression: 1
|
|
108
|
+
compressionQuality: 50
|
|
109
|
+
crunchedCompression: 0
|
|
110
|
+
allowsAlphaSplitting: 0
|
|
111
|
+
overridden: 0
|
|
112
|
+
androidETC2FallbackOverride: 0
|
|
113
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
114
|
+
- serializedVersion: 3
|
|
115
|
+
buildTarget: Android
|
|
116
|
+
maxTextureSize: 2048
|
|
117
|
+
resizeAlgorithm: 0
|
|
118
|
+
textureFormat: -1
|
|
119
|
+
textureCompression: 1
|
|
120
|
+
compressionQuality: 50
|
|
121
|
+
crunchedCompression: 0
|
|
122
|
+
allowsAlphaSplitting: 0
|
|
123
|
+
overridden: 0
|
|
124
|
+
androidETC2FallbackOverride: 0
|
|
125
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
126
|
+
spriteSheet:
|
|
127
|
+
serializedVersion: 2
|
|
128
|
+
sprites: []
|
|
129
|
+
outline: []
|
|
130
|
+
physicsShape: []
|
|
131
|
+
bones: []
|
|
132
|
+
spriteID: 5e97eb03825dee720800000000000000
|
|
133
|
+
internalID: 0
|
|
134
|
+
vertices: []
|
|
135
|
+
indices:
|
|
136
|
+
edges: []
|
|
137
|
+
weights: []
|
|
138
|
+
secondaryTextures: []
|
|
139
|
+
spritePackingTag:
|
|
140
|
+
pSDRemoveMatte: 0
|
|
141
|
+
pSDShowRemoveMatteOption: 0
|
|
142
|
+
userData:
|
|
143
|
+
assetBundleName:
|
|
144
|
+
assetBundleVariant:
|
package/Runtime/BaseSdk.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
using UnityEngine;
|
|
3
4
|
|
|
4
5
|
namespace TyphoonUnitySDK
|
|
@@ -69,10 +70,50 @@ namespace TyphoonUnitySDK
|
|
|
69
70
|
{
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
#region 录屏分享(抖音小游戏)
|
|
75
|
+
|
|
76
|
+
/*是否支持录屏分享*/
|
|
77
|
+
public virtual bool CanRecordGame()
|
|
78
|
+
{
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*开始录屏*/
|
|
83
|
+
public virtual void StartRecordGame(bool isRecordAudio = true, int maxRecordTimeSec = 600,
|
|
84
|
+
Action onStart = null,
|
|
85
|
+
Action<string> onError = null, Action<string> onComplete = null)
|
|
86
|
+
{
|
|
87
|
+
onError?.Invoke("not support");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/*停止录屏*/
|
|
91
|
+
public virtual void StopRecordGame(Action<string> complete = null, Action<string> onError = null,
|
|
92
|
+
List<TimeClip> clips = null, bool autoMerge = true)
|
|
93
|
+
{
|
|
94
|
+
onError?.Invoke("not support");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*获取录屏时长*/
|
|
98
|
+
public virtual float GetRecordDuration()
|
|
99
|
+
{
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/*是否可分享录屏*/
|
|
104
|
+
public virtual bool CanShareRecordGame()
|
|
74
105
|
{
|
|
75
|
-
|
|
106
|
+
return false;
|
|
76
107
|
}
|
|
108
|
+
|
|
109
|
+
/*分享录屏*/
|
|
110
|
+
public virtual void ShareRecordGame(string title, List<string> topics, Action success,
|
|
111
|
+
Action<string> fail = null,
|
|
112
|
+
Action cancel = null)
|
|
113
|
+
{
|
|
114
|
+
fail?.Invoke("not support");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#endregion
|
|
77
118
|
}
|
|
78
119
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#if UNITY_EDITOR
|
|
2
|
+
using System;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace TyphoonUnitySDK
|
|
6
|
+
{
|
|
7
|
+
public class GUIMessageBox : MonoSingleton<GUIMessageBox>
|
|
8
|
+
{
|
|
9
|
+
private const float HOLD_TIME = 1.3F;
|
|
10
|
+
public bool IsShow = false;
|
|
11
|
+
public string Content;
|
|
12
|
+
public string TxtYes;
|
|
13
|
+
public string TxtNo;
|
|
14
|
+
private Texture _black;
|
|
15
|
+
private Texture _green;
|
|
16
|
+
private float _holdTimeYes;
|
|
17
|
+
private float _holdTimeNo;
|
|
18
|
+
private GUIStyle _labelStyle = null;
|
|
19
|
+
private Action _onYes;
|
|
20
|
+
private Action _onNo;
|
|
21
|
+
|
|
22
|
+
private GUIStyle LabelStyle
|
|
23
|
+
{
|
|
24
|
+
get
|
|
25
|
+
{
|
|
26
|
+
if (_labelStyle == null)
|
|
27
|
+
{
|
|
28
|
+
_labelStyle = GUI.skin.label;
|
|
29
|
+
_labelStyle.fontSize = 32;
|
|
30
|
+
_labelStyle.fontStyle = FontStyle.Bold;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return _labelStyle;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
protected override void Init()
|
|
39
|
+
{
|
|
40
|
+
base.Init();
|
|
41
|
+
DontDestroyOnLoad(gameObject);
|
|
42
|
+
_black = Resources.Load<Texture>("TYPHOON_TEXTURE_TOAST_BLACK");
|
|
43
|
+
_green = Resources.Load<Texture>("TYPHOON_TEXTURE_TOAST_GREEN_ALPHA");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public void Show(string content, string txtYes = "是", string txtNo = "否", Action success = null,
|
|
47
|
+
Action fail = null)
|
|
48
|
+
{
|
|
49
|
+
_onYes = success;
|
|
50
|
+
_onNo = fail;
|
|
51
|
+
Content = content;
|
|
52
|
+
TxtYes = txtYes;
|
|
53
|
+
TxtNo = txtNo;
|
|
54
|
+
IsShow = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private void OnGUI()
|
|
58
|
+
{
|
|
59
|
+
if (IsShow)
|
|
60
|
+
{
|
|
61
|
+
var rect = new Rect(0, 0, Screen.width, Screen.height);
|
|
62
|
+
var rectContent = rect;
|
|
63
|
+
rectContent.width = rect.width * 0.8f;
|
|
64
|
+
rectContent.height = Mathf.Min(rect.height * 0.3f, 260);
|
|
65
|
+
rectContent.center = rect.center;
|
|
66
|
+
rectContent.y -= rectContent.height * 0.5f;
|
|
67
|
+
rectContent.y -= 20;
|
|
68
|
+
DrawLabel(rectContent, Content);
|
|
69
|
+
var rectYes = rectContent;
|
|
70
|
+
rectYes.width = rectContent.width * 0.5f - 20;
|
|
71
|
+
rectYes.height = rectContent.height * 0.5f;
|
|
72
|
+
rectYes.y = rect.center.y + 20;
|
|
73
|
+
rectYes.x = rect.center.x + 20;
|
|
74
|
+
var rectNo = rectYes;
|
|
75
|
+
rectNo.x = rect.center.x - rectNo.width - 20;
|
|
76
|
+
DrawLabel(rectYes, TxtYes);
|
|
77
|
+
DrawLabel(rectNo, TxtNo);
|
|
78
|
+
HoldHide(rectYes, ref _holdTimeYes, () =>
|
|
79
|
+
{
|
|
80
|
+
_onYes?.Invoke();
|
|
81
|
+
IsShow = false;
|
|
82
|
+
});
|
|
83
|
+
HoldHide(rectNo, ref _holdTimeNo, () =>
|
|
84
|
+
{
|
|
85
|
+
_onNo?.Invoke();
|
|
86
|
+
IsShow = false;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private void DrawLabel(Rect rect, string content, TextAnchor anchor = TextAnchor.MiddleCenter,
|
|
92
|
+
int fontSize = 32)
|
|
93
|
+
{
|
|
94
|
+
GUI.DrawTexture(rect, _black, ScaleMode.StretchToFill, true);
|
|
95
|
+
LabelStyle.alignment = anchor;
|
|
96
|
+
LabelStyle.fontSize = fontSize;
|
|
97
|
+
GUI.Label(rect, content, LabelStyle);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
private void HoldHide(Rect rectClose, ref float holdTime, Action hideHandler)
|
|
102
|
+
{
|
|
103
|
+
var inside = rectClose.Contains(Event.current.mousePosition);
|
|
104
|
+
if (inside && Event.current.delta == Vector2.zero)
|
|
105
|
+
{
|
|
106
|
+
holdTime += Time.unscaledDeltaTime;
|
|
107
|
+
var process = Mathf.Clamp01(holdTime / HOLD_TIME);
|
|
108
|
+
var rectProcess = rectClose;
|
|
109
|
+
rectProcess.width *= process;
|
|
110
|
+
GUI.DrawTexture(rectProcess, _green, ScaleMode.StretchToFill, true);
|
|
111
|
+
if (process >= 1)
|
|
112
|
+
{
|
|
113
|
+
hideHandler?.Invoke();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
{
|
|
118
|
+
holdTime = 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (inside && Event.current.type == EventType.MouseDown)
|
|
122
|
+
{
|
|
123
|
+
hideHandler?.Invoke();
|
|
124
|
+
Event.current.Use();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
#endif
|
package/Runtime/Interface.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
|
|
3
4
|
namespace TyphoonUnitySDK
|
|
4
5
|
{
|
|
@@ -6,7 +7,7 @@ namespace TyphoonUnitySDK
|
|
|
6
7
|
/// SDK全功能接口
|
|
7
8
|
/// </summary>
|
|
8
9
|
public interface ISdk : IOnCreate, IInitSdk, ILogin, IExitGame, IBannerAD, IVideoAD, IIntersAD, IFloatIconAD,
|
|
9
|
-
INativeAD
|
|
10
|
+
INativeAD, IRecordGame
|
|
10
11
|
{
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -19,7 +20,6 @@ namespace TyphoonUnitySDK
|
|
|
19
20
|
|
|
20
21
|
#endregion
|
|
21
22
|
|
|
22
|
-
|
|
23
23
|
#region 初始化
|
|
24
24
|
|
|
25
25
|
public interface IInitSdk
|
|
@@ -112,4 +112,36 @@ namespace TyphoonUnitySDK
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
#endregion
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
#region 录屏分享(抖音小游戏)
|
|
118
|
+
|
|
119
|
+
/*录屏分享(抖音)*/
|
|
120
|
+
public interface IRecordGame
|
|
121
|
+
{
|
|
122
|
+
/*是否可以录屏*/
|
|
123
|
+
bool CanRecordGame();
|
|
124
|
+
|
|
125
|
+
/*开启录屏*/
|
|
126
|
+
void StartRecordGame(bool isRecordAudio = true, int maxRecordTimeSec = 600,
|
|
127
|
+
Action onStart = null, Action<string> onError = null, Action<string> onComplete = null);
|
|
128
|
+
|
|
129
|
+
/*结束录屏*/
|
|
130
|
+
void StopRecordGame(Action<string> complete = null, Action<string> onError = null,
|
|
131
|
+
List<TimeClip> clips = null,
|
|
132
|
+
bool autoMerge = true);
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/*获取录屏时间*/
|
|
136
|
+
float GetRecordDuration();
|
|
137
|
+
|
|
138
|
+
/*可分享游戏录屏*/
|
|
139
|
+
bool CanShareRecordGame();
|
|
140
|
+
|
|
141
|
+
/*分享游戏录屏*/
|
|
142
|
+
void ShareRecordGame(string title, List<string> topics, Action success, Action<string> fail = null,
|
|
143
|
+
Action cancel = null);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#endregion
|
|
115
147
|
}
|
package/Runtime/Model.cs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
using System.Collections;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace TyphoonUnitySDK
|
|
6
|
+
{
|
|
7
|
+
public class Model
|
|
8
|
+
{
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// 时间片段,单位:毫秒
|
|
13
|
+
/// </summary>
|
|
14
|
+
public class TimeClip
|
|
15
|
+
{
|
|
16
|
+
public int Start;
|
|
17
|
+
public int End;
|
|
18
|
+
|
|
19
|
+
public TimeClip(int start, int end)
|
|
20
|
+
{
|
|
21
|
+
Start = start;
|
|
22
|
+
End = end;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d8f62bc650e259a42b06cf4c7f1c8aef
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 11
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 1
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
vTOnly: 0
|
|
27
|
+
grayScaleToAlpha: 0
|
|
28
|
+
generateCubemap: 6
|
|
29
|
+
cubemapConvolution: 0
|
|
30
|
+
seamlessCubemap: 0
|
|
31
|
+
textureFormat: 1
|
|
32
|
+
maxTextureSize: 2048
|
|
33
|
+
textureSettings:
|
|
34
|
+
serializedVersion: 2
|
|
35
|
+
filterMode: 1
|
|
36
|
+
aniso: 1
|
|
37
|
+
mipBias: 0
|
|
38
|
+
wrapU: 0
|
|
39
|
+
wrapV: 0
|
|
40
|
+
wrapW: 0
|
|
41
|
+
nPOTScale: 1
|
|
42
|
+
lightmap: 0
|
|
43
|
+
compressionQuality: 50
|
|
44
|
+
spriteMode: 0
|
|
45
|
+
spriteExtrude: 1
|
|
46
|
+
spriteMeshType: 1
|
|
47
|
+
alignment: 0
|
|
48
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
49
|
+
spritePixelsToUnits: 100
|
|
50
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
51
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
52
|
+
alphaUsage: 1
|
|
53
|
+
alphaIsTransparency: 0
|
|
54
|
+
spriteTessellationDetail: -1
|
|
55
|
+
textureType: 0
|
|
56
|
+
textureShape: 1
|
|
57
|
+
singleChannelComponent: 0
|
|
58
|
+
flipbookRows: 1
|
|
59
|
+
flipbookColumns: 1
|
|
60
|
+
maxTextureSizeSet: 0
|
|
61
|
+
compressionQualitySet: 0
|
|
62
|
+
textureFormatSet: 0
|
|
63
|
+
ignorePngGamma: 0
|
|
64
|
+
applyGammaDecoding: 0
|
|
65
|
+
platformSettings:
|
|
66
|
+
- serializedVersion: 3
|
|
67
|
+
buildTarget: DefaultTexturePlatform
|
|
68
|
+
maxTextureSize: 2048
|
|
69
|
+
resizeAlgorithm: 0
|
|
70
|
+
textureFormat: -1
|
|
71
|
+
textureCompression: 1
|
|
72
|
+
compressionQuality: 50
|
|
73
|
+
crunchedCompression: 0
|
|
74
|
+
allowsAlphaSplitting: 0
|
|
75
|
+
overridden: 0
|
|
76
|
+
androidETC2FallbackOverride: 0
|
|
77
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
78
|
+
spriteSheet:
|
|
79
|
+
serializedVersion: 2
|
|
80
|
+
sprites: []
|
|
81
|
+
outline: []
|
|
82
|
+
physicsShape: []
|
|
83
|
+
bones: []
|
|
84
|
+
spriteID:
|
|
85
|
+
internalID: 0
|
|
86
|
+
vertices: []
|
|
87
|
+
indices:
|
|
88
|
+
edges: []
|
|
89
|
+
weights: []
|
|
90
|
+
secondaryTextures: []
|
|
91
|
+
spritePackingTag:
|
|
92
|
+
pSDRemoveMatte: 0
|
|
93
|
+
pSDShowRemoveMatteOption: 0
|
|
94
|
+
userData:
|
|
95
|
+
assetBundleName:
|
|
96
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: e707b1f4d89ec074fa368d77d9b21f14
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 11
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 1
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
vTOnly: 0
|
|
27
|
+
grayScaleToAlpha: 0
|
|
28
|
+
generateCubemap: 6
|
|
29
|
+
cubemapConvolution: 0
|
|
30
|
+
seamlessCubemap: 0
|
|
31
|
+
textureFormat: 1
|
|
32
|
+
maxTextureSize: 2048
|
|
33
|
+
textureSettings:
|
|
34
|
+
serializedVersion: 2
|
|
35
|
+
filterMode: 1
|
|
36
|
+
aniso: 1
|
|
37
|
+
mipBias: 0
|
|
38
|
+
wrapU: 0
|
|
39
|
+
wrapV: 0
|
|
40
|
+
wrapW: 0
|
|
41
|
+
nPOTScale: 1
|
|
42
|
+
lightmap: 0
|
|
43
|
+
compressionQuality: 50
|
|
44
|
+
spriteMode: 0
|
|
45
|
+
spriteExtrude: 1
|
|
46
|
+
spriteMeshType: 1
|
|
47
|
+
alignment: 0
|
|
48
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
49
|
+
spritePixelsToUnits: 100
|
|
50
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
51
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
52
|
+
alphaUsage: 1
|
|
53
|
+
alphaIsTransparency: 1
|
|
54
|
+
spriteTessellationDetail: -1
|
|
55
|
+
textureType: 0
|
|
56
|
+
textureShape: 1
|
|
57
|
+
singleChannelComponent: 0
|
|
58
|
+
flipbookRows: 1
|
|
59
|
+
flipbookColumns: 1
|
|
60
|
+
maxTextureSizeSet: 0
|
|
61
|
+
compressionQualitySet: 0
|
|
62
|
+
textureFormatSet: 0
|
|
63
|
+
ignorePngGamma: 0
|
|
64
|
+
applyGammaDecoding: 0
|
|
65
|
+
platformSettings:
|
|
66
|
+
- serializedVersion: 3
|
|
67
|
+
buildTarget: DefaultTexturePlatform
|
|
68
|
+
maxTextureSize: 2048
|
|
69
|
+
resizeAlgorithm: 0
|
|
70
|
+
textureFormat: -1
|
|
71
|
+
textureCompression: 1
|
|
72
|
+
compressionQuality: 50
|
|
73
|
+
crunchedCompression: 0
|
|
74
|
+
allowsAlphaSplitting: 0
|
|
75
|
+
overridden: 0
|
|
76
|
+
androidETC2FallbackOverride: 0
|
|
77
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
78
|
+
- serializedVersion: 3
|
|
79
|
+
buildTarget: Standalone
|
|
80
|
+
maxTextureSize: 2048
|
|
81
|
+
resizeAlgorithm: 0
|
|
82
|
+
textureFormat: -1
|
|
83
|
+
textureCompression: 1
|
|
84
|
+
compressionQuality: 50
|
|
85
|
+
crunchedCompression: 0
|
|
86
|
+
allowsAlphaSplitting: 0
|
|
87
|
+
overridden: 0
|
|
88
|
+
androidETC2FallbackOverride: 0
|
|
89
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
90
|
+
- serializedVersion: 3
|
|
91
|
+
buildTarget: iPhone
|
|
92
|
+
maxTextureSize: 2048
|
|
93
|
+
resizeAlgorithm: 0
|
|
94
|
+
textureFormat: -1
|
|
95
|
+
textureCompression: 1
|
|
96
|
+
compressionQuality: 50
|
|
97
|
+
crunchedCompression: 0
|
|
98
|
+
allowsAlphaSplitting: 0
|
|
99
|
+
overridden: 0
|
|
100
|
+
androidETC2FallbackOverride: 0
|
|
101
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
102
|
+
- serializedVersion: 3
|
|
103
|
+
buildTarget: WebGL
|
|
104
|
+
maxTextureSize: 2048
|
|
105
|
+
resizeAlgorithm: 0
|
|
106
|
+
textureFormat: -1
|
|
107
|
+
textureCompression: 1
|
|
108
|
+
compressionQuality: 50
|
|
109
|
+
crunchedCompression: 0
|
|
110
|
+
allowsAlphaSplitting: 0
|
|
111
|
+
overridden: 0
|
|
112
|
+
androidETC2FallbackOverride: 0
|
|
113
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
114
|
+
- serializedVersion: 3
|
|
115
|
+
buildTarget: Android
|
|
116
|
+
maxTextureSize: 2048
|
|
117
|
+
resizeAlgorithm: 0
|
|
118
|
+
textureFormat: -1
|
|
119
|
+
textureCompression: 1
|
|
120
|
+
compressionQuality: 50
|
|
121
|
+
crunchedCompression: 0
|
|
122
|
+
allowsAlphaSplitting: 0
|
|
123
|
+
overridden: 0
|
|
124
|
+
androidETC2FallbackOverride: 0
|
|
125
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
126
|
+
spriteSheet:
|
|
127
|
+
serializedVersion: 2
|
|
128
|
+
sprites: []
|
|
129
|
+
outline: []
|
|
130
|
+
physicsShape: []
|
|
131
|
+
bones: []
|
|
132
|
+
spriteID:
|
|
133
|
+
internalID: 0
|
|
134
|
+
vertices: []
|
|
135
|
+
indices:
|
|
136
|
+
edges: []
|
|
137
|
+
weights: []
|
|
138
|
+
secondaryTextures: []
|
|
139
|
+
spritePackingTag:
|
|
140
|
+
pSDRemoveMatte: 0
|
|
141
|
+
pSDShowRemoveMatteOption: 0
|
|
142
|
+
userData:
|
|
143
|
+
assetBundleName:
|
|
144
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 01ab6d066fda9ae4ab539f69e9f9c0df
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 11
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 1
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
vTOnly: 0
|
|
27
|
+
grayScaleToAlpha: 0
|
|
28
|
+
generateCubemap: 6
|
|
29
|
+
cubemapConvolution: 0
|
|
30
|
+
seamlessCubemap: 0
|
|
31
|
+
textureFormat: 1
|
|
32
|
+
maxTextureSize: 2048
|
|
33
|
+
textureSettings:
|
|
34
|
+
serializedVersion: 2
|
|
35
|
+
filterMode: 1
|
|
36
|
+
aniso: 1
|
|
37
|
+
mipBias: 0
|
|
38
|
+
wrapU: 0
|
|
39
|
+
wrapV: 0
|
|
40
|
+
wrapW: 0
|
|
41
|
+
nPOTScale: 1
|
|
42
|
+
lightmap: 0
|
|
43
|
+
compressionQuality: 50
|
|
44
|
+
spriteMode: 0
|
|
45
|
+
spriteExtrude: 1
|
|
46
|
+
spriteMeshType: 1
|
|
47
|
+
alignment: 0
|
|
48
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
49
|
+
spritePixelsToUnits: 100
|
|
50
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
51
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
52
|
+
alphaUsage: 1
|
|
53
|
+
alphaIsTransparency: 1
|
|
54
|
+
spriteTessellationDetail: -1
|
|
55
|
+
textureType: 0
|
|
56
|
+
textureShape: 1
|
|
57
|
+
singleChannelComponent: 0
|
|
58
|
+
flipbookRows: 1
|
|
59
|
+
flipbookColumns: 1
|
|
60
|
+
maxTextureSizeSet: 0
|
|
61
|
+
compressionQualitySet: 0
|
|
62
|
+
textureFormatSet: 0
|
|
63
|
+
ignorePngGamma: 0
|
|
64
|
+
applyGammaDecoding: 0
|
|
65
|
+
platformSettings:
|
|
66
|
+
- serializedVersion: 3
|
|
67
|
+
buildTarget: DefaultTexturePlatform
|
|
68
|
+
maxTextureSize: 2048
|
|
69
|
+
resizeAlgorithm: 0
|
|
70
|
+
textureFormat: -1
|
|
71
|
+
textureCompression: 1
|
|
72
|
+
compressionQuality: 50
|
|
73
|
+
crunchedCompression: 0
|
|
74
|
+
allowsAlphaSplitting: 0
|
|
75
|
+
overridden: 0
|
|
76
|
+
androidETC2FallbackOverride: 0
|
|
77
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
78
|
+
- serializedVersion: 3
|
|
79
|
+
buildTarget: Standalone
|
|
80
|
+
maxTextureSize: 2048
|
|
81
|
+
resizeAlgorithm: 0
|
|
82
|
+
textureFormat: -1
|
|
83
|
+
textureCompression: 1
|
|
84
|
+
compressionQuality: 50
|
|
85
|
+
crunchedCompression: 0
|
|
86
|
+
allowsAlphaSplitting: 0
|
|
87
|
+
overridden: 0
|
|
88
|
+
androidETC2FallbackOverride: 0
|
|
89
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
90
|
+
- serializedVersion: 3
|
|
91
|
+
buildTarget: iPhone
|
|
92
|
+
maxTextureSize: 2048
|
|
93
|
+
resizeAlgorithm: 0
|
|
94
|
+
textureFormat: -1
|
|
95
|
+
textureCompression: 1
|
|
96
|
+
compressionQuality: 50
|
|
97
|
+
crunchedCompression: 0
|
|
98
|
+
allowsAlphaSplitting: 0
|
|
99
|
+
overridden: 0
|
|
100
|
+
androidETC2FallbackOverride: 0
|
|
101
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
102
|
+
- serializedVersion: 3
|
|
103
|
+
buildTarget: WebGL
|
|
104
|
+
maxTextureSize: 2048
|
|
105
|
+
resizeAlgorithm: 0
|
|
106
|
+
textureFormat: -1
|
|
107
|
+
textureCompression: 1
|
|
108
|
+
compressionQuality: 50
|
|
109
|
+
crunchedCompression: 0
|
|
110
|
+
allowsAlphaSplitting: 0
|
|
111
|
+
overridden: 0
|
|
112
|
+
androidETC2FallbackOverride: 0
|
|
113
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
114
|
+
- serializedVersion: 3
|
|
115
|
+
buildTarget: Android
|
|
116
|
+
maxTextureSize: 2048
|
|
117
|
+
resizeAlgorithm: 0
|
|
118
|
+
textureFormat: -1
|
|
119
|
+
textureCompression: 1
|
|
120
|
+
compressionQuality: 50
|
|
121
|
+
crunchedCompression: 0
|
|
122
|
+
allowsAlphaSplitting: 0
|
|
123
|
+
overridden: 0
|
|
124
|
+
androidETC2FallbackOverride: 0
|
|
125
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
126
|
+
spriteSheet:
|
|
127
|
+
serializedVersion: 2
|
|
128
|
+
sprites: []
|
|
129
|
+
outline: []
|
|
130
|
+
physicsShape: []
|
|
131
|
+
bones: []
|
|
132
|
+
spriteID:
|
|
133
|
+
internalID: 0
|
|
134
|
+
vertices: []
|
|
135
|
+
indices:
|
|
136
|
+
edges: []
|
|
137
|
+
weights: []
|
|
138
|
+
secondaryTextures: []
|
|
139
|
+
spritePackingTag:
|
|
140
|
+
pSDRemoveMatte: 0
|
|
141
|
+
pSDShowRemoveMatteOption: 0
|
|
142
|
+
userData:
|
|
143
|
+
assetBundleName:
|
|
144
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
using System.Collections;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace TyphoonUnitySDK
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// runtime封装
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class RuntimeUtil
|
|
12
|
+
{
|
|
13
|
+
public static string GetPathRoot()
|
|
14
|
+
{
|
|
15
|
+
if (Directory.Exists("Assets/com.typhoon.unitysdk"))
|
|
16
|
+
{
|
|
17
|
+
return "Assets/com.typhoon.unitysdk";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return "Packages/com.typhoon.unitysdk";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -16,18 +16,7 @@ namespace TyphoonUnitySDK
|
|
|
16
16
|
#if UNITY_EDITOR
|
|
17
17
|
public static float HOLD_TIME = SdkTestInUnity.Instance.InteractiveHoldCloseTime;
|
|
18
18
|
|
|
19
|
-
public static string PathRoot
|
|
20
|
-
{
|
|
21
|
-
get
|
|
22
|
-
{
|
|
23
|
-
if (Directory.Exists("Assets/com.typhoon.unitysdk"))
|
|
24
|
-
{
|
|
25
|
-
return "Assets/com.typhoon.unitysdk";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return "Packages/com.typhoon.unitysdk";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
19
|
+
public static string PathRoot => RuntimeUtil.GetPathRoot();
|
|
31
20
|
|
|
32
21
|
/// <summary>
|
|
33
22
|
/// 横竖屏模式
|
|
@@ -496,7 +485,7 @@ namespace TyphoonUnitySDK
|
|
|
496
485
|
view.y = Mathf.Lerp(0, rect.width, Sp.y);
|
|
497
486
|
GUI.DrawTexture(view, Image);
|
|
498
487
|
var rectClose = view;
|
|
499
|
-
DrawViewTxtLabel(rectClose, "关闭", TextAnchor.UpperRight,0.3f);
|
|
488
|
+
DrawViewTxtLabel(rectClose, "关闭", TextAnchor.UpperRight, 0.3f);
|
|
500
489
|
HoldHide(rectClose, ref HoldTime, Hide);
|
|
501
490
|
}
|
|
502
491
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#if UNITY_EDITOR
|
|
2
|
+
using System;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace TyphoonUnitySDK
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// 模拟录屏分享
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class SimulateRecordGame : MonoSingleton<SimulateRecordGame>
|
|
11
|
+
{
|
|
12
|
+
/*是否在录制中*/
|
|
13
|
+
public bool IsRecording = false;
|
|
14
|
+
|
|
15
|
+
/*开始时间*/
|
|
16
|
+
public float StartTime;
|
|
17
|
+
|
|
18
|
+
/*录制时长*/
|
|
19
|
+
public float RecordTime;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
protected override void Init()
|
|
23
|
+
{
|
|
24
|
+
base.Init();
|
|
25
|
+
DontDestroyOnLoad(gameObject);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
public bool CanRecord()
|
|
30
|
+
{
|
|
31
|
+
return AppConfig.Channel == AppChannel.DouyinAndroid;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public float GetDuration()
|
|
35
|
+
{
|
|
36
|
+
if (IsRecording)
|
|
37
|
+
{
|
|
38
|
+
return Time.time - StartTime;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public void StartRecord(Action onStart)
|
|
45
|
+
{
|
|
46
|
+
onStart?.Invoke();
|
|
47
|
+
IsRecording = true;
|
|
48
|
+
StartTime = Time.time;
|
|
49
|
+
RecordTime = 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public void StopRecord(Action<string> complete)
|
|
53
|
+
{
|
|
54
|
+
complete?.Invoke("video_xxxx,(本地模拟,实际以发布后为准)");
|
|
55
|
+
IsRecording = false;
|
|
56
|
+
RecordTime = Time.time - StartTime;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
public bool CanShare()
|
|
61
|
+
{
|
|
62
|
+
if (IsRecording)
|
|
63
|
+
{
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return RecordTime > 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public void Share(Action success, Action fail)
|
|
71
|
+
{
|
|
72
|
+
if (!CanShare())
|
|
73
|
+
{
|
|
74
|
+
fail?.Invoke();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
GUIMessageBox.Instance.Show("请选择分享返回结果", "成功返回", "失败返回", () => success?.Invoke(),
|
|
79
|
+
() => fail?.Invoke());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#endif
|
package/Runtime/TyphoonSdk.cs
CHANGED
|
@@ -34,6 +34,9 @@ namespace TyphoonUnitySDK
|
|
|
34
34
|
|
|
35
35
|
private void CreateSDK()
|
|
36
36
|
{
|
|
37
|
+
#if UNITY_EDITOR
|
|
38
|
+
return;
|
|
39
|
+
#endif
|
|
37
40
|
if (SDKBindings.TryGetValue(AppConfig.Channel, out var match))
|
|
38
41
|
{
|
|
39
42
|
var source = Resources.Load<GameObject>(match);
|
|
@@ -412,5 +415,96 @@ namespace TyphoonUnitySDK
|
|
|
412
415
|
}
|
|
413
416
|
|
|
414
417
|
#endregion
|
|
418
|
+
|
|
419
|
+
#region 录屏分享
|
|
420
|
+
|
|
421
|
+
/// <summary>
|
|
422
|
+
/// 是否支持录屏分享
|
|
423
|
+
/// </summary>
|
|
424
|
+
public bool CanRecordGame()
|
|
425
|
+
{
|
|
426
|
+
#if UNITY_EDITOR
|
|
427
|
+
return SimulateRecordGame.Instance.CanRecord();
|
|
428
|
+
#endif
|
|
429
|
+
return _sdk.CanRecordGame();
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/// <summary>
|
|
433
|
+
/// 开启录屏
|
|
434
|
+
/// </summary>
|
|
435
|
+
/// <param name="isRecordAudio">包含音频</param>
|
|
436
|
+
/// <param name="maxRecordTimeSec">最大录屏时长</param>
|
|
437
|
+
/// <param name="onStart">开始回调</param>
|
|
438
|
+
/// <param name="onError">错误回调</param>
|
|
439
|
+
/// <param name="onComplete">完成回调</param>
|
|
440
|
+
public void StartRecordGame(bool isRecordAudio = true, int maxRecordTimeSec = 600, Action onStart = null,
|
|
441
|
+
Action<string> onError = null, Action<string> onComplete = null)
|
|
442
|
+
{
|
|
443
|
+
#if UNITY_EDITOR
|
|
444
|
+
SimulateRecordGame.Instance.StartRecord(onStart);
|
|
445
|
+
return;
|
|
446
|
+
#endif
|
|
447
|
+
_sdk.StartRecordGame(isRecordAudio, maxRecordTimeSec, onStart, onError, onComplete);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/// <summary>
|
|
451
|
+
/// 停止录制
|
|
452
|
+
/// </summary>
|
|
453
|
+
/// <param name="complete">完成回调,返回videopath</param>
|
|
454
|
+
/// <param name="onError">错误回调</param>
|
|
455
|
+
/// <param name="clips">自定义剪辑片段,单位毫秒</param>
|
|
456
|
+
/// <param name="autoMerge">自动合并</param>
|
|
457
|
+
public void StopRecordGame(Action<string> complete = null, Action<string> onError = null,
|
|
458
|
+
List<TimeClip> clips = null, bool autoMerge = true)
|
|
459
|
+
{
|
|
460
|
+
#if UNITY_EDITOR
|
|
461
|
+
SimulateRecordGame.Instance.StopRecord(complete);
|
|
462
|
+
return;
|
|
463
|
+
#endif
|
|
464
|
+
_sdk.StopRecordGame(complete, onError, clips, autoMerge);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/// <summary>
|
|
468
|
+
/// 获取录屏时长
|
|
469
|
+
/// </summary>
|
|
470
|
+
public float GetRecordDuration()
|
|
471
|
+
{
|
|
472
|
+
#if UNITY_EDITOR
|
|
473
|
+
return SimulateRecordGame.Instance.GetDuration();
|
|
474
|
+
#endif
|
|
475
|
+
return _sdk.GetRecordDuration();
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
/// <summary>
|
|
480
|
+
/// 是否可以分享录屏
|
|
481
|
+
/// </summary>
|
|
482
|
+
public bool CanShareRecordGame()
|
|
483
|
+
{
|
|
484
|
+
#if UNITY_EDITOR
|
|
485
|
+
return SimulateRecordGame.Instance.CanShare();
|
|
486
|
+
#endif
|
|
487
|
+
return _sdk.CanShareRecordGame();
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/// <summary>
|
|
491
|
+
/// 分享录屏
|
|
492
|
+
/// </summary>
|
|
493
|
+
/// <param name="title">标题</param>
|
|
494
|
+
/// <param name="topics">话题</param>
|
|
495
|
+
/// <param name="success">成功回调</param>
|
|
496
|
+
/// <param name="fail">失败回调</param>
|
|
497
|
+
/// <param name="cancel">取消回调</param>
|
|
498
|
+
public void ShareRecordGame(string title, List<string> topics, Action success, Action<string> fail = null,
|
|
499
|
+
Action cancel = null)
|
|
500
|
+
{
|
|
501
|
+
#if UNITY_EDITOR
|
|
502
|
+
SimulateRecordGame.Instance.Share(success, () => fail?.Invoke("分享失败"));
|
|
503
|
+
return;
|
|
504
|
+
#endif
|
|
505
|
+
_sdk.ShareRecordGame(title, topics, success, fail, cancel);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
#endregion
|
|
415
509
|
}
|
|
416
510
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -88,12 +88,6 @@ Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Editor/starksdk_tools.
|
|
|
88
88
|
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Editor/starksdk_tools.dll.meta
|
|
89
89
|
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools/dummy.py
|
|
90
90
|
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools/dummy.py.meta
|
|
91
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/clean_cache.bat
|
|
92
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/clean_cache.sh
|
|
93
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/launch_game.bat
|
|
94
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/launch_game.sh
|
|
95
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/pushapk.bat
|
|
96
|
-
Assets/Plugins/ByteGame/com.bytedance.starksdk.unitytools/Tools~/pushapk.sh
|
|
97
91
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin
|
|
98
92
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/DouyinBannerAd.cs
|
|
99
93
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/DouyinBannerAd.cs.meta
|
|
@@ -103,5 +97,7 @@ Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Editor.meta
|
|
|
103
97
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Resources.meta
|
|
104
98
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Editor/PublishDouyinAndroid.cs
|
|
105
99
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Editor/PublishDouyinAndroid.cs.meta
|
|
100
|
+
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Editor/PublishDouyinIOS.cs
|
|
101
|
+
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Editor/PublishDouyinIOS.cs.meta
|
|
106
102
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Resources/TYPHOON_SDK_DOUYIN_MINI.prefab
|
|
107
103
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin/Resources/TYPHOON_SDK_DOUYIN_MINI.prefab.meta
|
|
Binary file
|
|
@@ -381,6 +381,8 @@ Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini
|
|
|
381
381
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/Editor.meta
|
|
382
382
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/Plugins.meta
|
|
383
383
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/Resources.meta
|
|
384
|
+
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/UnityToJs.cs
|
|
385
|
+
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/UnityToJs.cs.meta
|
|
384
386
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/WxMiniSdk.cs
|
|
385
387
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/WxMiniSdk.cs.meta
|
|
386
388
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini/Editor/PublishWxMini.cs
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.
|
|
1
|
+
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.24","description":"unity端个汇总渠道的sdk,统一接口,一键发布","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
|
package/Runtime/UnityToJs.cs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
using System.Collections;
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using System.Runtime.InteropServices;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
namespace TyphoonUnitySDK
|
|
8
|
-
{
|
|
9
|
-
#if UNITY_WEBGL
|
|
10
|
-
/// <summary>
|
|
11
|
-
/// unity 调用 js
|
|
12
|
-
/// </summary>
|
|
13
|
-
public class UnityToJs
|
|
14
|
-
{
|
|
15
|
-
[DllImport("__Internal")]
|
|
16
|
-
private static extern void WebMethodCall(string msg);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
[DllImport("__Internal")]
|
|
20
|
-
private static extern string WebMethodGet(string msg);
|
|
21
|
-
|
|
22
|
-
public static void MethodCall(string msg)
|
|
23
|
-
{
|
|
24
|
-
#if UNITY_EDITOR
|
|
25
|
-
Debug.Log($"## unity call js {msg}");
|
|
26
|
-
#else
|
|
27
|
-
WebMethodCall(msg);
|
|
28
|
-
#endif
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
public static string MethodGet(string msg)
|
|
33
|
-
{
|
|
34
|
-
#if UNITY_EDITOR
|
|
35
|
-
Debug.Log($"## unity get js {msg}");
|
|
36
|
-
return msg;
|
|
37
|
-
#else
|
|
38
|
-
return WebMethodGet(msg);
|
|
39
|
-
#endif
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/*无回调的方式*/
|
|
43
|
-
public static void MethodCall(string method, object data)
|
|
44
|
-
{
|
|
45
|
-
var send = new
|
|
46
|
-
{
|
|
47
|
-
method,
|
|
48
|
-
data,
|
|
49
|
-
};
|
|
50
|
-
MethodCall(send.ToJson());
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/*带回调的方式*/
|
|
54
|
-
public static void MethodCall(SessionItem session)
|
|
55
|
-
{
|
|
56
|
-
var send = new
|
|
57
|
-
{
|
|
58
|
-
session = session.SessionId,
|
|
59
|
-
method = session.MethodName,
|
|
60
|
-
data = session.SendData,
|
|
61
|
-
};
|
|
62
|
-
MethodCall(send.ToJson());
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
#endif
|
|
66
|
-
}
|