gg.easy.airship 0.1.2183 → 0.1.2185
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/AirshipComponentEditor.cs +79 -15
- package/Editor/AirshipScriptGUI.cs +6 -1
- package/Editor/BuildMenu.cs +44 -2
- package/Editor/EditorInternal/AirshipEditorInternals.cs +61 -1
- package/Editor/EditorInternal/AirshipObjectGUIInternal.cs +205 -0
- package/Editor/EditorInternal/AirshipObjectGUIInternal.cs.meta +3 -0
- package/Editor/Util/AirshipEditorGUI.cs +29 -2
- package/Runtime/Code/AirshipConst.cs +9 -2
- package/Runtime/Code/Auth/AuthManager.cs +28 -2
- package/Runtime/Code/Bootstrap/AirshipEntryPoint.cs +26 -0
- package/Runtime/Code/CoreUI/CoreLoadingScreen.prefab +289 -1
- package/Runtime/Code/CoreUI/Loading/CoreLoadingScreen.cs +23 -0
- package/Runtime/Code/CoreUI/Login/LoginApp.cs +6 -0
- package/Runtime/Code/CoreUI/MainMenu/MainMenuLoadingScreen.prefab +1 -1
- package/Runtime/Code/Easy.Airship.asmdef +2 -1
- package/Runtime/Code/Luau/AirshipComponent.cs +1 -1
- package/Runtime/Code/Luau/AirshipEditorInfo.cs +56 -2
- package/Runtime/Code/Luau/LuauCoreReflection.cs +15 -2
- package/Runtime/Code/Luau/LuauMetadata.cs +8 -0
- package/Runtime/Code/Luau/LuauMetadataPropertySerializer.cs +6 -0
- package/Runtime/Code/Luau/ReflectionList.cs +2 -0
- package/Runtime/Code/LuauAPI/JobHandleAPI.cs +9 -0
- package/Runtime/Code/LuauAPI/JobHandleAPI.cs.meta +3 -0
- package/Runtime/Code/MainMenu/MainMenuSceneManager.cs +14 -10
- package/Runtime/Code/PSO/PSOTraceManager.cs +2 -1
- package/Runtime/Code/Player/PlayerManagerBridge.cs +7 -11
- package/Runtime/Code/Quality/QualityManager.cs +71 -28
- package/Runtime/Code/UI/Canvas/CanvasUIEvents.cs +1 -0
- package/Runtime/Code/UI/ManageFullscreenSwitch.cs +4 -6
- package/Runtime/Code/Window/WindowManager.cs +3 -3
- package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/Info.plist +2 -2
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Mac/Titlebar.bundle/Contents/Info.plist +46 -0
- package/{ThirdParty/TitlebarLib/libTitlebarLib.dylib → Runtime/Plugins/Mac/Titlebar.bundle/Contents/MacOS/Titlebar} +0 -0
- package/Runtime/Plugins/Mac/Titlebar.bundle/Contents/_CodeSignature/CodeResources +115 -0
- package/Runtime/Plugins/Mac/Titlebar.bundle.meta +2 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
- package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
- package/ThirdParty/Sentry/Sentry.Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/ThirdParty/Sentry/Sentry.Microsoft.Bcl.AsyncInterfaces.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Buffers.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Buffers.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Collections.Immutable.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Collections.Immutable.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Memory.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Memory.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Numerics.Vectors.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Numerics.Vectors.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Reflection.Metadata.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Reflection.Metadata.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Runtime.CompilerServices.Unsafe.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Text.Encodings.Web.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Text.Encodings.Web.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Text.Json.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Text.Json.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.System.Threading.Tasks.Extensions.dll +0 -0
- package/ThirdParty/Sentry/Sentry.System.Threading.Tasks.Extensions.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.Unity.Android.dll +0 -0
- package/ThirdParty/Sentry/Sentry.Unity.Android.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.Unity.Native.dll +0 -0
- package/ThirdParty/Sentry/Sentry.Unity.Native.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.Unity.dll +0 -0
- package/ThirdParty/Sentry/Sentry.Unity.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.Unity.iOS.dll +0 -0
- package/ThirdParty/Sentry/Sentry.Unity.iOS.dll.meta +2 -0
- package/ThirdParty/Sentry/Sentry.dll +0 -0
- package/ThirdParty/Sentry/Sentry.dll.meta +2 -0
- package/ThirdParty/Sentry/io.sentry.unity.airship.asmdef +13 -0
- package/ThirdParty/Sentry/io.sentry.unity.airship.asmdef.meta +7 -0
- package/ThirdParty/Sentry.meta +8 -0
- package/package.json +1 -1
- package/ThirdParty/TitlebarLib/libTitlebarLib.dylib.meta +0 -2
|
@@ -598,6 +598,9 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
598
598
|
case "IntEnum":
|
|
599
599
|
DrawCustomIntEnumProperty(guiContent, bindingProp, value, modified);
|
|
600
600
|
break;
|
|
601
|
+
case "FlagEnum":
|
|
602
|
+
DrawCustomFlagEnumProperty(guiContent, bindingProp, value, modified);
|
|
603
|
+
break;
|
|
601
604
|
case "boolean" or "bool":
|
|
602
605
|
DrawCustomBoolProperty(guiContent, type, decorators, value, modified);
|
|
603
606
|
break;
|
|
@@ -642,6 +645,11 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
642
645
|
GUILayout.Label($"{propName.stringValue}: {type.stringValue} not yet supported");
|
|
643
646
|
break;
|
|
644
647
|
}
|
|
648
|
+
|
|
649
|
+
if (Application.isPlaying) {
|
|
650
|
+
var component = (AirshipComponent)target;
|
|
651
|
+
component.WriteChangedComponentProperties();
|
|
652
|
+
}
|
|
645
653
|
|
|
646
654
|
if (hasOverride && Event.current.type == EventType.Repaint) {
|
|
647
655
|
var lastRect = GUILayoutUtility.GetLastRect();
|
|
@@ -851,11 +859,22 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
851
859
|
}
|
|
852
860
|
case AirshipComponentPropertyType.AirshipObject: {
|
|
853
861
|
var objOld = objectRefs.arraySize > index ? objectRefs.GetArrayElementAtIndex(index).objectReferenceValue : null;
|
|
854
|
-
|
|
855
|
-
if (
|
|
856
|
-
|
|
857
|
-
|
|
862
|
+
|
|
863
|
+
if (objectType == typeof(Sprite) || objectType == typeof(Texture2D)) {
|
|
864
|
+
var objNew = AirshipEditorGUI.ObjectField(rect, new GUIContent(label), objOld, objectType, true);
|
|
865
|
+
if (objOld != objNew) {
|
|
866
|
+
objectRefs.GetArrayElementAtIndex(index).objectReferenceValue = objNew;
|
|
867
|
+
arrayModified.boolValue = true;
|
|
868
|
+
}
|
|
869
|
+
} else {
|
|
870
|
+
var objNew = EditorGUI.ObjectField(rect, label, objOld, objectType, true);
|
|
871
|
+
if (objOld != objNew) {
|
|
872
|
+
objectRefs.GetArrayElementAtIndex(index).objectReferenceValue = objNew;
|
|
873
|
+
arrayModified.boolValue = true;
|
|
874
|
+
}
|
|
858
875
|
}
|
|
876
|
+
|
|
877
|
+
|
|
859
878
|
break;
|
|
860
879
|
}
|
|
861
880
|
default:
|
|
@@ -882,11 +901,11 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
882
901
|
{
|
|
883
902
|
newValue = Math.Max(Convert.ToInt32(minParams[0].value), newValue);
|
|
884
903
|
}
|
|
885
|
-
|
|
886
|
-
{
|
|
904
|
+
|
|
905
|
+
if (modifiers.TryGetValue("Max", out var maxParams)) {
|
|
887
906
|
newValue = Math.Min(Convert.ToInt32(maxParams[0].value), newValue);
|
|
888
907
|
}
|
|
889
|
-
|
|
908
|
+
|
|
890
909
|
if (newValue != currentValue) {
|
|
891
910
|
value.stringValue = newValue.ToString(CultureInfo.InvariantCulture);
|
|
892
911
|
modified.boolValue = true;
|
|
@@ -981,7 +1000,7 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
981
1000
|
|
|
982
1001
|
List<GUIContent> items = new();
|
|
983
1002
|
foreach (var item in enumerableType.members) {
|
|
984
|
-
items.Add(new GUIContent(ObjectNames.NicifyVariableName(item.Name)
|
|
1003
|
+
items.Add(new GUIContent(ObjectNames.NicifyVariableName(item.Name)) );
|
|
985
1004
|
}
|
|
986
1005
|
|
|
987
1006
|
int idx = 0;
|
|
@@ -1004,6 +1023,28 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
1004
1023
|
private void DrawCustomIntEnumProperty(GUIContent guiContent, LuauMetadataProperty metadataProperty,
|
|
1005
1024
|
SerializedProperty value, SerializedProperty modified) {
|
|
1006
1025
|
//
|
|
1026
|
+
if (!AirshipEditorInfo.Instance) {
|
|
1027
|
+
EditorGUILayout.HelpBox("Cannot find editor info", MessageType.Error);
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
if (metadataProperty.refPath == null) {
|
|
1032
|
+
EditorGUILayout.HelpBox("Cannot find refPath", MessageType.Error);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
var tsEnum = AirshipEditorInfo.Enums.GetEnum(metadataProperty.refPath);
|
|
1037
|
+
if (tsEnum == null) {
|
|
1038
|
+
EditorGUILayout.HelpBox("Cannot find enum from refPath", MessageType.Error);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
DrawCustomIntEnumDropdown(guiContent, tsEnum, value, modified, null);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
private void DrawCustomFlagEnumProperty(GUIContent guiContent, LuauMetadataProperty metadataProperty,
|
|
1046
|
+
SerializedProperty value, SerializedProperty modified) {
|
|
1047
|
+
|
|
1007
1048
|
if (!AirshipEditorInfo.Instance) return;
|
|
1008
1049
|
|
|
1009
1050
|
if (metadataProperty.refPath == null) {
|
|
@@ -1012,8 +1053,25 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
1012
1053
|
|
|
1013
1054
|
var tsEnum = AirshipEditorInfo.Enums.GetEnum(metadataProperty.refPath);
|
|
1014
1055
|
if (tsEnum == null) return;
|
|
1056
|
+
|
|
1057
|
+
int.TryParse(value.stringValue, out int currentMask);
|
|
1015
1058
|
|
|
1016
|
-
|
|
1059
|
+
#if AIRSHIP_INTERNAL
|
|
1060
|
+
EditorGUILayout.BeginHorizontal();
|
|
1061
|
+
#endif
|
|
1062
|
+
var newMask = EditorGUILayout.MaskField(guiContent, currentMask, tsEnum.flagNames);
|
|
1063
|
+
if (newMask != currentMask) {
|
|
1064
|
+
value.stringValue = newMask.ToString(CultureInfo.InvariantCulture);
|
|
1065
|
+
modified.boolValue = true;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
#if AIRSHIP_INTERNAL
|
|
1069
|
+
GUI.enabled = false;
|
|
1070
|
+
EditorGUILayout.IntField(newMask, GUILayout.Width(100));
|
|
1071
|
+
EditorGUILayout.Toggle("", tsEnum.isFlagLike, GUILayout.Width(30));
|
|
1072
|
+
GUI.enabled = true;
|
|
1073
|
+
EditorGUILayout.EndHorizontal();
|
|
1074
|
+
#endif
|
|
1017
1075
|
}
|
|
1018
1076
|
|
|
1019
1077
|
private void DrawCustomStringEnumProperty(GUIContent guiContent, LuauMetadataProperty metadataProperty, SerializedProperty value,
|
|
@@ -1097,11 +1155,11 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
1097
1155
|
{
|
|
1098
1156
|
currentValue = 0;
|
|
1099
1157
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
{
|
|
1103
|
-
value.stringValue =
|
|
1104
|
-
modified.boolValue = true;
|
|
1158
|
+
|
|
1159
|
+
int maskValue = EditorGUILayout.MaskField(guiContent, currentValue, GameConfig.Load().gameLayers);
|
|
1160
|
+
if (maskValue != currentValue) {
|
|
1161
|
+
value.stringValue = maskValue.ToString(CultureInfo.InvariantCulture);
|
|
1162
|
+
modified.boolValue = true;
|
|
1105
1163
|
}
|
|
1106
1164
|
}
|
|
1107
1165
|
|
|
@@ -1225,7 +1283,13 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
1225
1283
|
private void DrawCustomObjectProperty(GUIContent guiContent, SerializedProperty type, SerializedProperty modifiers, SerializedProperty obj, SerializedProperty objType, SerializedProperty modified) {
|
|
1226
1284
|
var currentObject = obj.objectReferenceValue;
|
|
1227
1285
|
var t = objType.stringValue != "" ? TypeReflection.GetTypeFromString(objType.stringValue) : typeof(Object);
|
|
1228
|
-
|
|
1286
|
+
|
|
1287
|
+
UnityEngine.Object newObject;
|
|
1288
|
+
if (t == typeof(Sprite) || t == typeof(Texture2D)) {
|
|
1289
|
+
newObject = AirshipEditorGUI.ObjectFieldLayout(guiContent, currentObject, t, true);
|
|
1290
|
+
} else {
|
|
1291
|
+
newObject = EditorGUILayout.ObjectField(guiContent, currentObject, t, true);
|
|
1292
|
+
}
|
|
1229
1293
|
|
|
1230
1294
|
if (newObject != currentObject) {
|
|
1231
1295
|
obj.objectReferenceValue = newObject;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#if UNITY_EDITOR
|
|
2
2
|
using System;
|
|
3
|
+
using Editor.EditorInternal;
|
|
3
4
|
using JetBrains.Annotations;
|
|
4
5
|
using Luau;
|
|
5
6
|
using UnityEditor;
|
|
@@ -187,7 +188,7 @@ namespace Code.Luau {
|
|
|
187
188
|
temp.image = displayIcon;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
AirshipEditorGUI.nonClippingObjectField.Draw(position, temp, id, DragAndDrop.activeControlID == id,
|
|
191
192
|
position.Contains(Event.current.mousePosition));
|
|
192
193
|
|
|
193
194
|
|
|
@@ -242,6 +243,10 @@ namespace Code.Luau {
|
|
|
242
243
|
var r = EditorGUILayout.GetControlRect(false, ObjectField.singleLineHeight);
|
|
243
244
|
return AirshipBehaviourField(r, content, script, airshipComponent, null);
|
|
244
245
|
}
|
|
246
|
+
|
|
247
|
+
internal static Sprite AirshipSpriteField(Rect position, GUIContent content, Sprite sprite) {
|
|
248
|
+
return (Sprite) AirshipEditorInternals.DoCustomObjectField(position, content, sprite, typeof(Sprite));
|
|
249
|
+
}
|
|
245
250
|
}
|
|
246
251
|
}
|
|
247
252
|
#endif
|
package/Editor/BuildMenu.cs
CHANGED
|
@@ -78,7 +78,7 @@ namespace Editor {
|
|
|
78
78
|
locationPathName = $"build/StandaloneLinux64/{ServerExecutableName}",
|
|
79
79
|
options = BuildOptions.Development,
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
var report = BuildPipeline.BuildPlayer(options);
|
|
83
83
|
var summary = report.summary;
|
|
84
84
|
switch (summary.result) {
|
|
@@ -87,12 +87,18 @@ namespace Editor {
|
|
|
87
87
|
break;
|
|
88
88
|
case BuildResult.Failed:
|
|
89
89
|
Debug.Log("Build Linux failed");
|
|
90
|
+
#if GAME_CI
|
|
91
|
+
EditorApplication.Exit(1);
|
|
92
|
+
#endif
|
|
90
93
|
break;
|
|
91
94
|
default:
|
|
92
95
|
Debug.Log("Build Linux unexpected result:" + summary.result);
|
|
96
|
+
#if GAME_CI
|
|
97
|
+
EditorApplication.Exit(2);
|
|
98
|
+
#endif
|
|
93
99
|
break;
|
|
94
100
|
}
|
|
95
|
-
|
|
101
|
+
|
|
96
102
|
CreateAssetBundles.AddAllGameBundleScenes();
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -142,9 +148,15 @@ namespace Editor {
|
|
|
142
148
|
break;
|
|
143
149
|
case BuildResult.Failed:
|
|
144
150
|
Debug.LogError("Build Mac failed");
|
|
151
|
+
#if GAME_CI
|
|
152
|
+
EditorApplication.Exit(1);
|
|
153
|
+
#endif
|
|
145
154
|
break;
|
|
146
155
|
default:
|
|
147
156
|
Debug.LogError("Build Mac unexpected result:" + summary.result);
|
|
157
|
+
#if GAME_CI
|
|
158
|
+
EditorApplication.Exit(2);
|
|
159
|
+
#endif
|
|
148
160
|
break;
|
|
149
161
|
}
|
|
150
162
|
|
|
@@ -181,9 +193,15 @@ namespace Editor {
|
|
|
181
193
|
break;
|
|
182
194
|
case BuildResult.Failed:
|
|
183
195
|
Debug.LogError("Build Mac failed");
|
|
196
|
+
#if GAME_CI
|
|
197
|
+
EditorApplication.Exit(1);
|
|
198
|
+
#endif
|
|
184
199
|
break;
|
|
185
200
|
default:
|
|
186
201
|
Debug.LogError("Build Mac unexpected result:" + summary.result);
|
|
202
|
+
#if GAME_CI
|
|
203
|
+
EditorApplication.Exit(2);
|
|
204
|
+
#endif
|
|
187
205
|
break;
|
|
188
206
|
}
|
|
189
207
|
|
|
@@ -227,9 +245,15 @@ namespace Editor {
|
|
|
227
245
|
break;
|
|
228
246
|
case BuildResult.Failed:
|
|
229
247
|
Debug.LogError("Build iOS failed");
|
|
248
|
+
#if GAME_CI
|
|
249
|
+
EditorApplication.Exit(1);
|
|
250
|
+
#endif
|
|
230
251
|
break;
|
|
231
252
|
default:
|
|
232
253
|
Debug.LogError("Build iOS unexpected result:" + summary.result);
|
|
254
|
+
#if GAME_CI
|
|
255
|
+
EditorApplication.Exit(2);
|
|
256
|
+
#endif
|
|
233
257
|
break;
|
|
234
258
|
}
|
|
235
259
|
|
|
@@ -284,9 +308,15 @@ namespace Editor {
|
|
|
284
308
|
break;
|
|
285
309
|
case BuildResult.Failed:
|
|
286
310
|
Debug.LogError("Build Android failed");
|
|
311
|
+
#if GAME_CI
|
|
312
|
+
EditorApplication.Exit(1);
|
|
313
|
+
#endif
|
|
287
314
|
break;
|
|
288
315
|
default:
|
|
289
316
|
Debug.LogError("Build Android unexpected result:" + summary.result);
|
|
317
|
+
#if GAME_CI
|
|
318
|
+
EditorApplication.Exit(2);
|
|
319
|
+
#endif
|
|
290
320
|
break;
|
|
291
321
|
}
|
|
292
322
|
|
|
@@ -371,9 +401,15 @@ namespace Editor {
|
|
|
371
401
|
break;
|
|
372
402
|
case BuildResult.Failed:
|
|
373
403
|
Debug.Log("Build Windows failed");
|
|
404
|
+
#if GAME_CI
|
|
405
|
+
EditorApplication.Exit(1);
|
|
406
|
+
#endif
|
|
374
407
|
break;
|
|
375
408
|
default:
|
|
376
409
|
Debug.Log("Build Windows unexpected result:" + summary.result);
|
|
410
|
+
#if GAME_CI
|
|
411
|
+
EditorApplication.Exit(2);
|
|
412
|
+
#endif
|
|
377
413
|
break;
|
|
378
414
|
}
|
|
379
415
|
|
|
@@ -407,9 +443,15 @@ namespace Editor {
|
|
|
407
443
|
break;
|
|
408
444
|
case BuildResult.Failed:
|
|
409
445
|
Debug.Log("Build Windows failed");
|
|
446
|
+
#if GAME_CI
|
|
447
|
+
EditorApplication.Exit(1);
|
|
448
|
+
#endif
|
|
410
449
|
break;
|
|
411
450
|
default:
|
|
412
451
|
Debug.Log("Build Windows unexpected result:" + summary.result);
|
|
452
|
+
#if GAME_CI
|
|
453
|
+
EditorApplication.Exit(2);
|
|
454
|
+
#endif
|
|
413
455
|
break;
|
|
414
456
|
}
|
|
415
457
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
using
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.EventSystems;
|
|
2
5
|
|
|
3
6
|
namespace Editor.EditorInternal {
|
|
4
7
|
public class AirshipEditorInternals {
|
|
@@ -11,5 +14,62 @@ namespace Editor.EditorInternal {
|
|
|
11
14
|
internal static bool GetBoldDefaultFont() {
|
|
12
15
|
return EditorGUIUtility.GetBoldDefaultFont();
|
|
13
16
|
}
|
|
17
|
+
|
|
18
|
+
internal static void ShowObjectSelector(UnityEngine.Object obj, Type objectTypes, UnityEngine.Object objBeingEdited, bool allowSceneObjects) {
|
|
19
|
+
ObjectSelector.get.Show(obj, objectTypes,objBeingEdited, allowSceneObjects);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
internal static UnityEngine.Object DoCustomObjectField(Rect position, GUIContent label,
|
|
23
|
+
UnityEngine.Object value, System.Type type) {
|
|
24
|
+
int id = "s_ObjectField".GetHashCode();
|
|
25
|
+
var eventType = Event.current;
|
|
26
|
+
|
|
27
|
+
position = EditorGUI.PrefixLabel(position, label);
|
|
28
|
+
|
|
29
|
+
switch (eventType.type) {
|
|
30
|
+
case EventType.MouseDown: {
|
|
31
|
+
if (position.Contains(UnityEngine.Event.current.mousePosition) &&
|
|
32
|
+
UnityEngine.Event.current.button == 0) {
|
|
33
|
+
// Rect buttonRect = EditorGUI.GetButtonRect(visualType, position);
|
|
34
|
+
EditorGUIUtility.editingTextField = false;
|
|
35
|
+
if (GUI.enabled) {
|
|
36
|
+
ShowObjectSelector(value, type, null, true);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case EventType.Repaint: {
|
|
43
|
+
EditorGUI.BeginHandleMixedValueContentColor();
|
|
44
|
+
|
|
45
|
+
GUIContent content = EditorGUIUtility.ObjectContent(value, type, false);
|
|
46
|
+
Color contentColor = GUI.contentColor;
|
|
47
|
+
float a = contentColor.a;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
if (value == null) {
|
|
51
|
+
contentColor.a = 0.7f;
|
|
52
|
+
GUI.contentColor = contentColor;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var buttonRect = new Rect(position.xMax - 19f, position.y, 19f, position.height);
|
|
56
|
+
Rect position1 = EditorStyles.objectFieldButton.margin.Remove(buttonRect);
|
|
57
|
+
EditorStyles.objectField.Draw(position, content, id, DragAndDrop.activeControlID == id,
|
|
58
|
+
position.Contains(UnityEngine.Event.current.mousePosition));
|
|
59
|
+
EditorStyles.objectFieldButton.Draw(position1, GUIContent.none, id,
|
|
60
|
+
DragAndDrop.activeControlID == id,
|
|
61
|
+
position1.Contains(UnityEngine.Event.current.mousePosition));
|
|
62
|
+
|
|
63
|
+
EditorGUI.EndHandleMixedValueContentColor();
|
|
64
|
+
break;
|
|
65
|
+
} finally {
|
|
66
|
+
contentColor.a = a;
|
|
67
|
+
GUI.contentColor = contentColor;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
14
74
|
}
|
|
15
75
|
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
|
|
2
|
+
using System;
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using Object = UnityEngine.Object;
|
|
6
|
+
|
|
7
|
+
internal static class AirshipObjectGUIInternal {
|
|
8
|
+
// Unfortunately this is necessary due to lack of customization
|
|
9
|
+
|
|
10
|
+
public delegate void ObjectSelectAction(UnityEngine.Object obj, System.Type[] requiredTypes);
|
|
11
|
+
|
|
12
|
+
private static Object DoCustomObjectField(
|
|
13
|
+
Rect position,
|
|
14
|
+
Rect dropRect,
|
|
15
|
+
int id,
|
|
16
|
+
Object obj,
|
|
17
|
+
Object objBeingEdited,
|
|
18
|
+
Type objType,
|
|
19
|
+
EditorGUI.ObjectFieldValidator validator,
|
|
20
|
+
bool allowSceneObjects,
|
|
21
|
+
GUIStyle style,
|
|
22
|
+
GUIStyle buttonStyle,
|
|
23
|
+
ObjectSelectAction onRequestSelectObject
|
|
24
|
+
) {
|
|
25
|
+
|
|
26
|
+
var visualType = EditorGUI.ObjectFieldVisualType.IconAndText;
|
|
27
|
+
validator ??= EditorGUI.ValidateObjectFieldAssignment;
|
|
28
|
+
|
|
29
|
+
var current = Event.current;
|
|
30
|
+
var eventType = current.type;
|
|
31
|
+
var buttonRect = new Rect(position.xMax - 19f, position.y, 19f, position.height);
|
|
32
|
+
|
|
33
|
+
if (eventType == EventType.ContextClick && position.Contains(Event.current.mousePosition))
|
|
34
|
+
{
|
|
35
|
+
var actualObject = obj;
|
|
36
|
+
var menu = new GenericMenu();
|
|
37
|
+
|
|
38
|
+
// if (EditorGUI.FillPropertyContextMenu(null, menu: menu) != null) {
|
|
39
|
+
// menu.AddSeparator("");
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
menu.AddItem(new GUIContent("Properties..."), false, () => PropertyEditor.OpenPropertyEditor(actualObject));
|
|
43
|
+
menu.DropDown(position);
|
|
44
|
+
Event.current.Use();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
switch (eventType) {
|
|
48
|
+
case EventType.KeyDown: {
|
|
49
|
+
if (GUIUtility.keyboardControl == id) {
|
|
50
|
+
if (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete &&
|
|
51
|
+
(current.modifiers & EventModifiers.Shift) == EventModifiers.None) {
|
|
52
|
+
obj = null;
|
|
53
|
+
GUI.changed = true;
|
|
54
|
+
current.Use();
|
|
55
|
+
}
|
|
56
|
+
if (current.MainActionKeyForControl(id)) {
|
|
57
|
+
onRequestSelectObject(obj, new[] { objType });
|
|
58
|
+
current.Use();
|
|
59
|
+
GUIUtility.ExitGUI();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case EventType.MouseDown: {
|
|
66
|
+
if (position.Contains(Event.current.mousePosition) &&
|
|
67
|
+
Event.current.button == 0) {
|
|
68
|
+
|
|
69
|
+
EditorGUIUtility.editingTextField = false;
|
|
70
|
+
if (buttonRect.Contains(Event.current.mousePosition)) {
|
|
71
|
+
if (GUI.enabled) {
|
|
72
|
+
GUIUtility.keyboardControl = id;
|
|
73
|
+
|
|
74
|
+
onRequestSelectObject(obj, new[] { objType });
|
|
75
|
+
|
|
76
|
+
current.Use();
|
|
77
|
+
GUIUtility.ExitGUI();
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
if (Event.current.clickCount == 1) {
|
|
81
|
+
GUIUtility.keyboardControl = id;
|
|
82
|
+
EditorGUI.PingObjectOrShowPreviewOnClick(obj, position);
|
|
83
|
+
current.Use();
|
|
84
|
+
} else if (Event.current.clickCount == 2 && (bool) obj)
|
|
85
|
+
{
|
|
86
|
+
AssetDatabase.OpenAsset(obj);
|
|
87
|
+
current.Use();
|
|
88
|
+
GUIUtility.ExitGUI();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case EventType.Repaint: {
|
|
95
|
+
var content = EditorGUIUtility.ObjectContent(obj, objType, null, validator);
|
|
96
|
+
var contentColor = GUI.contentColor;
|
|
97
|
+
var a = contentColor.a;
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
if (obj == null)
|
|
101
|
+
{
|
|
102
|
+
contentColor.a = 0.7f;
|
|
103
|
+
GUI.contentColor = contentColor;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
EditorGUI.BeginHandleMixedValueContentColor();
|
|
107
|
+
style.Draw(position, content, id, DragAndDrop.activeControlID == id, position.Contains(UnityEngine.Event.current.mousePosition));
|
|
108
|
+
var position1 = buttonStyle.margin.Remove(buttonRect);
|
|
109
|
+
buttonStyle.Draw(position1, GUIContent.none, id, DragAndDrop.activeControlID == id, position1.Contains(UnityEngine.Event.current.mousePosition));
|
|
110
|
+
EditorGUI.EndHandleMixedValueContentColor();
|
|
111
|
+
} finally {
|
|
112
|
+
contentColor.a = a;
|
|
113
|
+
GUI.contentColor = contentColor;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case EventType.DragUpdated:
|
|
119
|
+
case EventType.DragPerform: {
|
|
120
|
+
if (dropRect.Contains(UnityEngine.Event.current.mousePosition) && GUI.enabled) {
|
|
121
|
+
var objectReferences = DragAndDrop.objectReferences;
|
|
122
|
+
var target = validator(objectReferences, objType, null, EditorGUI.ObjectFieldValidatorOptions.None);
|
|
123
|
+
if (target != null && !allowSceneObjects && !EditorUtility.IsPersistent(target)) {
|
|
124
|
+
target = null;
|
|
125
|
+
}
|
|
126
|
+
if (target != null) {
|
|
127
|
+
if (DragAndDrop.visualMode == DragAndDropVisualMode.None)
|
|
128
|
+
DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
|
|
129
|
+
|
|
130
|
+
if (eventType == EventType.DragPerform) {
|
|
131
|
+
obj = target;
|
|
132
|
+
GUI.changed = true;
|
|
133
|
+
DragAndDrop.AcceptDrag();
|
|
134
|
+
DragAndDrop.activeControlID = 0;
|
|
135
|
+
} else DragAndDrop.activeControlID = id;
|
|
136
|
+
current.Use();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case EventType.DragExited:
|
|
143
|
+
if (GUI.enabled) HandleUtility.Repaint();
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return obj;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public static GUIStyle objectFieldButtonStyle => EditorStyles.objectFieldButton;
|
|
151
|
+
|
|
152
|
+
public static Object DoObjectField(
|
|
153
|
+
Rect position,
|
|
154
|
+
Rect dropRect,
|
|
155
|
+
GUIContent label,
|
|
156
|
+
int id,
|
|
157
|
+
Object obj,
|
|
158
|
+
Object objBeingEdited,
|
|
159
|
+
Type objType,
|
|
160
|
+
EditorGUI.ObjectFieldValidator validator,
|
|
161
|
+
bool allowSceneObjects,
|
|
162
|
+
GUIStyle style,
|
|
163
|
+
GUIStyle buttonStyle,
|
|
164
|
+
Action<Object> onObjectSelectorClosed = null,
|
|
165
|
+
Action<Object> onObjectSelectedUpdated = null) {
|
|
166
|
+
|
|
167
|
+
var controlId = GUIUtility.GetControlID(id, FocusType.Keyboard, position);
|
|
168
|
+
position = EditorGUI.PrefixLabel(position, controlId, label);
|
|
169
|
+
|
|
170
|
+
void ShowObjectSelector(Object onObject, Type[] types) {
|
|
171
|
+
ObjectSelector.get.Show(onObject, types, onObject, allowSceneObjects, onObjectSelectedUpdated: onObjectSelectedUpdated, onObjectSelectorClosed: onObjectSelectorClosed);
|
|
172
|
+
ObjectSelector.get.objectSelectorID = controlId;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var result = DoCustomObjectField(position, dropRect, controlId, obj, objBeingEdited, objType, validator, allowSceneObjects,
|
|
176
|
+
style, buttonStyle, ShowObjectSelector);
|
|
177
|
+
|
|
178
|
+
var current = Event.current;
|
|
179
|
+
var commandName = current.commandName;
|
|
180
|
+
|
|
181
|
+
switch (Event.current.type) {
|
|
182
|
+
case EventType.ExecuteCommand: {
|
|
183
|
+
if (commandName == "ObjectSelectorUpdated" && ObjectSelector.get.objectSelectorID == controlId) {
|
|
184
|
+
return ObjectSelector.GetCurrentObject();
|
|
185
|
+
}
|
|
186
|
+
if (commandName == "ObjectSelectorClosed" && ObjectSelector.get.objectSelectorID == controlId)
|
|
187
|
+
{
|
|
188
|
+
if (ObjectSelector.get.GetInstanceID() != 0)
|
|
189
|
+
return ObjectSelector.GetCurrentObject();
|
|
190
|
+
current.Use();
|
|
191
|
+
}
|
|
192
|
+
if ((current.commandName == "Delete" || current.commandName == "SoftDelete") &&
|
|
193
|
+
GUIUtility.keyboardControl == id) {
|
|
194
|
+
obj = null;
|
|
195
|
+
|
|
196
|
+
GUI.changed = true;
|
|
197
|
+
current.Use();
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -5,7 +5,7 @@ using Editor.EditorInternal;
|
|
|
5
5
|
using UnityEditor;
|
|
6
6
|
using UnityEngine;
|
|
7
7
|
|
|
8
|
-
public class AirshipEditorGUI {
|
|
8
|
+
public static class AirshipEditorGUI {
|
|
9
9
|
public static void HorizontalLine(Color color = default, int thickness = 1, int padding = 10, int margin = 0)
|
|
10
10
|
{
|
|
11
11
|
color = color != default ? color : Color.grey;
|
|
@@ -28,10 +28,37 @@ public class AirshipEditorGUI {
|
|
|
28
28
|
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
EditorGUI.DrawRect(r, color);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
private static GUIStyle _nonClippingObjectField;
|
|
37
|
+
internal static GUIStyle nonClippingObjectField {
|
|
38
|
+
get {
|
|
39
|
+
if (_nonClippingObjectField == null) {
|
|
40
|
+
_nonClippingObjectField = new GUIStyle(EditorStyles.objectField) {
|
|
41
|
+
imagePosition = ImagePosition.ImageLeft,
|
|
42
|
+
clipping = TextClipping.Ellipsis,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return _nonClippingObjectField;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static UnityEngine.Object ObjectField(Rect rect, GUIContent label, UnityEngine.Object currentValue, System.Type type, bool
|
|
51
|
+
allowSceneObjects) {
|
|
52
|
+
return AirshipObjectGUIInternal.DoObjectField(rect, rect, label, "k_objectFieldHash".GetHashCode(), currentValue, null,
|
|
53
|
+
type, null, allowSceneObjects, nonClippingObjectField, AirshipObjectGUIInternal.objectFieldButtonStyle);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static UnityEngine.Object ObjectFieldLayout(GUIContent label, UnityEngine.Object currentValue, System.Type type, bool
|
|
57
|
+
allowSceneObjects) {
|
|
58
|
+
var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
|
|
59
|
+
return ObjectField(rect, label, currentValue, type, allowSceneObjects);
|
|
60
|
+
}
|
|
61
|
+
|
|
35
62
|
private const int TabButtonHeight = 22;
|
|
36
63
|
|
|
37
64
|
private static GUIStyle s_TabOnlyOne;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
// ReSharper disable InconsistentNaming
|
|
2
2
|
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEngine.Scripting;
|
|
5
|
+
|
|
3
6
|
namespace Code {
|
|
4
|
-
[LuauAPI]
|
|
7
|
+
[LuauAPI][Preserve]
|
|
5
8
|
public static class AirshipConst {
|
|
6
|
-
public const int playerVersion =
|
|
9
|
+
public const int playerVersion = 18;
|
|
10
|
+
public static readonly IReadOnlyList<string> playerFlags = new string[] {
|
|
11
|
+
"SkipLoading",
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
|
|
8
15
|
/// <summary>
|
|
9
16
|
/// The server will kick clients that have a playerVersion lower than this value.
|