com.typhoon.unitysdk 1.0.15 → 1.0.17
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 +3 -0
- package/Editor/PublishVivoBatSettingInspector.cs +14 -15
- package/Editor/PublishWindow.cs +25 -11
- package/Editor/UniEditor.cs +35 -0
- package/package.json +1 -1
package/Editor/ApplyTool.cs
CHANGED
|
@@ -3,6 +3,7 @@ using System.Collections;
|
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
5
5
|
using UnityEditor;
|
|
6
|
+
using UnityEditor.VersionControl;
|
|
6
7
|
using UnityEngine;
|
|
7
8
|
|
|
8
9
|
namespace TyphoonUnitySDK
|
|
@@ -35,6 +36,8 @@ namespace TyphoonUnitySDK
|
|
|
35
36
|
var done = SwitchPlatformTo(setting.BuildTarget);
|
|
36
37
|
if (done)
|
|
37
38
|
{
|
|
39
|
+
//写入apply 历史
|
|
40
|
+
UniEditor.WriteApplyHistory(setting);
|
|
38
41
|
//修改参数
|
|
39
42
|
switch (setting.BuildTarget)
|
|
40
43
|
{
|
|
@@ -456,35 +456,34 @@ dependencies {{
|
|
|
456
456
|
/*写入untiylibrary.xml*/
|
|
457
457
|
private void WriteUnityLibrary()
|
|
458
458
|
{
|
|
459
|
-
var
|
|
459
|
+
var android = GetUnityLibrary();
|
|
460
460
|
var unityProj = GetMatchChinaAndroidProj();
|
|
461
461
|
if (unityProj == null)
|
|
462
462
|
{
|
|
463
463
|
throw new Exception($"找不到unity导出工程");
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
var
|
|
467
|
-
var
|
|
468
|
-
var map = new (string from, string to)[]
|
|
466
|
+
var unityLib = $"{unityProj}/unityLibrary";
|
|
467
|
+
var map = new (string androidPath, string unityPath)[]
|
|
469
468
|
{
|
|
470
469
|
//{unityProj}\unityLibrary
|
|
471
|
-
($"{
|
|
472
|
-
($"{
|
|
473
|
-
($"{
|
|
474
|
-
($"{
|
|
470
|
+
($"{android}/libs", $"{unityLib}/libs"),
|
|
471
|
+
($"{android}/src/main/assets", $"{unityLib}/src/main/assets"),
|
|
472
|
+
($"{android}/src/main/java", $"{unityLib}/src/main/java"),
|
|
473
|
+
($"{android}/src/main/jniLibs", $"{unityLib}/src/main/jniLibs"),
|
|
475
474
|
};
|
|
476
475
|
|
|
477
|
-
var
|
|
478
|
-
var
|
|
476
|
+
var xmlAndroid = $"{android}/src/main/AndroidManifest.xml";
|
|
477
|
+
var xmlUnity = $"{unityLib}/src/main/AndroidManifest.xml";
|
|
479
478
|
foreach (var e in map)
|
|
480
479
|
{
|
|
481
|
-
UniEditor.TryDeleteFolder(e.
|
|
482
|
-
UniEditor.CopyFolder(e.
|
|
483
|
-
Debug.Log($"写入:{e.
|
|
480
|
+
UniEditor.TryDeleteFolder(e.androidPath);
|
|
481
|
+
UniEditor.CopyFolder(e.unityPath, e.androidPath);
|
|
482
|
+
Debug.Log($"写入:{e.androidPath} ");
|
|
484
483
|
}
|
|
485
484
|
|
|
486
|
-
File.Copy(
|
|
487
|
-
Debug.Log($"复制:{
|
|
485
|
+
File.Copy(xmlUnity, xmlAndroid, true);
|
|
486
|
+
Debug.Log($"复制:{xmlUnity}-->{xmlAndroid} ");
|
|
488
487
|
|
|
489
488
|
var xmlPath = GetUnityLibraryAndroidManifestXml();
|
|
490
489
|
var xml = File.ReadAllText(xmlPath);
|
package/Editor/PublishWindow.cs
CHANGED
|
@@ -74,11 +74,21 @@ namespace TyphoonUnitySDK
|
|
|
74
74
|
private void OnEnable()
|
|
75
75
|
{
|
|
76
76
|
ReloadSettings();
|
|
77
|
+
if (UniEditor.TryGetApplyHistory(out var match))
|
|
78
|
+
{
|
|
79
|
+
foreach (var setting in PublishSettings)
|
|
80
|
+
{
|
|
81
|
+
if (setting.name == match)
|
|
82
|
+
{
|
|
83
|
+
_select = setting;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
protected
|
|
90
|
+
protected void OnGUI()
|
|
80
91
|
{
|
|
81
|
-
|
|
82
92
|
var temEnable = GUI.enabled;
|
|
83
93
|
if (EditorApplication.isPlaying)
|
|
84
94
|
{
|
|
@@ -122,24 +132,26 @@ namespace TyphoonUnitySDK
|
|
|
122
132
|
rectToolbar.height = 22;
|
|
123
133
|
GUILayout.BeginArea(rectToolbar);
|
|
124
134
|
GUILayout.BeginHorizontal();
|
|
125
|
-
GUILayout.Label("发布配置", Styles.rbold_label,GUILayout.Width(110));
|
|
135
|
+
GUILayout.Label("发布配置", Styles.rbold_label, GUILayout.Width(110));
|
|
126
136
|
GUILayout.Space(1);
|
|
127
137
|
if (GUILayout.Button(new GUIContent(EditorIcons.icon_import, "导入常用配置"), Styles.rbutton,
|
|
128
|
-
GUILayout.Width(40),GUILayout.Height(20)))
|
|
138
|
+
GUILayout.Width(40), GUILayout.Height(20)))
|
|
129
139
|
{
|
|
130
140
|
UniEditor.ImportPackage(UniEditor.PackagePath_PublishSetting);
|
|
131
141
|
}
|
|
142
|
+
|
|
132
143
|
GUILayout.Space(1);
|
|
133
144
|
if (GUILayout.Button(new GUIContent(EditorIcons.icon_refresh, "刷新"), Styles.rbutton,
|
|
134
|
-
GUILayout.Width(40),GUILayout.Height(20)))
|
|
145
|
+
GUILayout.Width(40), GUILayout.Height(20)))
|
|
135
146
|
{
|
|
136
147
|
ReloadSettings();
|
|
137
148
|
Repaint();
|
|
138
149
|
}
|
|
150
|
+
|
|
139
151
|
GUILayout.Space(1);
|
|
140
152
|
|
|
141
153
|
if (GUILayout.Button(new GUIContent(EditorIcons.icon_extension, "更多"), Styles.rbutton,
|
|
142
|
-
GUILayout.Width(40),GUILayout.Height(20)))
|
|
154
|
+
GUILayout.Width(40), GUILayout.Height(20)))
|
|
143
155
|
{
|
|
144
156
|
var menu = new GenericMenu();
|
|
145
157
|
menu.AddItem(new GUIContent("导入常用配置"), false,
|
|
@@ -153,13 +165,14 @@ namespace TyphoonUnitySDK
|
|
|
153
165
|
rectSearch.y = rectToolbar.yMax;
|
|
154
166
|
rectSearch.height = 22;
|
|
155
167
|
InputTxtSearchSetting = GUI.TextField(rectSearch, InputTxtSearchSetting);
|
|
156
|
-
if(string.IsNullOrEmpty(InputTxtSearchSetting))
|
|
157
|
-
|
|
168
|
+
if (string.IsNullOrEmpty(InputTxtSearchSetting))
|
|
169
|
+
{
|
|
170
|
+
GUI.Label(rectSearch, "搜索...", Styles.rlabel_italic);
|
|
158
171
|
}
|
|
159
172
|
|
|
160
173
|
/*绘制菜单栏*/
|
|
161
174
|
var rectPos = rectLeftMenu;
|
|
162
|
-
rectPos.y = rectSearch.yMax+4;
|
|
175
|
+
rectPos.y = rectSearch.yMax + 4;
|
|
163
176
|
rectPos.height = rectLeftMenu.yMax - rectPos.y;
|
|
164
177
|
GUILayout.BeginArea(rectPos);
|
|
165
178
|
rectPos.x = 0;
|
|
@@ -206,7 +219,7 @@ namespace TyphoonUnitySDK
|
|
|
206
219
|
var lockRect = rectItem;
|
|
207
220
|
lockRect.width = 60;
|
|
208
221
|
lockRect.x = rectItem.xMax - lockRect.width;
|
|
209
|
-
GUI.Label(lockRect,"未开放",Styles.rlabel_italic);
|
|
222
|
+
GUI.Label(lockRect, "未开放", Styles.rlabel_italic);
|
|
210
223
|
}
|
|
211
224
|
}
|
|
212
225
|
|
|
@@ -241,7 +254,7 @@ namespace TyphoonUnitySDK
|
|
|
241
254
|
rectContent.height -= 8;
|
|
242
255
|
rectContent.width -= 8;
|
|
243
256
|
rectContent.center = rect.center;
|
|
244
|
-
|
|
257
|
+
|
|
245
258
|
if (_select == null)
|
|
246
259
|
{
|
|
247
260
|
var tipRect = rectContent;
|
|
@@ -370,5 +383,6 @@ namespace TyphoonUnitySDK
|
|
|
370
383
|
|
|
371
384
|
PublishSettings = hash;
|
|
372
385
|
}
|
|
386
|
+
|
|
373
387
|
}
|
|
374
388
|
}
|
package/Editor/UniEditor.cs
CHANGED
|
@@ -27,6 +27,11 @@ namespace TyphoonUnitySDK
|
|
|
27
27
|
/// </summary>
|
|
28
28
|
public static readonly string DEFINE_TYPHOON_ADDRESSABLE_NAME = "TYPHOON_ADDRESSABLE";
|
|
29
29
|
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// apply历史记录
|
|
32
|
+
/// </summary>
|
|
33
|
+
public static readonly string APPLY_HISTORY = "Temp/typhoon_apply_history.txt";
|
|
34
|
+
|
|
30
35
|
|
|
31
36
|
/// <summary>
|
|
32
37
|
/// 插件包根目录
|
|
@@ -447,5 +452,35 @@ namespace TyphoonUnitySDK
|
|
|
447
452
|
return !string.IsNullOrEmpty(Preferences.Default.GradlePath) &&
|
|
448
453
|
File.Exists($"{Preferences.Default.GradlePath}/gradle");
|
|
449
454
|
}
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
/// <summary>
|
|
458
|
+
/// 尝试获取apply历史记录
|
|
459
|
+
/// </summary>
|
|
460
|
+
public static bool TryGetApplyHistory(out string match)
|
|
461
|
+
{
|
|
462
|
+
match = default;
|
|
463
|
+
if (File.Exists(APPLY_HISTORY))
|
|
464
|
+
{
|
|
465
|
+
match = File.ReadAllText(APPLY_HISTORY);
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/// <summary>
|
|
473
|
+
/// 写入apply历史记录
|
|
474
|
+
/// </summary>
|
|
475
|
+
public static void WriteApplyHistory(PublishSetting setting)
|
|
476
|
+
{
|
|
477
|
+
var dir = Path.GetDirectoryName(APPLY_HISTORY);
|
|
478
|
+
if (!Directory.Exists(dir))
|
|
479
|
+
{
|
|
480
|
+
Directory.CreateDirectory(dir);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
File.WriteAllText(APPLY_HISTORY, setting.name);
|
|
484
|
+
}
|
|
450
485
|
}
|
|
451
486
|
}
|
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.17","description":"unity端个汇总渠道的sdk,统一接口,一键发布","unity":"2017.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"}}
|