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.
Files changed (37) hide show
  1. package/Editor/ApplyTool.cs +66 -8
  2. package/Editor/EditorIcons.cs +8 -0
  3. package/Editor/ExportModule.cs +24 -4
  4. package/Editor/GUIDrawer.cs +82 -0
  5. package/Editor/GUIDrawer.cs.meta +11 -0
  6. package/Editor/Preferences.cs +3 -0
  7. package/Editor/PreferencesWindow.cs +84 -88
  8. package/Editor/PublishProcess.cs +1 -0
  9. package/Editor/PublishResult.cs +5 -0
  10. package/Editor/PublishSetting.cs +18 -4
  11. package/Editor/PublishSettingGUIDrawer.cs +166 -7
  12. package/Editor/PublishTool.cs +3 -5
  13. package/Editor/PublishVivoBatSettingInspector.cs +0 -1
  14. package/Editor/PublishWindow.cs +14 -5
  15. package/Editor/Texture/black_32x32.png +0 -0
  16. package/Editor/Texture/black_32x32.png.meta +144 -0
  17. package/Editor/Texture/icon_arrow_right.png +0 -0
  18. package/Editor/Texture/icon_arrow_right.png.meta +144 -0
  19. package/Editor/Texture/icon_variable.png +0 -0
  20. package/Editor/Texture/icon_variable.png.meta +144 -0
  21. package/Editor/UniEditor.cs +22 -0
  22. package/Editor/VariablePreset.cs +160 -0
  23. package/Editor/VariablePreset.cs.meta +11 -0
  24. package/Editor/VariablePresetWindow.cs +153 -0
  25. package/Editor/VariablePresetWindow.cs.meta +11 -0
  26. package/Editor/WxMiniConfig.cs +285 -0
  27. package/Editor/WxMiniConfig.cs.meta +11 -0
  28. package/Editor/WxMiniConfigWindow.cs +58 -0
  29. package/Editor/WxMiniConfigWindow.cs.meta +11 -0
  30. package/Runtime/TyphoonSdk.cs +2 -0
  31. package/Runtime/UnityToJs.cs +64 -0
  32. package/Runtime/UnityToJs.cs.meta +11 -0
  33. package/Runtime/WxMiniTouchInputSupport.cs +33 -0
  34. package/Runtime/WxMiniTouchInputSupport.cs.meta +11 -0
  35. package/Sources~/Package/WxMini.unitypackage +0 -0
  36. package/Sources~/Package/WxMini.unitypackage.manifest +395 -0
  37. package/package.json +1 -1
@@ -0,0 +1,144 @@
1
+ fileFormatVersion: 2
2
+ guid: 5c65335db69a83d4ca74596d4ef98324
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:
@@ -5,6 +5,7 @@ using System.Linq;
5
5
  using System.Text;
6
6
  using UnityEditor;
7
7
  using UnityEngine;
8
+ using Object = UnityEngine.Object;
8
9
 
9
10
  namespace TyphoonUnitySDK
10
11
  {
@@ -27,6 +28,11 @@ namespace TyphoonUnitySDK
27
28
  /// </summary>
28
29
  public static string PackagePath_ChinaAndroid = $"{PathRoot}/Sources~/Package/ChinaAndroid.unitypackage";
29
30
 
31
+ /// <summary>
32
+ /// WxMini 资源包
33
+ /// </summary>
34
+ public static string PackagePath_WxMini = $"{PathRoot}/Sources~/Package/WxMini.unitypackage";
35
+
30
36
 
31
37
  /// <summary>
32
38
  /// 开启Addressable模块支持
@@ -335,6 +341,7 @@ namespace TyphoonUnitySDK
335
341
  {
336
342
  return path;
337
343
  }
344
+
338
345
  path = Path.GetFullPath(path);
339
346
  path = path.Replace("\\", "/");
340
347
  var pp = Path.GetDirectoryName(Application.dataPath);
@@ -487,5 +494,20 @@ namespace TyphoonUnitySDK
487
494
 
488
495
  File.WriteAllText(APPLY_HISTORY, setting.name);
489
496
  }
497
+
498
+
499
+ /// <summary>
500
+ /// 写入Txt
501
+ /// </summary>
502
+ public static void WriteTxt(string path, List<string> lines)
503
+ {
504
+ var sb = new StringBuilder();
505
+ foreach (var line in lines)
506
+ {
507
+ sb.AppendLine(line);
508
+ }
509
+
510
+ File.WriteAllText(path, sb.ToString());
511
+ }
490
512
  }
491
513
  }
