com.amanotes.gdk 0.1.21 → 0.2.1
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/CHANGELOG.md +5 -5
- package/Editor/AmaGDKEditor.cs +91 -46
- package/Editor/AmaGDKManager.cs +26 -27
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +133 -103
- package/Editor/Utils/AmaGDKEditor.GUI.cs +54 -51
- package/Editor/Utils/AmaGDKEditor.Utils.cs +2 -3
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
- package/Packages/AmaPassport.ATTSupport.unitypackage.meta +7 -0
- package/Packages/AmaPassport.AdvertisingID.unitypackage +0 -0
- package/Packages/AmaPassport.AdvertisingID.unitypackage.meta +7 -0
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta +1 -1
- package/Runtime/AmaGDK.Adapters.cs +13 -14
- package/Runtime/AmaGDK.Ads.cs +523 -151
- package/Runtime/AmaGDK.AmaPassport.cs +433 -0
- package/Runtime/AmaGDK.AmaPassport.cs.meta +11 -0
- package/Runtime/AmaGDK.Analytics.cs +78 -89
- package/Runtime/AmaGDK.Config.cs +23 -19
- package/Runtime/AmaGDK.Internal.SemVer.cs +11 -29
- package/Runtime/AmaGDK.Internal.cs +16 -10
- package/Runtime/AmaGDK.RemoteConfig.cs +32 -23
- package/Runtime/AmaGDK.UserProfile.cs +5 -8
- package/Runtime/AmaGDK.Utils.cs +40 -50
- package/Runtime/AmaGDK.WebUtils.cs +42 -42
- package/Runtime/AmaGDK.cs +70 -20
- package/Runtime/AssemblyInfo.cs +0 -1
- package/package.json +1 -1
|
@@ -10,67 +10,84 @@ using static Amanotes.Core.AmaGDK.AdapterID;
|
|
|
10
10
|
|
|
11
11
|
namespace Amanotes.Editor
|
|
12
12
|
{
|
|
13
|
+
internal class IronSourceSDKAdapter
|
|
14
|
+
{
|
|
15
|
+
public string name;
|
|
16
|
+
public SemVer semVer;
|
|
17
|
+
public string version;
|
|
18
|
+
|
|
19
|
+
public IronSourceSDKAdapter(string name, string version)
|
|
20
|
+
{
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.version = version;
|
|
23
|
+
semVer = new SemVer(version);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
[Serializable] internal class SDKStatus
|
|
14
28
|
{
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
|
|
32
|
+
private static readonly Dictionary<string, SDKStatus> _cache = new Dictionary<string, SDKStatus>();
|
|
15
33
|
public string sdkId;
|
|
16
|
-
public SemVer sdkVersion;
|
|
17
34
|
public SemVer adapterVersion;
|
|
35
|
+
public SemVer sdkVersion;
|
|
18
36
|
|
|
19
|
-
public bool sdkInstalled
|
|
20
|
-
public bool adapterInstalled
|
|
37
|
+
public bool sdkInstalled => sdkVersion > SemVer.ZERO;
|
|
38
|
+
public bool adapterInstalled => sdkVersion > SemVer.ZERO;
|
|
21
39
|
|
|
22
40
|
public string ToTSVString()
|
|
23
41
|
{
|
|
24
42
|
return $"{sdkId}\t{sdkVersion}\t{adapterVersion}";
|
|
25
43
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
static readonly public Dictionary<string, SDKStatus> _cache = new Dictionary<string, SDKStatus>();
|
|
30
|
-
static public SDKStatus Get(string sdkId, bool force = false){
|
|
44
|
+
public static SDKStatus Get(string sdkId, bool force = false)
|
|
45
|
+
{
|
|
31
46
|
if (!force && _cache.TryGetValue(sdkId, out var result)) return result;
|
|
32
47
|
|
|
33
|
-
result = new SDKStatus
|
|
48
|
+
result = new SDKStatus
|
|
49
|
+
{
|
|
34
50
|
sdkId = sdkId,
|
|
35
51
|
adapterVersion = new SemVer(ExtractVersion.GDKAdapter(sdkId)),
|
|
36
52
|
sdkVersion = new SemVer(ExtractVersion.ThirdParty(sdkId))
|
|
37
53
|
};
|
|
38
54
|
|
|
39
|
-
if (_cache.ContainsKey(sdkId))
|
|
55
|
+
if (_cache.ContainsKey(sdkId))
|
|
56
|
+
{
|
|
40
57
|
_cache[sdkId] = result;
|
|
41
|
-
}
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
{
|
|
42
61
|
_cache.Add(sdkId, result);
|
|
43
62
|
}
|
|
44
|
-
|
|
63
|
+
|
|
45
64
|
return result;
|
|
46
65
|
}
|
|
47
66
|
}
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
internal static class ExtractVersion
|
|
50
69
|
{
|
|
51
70
|
public static string GDKAdapter(string sdkId)
|
|
52
71
|
{
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
var version = "";
|
|
73
|
+
string adapterId = sdkId + "Adapter";
|
|
74
|
+
|
|
55
75
|
// Debug.Log($"Searching for AdapterId: {adapterId}");
|
|
56
|
-
|
|
57
|
-
if (assemblies != null)
|
|
76
|
+
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
|
58
77
|
{
|
|
59
|
-
foreach (
|
|
78
|
+
foreach (var oType in assembly.GetTypes())
|
|
60
79
|
{
|
|
61
|
-
|
|
80
|
+
if (!oType.Name.Equals(adapterId)) continue;
|
|
81
|
+
|
|
82
|
+
var field = oType.GetField("VERSION");
|
|
83
|
+
if (field == null)
|
|
62
84
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var field = oType.GetField("VERSION");
|
|
66
|
-
if (field == null) {
|
|
67
|
-
// Debug.Log("Found: " + oType + " --> " + field);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
version = field.GetValue(null).ToString();
|
|
72
|
-
return version;
|
|
85
|
+
// Debug.Log("Found: " + oType + " --> " + field);
|
|
86
|
+
continue;
|
|
73
87
|
}
|
|
88
|
+
|
|
89
|
+
version = field.GetValue(null).ToString();
|
|
90
|
+
return version;
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
93
|
return version.Trim();
|
|
@@ -78,87 +95,77 @@ namespace Amanotes.Editor
|
|
|
78
95
|
|
|
79
96
|
public static string ThirdParty(string sdkId)
|
|
80
97
|
{
|
|
81
|
-
|
|
98
|
+
var version = "";
|
|
82
99
|
switch (sdkId)
|
|
83
100
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
case FIREBASE_ANALYTICS: return FirebaseAnalytics();
|
|
102
|
+
case FIREBASE_REMOTE_CONFIG: return FirebaseRemoteConfig();
|
|
103
|
+
case APPSFLYER: return AppsFlyer();
|
|
104
|
+
case IRONSOURCE: return Ironsource();
|
|
105
|
+
case REVENUECAT: return RevenueCat();
|
|
106
|
+
default:
|
|
107
|
+
Debug.LogWarning($"Unsupported sdkID <{sdkId}>");
|
|
108
|
+
break;
|
|
92
109
|
}
|
|
93
110
|
return version;
|
|
94
111
|
}
|
|
95
|
-
|
|
112
|
+
|
|
96
113
|
internal static string FirebaseAnalytics()
|
|
97
114
|
{
|
|
98
|
-
|
|
115
|
+
var version = "";
|
|
99
116
|
string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
|
|
100
|
-
if (filesFirebase
|
|
117
|
+
if (filesFirebase.Length <= 0) return version.Trim();
|
|
118
|
+
|
|
119
|
+
for (var i = 0; i < filesFirebase.Length; i++)
|
|
101
120
|
{
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
XmlDocument Xdoc = new XmlDocument();
|
|
121
|
+
var Xdoc = new XmlDocument();
|
|
105
122
|
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
Xdoc.Load(filesFirebase[i]);
|
|
124
|
+
var root = Xdoc.DocumentElement;
|
|
108
125
|
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
if (root == null) continue;
|
|
127
|
+
var dataName = root.SelectSingleNode("artifactId");
|
|
128
|
+
var dataVersion = root.SelectSingleNode("versioning/release");
|
|
111
129
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
130
|
+
if (dataName == null || !dataName.InnerText.Contains("firebase-analytics-unity")) continue;
|
|
131
|
+
version = dataVersion?.InnerText;
|
|
132
|
+
break;
|
|
118
133
|
}
|
|
119
|
-
return version
|
|
134
|
+
return version?.Trim();
|
|
120
135
|
}
|
|
121
136
|
|
|
122
137
|
internal static string FirebaseRemoteConfig()
|
|
123
138
|
{
|
|
124
|
-
|
|
139
|
+
var version = "";
|
|
125
140
|
string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
|
|
126
|
-
if (filesFirebase
|
|
127
|
-
{
|
|
128
|
-
for (int i = 0; i < filesFirebase.Length; i++)
|
|
129
|
-
{
|
|
130
|
-
XmlDocument Xdoc = new XmlDocument();
|
|
131
|
-
|
|
132
|
-
Xdoc.Load(filesFirebase[i]);
|
|
133
|
-
XmlElement root = Xdoc.DocumentElement;
|
|
134
|
-
|
|
135
|
-
XmlNode dataName = root.SelectSingleNode("artifactId");
|
|
136
|
-
XmlNode dataVersion = root.SelectSingleNode("versioning/release");
|
|
141
|
+
if (filesFirebase.Length <= 0) return version.Trim();
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
for (var i = 0; i < filesFirebase.Length; i++)
|
|
144
|
+
{
|
|
145
|
+
var Xdoc = new XmlDocument();
|
|
146
|
+
Xdoc.Load(filesFirebase[i]);
|
|
147
|
+
var root = Xdoc.DocumentElement;
|
|
148
|
+
if (root == null) continue;
|
|
149
|
+
var dataName = root.SelectSingleNode("artifactId");
|
|
150
|
+
var dataVersion = root.SelectSingleNode("versioning/release");
|
|
151
|
+
if (dataName == null || !dataName.InnerText.Contains("firebase-config-unity")) continue;
|
|
152
|
+
version = dataVersion?.InnerText;
|
|
153
|
+
break;
|
|
144
154
|
}
|
|
145
|
-
return version
|
|
155
|
+
return version?.Trim();
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
internal static string AppsFlyer()
|
|
149
159
|
{
|
|
150
|
-
|
|
160
|
+
var version = "";
|
|
151
161
|
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
152
|
-
|
|
162
|
+
foreach (var assembly in assemblies)
|
|
153
163
|
{
|
|
154
|
-
foreach (
|
|
164
|
+
foreach (var oType in assembly.GetTypes())
|
|
155
165
|
{
|
|
156
|
-
|
|
166
|
+
if (oType.Name.Equals("AppsFlyer"))
|
|
157
167
|
{
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
version = oType.GetField("kAppsFlyerPluginVersion").GetValue(null).ToString();
|
|
161
|
-
}
|
|
168
|
+
version = oType.GetField("kAppsFlyerPluginVersion").GetValue(null).ToString();
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
}
|
|
@@ -168,24 +175,23 @@ namespace Amanotes.Editor
|
|
|
168
175
|
|
|
169
176
|
internal static string Ironsource()
|
|
170
177
|
{
|
|
171
|
-
|
|
172
|
-
string[] issdk = Directory.GetFiles("Assets", "IronSourceSDKDependencies.xml",
|
|
173
|
-
if (issdk
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return version.Trim();
|
|
178
|
+
var version = "";
|
|
179
|
+
string[] issdk = Directory.GetFiles("Assets", "IronSourceSDKDependencies.xml", SearchOption.AllDirectories);
|
|
180
|
+
if (issdk.Length <= 0) return version.Trim();
|
|
181
|
+
|
|
182
|
+
var Xdoc2 = new XmlDocument();
|
|
183
|
+
Xdoc2.Load(issdk[0]);
|
|
184
|
+
var root2 = Xdoc2.DocumentElement;
|
|
185
|
+
var dataVersion2 = root2?.SelectSingleNode("unityversion");
|
|
186
|
+
version = dataVersion2?.InnerText;
|
|
187
|
+
return version?.Trim();
|
|
182
188
|
}
|
|
183
|
-
|
|
189
|
+
|
|
184
190
|
internal static string RevenueCat()
|
|
185
191
|
{
|
|
186
192
|
string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
|
|
187
|
-
|
|
188
|
-
|
|
193
|
+
var searchString = "PLUGIN_VERSION";
|
|
194
|
+
var version = "";
|
|
189
195
|
if (files.Length < 1)
|
|
190
196
|
{
|
|
191
197
|
return version;
|
|
@@ -193,20 +199,44 @@ namespace Amanotes.Editor
|
|
|
193
199
|
|
|
194
200
|
foreach (string file in files)
|
|
195
201
|
{
|
|
196
|
-
using (
|
|
202
|
+
using (var r = new StreamReader(file))
|
|
197
203
|
{
|
|
198
204
|
string line;
|
|
199
205
|
while ((line = r.ReadLine()) != null)
|
|
200
206
|
{
|
|
201
|
-
if (line.Contains(searchString))
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
207
|
+
if (!line.Contains(searchString)) continue;
|
|
208
|
+
version = line.Split('=')[1].Replace("\"", "").Replace(";", "");
|
|
209
|
+
break;
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
return version.Trim();
|
|
210
214
|
}
|
|
215
|
+
|
|
216
|
+
internal static List<IronSourceSDKAdapter> IronSourceAdapter()
|
|
217
|
+
{
|
|
218
|
+
string[] filesIRadapter = Directory.GetFiles("Assets/IronSource", "IS*AdapterDependencies.xml", SearchOption.AllDirectories);
|
|
219
|
+
List<IronSourceSDKAdapter> listAdapter = new List<IronSourceSDKAdapter>();
|
|
220
|
+
|
|
221
|
+
if (filesIRadapter.Length <= 0) return listAdapter;
|
|
222
|
+
for (var i = 0; i < filesIRadapter.Length; i++)
|
|
223
|
+
{
|
|
224
|
+
var Xdoc = new XmlDocument();
|
|
225
|
+
string filePath = filesIRadapter[i];
|
|
226
|
+
|
|
227
|
+
Xdoc.Load(filePath);
|
|
228
|
+
|
|
229
|
+
var root = Xdoc.DocumentElement;
|
|
230
|
+
var version = root?.SelectSingleNode("//unityversion");
|
|
231
|
+
if (version == null) continue;
|
|
232
|
+
string name = Path.GetFileName(filePath)
|
|
233
|
+
.Replace("AdapterDependencies.xml", "")
|
|
234
|
+
.Replace("IS", "").Trim();
|
|
235
|
+
|
|
236
|
+
listAdapter.Add(new IronSourceSDKAdapter(name, version.InnerText));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return listAdapter;
|
|
240
|
+
}
|
|
211
241
|
}
|
|
212
|
-
}
|
|
242
|
+
}
|
|
@@ -2,22 +2,26 @@
|
|
|
2
2
|
using Amanotes.Core.Internal;
|
|
3
3
|
using UnityEditor;
|
|
4
4
|
using UnityEngine;
|
|
5
|
-
|
|
6
5
|
namespace Amanotes.Editor
|
|
7
6
|
{
|
|
8
|
-
|
|
7
|
+
internal static class AmaGUI
|
|
9
8
|
{
|
|
10
|
-
static Color LIGHT_BLUE = new Color(0.2f, 0.45f, 1f);
|
|
11
|
-
static Color LIGHT_GRAY = new Color(0.6f, 0.6f, 0.6f);
|
|
12
|
-
static Color DARK = new Color(0.15f, 0.15f, 0.15f, 1f);
|
|
9
|
+
private static readonly Color LIGHT_BLUE = new Color(0.2f, 0.45f, 1f);
|
|
10
|
+
private static readonly Color LIGHT_GRAY = new Color(0.6f, 0.6f, 0.6f);
|
|
11
|
+
private static readonly Color DARK = new Color(0.15f, 0.15f, 0.15f, 1f);
|
|
12
|
+
|
|
13
|
+
private static GUIStyle BIG_LABEL;
|
|
13
14
|
|
|
14
|
-
static
|
|
15
|
+
private static readonly Texture2D TAG_0 = (Texture2D)EditorGUIUtility.IconContent("sv_label_0").image;
|
|
16
|
+
private static readonly Texture2D TAG_1 = (Texture2D)EditorGUIUtility.IconContent("sv_icon_dot1_pix16_gizmo").image;
|
|
17
|
+
private static GUIStyle versionStyle;
|
|
18
|
+
private static GUIStyle tagLabelStyle;
|
|
15
19
|
|
|
16
20
|
public static void SectionLabel(string text)
|
|
17
21
|
{
|
|
18
22
|
if (BIG_LABEL == null)
|
|
19
23
|
{
|
|
20
|
-
BIG_LABEL = new GUIStyle(
|
|
24
|
+
BIG_LABEL = new GUIStyle(GUI.skin.label)
|
|
21
25
|
{
|
|
22
26
|
fontSize = 18,
|
|
23
27
|
alignment = TextAnchor.MiddleCenter,
|
|
@@ -27,7 +31,7 @@ namespace Amanotes.Editor
|
|
|
27
31
|
BIG_LABEL.normal.textColor = Color.white;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
var rect = GUILayoutUtility.GetRect(Screen.width, 32);
|
|
31
35
|
rect.xMin -= 16f;
|
|
32
36
|
EditorGUI.DrawRect(rect, DARK);
|
|
33
37
|
EditorGUI.LabelField(rect, text, BIG_LABEL);
|
|
@@ -35,25 +39,25 @@ namespace Amanotes.Editor
|
|
|
35
39
|
|
|
36
40
|
public static bool BigButton(string label, float height = 16f, Color? color = null, float colorMod = 0.5f)
|
|
37
41
|
{
|
|
38
|
-
var bgColor =
|
|
42
|
+
var bgColor = GUI.backgroundColor;
|
|
39
43
|
|
|
40
44
|
bool result;
|
|
41
45
|
if (color != null)
|
|
42
46
|
{
|
|
43
|
-
var c =
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
var c = colorMod < 0f ? Color.Lerp(color.Value, Color.black, -colorMod)
|
|
48
|
+
: colorMod > 0f ? Color.Lerp(color.Value, Color.white, colorMod) : color.Value;
|
|
49
|
+
GUI.backgroundColor = c;
|
|
46
50
|
}
|
|
47
51
|
{
|
|
48
52
|
result = GUILayout.Button(label, GUILayout.Height(height));
|
|
49
53
|
}
|
|
50
|
-
if (color != null)
|
|
54
|
+
if (color != null) GUI.backgroundColor = bgColor;
|
|
51
55
|
return result;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
public static bool Toggle(string label, ref bool value)
|
|
55
59
|
{
|
|
56
|
-
|
|
60
|
+
bool newValue = EditorGUILayout.Toggle(label, value);
|
|
57
61
|
if (newValue == value) return false;
|
|
58
62
|
|
|
59
63
|
value = newValue;
|
|
@@ -63,8 +67,8 @@ namespace Amanotes.Editor
|
|
|
63
67
|
public static bool ToggleGroup(string label, ref bool isOpen, Action drawFunc, Action titleFunc = null)
|
|
64
68
|
{
|
|
65
69
|
GUILayout.BeginHorizontal();
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
bool newValue = EditorGUILayout.Foldout(isOpen, label);
|
|
71
|
+
bool changed = newValue != isOpen;
|
|
68
72
|
titleFunc?.Invoke();
|
|
69
73
|
GUILayout.EndHorizontal();
|
|
70
74
|
|
|
@@ -81,35 +85,36 @@ namespace Amanotes.Editor
|
|
|
81
85
|
return true;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
static
|
|
85
|
-
static readonly Texture2D TAG_1 = (Texture2D)EditorGUIUtility.IconContent("sv_icon_dot1_pix16_gizmo").image;
|
|
86
|
-
static GUIStyle versionStyle;
|
|
87
|
-
static GUIStyle tagLabelStyle;
|
|
88
|
-
|
|
89
|
-
public static void SemVerGUI(string title, SemVer version)
|
|
88
|
+
public static void SemVerGUI(string title, SemVer version, Color? color1 = null, Color? color2 = null)
|
|
90
89
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
90
|
+
const int TAG_SIZE = 60;
|
|
91
|
+
versionStyle ??= new GUIStyle(EditorStyles.miniBoldLabel)
|
|
92
|
+
{
|
|
93
|
+
alignment = TextAnchor.MiddleCenter
|
|
94
|
+
};
|
|
97
95
|
|
|
98
|
-
var rect = GUILayoutUtility.GetRect(
|
|
96
|
+
var rect = GUILayoutUtility.GetRect(120, 16f);
|
|
99
97
|
var rect1 = rect;
|
|
100
|
-
|
|
98
|
+
|
|
101
99
|
rect1.width /= 2;
|
|
102
100
|
var rect2 = rect1;
|
|
103
101
|
rect2.x += rect.width / 2f;
|
|
104
102
|
|
|
105
103
|
GUI.Box(rect, GUIContent.none);
|
|
106
|
-
|
|
104
|
+
rect2.xMin += (rect2.width-TAG_SIZE);
|
|
105
|
+
rect2.width = TAG_SIZE;
|
|
106
|
+
|
|
107
|
+
color1 ??= LIGHT_BLUE;
|
|
108
|
+
color2 ??= LIGHT_GRAY;
|
|
109
|
+
DrawTag(rect2, version.ToString(), version.isValid ? color1.Value : color2.Value, 0.5f);
|
|
107
110
|
|
|
108
111
|
rect1.xMin += 4f;
|
|
112
|
+
rect1.width = rect.width - rect2.width;
|
|
109
113
|
GUI.Label(rect1, title, versionStyle);
|
|
110
114
|
}
|
|
111
|
-
|
|
112
|
-
public static void DrawSDKStatus(string sdkId)
|
|
115
|
+
|
|
116
|
+
public static void DrawSDKStatus(string sdkId)
|
|
117
|
+
{
|
|
113
118
|
var status = SDKStatus.Get(sdkId);
|
|
114
119
|
GUILayout.BeginHorizontal();
|
|
115
120
|
{
|
|
@@ -122,14 +127,12 @@ namespace Amanotes.Editor
|
|
|
122
127
|
GUILayout.EndHorizontal();
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
public static void DrawTag(Rect rect, string label, Color tagColor, float alpha = 1f, float margin =
|
|
130
|
+
public static void DrawTag(Rect rect, string label, Color tagColor, float alpha = 1f, float margin = 1f)
|
|
126
131
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
}
|
|
132
|
+
tagLabelStyle ??= new GUIStyle(EditorStyles.miniBoldLabel)
|
|
133
|
+
{
|
|
134
|
+
alignment = TextAnchor.MiddleCenter
|
|
135
|
+
};
|
|
133
136
|
|
|
134
137
|
rect.xMin += margin;
|
|
135
138
|
rect.xMax -= margin;
|
|
@@ -138,12 +141,12 @@ namespace Amanotes.Editor
|
|
|
138
141
|
|
|
139
142
|
tagColor.a = alpha;
|
|
140
143
|
GUI.DrawTexture(rect, Texture2D.whiteTexture, ScaleMode.StretchToFill, false, 1f, tagColor, 0f, 5f);
|
|
141
|
-
|
|
144
|
+
|
|
142
145
|
rect.xMin += 4f;
|
|
143
146
|
GUI.Label(rect, label, versionStyle);
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
public static void Draw9Slice(Rect rect, Texture2D texture,
|
|
149
|
+
public static void Draw9Slice(Rect rect, Texture2D texture,
|
|
147
150
|
float l, float r, float t, float b)
|
|
148
151
|
{
|
|
149
152
|
float x = rect.x;
|
|
@@ -156,7 +159,7 @@ namespace Amanotes.Editor
|
|
|
156
159
|
|
|
157
160
|
float lu = l / tw;
|
|
158
161
|
float ru = (tw - r) / tw;
|
|
159
|
-
float tv = (th-t) / th;
|
|
162
|
+
float tv = (th - t) / th;
|
|
160
163
|
float bv = b / th;
|
|
161
164
|
|
|
162
165
|
// Calculate the sizes of the texture's center and corners.
|
|
@@ -164,19 +167,19 @@ namespace Amanotes.Editor
|
|
|
164
167
|
float centerY = Mathf.Max(h - t - b, 0);
|
|
165
168
|
|
|
166
169
|
// Draw the corners.
|
|
167
|
-
GUI.DrawTextureWithTexCoords(new Rect(x, y, l, t), texture, new Rect(0, tv, lu, t/th));
|
|
168
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y, r, t), texture, new Rect(ru, tv, r/tw, t/th));
|
|
170
|
+
GUI.DrawTextureWithTexCoords(new Rect(x, y, l, t), texture, new Rect(0, tv, lu, t / th));
|
|
171
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y, r, t), texture, new Rect(ru, tv, r / tw, t / th));
|
|
169
172
|
GUI.DrawTextureWithTexCoords(new Rect(x, y + h - b, l, b), texture, new Rect(0, 0, lu, bv));
|
|
170
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + h - b, r, b), texture, new Rect(ru, 0, r/tw, bv));
|
|
173
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + h - b, r, b), texture, new Rect(ru, 0, r / tw, bv));
|
|
171
174
|
|
|
172
175
|
// Draw the edges.
|
|
173
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + l, y, centerX, t), texture, new Rect(lu, tv, ru-lu, t/th));
|
|
174
|
-
GUI.DrawTextureWithTexCoords(new Rect(x, y + t, l, centerY), texture, new Rect(0, bv, lu, tv-bv));
|
|
175
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + t, r, centerY), texture, new Rect(ru, bv, r/tw, tv-bv));
|
|
176
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + h - b, centerX, b), texture, new Rect(lu, 0, ru-lu, bv));
|
|
176
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y, centerX, t), texture, new Rect(lu, tv, ru - lu, t / th));
|
|
177
|
+
GUI.DrawTextureWithTexCoords(new Rect(x, y + t, l, centerY), texture, new Rect(0, bv, lu, tv - bv));
|
|
178
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + t, r, centerY), texture, new Rect(ru, bv, r / tw, tv - bv));
|
|
179
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + h - b, centerX, b), texture, new Rect(lu, 0, ru - lu, bv));
|
|
177
180
|
|
|
178
181
|
// Draw the center.
|
|
179
|
-
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + t, centerX, centerY), texture, new Rect(lu, bv, ru-lu, tv-bv));
|
|
182
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + t, centerX, centerY), texture, new Rect(lu, bv, ru - lu, tv - bv));
|
|
180
183
|
}
|
|
181
184
|
}
|
|
182
185
|
}
|
|
@@ -2,12 +2,11 @@ using System;
|
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using UnityEditor;
|
|
4
4
|
using UnityEngine;
|
|
5
|
-
|
|
6
5
|
namespace Amanotes.Editor
|
|
7
6
|
{
|
|
8
|
-
|
|
7
|
+
internal static class Utils
|
|
9
8
|
{
|
|
10
|
-
|
|
9
|
+
internal static void StartEditorCoroutine(this IEnumerator update, Action end = null)
|
|
11
10
|
{
|
|
12
11
|
EditorApplication.CallbackFunction closureCallback = null;
|
|
13
12
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|