com.beanbag.tiktokminigames 1.0.0
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/DefaultTemplate/backgroundlandscape.png +0 -0
- package/DefaultTemplate/backgroundlandscape.png.meta +159 -0
- package/DefaultTemplate/backgroundportrait.png +0 -0
- package/DefaultTemplate/backgroundportrait.png.meta +159 -0
- package/DefaultTemplate/game.js +151 -0
- package/DefaultTemplate/game.js.meta +7 -0
- package/DefaultTemplate/images/unity_logo.png +0 -0
- package/DefaultTemplate/images/unity_logo.png.meta +159 -0
- package/DefaultTemplate/images.meta +8 -0
- package/DefaultTemplate/plugin-config.js +23 -0
- package/DefaultTemplate/plugin-config.js.meta +7 -0
- package/DefaultTemplate/plugin.js +1 -0
- package/DefaultTemplate/plugin.js.meta +7 -0
- package/DefaultTemplate/unity-namespace.js +11 -0
- package/DefaultTemplate/unity-namespace.js.meta +7 -0
- package/DefaultTemplate/webgl-wasm-split.js +17 -0
- package/DefaultTemplate/webgl-wasm-split.js.meta +7 -0
- package/DefaultTemplate.meta +8 -0
- package/Editor/Extras/Integration/DouYinMiniGameSettings.cs +30 -0
- package/Editor/Extras/Integration/DouYinMiniGameSettings.cs.meta +11 -0
- package/Editor/Extras/Integration/DouYinMiniGameSettingsEditor.cs +354 -0
- package/Editor/Extras/Integration/DouYinMiniGameSettingsEditor.cs.meta +3 -0
- package/Editor/Extras/Integration/DouYinSubplatformInterface.cs +153 -0
- package/Editor/Extras/Integration/DouYinSubplatformInterface.cs.meta +3 -0
- package/Editor/Extras/Integration.meta +8 -0
- package/Editor/Extras/Providers/TTMiniGameSupportProvider.cs +148 -0
- package/Editor/Extras/Providers/TTMiniGameSupportProvider.cs.meta +3 -0
- package/Editor/Extras/Providers.meta +3 -0
- package/Editor/Extras/TTEditorSupportProviderRegister.cs +15 -0
- package/Editor/Extras/TTEditorSupportProviderRegister.cs.meta +3 -0
- package/Editor/Extras.meta +3 -0
- package/Editor/ttsdk_tools.dll +0 -0
- package/Editor/ttsdk_tools.dll.meta +33 -0
- package/Editor/ttsdk_tools.pdb +0 -0
- package/Editor/ttsdk_tools.pdb.meta +7 -0
- package/Editor.meta +8 -0
- package/LitJson/TTLitJson.dll +0 -0
- package/LitJson/TTLitJson.dll.meta +33 -0
- package/LitJson/TTLitJson.pdb +0 -0
- package/LitJson/TTLitJson.pdb.meta +7 -0
- package/LitJson.meta +8 -0
- package/TTSDK/ttsdk.dll +0 -0
- package/TTSDK/ttsdk.dll.meta +33 -0
- package/TTSDK/ttsdk.pdb +0 -0
- package/TTSDK/ttsdk.pdb.meta +7 -0
- package/TTSDK.meta +8 -0
- package/WebGL/AssetBundle/DownloadHandlerTTAssetBundle.cs +85 -0
- package/WebGL/AssetBundle/DownloadHandlerTTAssetBundle.cs.meta +3 -0
- package/WebGL/AssetBundle/TTAssetBundle.cs +72 -0
- package/WebGL/AssetBundle/TTAssetBundle.cs.meta +3 -0
- package/WebGL/AssetBundle/TTAssetBundleExtensions.cs +25 -0
- package/WebGL/AssetBundle/TTAssetBundleExtensions.cs.meta +3 -0
- package/WebGL/AssetBundle/TTAssetBundleProviders.cs.txt +1301 -0
- package/WebGL/AssetBundle/TTAssetBundleProviders.cs.txt.meta +3 -0
- package/WebGL/AssetBundle/TTAssetBundleRequest.cs +96 -0
- package/WebGL/AssetBundle/TTAssetBundleRequest.cs.meta +3 -0
- package/WebGL/AssetBundle.meta +8 -0
- package/WebGL/Compatibility/UnityCacheCompatibility.cs +49 -0
- package/WebGL/Compatibility/UnityCacheCompatibility.cs.meta +3 -0
- package/WebGL/Compatibility/UnityWebRequestCompatibility.cs +18 -0
- package/WebGL/Compatibility/UnityWebRequestCompatibility.cs.meta +3 -0
- package/WebGL/Compatibility.meta +3 -0
- package/WebGL/FileSystem/TTFileSystemManager.cs +460 -0
- package/WebGL/FileSystem/TTFileSystemManager.cs.meta +11 -0
- package/WebGL/FileSystem/TTFileSystemManagerDefault.cs +1039 -0
- package/WebGL/FileSystem/TTFileSystemManagerDefault.cs.meta +11 -0
- package/WebGL/FileSystem/TTFileSystemManagerWebGL.cs +1278 -0
- package/WebGL/FileSystem/TTFileSystemManagerWebGL.cs.meta +11 -0
- package/WebGL/FileSystem.meta +3 -0
- package/WebGL/Input/Input.cs +230 -0
- package/WebGL/Input/Input.cs.meta +3 -0
- package/WebGL/Input/TTPCInputHandler.cs +199 -0
- package/WebGL/Input/TTPCInputHandler.cs.meta +3 -0
- package/WebGL/Input.meta +3 -0
- package/WebGL/Network/TTUDPSocketHandler.cs +130 -0
- package/WebGL/Network/TTUDPSocketHandler.cs.meta +11 -0
- package/WebGL/Network.meta +3 -0
- package/WebGL/TTAssetBundle.jslib +33 -0
- package/WebGL/TTAssetBundle.jslib.meta +32 -0
- package/WebGL/TTCallbackHandler.cs +139 -0
- package/WebGL/TTCallbackHandler.cs.meta +3 -0
- package/WebGL/TTModel.cs +582 -0
- package/WebGL/TTModel.cs.meta +11 -0
- package/WebGL/TTSDK.jslib +592 -0
- package/WebGL/TTSDK.jslib.meta +32 -0
- package/WebGL/TTSDKType.cs +10 -0
- package/WebGL/TTSDKType.cs.meta +3 -0
- package/WebGL/TTStorageManager.cs +155 -0
- package/WebGL/TTStorageManager.cs.meta +11 -0
- package/WebGL/TTUNBridge.jslib +117 -0
- package/WebGL/TTUNBridge.jslib.meta +32 -0
- package/WebGL/TTVersionAttribute.cs +21 -0
- package/WebGL/TTVersionAttribute.cs.meta +11 -0
- package/WebGL/TTWebGL.asmdef +18 -0
- package/WebGL/TTWebGL.asmdef.meta +7 -0
- package/WebGL/TTWebGLInterface.cs +63 -0
- package/WebGL/TTWebGLInterface.cs.meta +11 -0
- package/WebGL.meta +8 -0
- package/package.json +13 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#if UNITY_WEBGL && STARK_UNITY_INPUT_OVERRIDE
|
|
2
|
+
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.EventSystems;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Interface into the Input system. (Overridden by TTSDK)
|
|
8
|
+
/// </summary>
|
|
9
|
+
/// <remarks>
|
|
10
|
+
/// 覆盖 Input,用于将 Input.GetTouch() 等方法重载至 TTSDK 中的实现。
|
|
11
|
+
/// 因为编译器解析引用时,全局命名空间中的类优先级更高,Input.GetTouch() 等方法将优先选择当前类而非 UnityEngine.Input.
|
|
12
|
+
/// * 通过 STARK_UNITY_INPUT_OVERRIDE 符号控制开关,默认关闭。关闭时与 UnityEngine.Input 无差异。
|
|
13
|
+
/// * 不会重载以完全限定名形式(UnityEngine.Input)书写的调用,仅重载 Input.XXX。
|
|
14
|
+
/// * 不会重载动态链接库(DLL)中对 UnityEngine.Input 的直接调用。
|
|
15
|
+
/// </remarks>
|
|
16
|
+
public static class Input
|
|
17
|
+
{
|
|
18
|
+
static Input()
|
|
19
|
+
{
|
|
20
|
+
Debug.Log("Global Input overridden by TTSDK.");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#region Touch Override
|
|
24
|
+
|
|
25
|
+
private static BaseInputModule CurrentInputModule => EventSystem.current.currentInputModule;
|
|
26
|
+
|
|
27
|
+
private static bool Enabled => true;
|
|
28
|
+
|
|
29
|
+
#endregion
|
|
30
|
+
|
|
31
|
+
#region Touch
|
|
32
|
+
|
|
33
|
+
public static Touch GetTouch(int index)
|
|
34
|
+
{
|
|
35
|
+
if (!Enabled) return UnityEngine.Input.GetTouch(index);
|
|
36
|
+
|
|
37
|
+
return CurrentInputModule.input.GetTouch(index);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static int touchCount
|
|
41
|
+
{
|
|
42
|
+
get { return Enabled ? CurrentInputModule.input.touchCount : UnityEngine.Input.touchCount; }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static bool touchPressureSupported => UnityEngine.Input.touchPressureSupported;
|
|
46
|
+
|
|
47
|
+
public static bool stylusTouchSupported => UnityEngine.Input.stylusTouchSupported;
|
|
48
|
+
|
|
49
|
+
public static bool touchSupported
|
|
50
|
+
{
|
|
51
|
+
get { return Enabled ? CurrentInputModule.input.touchSupported : UnityEngine.Input.touchSupported; }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static bool multiTouchEnabled => UnityEngine.Input.multiTouchEnabled;
|
|
55
|
+
|
|
56
|
+
public static Touch[] touches
|
|
57
|
+
{
|
|
58
|
+
get
|
|
59
|
+
{
|
|
60
|
+
if (!Enabled) return UnityEngine.Input.touches;
|
|
61
|
+
|
|
62
|
+
var touchCount = CurrentInputModule.input.touchCount;
|
|
63
|
+
var touches = new Touch[touchCount];
|
|
64
|
+
for (var index = 0; index < touchCount; ++index) touches[index] = CurrentInputModule.input.GetTouch(index);
|
|
65
|
+
return touches;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#endregion
|
|
70
|
+
|
|
71
|
+
#region Mouse
|
|
72
|
+
|
|
73
|
+
public static Vector3 mousePosition
|
|
74
|
+
{
|
|
75
|
+
get
|
|
76
|
+
{
|
|
77
|
+
if (!Enabled) return UnityEngine.Input.mousePosition;
|
|
78
|
+
|
|
79
|
+
return new Vector3(CurrentInputModule.input.mousePosition.x, CurrentInputModule.input.mousePosition.y,
|
|
80
|
+
0.0f);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public static Vector2 mouseScrollDelta
|
|
85
|
+
{
|
|
86
|
+
get { return Enabled ? CurrentInputModule.input.mouseScrollDelta : UnityEngine.Input.mouseScrollDelta; }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public static bool mousePresent => Enabled ? CurrentInputModule.input.mousePresent : UnityEngine.Input.mousePresent;
|
|
90
|
+
|
|
91
|
+
public static bool GetMouseButton(int button)
|
|
92
|
+
{
|
|
93
|
+
return Enabled ? CurrentInputModule.input.GetMouseButton(button) : UnityEngine.Input.GetMouseButton(button);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public static bool GetMouseButtonDown(int button)
|
|
97
|
+
{
|
|
98
|
+
return Enabled ? CurrentInputModule.input.GetMouseButtonDown(button) : UnityEngine.Input.GetMouseButton(button);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public static bool GetMouseButtonUp(int button)
|
|
102
|
+
{
|
|
103
|
+
return Enabled ? CurrentInputModule.input.GetMouseButtonUp(button) : UnityEngine.Input.GetMouseButtonUp(button);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#endregion
|
|
107
|
+
|
|
108
|
+
public static float GetAxis(string axisName)
|
|
109
|
+
{
|
|
110
|
+
return UnityEngine.Input.GetAxis(axisName);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public static float GetAxisRaw(string axisName)
|
|
114
|
+
{
|
|
115
|
+
return UnityEngine.Input.GetAxisRaw(axisName);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public static bool GetButton(string buttonName)
|
|
119
|
+
{
|
|
120
|
+
return UnityEngine.Input.GetButton(buttonName);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public static bool GetButtonDown(string buttonName)
|
|
124
|
+
{
|
|
125
|
+
return UnityEngine.Input.GetButtonDown(buttonName);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public static bool GetButtonUp(string buttonName)
|
|
129
|
+
{
|
|
130
|
+
return UnityEngine.Input.GetButtonUp(buttonName);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public static void ResetInputAxes()
|
|
134
|
+
{
|
|
135
|
+
UnityEngine.Input.ResetInputAxes();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#if UNITY_STANDLONE_LINUX
|
|
139
|
+
public static bool IsJoystickPreconfigured(string joystickName)
|
|
140
|
+
{
|
|
141
|
+
return UnityEngine.Input.IsJoystickPreconfigured(joystickName);
|
|
142
|
+
}
|
|
143
|
+
#endif
|
|
144
|
+
|
|
145
|
+
public static string[] GetJoystickNames()
|
|
146
|
+
{
|
|
147
|
+
return UnityEngine.Input.GetJoystickNames();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public static AccelerationEvent GetAccelerationEvent(int index)
|
|
151
|
+
{
|
|
152
|
+
return UnityEngine.Input.GetAccelerationEvent(index);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public static bool GetKey(KeyCode key) => UnityEngine.Input.GetKey(key);
|
|
156
|
+
|
|
157
|
+
public static bool GetKey(string name) => UnityEngine.Input.GetKey(name);
|
|
158
|
+
|
|
159
|
+
public static bool GetKeyUp(KeyCode key) => UnityEngine.Input.GetKeyUp(key);
|
|
160
|
+
|
|
161
|
+
public static bool GetKeyUp(string name) => UnityEngine.Input.GetKeyUp(name);
|
|
162
|
+
|
|
163
|
+
public static bool GetKeyDown(KeyCode key) => UnityEngine.Input.GetKeyDown(key);
|
|
164
|
+
|
|
165
|
+
public static bool GetKeyDown(string name) => UnityEngine.Input.GetKeyDown(name);
|
|
166
|
+
|
|
167
|
+
public static bool simulateMouseWithTouches
|
|
168
|
+
{
|
|
169
|
+
get => UnityEngine.Input.simulateMouseWithTouches;
|
|
170
|
+
set => UnityEngine.Input.simulateMouseWithTouches = value;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public static bool anyKey => UnityEngine.Input.anyKey;
|
|
174
|
+
|
|
175
|
+
public static bool anyKeyDown => UnityEngine.Input.anyKeyDown;
|
|
176
|
+
|
|
177
|
+
public static string inputString => UnityEngine.Input.inputString;
|
|
178
|
+
|
|
179
|
+
public static IMECompositionMode imeCompositionMode
|
|
180
|
+
{
|
|
181
|
+
get => UnityEngine.Input.imeCompositionMode;
|
|
182
|
+
set => UnityEngine.Input.imeCompositionMode = value;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public static string compositionString => UnityEngine.Input.compositionString;
|
|
186
|
+
|
|
187
|
+
public static bool imeIsSelected => UnityEngine.Input.imeIsSelected;
|
|
188
|
+
|
|
189
|
+
public static Vector2 compositionCursorPos
|
|
190
|
+
{
|
|
191
|
+
get => UnityEngine.Input.compositionCursorPos;
|
|
192
|
+
set => UnityEngine.Input.compositionCursorPos = value;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public static bool eatKeyPressOnTextFieldFocus
|
|
196
|
+
{
|
|
197
|
+
get => UnityEngine.Input.eatKeyPressOnTextFieldFocus;
|
|
198
|
+
set => UnityEngine.Input.eatKeyPressOnTextFieldFocus = value;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public static bool isGyroAvailable => UnityEngine.Input.isGyroAvailable;
|
|
202
|
+
|
|
203
|
+
public static DeviceOrientation deviceOrientation => UnityEngine.Input.deviceOrientation;
|
|
204
|
+
|
|
205
|
+
public static Vector3 acceleration => UnityEngine.Input.acceleration;
|
|
206
|
+
|
|
207
|
+
public static bool compensateSensors
|
|
208
|
+
{
|
|
209
|
+
get => UnityEngine.Input.compensateSensors;
|
|
210
|
+
set => UnityEngine.Input.compensateSensors = value;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
public static int accelerationEventCount => UnityEngine.Input.accelerationEventCount;
|
|
214
|
+
|
|
215
|
+
public static bool backButtonLeavesApp
|
|
216
|
+
{
|
|
217
|
+
get => UnityEngine.Input.backButtonLeavesApp;
|
|
218
|
+
set => UnityEngine.Input.backButtonLeavesApp = value;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
public static LocationService location => UnityEngine.Input.location;
|
|
222
|
+
|
|
223
|
+
public static Compass compass => UnityEngine.Input.compass;
|
|
224
|
+
|
|
225
|
+
public static Gyroscope gyro => UnityEngine.Input.gyro;
|
|
226
|
+
|
|
227
|
+
public static AccelerationEvent[] accelerationEvents => UnityEngine.Input.accelerationEvents;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#endif
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
2
|
+
#define TT_PC_INPUT
|
|
3
|
+
#endif
|
|
4
|
+
|
|
5
|
+
using System;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
#if TT_PC_INPUT
|
|
9
|
+
using System.Runtime.InteropServices;
|
|
10
|
+
using AOT;
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
namespace TTSDK
|
|
14
|
+
{
|
|
15
|
+
public class TTPCInputHandler
|
|
16
|
+
{
|
|
17
|
+
#if UNITY_EDITOR
|
|
18
|
+
public const string NotImplMessage = "TT Desktop Input API not supported on Unity Editor. Test it with Douyin App.";
|
|
19
|
+
#elif UNITY_ANDROID
|
|
20
|
+
public const string NotImplMessage = "TT Desktop Input API not supported on Android Native.";
|
|
21
|
+
#else
|
|
22
|
+
public const string NotImplMessage = "TT Desktop Input API supported on current platform.";
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#region APIs
|
|
26
|
+
|
|
27
|
+
public static bool TT_SetCursor(string path, double x, double y)
|
|
28
|
+
{
|
|
29
|
+
throw new NotSupportedException(NotImplMessage);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public static void TT_RequestPointerLock()
|
|
33
|
+
{
|
|
34
|
+
throw new NotSupportedException(NotImplMessage);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static bool TT_IsPointerLocked()
|
|
38
|
+
{
|
|
39
|
+
throw new NotSupportedException(NotImplMessage);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static void TT_ExitPointerLock()
|
|
43
|
+
{
|
|
44
|
+
throw new NotSupportedException(NotImplMessage);
|
|
45
|
+
}
|
|
46
|
+
#endregion
|
|
47
|
+
|
|
48
|
+
#region Callback Delegate
|
|
49
|
+
|
|
50
|
+
internal delegate void TTIntPtrCallback(IntPtr ptr);
|
|
51
|
+
|
|
52
|
+
#endregion
|
|
53
|
+
|
|
54
|
+
#region Callback OnKeyDown
|
|
55
|
+
|
|
56
|
+
private static void TT_RegisterKeyDownCallback(TTIntPtrCallback callback)
|
|
57
|
+
{
|
|
58
|
+
throw new NotSupportedException(NotImplMessage);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#if TT_PC_INPUT
|
|
62
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
63
|
+
#endif
|
|
64
|
+
private static void _OnKeyDownCallback(IntPtr ptr)
|
|
65
|
+
{
|
|
66
|
+
_onKeyDownCallback.Invoke(ptr);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private static Action<IntPtr> _onKeyDownCallback;
|
|
70
|
+
public static void SetOnKeyDownCallback(Action<IntPtr> callback)
|
|
71
|
+
{
|
|
72
|
+
_onKeyDownCallback = callback;
|
|
73
|
+
TT_RegisterKeyDownCallback(_onKeyDownCallback != null ? _OnKeyDownCallback : null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#endregion
|
|
77
|
+
|
|
78
|
+
#region Callback OnKeyUp
|
|
79
|
+
|
|
80
|
+
private static void TT_RegisterKeyUpCallback(TTIntPtrCallback callback)
|
|
81
|
+
{
|
|
82
|
+
throw new NotSupportedException(NotImplMessage);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#if TT_PC_INPUT
|
|
86
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
87
|
+
#endif
|
|
88
|
+
private static void _OnKeyUpCallback(IntPtr ptr)
|
|
89
|
+
{
|
|
90
|
+
_onKeyUpCallback.Invoke(ptr);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private static Action<IntPtr> _onKeyUpCallback;
|
|
94
|
+
public static void SetOnKeyUpCallback(Action<IntPtr> callback)
|
|
95
|
+
{
|
|
96
|
+
_onKeyUpCallback = callback;
|
|
97
|
+
TT_RegisterKeyUpCallback(_onKeyUpCallback != null ? _OnKeyUpCallback : null);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#endregion
|
|
101
|
+
|
|
102
|
+
#region Callback OnMouseDown
|
|
103
|
+
|
|
104
|
+
private static void TT_RegisterMouseDownCallback(TTIntPtrCallback callback)
|
|
105
|
+
{
|
|
106
|
+
throw new NotSupportedException(NotImplMessage);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
#if TT_PC_INPUT
|
|
110
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
111
|
+
#endif
|
|
112
|
+
private static void _OnMouseDownCallback(IntPtr ptr)
|
|
113
|
+
{
|
|
114
|
+
_onMouseDownCallback.Invoke(ptr);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private static Action<IntPtr> _onMouseDownCallback;
|
|
118
|
+
public static void SetOnMouseDownCallback(Action<IntPtr> callback)
|
|
119
|
+
{
|
|
120
|
+
_onMouseDownCallback = callback;
|
|
121
|
+
TT_RegisterMouseDownCallback(_onMouseDownCallback != null ? _OnMouseDownCallback : null);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#endregion
|
|
125
|
+
|
|
126
|
+
#region Callback OnMouseUp
|
|
127
|
+
|
|
128
|
+
private static void TT_RegisterMouseUpCallback(TTIntPtrCallback callback)
|
|
129
|
+
{
|
|
130
|
+
throw new NotSupportedException(NotImplMessage);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#if TT_PC_INPUT
|
|
134
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
135
|
+
#endif
|
|
136
|
+
private static void _OnMouseUpCallback(IntPtr ptr)
|
|
137
|
+
{
|
|
138
|
+
_onMouseUpCallback.Invoke(ptr);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private static Action<IntPtr> _onMouseUpCallback;
|
|
142
|
+
public static void SetOnMouseUpCallback(Action<IntPtr> callback)
|
|
143
|
+
{
|
|
144
|
+
_onMouseUpCallback = callback;
|
|
145
|
+
TT_RegisterMouseUpCallback(_onMouseUpCallback != null ? _OnMouseUpCallback : null);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#endregion
|
|
149
|
+
|
|
150
|
+
#region Callback OnMouseMove
|
|
151
|
+
|
|
152
|
+
private static void TT_RegisterMouseMoveCallback(TTIntPtrCallback callback)
|
|
153
|
+
{
|
|
154
|
+
throw new NotSupportedException(NotImplMessage);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
#if TT_PC_INPUT
|
|
158
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
159
|
+
#endif
|
|
160
|
+
private static void _OnMouseMoveCallback(IntPtr ptr)
|
|
161
|
+
{
|
|
162
|
+
_onMouseMoveCallback.Invoke(ptr);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private static Action<IntPtr> _onMouseMoveCallback;
|
|
166
|
+
public static void SetOnMouseMoveCallback(Action<IntPtr> callback)
|
|
167
|
+
{
|
|
168
|
+
_onMouseMoveCallback = callback;
|
|
169
|
+
TT_RegisterMouseMoveCallback(_onMouseMoveCallback != null ? _OnMouseMoveCallback : null);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#endregion
|
|
173
|
+
|
|
174
|
+
#region Callback OnWheel
|
|
175
|
+
|
|
176
|
+
private static void TT_RegisterWheelCallback(TTIntPtrCallback callback)
|
|
177
|
+
{
|
|
178
|
+
throw new NotSupportedException(NotImplMessage);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#if TT_PC_INPUT
|
|
182
|
+
[MonoPInvokeCallback(typeof(TTIntPtrCallback))]
|
|
183
|
+
#endif
|
|
184
|
+
private static void _OnWheelCallback(IntPtr ptr)
|
|
185
|
+
{
|
|
186
|
+
_onWheelCallback.Invoke(ptr);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private static Action<IntPtr> _onWheelCallback;
|
|
190
|
+
public static void SetOnWheelCallback(Action<IntPtr> callback)
|
|
191
|
+
{
|
|
192
|
+
_onWheelCallback = callback;
|
|
193
|
+
TT_RegisterWheelCallback(_onWheelCallback != null ? _OnWheelCallback : null);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
#endregion
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
}
|
package/WebGL/Input.meta
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
2
|
+
#define TT_UDP_ENABLED
|
|
3
|
+
#endif
|
|
4
|
+
|
|
5
|
+
using System;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
#if TT_UDP_ENABLED
|
|
9
|
+
using System.Runtime.InteropServices;
|
|
10
|
+
using AOT;
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
namespace TTSDK.Network
|
|
14
|
+
{
|
|
15
|
+
public class TTUDPSocketHandler
|
|
16
|
+
{
|
|
17
|
+
|
|
18
|
+
#if UNITY_EDITOR
|
|
19
|
+
public const string NotImplMessage = "TT UDP Socket not supported on Unity Editor. Test it with Douyin App.";
|
|
20
|
+
#elif UNITY_ANDROID
|
|
21
|
+
public const string NotImplMessage = "TT UDP Socket not supported on Android Native.";
|
|
22
|
+
#else
|
|
23
|
+
public const string NotImplMessage = "TT UDP Socket not supported on current platform.";
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
public delegate void StarkUDPSocketOnMessageCallback(string instanceId, IntPtr ptrMsg, int lenMsg,
|
|
27
|
+
IntPtr ptrLocalInfo, IntPtr ptrRemoteInfo);
|
|
28
|
+
public static string StarkCreateUDPSocket()
|
|
29
|
+
{
|
|
30
|
+
throw new NotSupportedException(NotImplMessage);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public static void StarkUDPSocketClose(string id)
|
|
34
|
+
{
|
|
35
|
+
throw new NotSupportedException(NotImplMessage);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static void StarkUDPSocketConnect(string id, string option)
|
|
39
|
+
{
|
|
40
|
+
throw new NotSupportedException(NotImplMessage);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public static void StarkUDPSocketOnClose(string id)
|
|
44
|
+
{
|
|
45
|
+
throw new NotSupportedException(NotImplMessage);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static void StarkUDPSocketOffClose(string id)
|
|
49
|
+
{
|
|
50
|
+
throw new NotSupportedException(NotImplMessage);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static void StarkUDPSocketOnError(string id)
|
|
54
|
+
{
|
|
55
|
+
throw new NotSupportedException(NotImplMessage);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public static void StarkUDPSocketOffError(string id)
|
|
59
|
+
{
|
|
60
|
+
throw new NotSupportedException(NotImplMessage);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public static void StarkUDPSocketOnListening(string id)
|
|
64
|
+
{
|
|
65
|
+
throw new NotSupportedException(NotImplMessage);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public static void StarkUDPSocketOffListening(string id)
|
|
69
|
+
{
|
|
70
|
+
throw new NotSupportedException(NotImplMessage);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public static void StarkUDPSocketOnMessage(string id, bool needInfo)
|
|
74
|
+
{
|
|
75
|
+
throw new NotSupportedException(NotImplMessage);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public static void StarkUDPSocketOffMessage(string id)
|
|
79
|
+
{
|
|
80
|
+
throw new NotSupportedException(NotImplMessage);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public static void StarkUDPSocketSend(string id, string data, string param)
|
|
84
|
+
{
|
|
85
|
+
throw new NotSupportedException(NotImplMessage);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public static void StarkUDPSocketSend(string id, byte[] data, int dataLength, string param)
|
|
89
|
+
{
|
|
90
|
+
throw new NotSupportedException(NotImplMessage);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public static void StarkUDPSocketSetTTL(string id, double ttl)
|
|
94
|
+
{
|
|
95
|
+
throw new NotSupportedException(NotImplMessage);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public static int StarkUDPSocketBind(string id, string param)
|
|
99
|
+
{
|
|
100
|
+
throw new NotSupportedException(NotImplMessage);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public static void StarkUDPSocketDestroy(string id)
|
|
104
|
+
{
|
|
105
|
+
throw new NotSupportedException(NotImplMessage);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public static void StarkRegisterUDPSocketOnMessageCallback(StarkUDPSocketOnMessageCallback callback)
|
|
109
|
+
{
|
|
110
|
+
throw new NotSupportedException(NotImplMessage);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#if TT_UDP_ENABLED
|
|
114
|
+
[MonoPInvokeCallback(typeof(StarkUDPSocketOnMessageCallback))]
|
|
115
|
+
#endif
|
|
116
|
+
public static void _UDPSocketOnMessageCallback(string instanceId, IntPtr ptrMsg, int lenMsg,
|
|
117
|
+
IntPtr ptrLocalInfo, IntPtr ptrRemoteInfo)
|
|
118
|
+
{
|
|
119
|
+
_messageCallback.Invoke(instanceId, ptrMsg, lenMsg, ptrLocalInfo, ptrRemoteInfo);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private static Action<string, IntPtr, int, IntPtr, IntPtr> _messageCallback;
|
|
123
|
+
public static void SetTTUDPSocketMessageCallback(Action<string, IntPtr, int, IntPtr, IntPtr> callback)
|
|
124
|
+
{
|
|
125
|
+
_messageCallback = callback;
|
|
126
|
+
StarkRegisterUDPSocketOnMessageCallback(_UDPSocketOnMessageCallback);
|
|
127
|
+
}
|
|
128
|
+
// #endif
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
mergeInto(LibraryManager.library, {
|
|
2
|
+
StarkAbfsCheckReady: function() {
|
|
3
|
+
if (!window.StarkSDK || !window.StarkSDK.abfs)
|
|
4
|
+
return false;
|
|
5
|
+
return window.StarkSDK.abfs.checkReady();
|
|
6
|
+
},
|
|
7
|
+
StarkAbfsRegisterAssetBundleUrl: function(ptr) {
|
|
8
|
+
if (!window.StarkSDK) return;
|
|
9
|
+
var url = UTF8ToString(ptr);
|
|
10
|
+
window.StarkSDK.abfs.registerAssetBundleUrl(url);
|
|
11
|
+
},
|
|
12
|
+
StarkAbfsUnregisterAssetBundleUrl: function(ptr) {
|
|
13
|
+
if (!window.StarkSDK) return;
|
|
14
|
+
var url = UTF8ToString(ptr);
|
|
15
|
+
window.StarkSDK.abfs.unregisterAssetBundleUrl(url);
|
|
16
|
+
},
|
|
17
|
+
StarkAbfsFetchBundleFromXHR: function(url, id, callback, needRetry) {
|
|
18
|
+
if (!window.StarkSDK) return false;
|
|
19
|
+
var _url = UTF8ToString(url);
|
|
20
|
+
var _id = UTF8ToString(id);
|
|
21
|
+
var _callback = function(code, message) {
|
|
22
|
+
try {
|
|
23
|
+
var len = lengthBytesUTF8(_id) + 1;
|
|
24
|
+
var idPtr = _malloc(len);
|
|
25
|
+
stringToUTF8(_id, idPtr, len);
|
|
26
|
+
dynCall("viii", callback, [idPtr, code, 0]);
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.error("[TTAssetBundle] fetch callback error:", e.message || e);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
window.StarkSDK.abfs.fetchBundleFromXHR(_url, _id, _callback, needRetry);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 6ba649b40692046109a358054f0488a3
|
|
3
|
+
PluginImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
iconMap: {}
|
|
7
|
+
executionOrder: {}
|
|
8
|
+
defineConstraints: []
|
|
9
|
+
isPreloaded: 0
|
|
10
|
+
isOverridable: 0
|
|
11
|
+
isExplicitlyReferenced: 0
|
|
12
|
+
validateReferences: 1
|
|
13
|
+
platformData:
|
|
14
|
+
- first:
|
|
15
|
+
Any:
|
|
16
|
+
second:
|
|
17
|
+
enabled: 0
|
|
18
|
+
settings: {}
|
|
19
|
+
- first:
|
|
20
|
+
Editor: Editor
|
|
21
|
+
second:
|
|
22
|
+
enabled: 0
|
|
23
|
+
settings:
|
|
24
|
+
DefaultValueInitialized: true
|
|
25
|
+
- first:
|
|
26
|
+
WebGL: WebGL
|
|
27
|
+
second:
|
|
28
|
+
enabled: 1
|
|
29
|
+
settings: {}
|
|
30
|
+
userData:
|
|
31
|
+
assetBundleName:
|
|
32
|
+
assetBundleVariant:
|