@@ -0,0 +1,160 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+
7
+ namespace TyphoonUnitySDK
8
+ {
9
+ /// <summary>
10
+ /// 变量预设
11
+ /// 用于自定义工具内的变量名
12
+ /// </summary>
13
+ public class VariablePreset : ScriptableObject
14
+ {
15
+ private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/VariablePreset.asset";
16
+
17
+ private static VariablePreset _instance = null;
18
+
19
+ public static VariablePreset Default
20
+ {
21
+ get
22
+ {
23
+ if (_instance == null)
24
+ {
25
+ _instance = AssetDatabase.LoadAssetAtPath<VariablePreset>(ConfigPath);
26
+ }
27
+
28
+ if (_instance == null)
29
+ {
30
+ _instance = CreateInstance<VariablePreset>();
31
+ var folder = Path.GetDirectoryName(ConfigPath);
32
+ if (!Directory.Exists(folder))
33
+ {
34
+ Directory.CreateDirectory(folder);
35
+ AssetDatabase.Refresh();
36
+ }
37
+
38
+ AssetDatabase.CreateAsset(_instance, ConfigPath);
39
+ }
40
+
41
+ return _instance;
42
+ }
43
+ }
44
+
45
+ [Serializable]
46
+ public class VariableItem
47
+ {
48
+ public string VariableName;
49
+ public string VariableValue;
50
+
51
+ public VariableItem(string variableName, string variableValue)
52
+ {
53
+ VariableName = variableName;
54
+ VariableValue = variableValue;
55
+ }
56
+ }
57
+
58
+ public List<VariableItem> Presets = new List<VariableItem>();
59
+
60
+
61
+ /// <summary>
62
+ /// 解析到字符串
63
+ /// </summary>
64
+ public string ParserToString(string input)
65
+ {
66
+ foreach (var element in Presets)
67
+ {
68
+ if (string.IsNullOrEmpty(element.VariableName))
69
+ {
70
+ continue;
71
+ }
72
+
73
+ input = input.Replace($"[{element.VariableName}]", element.VariableValue);
74
+ }
75
+
76
+ return input;
77
+ }
78
+
79
+
80
+ /*上移*/
81
+ public void MoveUp(VariableItem item)
82
+ {
83
+ var index = Presets.IndexOf(item);
84
+ if (index >= 0 && index > 0)
85
+ {
86
+ var a = index;
87
+ var b = index - 1;
88
+ (Presets[a], Presets[b]) = (Presets[b], Presets[a]);
89
+ Save();
90
+ }
91
+ }
92
+
93
+ /*下移*/
94
+ public void MoveDown(VariableItem item)
95
+ {
96
+ var index = Presets.IndexOf(item);
97
+ if (index >= 0 && index < (Presets.Count - 1))
98
+ {
99
+ var a = index;
100
+ var b = index + 1;
101
+ (Presets[a], Presets[b]) = (Presets[b], Presets[a]);
102
+ Save();
103
+ }
104
+ }
105
+
106
+ /*删除*/
107
+ public void Delete(VariableItem item)
108
+ {
109
+ var flag = Presets.Remove(item);
110
+ if (flag)
111
+ {
112
+ Save();
113
+ }
114
+ }
115
+
116
+
117
+ /// <summary>
118
+ /// 是否存在变量
119
+ /// </summary>
120
+ public bool ContainsVariable(string variableName)
121
+ {
122
+ foreach (var item in Presets)
123
+ {
124
+ if (item.VariableName == variableName)
125
+ {
126
+ return true;
127
+ }
128
+ }
129
+
130
+ return false;
131
+ }
132
+
133
+
134
+ /*修改*/
135
+ public void Modify(string variable, string value)
136
+ {
137
+ var index = -1;
138
+ for (int i = 0; i < Presets.Count; i++)
139
+ {
140
+ var e = Presets[i];
141
+ if (e.VariableName == variable)
142
+ {
143
+ index = i;
144
+ }
145
+ }
146
+
147
+ if (index >= 0)
148
+ {
149
+ Presets[index].VariableValue = value;
150
+ }
151
+
152
+ }
153
+
154
+ public void Save()
155
+ {
156
+ EditorUtility.SetDirty(this);
157
+ AssetDatabase.SaveAssets();
158
+ }
159
+ }
160
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 313a1f4dae529ce468a781447e56a098
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,153 @@
1
+ using UnityEditor;
2
+ using UnityEngine;
3
+
4
+ namespace TyphoonUnitySDK
5
+ {
6
+ /// <summary>
7
+ /// 自定义变量窗口
8
+ /// </summary>
9
+ public class VariablePresetWindow : EditorWindow
10
+ {
11
+ private Vector2 _scroll;
12
+ private string _inputTxt;
13
+ private VariablePreset.VariableItem moveUp = null;
14
+ private VariablePreset.VariableItem moveDown = null;
15
+ private VariablePreset.VariableItem delete = null;
16
+
17
+ public static void Open()
18
+ {
19
+ var win = GetWindow<VariablePresetWindow>();
20
+ win.minSize = new Vector2(600, 500);
21
+ win.titleContent = new GUIContent("自定义变量");
22
+ win.Show();
23
+ }
24
+
25
+ private void OnGUI()
26
+ {
27
+ var rect = new Rect(0, 0, position.width, position.height);
28
+ var rectTitle = rect;
29
+ rectTitle.height = 32;
30
+ rectTitle.width -= 8;
31
+ rectTitle.x += 4;
32
+ rectTitle.y += 4;
33
+ EditorGUI.DrawRect(rectTitle, Skins.PublishWindowTitleBgColor);
34
+ GUI.Label(rectTitle, "自定义变量", Styles.rbold_title);
35
+ var rectSave = rectTitle;
36
+ rectSave.width = 90;
37
+ rectSave.x = rectTitle.xMax - rectSave.width - 4;
38
+ var center = rectSave.center;
39
+ rectSave.height -= 8;
40
+ rectSave.center = center;
41
+ if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save)))
42
+ {
43
+ VariablePreset.Default.Save();
44
+ }
45
+
46
+ var toolbarArea = rectTitle;
47
+ toolbarArea.y = rectTitle.yMax;
48
+ toolbarArea.y += 6;
49
+ toolbarArea.height = 22;
50
+ center = toolbarArea.center;
51
+ toolbarArea.width -= 4;
52
+ toolbarArea.center = center;
53
+ GUILayout.BeginArea(toolbarArea);
54
+ GUILayout.BeginHorizontal();
55
+ _inputTxt = GUILayout.TextField(_inputTxt);
56
+ GUI.SetNextControlName("input");
57
+ if (GUILayout.Button("+新建变量", GUILayout.Width(80)))
58
+ {
59
+ if (AddVariable(_inputTxt))
60
+ {
61
+ _inputTxt = string.Empty;
62
+ }
63
+ }
64
+
65
+ var tipRect = new Rect(0, 0, 180, toolbarArea.height);
66
+ tipRect.y -= 2;
67
+ if (string.IsNullOrEmpty(_inputTxt) && GUI.GetNameOfFocusedControl() != "input")
68
+ {
69
+ GUI.Label(tipRect, "请输入变量名...", Styles.rlabel_italic);
70
+ }
71
+
72
+ GUILayout.EndHorizontal();
73
+ GUILayout.EndArea();
74
+ var contentArea = toolbarArea;
75
+ contentArea.y = toolbarArea.yMax + 2;
76
+ contentArea.height = rect.yMax - contentArea.y - 4;
77
+ GUILayout.BeginArea(contentArea);
78
+ var presets = VariablePreset.Default.Presets;
79
+
80
+ foreach (var item in presets)
81
+ {
82
+ GUILayout.BeginHorizontal();
83
+ if (GUILayout.Button(item.VariableName, "Popup", GUILayout.Width(180)))
84
+ {
85
+ var tem = item;
86
+ var menu = new GenericMenu();
87
+ menu.AddItem(new GUIContent("删除"), false, () => delete = tem);
88
+ menu.AddItem(new GUIContent("上移"), false, () => moveUp = tem);
89
+ menu.AddItem(new GUIContent("下移"), false, () => moveDown = tem);
90
+ menu.ShowAsContext();
91
+ }
92
+
93
+ item.VariableValue = GUILayout.TextField(item.VariableValue);
94
+ GUILayout.EndHorizontal();
95
+ }
96
+
97
+ GUILayout.EndArea();
98
+ if (moveUp != null)
99
+ {
100
+ MoveUp(moveUp);
101
+ moveUp = null;
102
+ }
103
+
104
+ if (moveDown != null)
105
+ {
106
+ MoveDown(moveDown);
107
+ moveDown = null;
108
+ }
109
+
110
+ if (delete != null)
111
+ {
112
+ DeleteVariable(delete);
113
+ delete = null;
114
+ }
115
+
116
+ // Repaint();
117
+ }
118
+
119
+ private bool AddVariable(string variableName)
120
+ {
121
+ if (string.IsNullOrEmpty(variableName))
122
+ {
123
+ UniEditor.ShowMessageBox($"变量名不可为空", null);
124
+ return false;
125
+ }
126
+
127
+ if (VariablePreset.Default.ContainsVariable(variableName))
128
+ {
129
+ UniEditor.ShowMessageBox($"已经存在变量:{variableName}", null);
130
+ return false;
131
+ }
132
+
133
+ VariablePreset.Default.Presets.Add(new VariablePreset.VariableItem(variableName, ""));
134
+ VariablePreset.Default.Save();
135
+ return true;
136
+ }
137
+
138
+ private void DeleteVariable(VariablePreset.VariableItem item)
139
+ {
140
+ VariablePreset.Default.Delete(item);
141
+ }
142
+
143
+ private void MoveUp(VariablePreset.VariableItem item)
144
+ {
145
+ VariablePreset.Default.MoveUp(item);
146
+ }
147
+
148
+ private void MoveDown(VariablePreset.VariableItem item)
149
+ {
150
+ VariablePreset.Default.MoveDown(item);
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: bad4baad47a5a9e44aa56dd41c28fec0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: