com.typhoon.unitysdk 1.0.19 → 1.0.20
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 +66 -8
- package/Editor/EditorIcons.cs +8 -0
- package/Editor/ExportModule.cs +24 -4
- package/Editor/GUIDrawer.cs +82 -0
- package/Editor/GUIDrawer.cs.meta +11 -0
- package/Editor/Preferences.cs +3 -0
- package/Editor/PreferencesWindow.cs +84 -88
- package/Editor/PublishProcess.cs +1 -0
- package/Editor/PublishResult.cs +5 -0
- package/Editor/PublishSetting.cs +18 -4
- package/Editor/PublishSettingGUIDrawer.cs +166 -7
- package/Editor/PublishTool.cs +3 -5
- package/Editor/PublishVivoBatSettingInspector.cs +0 -1
- package/Editor/PublishWindow.cs +14 -5
- package/Editor/Texture/black_32x32.png +0 -0
- package/Editor/Texture/black_32x32.png.meta +144 -0
- package/Editor/Texture/icon_arrow_right.png +0 -0
- package/Editor/Texture/icon_arrow_right.png.meta +144 -0
- package/Editor/Texture/icon_variable.png +0 -0
- package/Editor/Texture/icon_variable.png.meta +144 -0
- package/Editor/UniEditor.cs +22 -0
- package/Editor/VariablePreset.cs +160 -0
- package/Editor/VariablePreset.cs.meta +11 -0
- package/Editor/VariablePresetWindow.cs +153 -0
- package/Editor/VariablePresetWindow.cs.meta +11 -0
- package/Editor/WxMiniConfig.cs +285 -0
- package/Editor/WxMiniConfig.cs.meta +11 -0
- package/Editor/WxMiniConfigWindow.cs +58 -0
- package/Editor/WxMiniConfigWindow.cs.meta +11 -0
- package/Runtime/TyphoonSdk.cs +2 -0
- package/Runtime/UnityToJs.cs +64 -0
- package/Runtime/UnityToJs.cs.meta +11 -0
- package/Runtime/WxMiniTouchInputSupport.cs +33 -0
- package/Runtime/WxMiniTouchInputSupport.cs.meta +11 -0
- package/Sources~/Package/WxMini.unitypackage +0 -0
- package/Sources~/Package/WxMini.unitypackage.manifest +395 -0
- package/package.json +1 -1
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace TyphoonUnitySDK
|
|
8
|
+
{
|
|
9
|
+
/*微信小游戏配置GUI绘制*/
|
|
10
|
+
public static class WxMiniConfigGUIDrawer
|
|
11
|
+
{
|
|
12
|
+
//微信小游戏进阶设置
|
|
13
|
+
private static bool _wxMiniConfigAdvanceFoldout = false;
|
|
14
|
+
|
|
15
|
+
public static Dictionary<string, Func<WxMiniConfig, bool>> OverrideDrawGUIWxMiniConfig =
|
|
16
|
+
new Dictionary<string, Func<WxMiniConfig, bool>>()
|
|
17
|
+
{
|
|
18
|
+
{ "m_Script", DrawProperty_m_Script },
|
|
19
|
+
{ nameof(WxMiniConfig.AppId), DrawProperty_AppId },
|
|
20
|
+
{ nameof(WxMiniConfig.ProjectName), DrawProperty_ProjectName },
|
|
21
|
+
{ nameof(WxMiniConfig.ScreenOrientation), DrawProperty_ScreenOrientation },
|
|
22
|
+
{ nameof(WxMiniConfig.MemorySize), DrawProperty_MemorySize },
|
|
23
|
+
{ nameof(WxMiniConfig.DST), DrawProperty_DST },
|
|
24
|
+
{ nameof(WxMiniConfig.AssetLoadType), DrawProperty_AssetLoadType },
|
|
25
|
+
{ nameof(WxMiniConfig.LoadingBg), DrawProperty_LoadingBg },
|
|
26
|
+
{ nameof(WxMiniConfig.CDN), DrawProperty_CDN },
|
|
27
|
+
/*进阶选项*/
|
|
28
|
+
{ nameof(WxMiniConfig.UseFriendRelation), DrawProperty_Advance },
|
|
29
|
+
{ nameof(WxMiniConfig.UseCompressedTexture), DrawProperty_Advance },
|
|
30
|
+
{ nameof(WxMiniConfig.UseMiniGameChat), DrawProperty_Advance },
|
|
31
|
+
{ nameof(WxMiniConfig.PreloadWXFont), DrawProperty_Advance },
|
|
32
|
+
{ nameof(WxMiniConfig.DevelopBuild), DrawProperty_Advance },
|
|
33
|
+
{ nameof(WxMiniConfig.AutoProfile), DrawProperty_Advance },
|
|
34
|
+
{ nameof(WxMiniConfig.ScriptOnly), DrawProperty_Advance },
|
|
35
|
+
{ nameof(WxMiniConfig.Il2CppOptimizeSize), DrawProperty_Advance },
|
|
36
|
+
{ nameof(WxMiniConfig.ProfilingFuncs), DrawProperty_Advance },
|
|
37
|
+
{ nameof(WxMiniConfig.Webgl2), DrawProperty_Advance },
|
|
38
|
+
{ nameof(WxMiniConfig.ClearStreamingAssets), DrawProperty_Advance },
|
|
39
|
+
{ nameof(WxMiniConfig.ProfilingMemory), DrawProperty_Advance },
|
|
40
|
+
{ nameof(WxMiniConfig.CleanBuild), DrawProperty_Advance },
|
|
41
|
+
{ nameof(WxMiniConfig.CustomNodePath), DrawProperty_Advance },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
private static bool DrawProperty_m_Script(WxMiniConfig arg)
|
|
46
|
+
{
|
|
47
|
+
var tmpEnable = GUI.enabled;
|
|
48
|
+
GUI.enabled = true;
|
|
49
|
+
GUILayout.Space(6);
|
|
50
|
+
GUIDrawer.DrawKeynotes("①推荐Unity版本:2019,2020,2021");
|
|
51
|
+
GUIDrawer.DrawKeynotes("②为EventSystem加上WxMiniTouchInputSupport组件,用于支持多点触控");
|
|
52
|
+
GUILayout.Space(6);
|
|
53
|
+
GUI.enabled = tmpEnable;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private static bool DrawProperty_Advance(WxMiniConfig arg)
|
|
58
|
+
{
|
|
59
|
+
if (_wxMiniConfigAdvanceFoldout)
|
|
60
|
+
{
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private static bool DrawProperty_CDN(WxMiniConfig arg)
|
|
68
|
+
{
|
|
69
|
+
GUILayout.BeginHorizontal();
|
|
70
|
+
arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
|
|
71
|
+
GUILayout.EndHorizontal();
|
|
72
|
+
GUILayout.TextArea($"支持与自定义变量组合,[变量名]作为占位符\n最终地址:{VariablePreset.Default.ParserToString(arg.CDN)}",
|
|
73
|
+
"helpBox",
|
|
74
|
+
GUILayout.Height(44));
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private static bool DrawProperty_LoadingBg(WxMiniConfig arg)
|
|
79
|
+
{
|
|
80
|
+
GUILayout.BeginHorizontal();
|
|
81
|
+
arg.LoadingBg =
|
|
82
|
+
EditorGUILayout.ObjectField("Loading图(默认使用纯黑)", arg.LoadingBg, typeof(Texture), false) as Texture;
|
|
83
|
+
GUILayout.EndHorizontal();
|
|
84
|
+
GUILayout.Space(5);
|
|
85
|
+
_wxMiniConfigAdvanceFoldout = EditorGUILayout.Foldout(_wxMiniConfigAdvanceFoldout, "进阶选项");
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private static bool DrawProperty_DST(WxMiniConfig arg)
|
|
90
|
+
{
|
|
91
|
+
GUILayout.BeginHorizontal();
|
|
92
|
+
GUILayout.Label("发布目录", GUILayout.Width(146));
|
|
93
|
+
arg.DST = GUILayout.TextField(arg.DST);
|
|
94
|
+
if (GUILayout.Button("打开", GUILayout.Width(50)))
|
|
95
|
+
{
|
|
96
|
+
if (Directory.Exists(arg.DST))
|
|
97
|
+
{
|
|
98
|
+
EditorUtility.RevealInFinder(arg.DST);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (GUILayout.Button("浏览", GUILayout.Width(50)))
|
|
103
|
+
{
|
|
104
|
+
var path = EditorUtility.OpenFolderPanel("请选择", "", "typhoon_wx_game");
|
|
105
|
+
if (!string.IsNullOrEmpty(path))
|
|
106
|
+
{
|
|
107
|
+
arg.DST = UniEditor.FullPathToAssetPath(path);
|
|
108
|
+
GUI.FocusControl("");
|
|
109
|
+
arg.Save();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
GUILayout.EndHorizontal();
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private static bool DrawProperty_MemorySize(WxMiniConfig arg)
|
|
118
|
+
{
|
|
119
|
+
GUILayout.BeginHorizontal();
|
|
120
|
+
GUILayout.Label("分配内存(MB)", GUILayout.Width(146));
|
|
121
|
+
arg.MemorySize = EditorGUILayout.IntSlider(arg.MemorySize, 256, 2048);
|
|
122
|
+
GUILayout.EndHorizontal();
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private static bool DrawProperty_ScreenOrientation(WxMiniConfig arg)
|
|
127
|
+
{
|
|
128
|
+
GUILayout.BeginHorizontal();
|
|
129
|
+
GUILayout.Label("屏幕朝向", GUILayout.Width(146));
|
|
130
|
+
if (GUILayout.Button(arg.ScreenOrientation == WxMiniConfig.Orientation.Portrait ? "竖屏" : "横屏", "PopUp"))
|
|
131
|
+
{
|
|
132
|
+
var menu = new GenericMenu();
|
|
133
|
+
menu.AddItem(new GUIContent("竖屏"), false, () =>
|
|
134
|
+
{
|
|
135
|
+
arg.ScreenOrientation = WxMiniConfig.Orientation.Portrait;
|
|
136
|
+
arg.Save();
|
|
137
|
+
});
|
|
138
|
+
menu.AddItem(new GUIContent("横屏"), false, () =>
|
|
139
|
+
{
|
|
140
|
+
arg.ScreenOrientation = WxMiniConfig.Orientation.Landscape;
|
|
141
|
+
arg.Save();
|
|
142
|
+
});
|
|
143
|
+
menu.ShowAsContext();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
GUILayout.EndHorizontal();
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private static bool DrawProperty_ProjectName(WxMiniConfig arg)
|
|
151
|
+
{
|
|
152
|
+
arg.ProjectName = EditorGUILayout.TextField("游戏名(找运营要)", arg.ProjectName);
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private static bool DrawProperty_AppId(WxMiniConfig arg)
|
|
157
|
+
{
|
|
158
|
+
GUILayout.Space(5);
|
|
159
|
+
arg.AppId = EditorGUILayout.TextField("AppId(找运营要)", arg.AppId);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public static void DrawWxMiniConfig()
|
|
164
|
+
{
|
|
165
|
+
var config = WxMiniConfig.Default;
|
|
166
|
+
GUIDrawer.DrawProperty(config, (property) =>
|
|
167
|
+
{
|
|
168
|
+
if (OverrideDrawGUIWxMiniConfig.TryGetValue(property, out var match))
|
|
169
|
+
{
|
|
170
|
+
return match.Invoke(config);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return false;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private static bool DrawProperty_AssetLoadType(WxMiniConfig arg)
|
|
178
|
+
{
|
|
179
|
+
GUILayout.BeginHorizontal();
|
|
180
|
+
GUILayout.Label("首包加载模式", GUILayout.Width(146));
|
|
181
|
+
if (GUILayout.Button(arg.AssetLoadType == 0 ? "CDN" : "游戏内", "PopUp"))
|
|
182
|
+
{
|
|
183
|
+
var menu = new GenericMenu();
|
|
184
|
+
menu.AddItem(new GUIContent("CDN"), false, () =>
|
|
185
|
+
{
|
|
186
|
+
arg.AssetLoadType = 0;
|
|
187
|
+
arg.Save();
|
|
188
|
+
});
|
|
189
|
+
menu.AddItem(new GUIContent("游戏内"), false, () =>
|
|
190
|
+
{
|
|
191
|
+
arg.AssetLoadType = 1;
|
|
192
|
+
arg.Save();
|
|
193
|
+
});
|
|
194
|
+
menu.ShowAsContext();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
GUILayout.EndHorizontal();
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/// <summary>
|
|
203
|
+
/// 微信小游戏配置
|
|
204
|
+
/// </summary>
|
|
205
|
+
public class WxMiniConfig : ScriptableObject
|
|
206
|
+
{
|
|
207
|
+
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/WxMiniConfig.asset";
|
|
208
|
+
|
|
209
|
+
private static WxMiniConfig _instance = null;
|
|
210
|
+
|
|
211
|
+
public static WxMiniConfig Default
|
|
212
|
+
{
|
|
213
|
+
get
|
|
214
|
+
{
|
|
215
|
+
if (_instance == null)
|
|
216
|
+
{
|
|
217
|
+
_instance = AssetDatabase.LoadAssetAtPath<WxMiniConfig>(ConfigPath);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (_instance == null)
|
|
221
|
+
{
|
|
222
|
+
_instance = CreateInstance<WxMiniConfig>();
|
|
223
|
+
var folder = Path.GetDirectoryName(ConfigPath);
|
|
224
|
+
if (!Directory.Exists(folder))
|
|
225
|
+
{
|
|
226
|
+
Directory.CreateDirectory(folder);
|
|
227
|
+
AssetDatabase.Refresh();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
AssetDatabase.CreateAsset(_instance, ConfigPath);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return _instance;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
/// <summary>
|
|
239
|
+
/// 朝向
|
|
240
|
+
/// </summary>
|
|
241
|
+
public enum Orientation
|
|
242
|
+
{
|
|
243
|
+
//横屏
|
|
244
|
+
Portrait,
|
|
245
|
+
|
|
246
|
+
//竖屏
|
|
247
|
+
Landscape,
|
|
248
|
+
|
|
249
|
+
LandscapeLeft,
|
|
250
|
+
LandscapeRight,
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
[Header("基础设置")] public string AppId = "";
|
|
254
|
+
public string ProjectName = "";
|
|
255
|
+
public string CDN = "https://xxx.xxx.xxx";
|
|
256
|
+
public Orientation ScreenOrientation = Orientation.Portrait;
|
|
257
|
+
public int MemorySize = 256;
|
|
258
|
+
public string DST = "typhoon_wx_game";
|
|
259
|
+
|
|
260
|
+
[Header("启动Loading配置")] public int AssetLoadType = 0; //首包加载方式,0:CDN,1:游戏内
|
|
261
|
+
public Texture LoadingBg;
|
|
262
|
+
|
|
263
|
+
[Header("SDK 功能选项")] public bool UseFriendRelation = false;
|
|
264
|
+
public bool UseCompressedTexture = false;
|
|
265
|
+
public bool UseMiniGameChat = false;
|
|
266
|
+
public bool PreloadWXFont = false;
|
|
267
|
+
|
|
268
|
+
[Header("调试编译选项")] public bool DevelopBuild = false;
|
|
269
|
+
public bool AutoProfile = false;
|
|
270
|
+
public bool ScriptOnly = false;
|
|
271
|
+
public bool Il2CppOptimizeSize = true;
|
|
272
|
+
public bool ProfilingFuncs = false;
|
|
273
|
+
public bool Webgl2 = false;
|
|
274
|
+
public bool ClearStreamingAssets = true;
|
|
275
|
+
public bool ProfilingMemory = false;
|
|
276
|
+
public bool CleanBuild = false;
|
|
277
|
+
public string CustomNodePath = string.Empty;
|
|
278
|
+
|
|
279
|
+
public void Save()
|
|
280
|
+
{
|
|
281
|
+
EditorUtility.SetDirty(this);
|
|
282
|
+
AssetDatabase.SaveAssets();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace TyphoonUnitySDK
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// 微信小游戏配置窗口
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class WxMiniConfigWindow : EditorWindow
|
|
10
|
+
{
|
|
11
|
+
private Vector2 _scroll;
|
|
12
|
+
|
|
13
|
+
public static void Open()
|
|
14
|
+
{
|
|
15
|
+
var win = GetWindow<WxMiniConfigWindow>();
|
|
16
|
+
win.titleContent = new GUIContent("微信小游戏发布配置");
|
|
17
|
+
win.minSize = new Vector2(500, 450);
|
|
18
|
+
win.Show();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private void OnGUI()
|
|
22
|
+
{
|
|
23
|
+
var config = WxMiniConfig.Default;
|
|
24
|
+
var rect = new Rect(0, 0, position.width, position.height);
|
|
25
|
+
var area = rect;
|
|
26
|
+
area.width -= 8;
|
|
27
|
+
area.height -= 8;
|
|
28
|
+
GUILayout.BeginArea(area);
|
|
29
|
+
_scroll = GUILayout.BeginScrollView(_scroll);
|
|
30
|
+
config.AppId = GUILayout.TextField("AppId", config.AppId);
|
|
31
|
+
config.ProjectName = GUILayout.TextField("游戏名", config.ProjectName);
|
|
32
|
+
config.CDN = GUILayout.TextField("CDN", config.CDN);
|
|
33
|
+
GUILayout.BeginHorizontal();
|
|
34
|
+
GUILayout.Label("屏幕朝向");
|
|
35
|
+
if (GUILayout.Button(config.ScreenOrientation == WxMiniConfig.Orientation.Portrait ? "竖屏" : "横屏"))
|
|
36
|
+
{
|
|
37
|
+
var menu = new GenericMenu();
|
|
38
|
+
menu.AddItem(new GUIContent("竖屏"), false,
|
|
39
|
+
() =>
|
|
40
|
+
{
|
|
41
|
+
config.ScreenOrientation = WxMiniConfig.Orientation.Portrait;
|
|
42
|
+
config.Save();
|
|
43
|
+
});
|
|
44
|
+
menu.AddItem(new GUIContent("横屏"), false,
|
|
45
|
+
() =>
|
|
46
|
+
{
|
|
47
|
+
config.ScreenOrientation = WxMiniConfig.Orientation.Landscape;
|
|
48
|
+
config.Save();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
GUILayout.EndHorizontal();
|
|
52
|
+
config.MemorySize = EditorGUILayout.IntSlider("分配内存", config.MemorySize, 256, 1024);
|
|
53
|
+
config.DST = GUILayout.TextField("导出目录", config.DST);
|
|
54
|
+
GUILayout.EndScrollView();
|
|
55
|
+
GUILayout.EndArea();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/Runtime/TyphoonSdk.cs
CHANGED
|
@@ -9,10 +9,12 @@ namespace TyphoonUnitySDK
|
|
|
9
9
|
/// </summary>
|
|
10
10
|
public partial class TyphoonSdk : MonoSingleton<TyphoonSdk>
|
|
11
11
|
{
|
|
12
|
+
/*绑定SDK实例*/
|
|
12
13
|
public static Dictionary<AppChannel, string> SDKBindings = new Dictionary<AppChannel, string>
|
|
13
14
|
{
|
|
14
15
|
{ AppChannel.Test, "TYPHOON_SDK_TEST" }, //测试渠道
|
|
15
16
|
{ AppChannel.ChinaAndroid, "TYPHOON_SDK_CHINA_ANDROID" }, //国内安卓
|
|
17
|
+
{ AppChannel.WxMini, "TYPHOON_SDK_WX_MINI" }, //微信小游戏
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
private ISdk _sdk;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
using System.Collections;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Runtime.InteropServices;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
namespace TyphoonUnitySDK
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// unity 调用 js
|
|
11
|
+
/// </summary>
|
|
12
|
+
public class UnityToJs
|
|
13
|
+
{
|
|
14
|
+
[DllImport("__Internal")]
|
|
15
|
+
private static extern void WebMethodCall(string msg);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
[DllImport("__Internal")]
|
|
19
|
+
private static extern string WebMethodGet(string msg);
|
|
20
|
+
|
|
21
|
+
public static void MethodCall(string msg)
|
|
22
|
+
{
|
|
23
|
+
#if UNITY_EDITOR
|
|
24
|
+
Debug.Log($"## unity call js {msg}");
|
|
25
|
+
#else
|
|
26
|
+
WebMethodCall(msg);
|
|
27
|
+
#endif
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
public static string MethodGet(string msg)
|
|
32
|
+
{
|
|
33
|
+
#if UNITY_EDITOR
|
|
34
|
+
Debug.Log($"## unity get js {msg}");
|
|
35
|
+
return msg;
|
|
36
|
+
#else
|
|
37
|
+
return WebMethodGet(msg);
|
|
38
|
+
#endif
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*无回调的方式*/
|
|
42
|
+
public static void MethodCall(string method, object data)
|
|
43
|
+
{
|
|
44
|
+
var send = new
|
|
45
|
+
{
|
|
46
|
+
method,
|
|
47
|
+
data,
|
|
48
|
+
};
|
|
49
|
+
MethodCall(send.ToJson());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*带回调的方式*/
|
|
53
|
+
public static void MethodCall(SessionItem session)
|
|
54
|
+
{
|
|
55
|
+
var send = new
|
|
56
|
+
{
|
|
57
|
+
session = session.SessionId,
|
|
58
|
+
method = session.MethodName,
|
|
59
|
+
data = session.SendData,
|
|
60
|
+
};
|
|
61
|
+
MethodCall(send.ToJson());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.EventSystems;
|
|
3
|
+
|
|
4
|
+
namespace TyphoonUnitySDK
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// 微信小游戏多点触控支持
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class WxMiniTouchInputSupport : MonoBehaviour
|
|
10
|
+
{
|
|
11
|
+
private void Awake()
|
|
12
|
+
{
|
|
13
|
+
if (AppConfig.Channel == AppChannel.WxMini)
|
|
14
|
+
{
|
|
15
|
+
//加载多点触控
|
|
16
|
+
var source = Resources.Load<GameObject>("WX_TOUCH_INPUT_OVERRIDE");
|
|
17
|
+
//获取
|
|
18
|
+
var com = source.GetComponents<BaseInput>();
|
|
19
|
+
foreach (var element in com)
|
|
20
|
+
{
|
|
21
|
+
var type = element.GetType();
|
|
22
|
+
if (type.Name.Contains("WXTouchInputOverride"))
|
|
23
|
+
{
|
|
24
|
+
Debug.Log("补充WXTouchInputOverride组件");
|
|
25
|
+
//补充WXTouchInputOverride组件
|
|
26
|
+
gameObject.AddComponent(type);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
Binary file
|