gg.easy.airship 0.1.2104 → 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 +38 -29
- package/Editor/Accessories/Clothing/PlatformGearBundleManifestEditor.cs +11 -2
- package/Editor/AirAsset/AirAssetBundleEditor.cs +2 -2
- 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/EditorIntegrationsConfig.cs +1 -1
- package/Editor/EditorInternal/EditorGUIExtensions.cs +5 -0
- package/Editor/EditorInternal/EditorGUIExtensions.cs.meta +3 -0
- package/Editor/LuauImporter.cs +1 -1
- package/Editor/Publish/Deploy.cs +16 -5
- package/Editor/TypescriptCompiler~/utsc.js +140 -140
- package/Editor/TypescriptServices/Compiler/TypescriptCompilationService.cs +97 -42
- package/Editor/TypescriptServices/Editor/AirshipComponentButton.cs +4 -3
- package/Editor/TypescriptServices/Editor/AirshipScriptFileEditor.cs +8 -8
- package/Editor/TypescriptServices/Editor/TypescriptOptions.cs +110 -59
- package/Editor/TypescriptServices/Projects/TypescriptProject.cs +2 -0
- package/Editor/TypescriptServices/Projects/TypescriptProjectsService.cs +2 -1
- package/Editor/TypescriptServices/TypescriptServices.cs +1 -0
- package/Editor/Util/AirshipEditorGUI.cs +87 -0
- package/Runtime/Code/Agones/AutoShutdownBridge.cs +1 -1
- package/Runtime/Code/AirAssetBundle/AirAssetBundle.cs +9 -5
- 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 +2 -8
- package/Runtime/Code/Player/Accessories/AccessoryComponent.cs +7 -0
- 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/Code/VoxelWorld/VoxelBlockDefinitionList.cs +37 -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.meta → Info.plist.meta} +1 -1
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS.meta +8 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/_CodeSignature/CodeResources.meta +7 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/_CodeSignature.meta +8 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents.meta +8 -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/ThirdParty/UnityTweens/Runtime/AirshipTweenExtensions.cs +11 -0
- package/URP/AirshipURPAsset_Renderer.asset +34 -37
- package/URP/Shaders/AirshipCharacterAlpha.shader +95 -0
- package/URP/Shaders/AirshipCharacterAlpha.shader.meta +9 -0
- package/URP/Shaders/AirshipCharacterBehindWalls.shader +59 -0
- package/URP/Shaders/AirshipCharacterBehindWalls.shader.meta +9 -0
- package/URP/Shaders/AirshipCharacterStencil.shader +19 -0
- package/URP/Shaders/AirshipCharacterStencil.shader.meta +9 -0
- package/URP/Shaders/CharacterOverlayAlpha.mat +167 -0
- package/URP/Shaders/CharacterOverlayAlpha.mat.meta +8 -0
- package/URP/Shaders/CharacterOverlayBehindWalls.mat +167 -0
- package/URP/Shaders/CharacterOverlayBehindWalls.mat.meta +8 -0
- package/URP/Shaders/CharacterOverlayStencil.mat +167 -0
- package/URP/Shaders/CharacterOverlayStencil.mat.meta +8 -0
- package/URP/Shaders.meta +8 -0
- 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
|
@@ -34,8 +34,8 @@ namespace Editor.Accessories {
|
|
|
34
34
|
private AccessoryPrefabEditor prefabEditor;
|
|
35
35
|
private GameObject characterGO;
|
|
36
36
|
List<AccessoryComponent> allAccessories = new List<AccessoryComponent>();
|
|
37
|
-
private AccessoryComponent
|
|
38
|
-
private AccessoryComponent
|
|
37
|
+
private AccessoryComponent editingAccessoryComponent;
|
|
38
|
+
private AccessoryComponent referenceAccessoryComponent;
|
|
39
39
|
private ListView _listPane;
|
|
40
40
|
|
|
41
41
|
private Label _selectedItemLabel;
|
|
@@ -46,7 +46,7 @@ namespace Editor.Accessories {
|
|
|
46
46
|
|
|
47
47
|
private static void Log(string message){
|
|
48
48
|
#if AIRSHIP_INTERNAL
|
|
49
|
-
Debug.Log("AccEditor: " + message);
|
|
49
|
+
// Debug.Log("AccEditor: " + message);
|
|
50
50
|
#endif
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -57,8 +57,8 @@ namespace Editor.Accessories {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
_prefabStage = null;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
editingAccessoryComponent = null;
|
|
61
|
+
referenceAccessoryComponent = null;
|
|
62
62
|
|
|
63
63
|
if (characterGO) {
|
|
64
64
|
DestroyImmediate(characterGO);
|
|
@@ -130,7 +130,7 @@ namespace Editor.Accessories {
|
|
|
130
130
|
saveBtn.text = "Save";
|
|
131
131
|
buttonPanel.Add(saveBtn);
|
|
132
132
|
saveBtn.clickable.clicked += () => {
|
|
133
|
-
if (
|
|
133
|
+
if (editingAccessoryComponent == null || referenceAccessoryComponent == null) return;
|
|
134
134
|
SaveCurrentAccessory();
|
|
135
135
|
};
|
|
136
136
|
|
|
@@ -139,7 +139,7 @@ namespace Editor.Accessories {
|
|
|
139
139
|
resetBtn.text = "Reset";
|
|
140
140
|
buttonPanel.Add(resetBtn);
|
|
141
141
|
resetBtn.clickable.clicked += () => {
|
|
142
|
-
if (
|
|
142
|
+
if (editingAccessoryComponent == null || referenceAccessoryComponent == null) return;
|
|
143
143
|
ResetCurrentAccessory();
|
|
144
144
|
};
|
|
145
145
|
|
|
@@ -219,9 +219,9 @@ namespace Editor.Accessories {
|
|
|
219
219
|
|
|
220
220
|
private void ClearCurrentAccessory() {
|
|
221
221
|
Log("ClearCurrentAccessory");
|
|
222
|
-
if (
|
|
223
|
-
DestroyImmediate(
|
|
224
|
-
|
|
222
|
+
if (editingAccessoryComponent) {
|
|
223
|
+
DestroyImmediate(editingAccessoryComponent.gameObject);
|
|
224
|
+
editingAccessoryComponent = null;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if (_selectedItemLabel != null) {
|
|
@@ -229,9 +229,11 @@ namespace Editor.Accessories {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
|
|
233
|
+
private bool hasFramedView = false;
|
|
232
234
|
private void BuildScene(AccessoryComponent accessoryComponent, bool forceRedraw = false) {
|
|
233
|
-
var newItem = accessoryComponent !=
|
|
234
|
-
Log("Building Scene. New Item: " + newItem + " acc: " + accessoryComponent?.gameObject.name + " oldAcc: " +
|
|
235
|
+
var newItem = accessoryComponent != referenceAccessoryComponent;
|
|
236
|
+
Log("Building Scene. New Item: " + newItem + " acc: " + accessoryComponent?.gameObject.name + " oldAcc: " + referenceAccessoryComponent?.gameObject.name);
|
|
235
237
|
if (_prefabStage == null || characterGO == null) {
|
|
236
238
|
CreateStage();
|
|
237
239
|
}
|
|
@@ -252,17 +254,24 @@ namespace Editor.Accessories {
|
|
|
252
254
|
return;
|
|
253
255
|
}
|
|
254
256
|
|
|
255
|
-
|
|
256
257
|
var go = (GameObject)PrefabUtility.InstantiatePrefab(accessoryComponent.gameObject, parent);
|
|
257
258
|
if (go != null) {
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
this.editingAccessoryComponent = go.GetComponent<AccessoryComponent>();
|
|
260
|
+
this.referenceAccessoryComponent = accessoryComponent;
|
|
260
261
|
//accessoryComponent.gameObject.hideFlags = HideFlags.DontSave;
|
|
261
262
|
Selection.activeObject = go;
|
|
262
263
|
Selection.activeGameObject = go;
|
|
263
|
-
SceneView.FrameLastActiveSceneView();
|
|
264
|
+
// SceneView.FrameLastActiveSceneView();
|
|
264
265
|
|
|
265
266
|
_selectedItemLabel.text = accessoryComponent.name;
|
|
267
|
+
|
|
268
|
+
if (this.editingAccessoryComponent.skinnedToCharacter) {
|
|
269
|
+
var skinnedMeshRenderers = go.GetComponentsInChildren<SkinnedMeshRenderer>();
|
|
270
|
+
foreach (var skinnedMeshRenderer in skinnedMeshRenderers) {
|
|
271
|
+
skinnedMeshRenderer.rootBone = rig.bodyMesh.rootBone;
|
|
272
|
+
skinnedMeshRenderer.bones = rig.bodyMesh.bones;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
266
275
|
}
|
|
267
276
|
}
|
|
268
277
|
}
|
|
@@ -366,30 +375,30 @@ namespace Editor.Accessories {
|
|
|
366
375
|
}
|
|
367
376
|
|
|
368
377
|
private void SaveCurrentAccessory() {
|
|
369
|
-
if (!
|
|
378
|
+
if (!referenceAccessoryComponent) {
|
|
370
379
|
Debug.LogError("Trying to save with an empty accessory component");
|
|
371
380
|
return;
|
|
372
381
|
}
|
|
373
382
|
|
|
374
|
-
Log("Saving acc: " +
|
|
375
|
-
Undo.RecordObject(
|
|
376
|
-
|
|
377
|
-
PrefabUtility.RecordPrefabInstancePropertyModifications(
|
|
378
|
-
EditorUtility.SetDirty(
|
|
379
|
-
PrefabUtility.ApplyPrefabInstance(
|
|
383
|
+
Log("Saving acc: " + referenceAccessoryComponent.gameObject.name);
|
|
384
|
+
Undo.RecordObject(referenceAccessoryComponent, "Save Accessory");
|
|
385
|
+
referenceAccessoryComponent.Copy(editingAccessoryComponent);
|
|
386
|
+
PrefabUtility.RecordPrefabInstancePropertyModifications(referenceAccessoryComponent);
|
|
387
|
+
EditorUtility.SetDirty(referenceAccessoryComponent);
|
|
388
|
+
PrefabUtility.ApplyPrefabInstance(editingAccessoryComponent.gameObject, InteractionMode.UserAction);
|
|
380
389
|
AssetDatabase.SaveAssets();
|
|
381
390
|
}
|
|
382
391
|
|
|
383
392
|
private void ResetCurrentAccessory() {
|
|
384
|
-
if(!
|
|
393
|
+
if(!referenceAccessoryComponent){
|
|
385
394
|
Debug.LogError("Trying to reset an empty accessory component");
|
|
386
395
|
return;
|
|
387
396
|
}
|
|
388
|
-
Log("Resetting acc: " +
|
|
389
|
-
Undo.RecordObject(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
PrefabUtility.RevertPrefabInstance(
|
|
397
|
+
Log("Resetting acc: " + referenceAccessoryComponent.gameObject.name);
|
|
398
|
+
Undo.RecordObject(editingAccessoryComponent.transform, "ResetTransform");
|
|
399
|
+
editingAccessoryComponent.transform.SetLocalPositionAndRotation(referenceAccessoryComponent.localPosition, referenceAccessoryComponent.localRotation);
|
|
400
|
+
editingAccessoryComponent.localScale = referenceAccessoryComponent.localScale;
|
|
401
|
+
PrefabUtility.RevertPrefabInstance(editingAccessoryComponent.gameObject, InteractionMode.UserAction);
|
|
393
402
|
}
|
|
394
403
|
|
|
395
404
|
private void SetPose(PoseType poseType){
|
|
@@ -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;
|
|
@@ -224,7 +232,8 @@ namespace Editor.Accessories.Clothing {
|
|
|
224
232
|
category = category,
|
|
225
233
|
subcategory = subcategory,
|
|
226
234
|
};
|
|
227
|
-
var
|
|
235
|
+
var url = $"{AirshipPlatformUrl.contentService}/gear/class-id/{gear.classId}";
|
|
236
|
+
var req = UnityWebRequest.Put(url,
|
|
228
237
|
JsonUtility.ToJson(data));
|
|
229
238
|
req.method = "PATCH";
|
|
230
239
|
req.SetRequestHeader("Content-Type","application/json");
|
|
@@ -232,7 +241,7 @@ namespace Editor.Accessories.Clothing {
|
|
|
232
241
|
req.SetRequestHeader("x-airship-ignore-rate-limit", "true");
|
|
233
242
|
await req.SendWebRequest();
|
|
234
243
|
if (req.result != UnityWebRequest.Result.Success) {
|
|
235
|
-
Debug.LogError("patch classId
|
|
244
|
+
Debug.LogError($"patch classId. url: {url}, response: {req.downloadHandler.text}, authToken: {InternalHttpManager.editorAuthToken}");
|
|
236
245
|
return;
|
|
237
246
|
}
|
|
238
247
|
}
|
|
@@ -4,7 +4,7 @@ using System.IO;
|
|
|
4
4
|
using System.Linq;
|
|
5
5
|
using System.Threading.Tasks;
|
|
6
6
|
using Code.Accessories.Clothing;
|
|
7
|
-
using Code.
|
|
7
|
+
using Code.AirAssetBundle;
|
|
8
8
|
using Code.Bootstrap;
|
|
9
9
|
using Code.Http.Internal;
|
|
10
10
|
using Code.Platform.Shared;
|
|
@@ -174,7 +174,7 @@ namespace Editor.AirAsset {
|
|
|
174
174
|
var addressableNames = assetPaths
|
|
175
175
|
.Select((p) => p.ToLower())
|
|
176
176
|
.Select((p) => {
|
|
177
|
-
if (p.Contains(target.name + ".asset")) {
|
|
177
|
+
if (p.Contains(target.name.ToLower() + ".asset")) {
|
|
178
178
|
// custom name so it's easier to find when loading
|
|
179
179
|
return "_AirAssetBundle";
|
|
180
180
|
}
|
|
@@ -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
|