gg.easy.airship 0.1.2105 → 0.1.2106
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/Accessories/AccessoryEditorWindow.cs +1 -1
- package/Editor/Accessories/Clothing/PlatformGearBundleManifestEditor.cs +8 -0
- package/Editor/AirshipComponentEditor.cs +33 -28
- package/Editor/AirshipComponents/AirshipComponentHeaderHandler.cs +1 -2
- package/Editor/AirshipComponents/AirshipComponentHeaderWrapper.cs +7 -9
- package/Editor/AirshipScriptGUI.cs +8 -5
- package/Editor/BinaryFileDragDrop.cs +38 -70
- package/Editor/EditorInternal/EditorGUIExtensions.cs +5 -0
- package/Editor/EditorInternal/EditorGUIExtensions.cs.meta +3 -0
- package/Editor/LuauImporter.cs +1 -1
- package/Editor/TypescriptServices/Editor/AirshipComponentButton.cs +4 -3
- package/Editor/TypescriptServices/Editor/AirshipScriptFileEditor.cs +8 -8
- package/Editor/TypescriptServices/Editor/TypescriptOptions.cs +42 -58
- package/Editor/TypescriptServices/Projects/TypescriptProjectsService.cs +2 -1
- package/Editor/Util/AirshipEditorGUI.cs +87 -0
- package/Runtime/Code/Agones/AutoShutdownBridge.cs +1 -1
- package/Runtime/Code/Bootstrap/SignalHandler.cs +28 -31
- package/Runtime/Code/Bundles/AirshipEditorNetworkConfig.cs.meta +9 -1
- package/Runtime/Code/Luau/AirshipComponent.cs +383 -844
- package/Runtime/Code/Luau/AirshipComponentV2.cs +360 -0
- package/Runtime/Code/Luau/AirshipComponentV2.cs.meta +3 -0
- package/Runtime/Code/Luau/Editor/LuauCoreEditor.cs +30 -0
- package/Runtime/Code/Luau/Editor/LuauCoreEditor.cs.meta +3 -0
- package/Runtime/Code/Luau/LuauCompiler.cs +1 -1
- package/Runtime/Code/Luau/LuauCore.cs +19 -64
- package/Runtime/Code/Luau/LuauCore.cs.meta +11 -11
- package/Runtime/Code/Luau/LuauCoreCallbacks.cs +72 -89
- package/Runtime/Code/Luau/LuauCoreSystemNamespaces.cs +4 -1
- package/Runtime/Code/Luau/LuauCoreUtilities.cs +3 -26
- package/Runtime/Code/Luau/LuauMetadata.cs +12 -13
- package/Runtime/Code/Luau/LuauPlugin.cs +16 -4
- package/Runtime/Code/Luau/LuauPluginRaw.cs +17 -17
- package/Runtime/Code/Luau/LuauScript.cs +191 -0
- package/Runtime/Code/Luau/LuauScript.cs.meta +3 -0
- package/Runtime/Code/Luau/LuauState.cs +8 -3
- package/Runtime/Code/Luau/ScriptingEntryPoint.cs +13 -21
- package/Runtime/Code/LuauAPI/AirshipBehaviourHelper.cs +34 -42
- package/Runtime/Code/LuauAPI/Bridge.cs +7 -0
- package/Runtime/Code/LuauHelper/AssetBridgeInjector.cs +3 -4
- package/Runtime/Code/LuauHelper/LuauHelper.cs +2 -1
- package/Runtime/Code/LuauHelper/LuauHelper.cs.meta +9 -1
- package/Runtime/Code/MainMenu/MainMenuSceneManager.cs +3 -5
- package/Runtime/Code/Misc/AirshipBuildInfo.cs +1 -1
- package/Runtime/Code/Network/AirshipNetworkManager.cs +4 -5
- package/Runtime/Code/Platform/Shared/AirshipInventoryServiceDto.cs +7 -0
- package/Runtime/Code/Player/Accessories/AccessoryBuilder.cs +0 -6
- package/Runtime/Code/Player/Character/Animation/CharacterAnimationHelper.cs +5 -5
- package/Runtime/Code/Player/OcclusionCam.cs +59 -54
- package/Runtime/Code/TSCodeGen/TypeGenerator.cs +2 -0
- package/Runtime/Code/UserInput/InputBridge.cs.meta +11 -11
- package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/Info.plist +1 -1
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll.meta +1 -62
- package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
- package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
- package/Runtime/Prefabs/LuauCore.prefab +104 -0
- package/{Editor/Resources/HumanAnimationPrefab.prefab.meta → Runtime/Prefabs/LuauCore.prefab.meta} +1 -1
- package/Runtime/Scenes/CoreScene.unity +231 -263
- package/Runtime/Scenes/MainMenu.unity +146 -66
- package/package.json +1 -1
- package/Editor/Resources/HumanAnimationPrefab.prefab +0 -23574
- package/Runtime/Code/Luau/AirshipComponentUpdater.cs +0 -59
- package/Runtime/Code/Luau/AirshipComponentUpdater.cs.meta +0 -3
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin.meta +0 -7
|
@@ -123,7 +123,15 @@ namespace Editor.Accessories.Clothing {
|
|
|
123
123
|
req.SetRequestHeader("Authorization", "Bearer " + InternalHttpManager.editorAuthToken);
|
|
124
124
|
req.SetRequestHeader("x-airship-ignore-rate-limit", "true");
|
|
125
125
|
await req.SendWebRequest();
|
|
126
|
+
if (req.result != UnityWebRequest.Result.Success) {
|
|
127
|
+
Debug.LogError("Failed to update air asset: " + req.downloadHandler.text);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
126
130
|
Debug.Log("Create classId response: " + req.downloadHandler.text);
|
|
131
|
+
var createResponse = JsonUtility.FromJson<GearCreateResponse>(req.downloadHandler.text);
|
|
132
|
+
gear.classId = createResponse.classId;
|
|
133
|
+
EditorUtility.SetDirty(gear);
|
|
134
|
+
AssetDatabase.SaveAssets();
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
string airId = manifest.airId;
|
|
@@ -31,7 +31,7 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
31
31
|
|
|
32
32
|
public void OnEnable() {
|
|
33
33
|
var comp = (Component)serializedObject.targetObject;
|
|
34
|
-
var metadata = serializedObject.FindProperty("
|
|
34
|
+
var metadata = serializedObject.FindProperty("metadata");
|
|
35
35
|
var metadataProperties = metadata.FindPropertyRelative("properties");
|
|
36
36
|
for (var i = 0; i < metadataProperties.arraySize; i++) {
|
|
37
37
|
var serializedProperty = metadataProperties.GetArrayElementAtIndex(i);
|
|
@@ -49,18 +49,18 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
49
49
|
|
|
50
50
|
AirshipComponent binding = (AirshipComponent)target;
|
|
51
51
|
|
|
52
|
-
if (binding.
|
|
53
|
-
// Debug.Log("Setting Script File from Path: " + binding.
|
|
54
|
-
// binding.SetScriptFromPath(binding.
|
|
55
|
-
if (binding.
|
|
56
|
-
Debug.LogWarning($"Failed to load script asset: {binding.
|
|
57
|
-
EditorGUILayout.HelpBox("Missing reference. This is likely from renaming a script.\n\nOld path: " + binding.
|
|
52
|
+
if (binding.script == null && !string.IsNullOrEmpty(binding.scriptPath)) {
|
|
53
|
+
// Debug.Log("Setting Script File from Path: " + binding.scriptPath);
|
|
54
|
+
// binding.SetScriptFromPath(binding.scriptPath, LuauContext.Game);
|
|
55
|
+
if (binding.script == null) {
|
|
56
|
+
Debug.LogWarning($"Failed to load script asset: {binding.scriptPath}");
|
|
57
|
+
EditorGUILayout.HelpBox("Missing reference. This is likely from renaming a script.\n\nOld path: " + binding.scriptPath.Replace("Assets/Bundles/", ""), MessageType.Warning);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
DrawScriptBindingProperties(binding);
|
|
62
62
|
|
|
63
|
-
if (binding.
|
|
63
|
+
if (binding.script != null && binding.script.m_metadata != null) {
|
|
64
64
|
if (ShouldReconcile(binding)) {
|
|
65
65
|
binding.ReconcileMetadata();
|
|
66
66
|
serializedObject.ApplyModifiedProperties();
|
|
@@ -70,8 +70,8 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
70
70
|
CheckDefaults(binding);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
if (binding.
|
|
74
|
-
var metadata = serializedObject.FindProperty("
|
|
73
|
+
if (binding.script != null) {
|
|
74
|
+
var metadata = serializedObject.FindProperty("metadata");
|
|
75
75
|
var metadataName = metadata.FindPropertyRelative("name");
|
|
76
76
|
if (!string.IsNullOrEmpty(metadataName.stringValue)) {
|
|
77
77
|
DrawBinaryFileMetadata(binding, metadata);
|
|
@@ -87,6 +87,10 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
87
87
|
EditorGUILayout.LabelField("Component Id", binding.GetAirshipComponentId().ToString());
|
|
88
88
|
}
|
|
89
89
|
EditorGUILayout.EndHorizontal();
|
|
90
|
+
|
|
91
|
+
EditorGUILayout.BeginHorizontal();
|
|
92
|
+
EditorGUILayout.LabelField("Context", binding.context.ToString());
|
|
93
|
+
EditorGUILayout.EndHorizontal();
|
|
90
94
|
}
|
|
91
95
|
#endif
|
|
92
96
|
|
|
@@ -155,10 +159,10 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
private void CheckDefaults(AirshipComponent binding) {
|
|
158
|
-
var metadata = serializedObject.FindProperty("
|
|
162
|
+
var metadata = serializedObject.FindProperty("metadata");
|
|
159
163
|
|
|
160
164
|
var metadataProperties = metadata.FindPropertyRelative("properties");
|
|
161
|
-
var originalMetadataProperties = binding.
|
|
165
|
+
var originalMetadataProperties = binding.script.m_metadata.properties;
|
|
162
166
|
|
|
163
167
|
var setDefault = false;
|
|
164
168
|
|
|
@@ -201,12 +205,12 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
201
205
|
}
|
|
202
206
|
|
|
203
207
|
private bool ShouldReconcile(AirshipComponent binding) {
|
|
204
|
-
if (binding.
|
|
208
|
+
if (binding.metadata == null || binding.script.m_metadata == null) return false;
|
|
205
209
|
|
|
206
|
-
var metadata = serializedObject.FindProperty("
|
|
210
|
+
var metadata = serializedObject.FindProperty("metadata");
|
|
207
211
|
|
|
208
212
|
var metadataProperties = metadata.FindPropertyRelative("properties");
|
|
209
|
-
var originalMetadataProperties = binding.
|
|
213
|
+
var originalMetadataProperties = binding.script.m_metadata?.properties;
|
|
210
214
|
|
|
211
215
|
if (metadataProperties.arraySize != originalMetadataProperties.Count) {
|
|
212
216
|
return true;
|
|
@@ -282,27 +286,27 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
282
286
|
private void DrawScriptBindingProperties(AirshipComponent binding) {
|
|
283
287
|
EditorGUILayout.Space(5);
|
|
284
288
|
|
|
285
|
-
var script = binding.
|
|
286
|
-
var scriptPath = serializedObject.FindProperty("
|
|
289
|
+
var script = binding.script;
|
|
290
|
+
var scriptPath = serializedObject.FindProperty("scriptPath");
|
|
287
291
|
var content = new GUIContent {
|
|
288
292
|
text = "Script",
|
|
289
293
|
tooltip = scriptPath.stringValue,
|
|
290
294
|
};
|
|
291
295
|
|
|
292
|
-
if (
|
|
296
|
+
if (script != null && (binding.metadata != null || Application.isPlaying)) {
|
|
293
297
|
GUI.enabled = false;
|
|
294
298
|
}
|
|
295
299
|
|
|
296
300
|
var newScript = EditorGUILayout.ObjectField(content, script, typeof(AirshipScript), true);
|
|
297
301
|
if (newScript != script) {
|
|
298
|
-
binding.
|
|
299
|
-
scriptPath.stringValue = newScript == null ? "" :
|
|
302
|
+
binding.script = (AirshipScript)newScript;
|
|
303
|
+
scriptPath.stringValue = newScript == null ? "" : binding.script.m_path;
|
|
300
304
|
serializedObject.ApplyModifiedProperties();
|
|
301
305
|
}
|
|
302
306
|
|
|
303
307
|
GUI.enabled = true;
|
|
304
308
|
|
|
305
|
-
if (newScript == null) {
|
|
309
|
+
if (newScript == null && !Application.isPlaying) {
|
|
306
310
|
EditorGUILayout.Space(5);
|
|
307
311
|
|
|
308
312
|
var rect = GUILayoutUtility.GetLastRect();
|
|
@@ -312,8 +316,9 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
312
316
|
|
|
313
317
|
EditorGUILayout.BeginHorizontal();
|
|
314
318
|
if (GUILayout.Button("Select Airship Component", style)) {
|
|
315
|
-
AirshipComponentDropdown dd = new AirshipComponentDropdown(new AdvancedDropdownState(), (
|
|
316
|
-
binding.
|
|
319
|
+
AirshipComponentDropdown dd = new AirshipComponentDropdown(new AdvancedDropdownState(), (airshipScript) => {
|
|
320
|
+
binding.script = airshipScript;
|
|
321
|
+
binding.scriptPath = airshipScript.m_path;
|
|
317
322
|
serializedObject.ApplyModifiedProperties();
|
|
318
323
|
EditorUtility.SetDirty(serializedObject.targetObject);
|
|
319
324
|
});
|
|
@@ -333,11 +338,11 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
333
338
|
var propertyList = new List<SerializedProperty>();
|
|
334
339
|
var indexDictionary = new Dictionary<string, int>();
|
|
335
340
|
|
|
336
|
-
if (binding.
|
|
341
|
+
if (binding.script.m_metadata != null) {
|
|
337
342
|
for (var i = 0; i < metadataProperties.arraySize; i++) {
|
|
338
343
|
var property = metadataProperties.GetArrayElementAtIndex(i);
|
|
339
344
|
propertyList.Add(property);
|
|
340
|
-
indexDictionary.Add(binding.
|
|
345
|
+
indexDictionary.Add(binding.script.m_metadata.properties[i].name, i);
|
|
341
346
|
}
|
|
342
347
|
}
|
|
343
348
|
|
|
@@ -348,7 +353,7 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
348
353
|
);
|
|
349
354
|
|
|
350
355
|
foreach (var prop in propertyList) {
|
|
351
|
-
DrawCustomProperty(binding.GetInstanceID(), binding.
|
|
356
|
+
DrawCustomProperty(binding.GetInstanceID(), binding.script.m_metadata, prop);
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
359
|
|
|
@@ -532,13 +537,13 @@ public class ScriptBindingEditor : UnityEditor.Editor {
|
|
|
532
537
|
var scriptPath = buildInfo.GetScriptPathByTypeName(typeName);
|
|
533
538
|
|
|
534
539
|
switch (draggedObject) {
|
|
535
|
-
case AirshipComponent component when scriptPath != null && buildInfo.Inherits(component.
|
|
540
|
+
case AirshipComponent component when scriptPath != null && buildInfo.Inherits(component.script, scriptPath):
|
|
536
541
|
objRef = component;
|
|
537
542
|
break;
|
|
538
543
|
case AirshipComponent:
|
|
539
544
|
continue;
|
|
540
545
|
case GameObject go: {
|
|
541
|
-
var firstMatchingComponent = go.GetComponents<AirshipComponent>().FirstOrDefault(f => buildInfo.Inherits(f.
|
|
546
|
+
var firstMatchingComponent = go.GetComponents<AirshipComponent>().FirstOrDefault(f => buildInfo.Inherits(f.script, scriptPath));
|
|
542
547
|
if (firstMatchingComponent != null) {
|
|
543
548
|
objRef = firstMatchingComponent;
|
|
544
549
|
}
|
|
@@ -21,8 +21,7 @@ public class AirshipComponentHeaderHandler {
|
|
|
21
21
|
if (inspectorMode == InspectorMode.Debug) return;
|
|
22
22
|
|
|
23
23
|
var component = editorAndHeader.editor.target as Component;
|
|
24
|
-
if (component is not AirshipComponent binding || binding.
|
|
25
|
-
!binding.scriptFile.airshipBehaviour) continue;
|
|
24
|
+
if (component is not AirshipComponent binding || binding.script == null || !binding.script.airshipBehaviour) continue;
|
|
26
25
|
|
|
27
26
|
if(onGUIHandler.Method is { Name: "DrawWrappedHeaderGUI" }) continue;
|
|
28
27
|
|
|
@@ -15,7 +15,7 @@ internal static class AirshipComponentHeader {
|
|
|
15
15
|
private static readonly GUIContent label = new GUIContent("");
|
|
16
16
|
|
|
17
17
|
internal static float AfterComponentHeader(AirshipComponent component, Rect headerRect, bool isHeaderSelected) {
|
|
18
|
-
var scriptFile = component.
|
|
18
|
+
var scriptFile = component.script;
|
|
19
19
|
var metadata = scriptFile.m_metadata;
|
|
20
20
|
|
|
21
21
|
if (metadata == null) return 0f;
|
|
@@ -69,25 +69,23 @@ internal class AirshipComponentHeaderWrapper {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
public void DrawWrappedHeaderGUI() {
|
|
72
|
-
if (component == null || component.
|
|
72
|
+
if (component == null || component.script == null || !component.script.airshipBehaviour) {
|
|
73
73
|
RemoveOverrideHeader();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
Rect headerRect = headerElement.contentRect;
|
|
78
|
-
bool
|
|
78
|
+
bool headerIsSelected = headerElement.focusController.focusedElement == headerElement;
|
|
79
79
|
|
|
80
80
|
unityOnGUIHandler.Invoke();
|
|
81
81
|
|
|
82
|
-
if (component.
|
|
83
|
-
AirshipComponentHeader.AfterComponentHeader(component, headerRect,
|
|
82
|
+
if (component.metadata.name != "") {
|
|
83
|
+
AirshipComponentHeader.AfterComponentHeader(component, headerRect, headerIsSelected);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
private void RemoveOverrideHeader()
|
|
88
|
-
|
|
89
|
-
if(headerElement is null)
|
|
90
|
-
{
|
|
87
|
+
private void RemoveOverrideHeader() {
|
|
88
|
+
if (headerElement is null) {
|
|
91
89
|
return;
|
|
92
90
|
}
|
|
93
91
|
|
|
@@ -10,6 +10,10 @@ using Object = UnityEngine.Object;
|
|
|
10
10
|
namespace Code.Luau {
|
|
11
11
|
public static class AirshipScriptGUI {
|
|
12
12
|
internal delegate Object AirshipBehaviourValidator(Object[] references, SerializedProperty property);
|
|
13
|
+
|
|
14
|
+
private static bool IsBindableAsComponent(AirshipComponent component, AirshipScript file) {
|
|
15
|
+
return file.assetPath == component.script.assetPath;
|
|
16
|
+
}
|
|
13
17
|
|
|
14
18
|
private static Object Validate(Object[] references, AirshipScript script, AirshipComponent binding) {
|
|
15
19
|
if (references.Length <= 0) return null;
|
|
@@ -21,13 +25,13 @@ namespace Code.Luau {
|
|
|
21
25
|
references = gameObject.GetComponents(typeof(AirshipComponent));
|
|
22
26
|
foreach (var reference in references) {
|
|
23
27
|
if (reference != null && reference is AirshipComponent bindingComponent &&
|
|
24
|
-
(
|
|
28
|
+
(IsBindableAsComponent(bindingComponent, script) ||
|
|
25
29
|
buildInfo.ComponentIsValidInheritance(bindingComponent, script))) {
|
|
26
30
|
return reference;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
|
-
else if (objectReference is AirshipComponent otherBinding && (
|
|
34
|
+
else if (objectReference is AirshipComponent otherBinding && (IsBindableAsComponent(otherBinding, script) || buildInfo.ComponentIsValidInheritance(otherBinding, script))) {
|
|
31
35
|
return otherBinding;
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -130,8 +134,7 @@ namespace Code.Luau {
|
|
|
130
134
|
},
|
|
131
135
|
item => {
|
|
132
136
|
var itemScriptBinding = item.ToObject<AirshipComponent>();
|
|
133
|
-
return itemScriptBinding != null &&
|
|
134
|
-
itemScriptBinding.IsBindableAsComponent(script);
|
|
137
|
+
return itemScriptBinding != null && IsBindableAsComponent(itemScriptBinding, script);
|
|
135
138
|
}, null, script.m_metadata?.displayName ?? "AirshipBehaviour");
|
|
136
139
|
view.SetSearchText($"h:t:ScriptBinding"); // #m_fileFullPath={script.m_path}
|
|
137
140
|
|
|
@@ -168,7 +171,7 @@ namespace Code.Luau {
|
|
|
168
171
|
case EventType.Repaint: {
|
|
169
172
|
var temp = EditorGUIUtility.ObjectContent(obj, typeof(AirshipComponent));
|
|
170
173
|
|
|
171
|
-
var scriptInfo = airshipComponent && airshipComponent.
|
|
174
|
+
var scriptInfo = airshipComponent && airshipComponent.script ? airshipComponent.script : script;
|
|
172
175
|
|
|
173
176
|
var displayName = scriptInfo.m_metadata != null && !string.IsNullOrEmpty(scriptInfo.m_metadata.displayName)
|
|
174
177
|
? scriptInfo.m_metadata.displayName
|
|
@@ -3,38 +3,29 @@ using Luau;
|
|
|
3
3
|
using UnityEditor;
|
|
4
4
|
using UnityEngine;
|
|
5
5
|
|
|
6
|
-
namespace Editor
|
|
7
|
-
{
|
|
8
|
-
public static class BinaryFileDragDrop
|
|
9
|
-
{
|
|
6
|
+
namespace Editor {
|
|
7
|
+
public static class BinaryFileDragDrop {
|
|
10
8
|
[InitializeOnLoadMethod]
|
|
11
|
-
private static void OnLoad()
|
|
12
|
-
{
|
|
9
|
+
private static void OnLoad() {
|
|
13
10
|
DragAndDrop.AddDropHandler(OnInspectorDrop);
|
|
14
11
|
DragAndDrop.AddDropHandler(OnHierarchyDrop);
|
|
15
12
|
DragAndDrop.AddDropHandler(OnSceneDrop);
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
private static bool IsDraggingBinaryFile()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
if (obj is AirshipScript)
|
|
23
|
-
{
|
|
15
|
+
private static bool IsDraggingBinaryFile() {
|
|
16
|
+
foreach (var obj in DragAndDrop.objectReferences) {
|
|
17
|
+
if (obj is AirshipScript) {
|
|
24
18
|
return true;
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
21
|
return false;
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
private static Dictionary<string, AirshipScript> GetDraggedBinaryFiles()
|
|
31
|
-
{
|
|
24
|
+
private static Dictionary<string, AirshipScript> GetDraggedBinaryFiles() {
|
|
32
25
|
var binaryFiles = new Dictionary<string, AirshipScript>();
|
|
33
|
-
for (var i = 0; i < DragAndDrop.objectReferences.Length; i++)
|
|
34
|
-
{
|
|
26
|
+
for (var i = 0; i < DragAndDrop.objectReferences.Length; i++) {
|
|
35
27
|
var obj = DragAndDrop.objectReferences[i];
|
|
36
|
-
if (obj is AirshipScript binaryFile)
|
|
37
|
-
{
|
|
28
|
+
if (obj is AirshipScript binaryFile) {
|
|
38
29
|
var path = DragAndDrop.paths[i];
|
|
39
30
|
binaryFiles[path] = binaryFile;
|
|
40
31
|
}
|
|
@@ -43,27 +34,22 @@ namespace Editor
|
|
|
43
34
|
return binaryFiles;
|
|
44
35
|
}
|
|
45
36
|
|
|
46
|
-
private static DragAndDropVisualMode OnSceneDrop(object dropUpon, Vector3 worldPos, Vector2 viewportPos, Transform parent, bool perform)
|
|
47
|
-
|
|
48
|
-
if (!perform)
|
|
49
|
-
{
|
|
37
|
+
private static DragAndDropVisualMode OnSceneDrop(object dropUpon, Vector3 worldPos, Vector2 viewportPos, Transform parent, bool perform) {
|
|
38
|
+
if (!perform) {
|
|
50
39
|
return IsDraggingBinaryFile() && dropUpon != null ? DragAndDropVisualMode.Move : DragAndDropVisualMode.None;
|
|
51
40
|
}
|
|
52
41
|
|
|
53
42
|
GameObject go = null;
|
|
54
|
-
if (dropUpon is GameObject gameObj)
|
|
55
|
-
{
|
|
43
|
+
if (dropUpon is GameObject gameObj) {
|
|
56
44
|
go = gameObj;
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
if (go == null)
|
|
60
|
-
{
|
|
47
|
+
if (go == null) {
|
|
61
48
|
return DragAndDropVisualMode.None;
|
|
62
49
|
}
|
|
63
50
|
|
|
64
51
|
var binaryFiles = GetDraggedBinaryFiles();
|
|
65
|
-
if (binaryFiles.Count == 0)
|
|
66
|
-
{
|
|
52
|
+
if (binaryFiles.Count == 0) {
|
|
67
53
|
return DragAndDropVisualMode.None;
|
|
68
54
|
}
|
|
69
55
|
|
|
@@ -72,42 +58,34 @@ namespace Editor
|
|
|
72
58
|
return DragAndDropVisualMode.Move;
|
|
73
59
|
}
|
|
74
60
|
|
|
75
|
-
private static DragAndDropVisualMode OnHierarchyDrop(int instanceId, HierarchyDropFlags dropMode, Transform parent, bool perform)
|
|
76
|
-
|
|
77
|
-
if (!perform)
|
|
78
|
-
{
|
|
61
|
+
private static DragAndDropVisualMode OnHierarchyDrop(int instanceId, HierarchyDropFlags dropMode, Transform parent, bool perform) {
|
|
62
|
+
if (!perform) {
|
|
79
63
|
return IsDraggingBinaryFile() && dropMode == HierarchyDropFlags.DropUpon ? DragAndDropVisualMode.Move : DragAndDropVisualMode.None;
|
|
80
64
|
}
|
|
81
65
|
|
|
82
|
-
if (dropMode != HierarchyDropFlags.DropUpon)
|
|
83
|
-
{
|
|
66
|
+
if (dropMode != HierarchyDropFlags.DropUpon) {
|
|
84
67
|
return DragAndDropVisualMode.None;
|
|
85
68
|
}
|
|
86
69
|
|
|
87
70
|
// Grab the game object:
|
|
88
71
|
GameObject go = null;
|
|
89
|
-
if (instanceId != 0)
|
|
90
|
-
{
|
|
72
|
+
if (instanceId != 0) {
|
|
91
73
|
var target = EditorUtility.InstanceIDToObject(instanceId);
|
|
92
|
-
if (target is GameObject gameObj)
|
|
93
|
-
{
|
|
74
|
+
if (target is GameObject gameObj) {
|
|
94
75
|
go = gameObj;
|
|
95
76
|
}
|
|
96
77
|
}
|
|
97
|
-
else if (parent != null)
|
|
98
|
-
{
|
|
78
|
+
else if (parent != null) {
|
|
99
79
|
// If instanceId is 0, then we're dragging into a prefab and need to use the 'parent' transform:
|
|
100
80
|
go = parent.gameObject;
|
|
101
81
|
}
|
|
102
82
|
|
|
103
|
-
if (go == null)
|
|
104
|
-
{
|
|
83
|
+
if (go == null) {
|
|
105
84
|
return DragAndDropVisualMode.None;
|
|
106
85
|
}
|
|
107
86
|
|
|
108
87
|
var binaryFiles = GetDraggedBinaryFiles();
|
|
109
|
-
if (binaryFiles.Count == 0)
|
|
110
|
-
{
|
|
88
|
+
if (binaryFiles.Count == 0) {
|
|
111
89
|
return DragAndDropVisualMode.None;
|
|
112
90
|
}
|
|
113
91
|
|
|
@@ -116,27 +94,22 @@ namespace Editor
|
|
|
116
94
|
return DragAndDropVisualMode.Move;
|
|
117
95
|
}
|
|
118
96
|
|
|
119
|
-
private static DragAndDropVisualMode OnInspectorDrop(object[] targets, bool perform)
|
|
120
|
-
{
|
|
97
|
+
private static DragAndDropVisualMode OnInspectorDrop(object[] targets, bool perform) {
|
|
121
98
|
// If hovering, just quickly check if any of the grabbed items are a BinaryFile:
|
|
122
|
-
if (!perform)
|
|
123
|
-
{
|
|
99
|
+
if (!perform) {
|
|
124
100
|
return IsDraggingBinaryFile() ? DragAndDropVisualMode.Move : DragAndDropVisualMode.None;
|
|
125
101
|
}
|
|
126
102
|
|
|
127
103
|
// Collect all dragged binary files:
|
|
128
104
|
var binaryFiles = GetDraggedBinaryFiles();
|
|
129
105
|
|
|
130
|
-
if (binaryFiles.Count == 0)
|
|
131
|
-
{
|
|
106
|
+
if (binaryFiles.Count == 0) {
|
|
132
107
|
return DragAndDropVisualMode.None;
|
|
133
108
|
}
|
|
134
109
|
|
|
135
110
|
// Add the script bindings into the given targets:
|
|
136
|
-
foreach (var target in targets)
|
|
137
|
-
|
|
138
|
-
if (target is GameObject go)
|
|
139
|
-
{
|
|
111
|
+
foreach (var target in targets) {
|
|
112
|
+
if (target is GameObject go) {
|
|
140
113
|
AddAllScriptBindings(go, binaryFiles);
|
|
141
114
|
}
|
|
142
115
|
}
|
|
@@ -144,30 +117,25 @@ namespace Editor
|
|
|
144
117
|
return DragAndDropVisualMode.Move;
|
|
145
118
|
}
|
|
146
119
|
|
|
147
|
-
private static void AddAllScriptBindings(GameObject target, Dictionary<string, AirshipScript> binaryFiles)
|
|
148
|
-
|
|
149
|
-
foreach (var pair in binaryFiles)
|
|
150
|
-
{
|
|
120
|
+
private static void AddAllScriptBindings(GameObject target, Dictionary<string, AirshipScript> binaryFiles) {
|
|
121
|
+
foreach (var pair in binaryFiles) {
|
|
151
122
|
AddScriptBinding(target, pair.Value, pair.Key);
|
|
152
123
|
}
|
|
153
124
|
}
|
|
154
125
|
|
|
155
|
-
private static void AddScriptBinding(GameObject target, AirshipScript airshipScript, string path)
|
|
156
|
-
{
|
|
126
|
+
private static void AddScriptBinding(GameObject target, AirshipScript airshipScript, string path) {
|
|
157
127
|
if (HasScriptBinding(target, path)) return;
|
|
158
128
|
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
129
|
+
var component = target.AddComponent<AirshipComponent>();
|
|
130
|
+
component.script = airshipScript;
|
|
131
|
+
component.scriptPath = airshipScript.m_path;
|
|
132
|
+
EditorUtility.SetDirty(component);
|
|
162
133
|
}
|
|
163
134
|
|
|
164
|
-
private static bool HasScriptBinding(GameObject target, string path)
|
|
165
|
-
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
if (binding.m_fileFullPath == path)
|
|
170
|
-
{
|
|
135
|
+
private static bool HasScriptBinding(GameObject target, string path) {
|
|
136
|
+
var components = target.GetComponents<AirshipComponent>();
|
|
137
|
+
foreach (var component in components) {
|
|
138
|
+
if (component.scriptPath == path) {
|
|
171
139
|
return true;
|
|
172
140
|
}
|
|
173
141
|
}
|
package/Editor/LuauImporter.cs
CHANGED
|
@@ -132,7 +132,7 @@ public class LuauImporter : UnityEditor.AssetImporters.ScriptedImporter
|
|
|
132
132
|
|
|
133
133
|
// Compile
|
|
134
134
|
StopwatchCompile.Start();
|
|
135
|
-
var len = Encoding.
|
|
135
|
+
var len = Encoding.UTF8.GetByteCount(data);
|
|
136
136
|
IntPtr res = LuauPlugin.LuauCompileCode(dataStr, len, filenameStr, ctx.assetPath.Length, 1);
|
|
137
137
|
StopwatchCompile.Stop();
|
|
138
138
|
|
|
@@ -62,12 +62,13 @@ namespace Airship.Editor {
|
|
|
62
62
|
try {
|
|
63
63
|
if (GUI.Button(rect, content, "AC Button")) {
|
|
64
64
|
var airshipComponentDropdown = new AirshipComponentDropdown(new AdvancedDropdownState(),
|
|
65
|
-
(
|
|
65
|
+
(airshipScript) => {
|
|
66
66
|
var targetGo = firstPropertyEditor.target as GameObject;
|
|
67
67
|
if (!targetGo) return;
|
|
68
68
|
|
|
69
|
-
var
|
|
70
|
-
|
|
69
|
+
var component = targetGo.AddComponent<AirshipComponent>();
|
|
70
|
+
component.script = airshipScript;
|
|
71
|
+
component.scriptPath = airshipScript.m_path;
|
|
71
72
|
|
|
72
73
|
EditorUtility.SetDirty(targetGo);
|
|
73
74
|
});
|
|
@@ -11,8 +11,8 @@ namespace Airship.Editor {
|
|
|
11
11
|
[MenuItem("CONTEXT/" + nameof(AirshipComponent) + "/Reset", priority = 0)]
|
|
12
12
|
public static void Test(MenuCommand command) {
|
|
13
13
|
var binding = command.context as AirshipComponent;
|
|
14
|
-
if (binding == null || binding.
|
|
15
|
-
foreach (var property in binding.
|
|
14
|
+
if (binding == null || binding.metadata == null) return;
|
|
15
|
+
foreach (var property in binding.metadata.properties.Where(property => property.modified)) {
|
|
16
16
|
property.SetDefaultAsValue();
|
|
17
17
|
property.modified = false;
|
|
18
18
|
}
|
|
@@ -25,25 +25,25 @@ namespace Airship.Editor {
|
|
|
25
25
|
[MenuItem("CONTEXT/" + nameof(AirshipComponent) + "/Edit Script")]
|
|
26
26
|
public static void EditScript(MenuCommand command) {
|
|
27
27
|
var binding = command.context as AirshipComponent;
|
|
28
|
-
if (binding == null || binding.
|
|
28
|
+
if (binding == null || binding.metadata == null) return;
|
|
29
29
|
|
|
30
|
-
TypescriptProjectsService.OpenFileInEditor(binding.
|
|
30
|
+
TypescriptProjectsService.OpenFileInEditor(binding.script.assetPath);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
[MenuItem("CONTEXT/" + nameof(AirshipComponent) + "/Edit Script", validate = true)]
|
|
34
34
|
[MenuItem("CONTEXT/" + nameof(AirshipComponent) + "/Remove Script", validate = true)]
|
|
35
35
|
public static bool ValidateRemoveScript(MenuCommand command) {
|
|
36
36
|
var binding = command.context as AirshipComponent;
|
|
37
|
-
return binding != null && binding.
|
|
37
|
+
return binding != null && binding.script != null;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
[MenuItem("CONTEXT/" + nameof(AirshipComponent) + "/Remove Script")]
|
|
41
41
|
public static void RemoveScript(MenuCommand command) {
|
|
42
42
|
var binding = command.context as AirshipComponent;
|
|
43
|
-
if (binding == null || binding.
|
|
43
|
+
if (binding == null || binding.metadata == null) return;
|
|
44
44
|
|
|
45
|
-
binding.
|
|
46
|
-
binding.
|
|
45
|
+
binding.script = null;
|
|
46
|
+
binding.scriptPath = null;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|