gg.easy.airship 0.1.2115 → 0.1.2117

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.
Files changed (67) hide show
  1. package/Editor/AirshipComponentEditor.cs +74 -10
  2. package/Editor/AirshipScriptGUI.cs +1 -1
  3. package/Editor/Artifacts/AirshipLocalArtifactDatabase.cs +224 -0
  4. package/Editor/Artifacts/AirshipLocalArtifactDatabase.cs.meta +3 -0
  5. package/Editor/Artifacts/AirshipReconciliationService.cs +374 -0
  6. package/Editor/Artifacts/AirshipReconciliationService.cs.meta +3 -0
  7. package/Editor/Artifacts.meta +3 -0
  8. package/Editor/AssetIcons.svg +35 -5
  9. package/Editor/BuildMenu.cs +7 -8
  10. package/Editor/CreateAssetBundles.cs +2 -1
  11. package/Editor/EditorIntegrationsConfig.cs +14 -1
  12. package/Editor/EditorInternal/AirshipEditorInternals.cs +15 -0
  13. package/Editor/EditorInternal/AssemblyInfo.cs +3 -0
  14. package/Editor/EditorInternal/AssemblyInfo.cs.meta +3 -0
  15. package/Editor/EditorInternal/AssetImporterExtensions.cs +15 -0
  16. package/Editor/EditorInternal/AssetImporterExtensions.cs.meta +3 -0
  17. package/Editor/EditorInternal/GUIViewExtensions.cs +1 -1
  18. package/Editor/EditorInternal/InspectorExtensions.cs +2 -2
  19. package/Editor/EditorInternal/LogExtensions.cs +1 -1
  20. package/Editor/EditorInternal/Unity.InternalAPIEditorBridge.015.asmdef +15 -2
  21. package/Editor/Settings/AirshipScriptingSettingsProvider.cs +5 -3
  22. package/Editor/Settings/AirshipSettingsProvider.cs +29 -1
  23. package/Editor/Toolbar/EditorToolbar.cs +15 -6
  24. package/Editor/TypescriptCompiler~/utsc.js +92 -92
  25. package/Editor/TypescriptImporter.cs +14 -2
  26. package/Editor/TypescriptOk.png +0 -0
  27. package/Editor/TypescriptOkLight.png +0 -0
  28. package/Editor/TypescriptOkLight.png.meta +156 -0
  29. package/Editor/TypescriptServices/Compiler/TypescriptCompilationService.cs +81 -21
  30. package/Editor/TypescriptServices/Dependencies/TypescriptPrefabDependencyService.cs +12 -0
  31. package/Editor/TypescriptServices/Dependencies/TypescriptPrefabDependencyService.cs.meta +3 -0
  32. package/Editor/TypescriptServices/Dependencies.meta +3 -0
  33. package/Editor/TypescriptServices/Editor/AirshipScriptFileEditor.cs +12 -10
  34. package/Editor/TypescriptServices/Editor/TypescriptOptions.cs +78 -38
  35. package/Editor/TypescriptServices/Editor/TypescriptStatusbar.cs +7 -14
  36. package/Editor/TypescriptServices/TypescriptServices.cs +51 -4
  37. package/Runtime/Code/Bundles/SystemRoot.cs +19 -0
  38. package/Runtime/Code/Components/AirshipScrollRectConfig.cs +1 -1
  39. package/Runtime/Code/CoreUI/Login/LoginApp.cs +4 -2
  40. package/Runtime/Code/CoreUI/Login/LoginWithApple.cs +2 -0
  41. package/Runtime/Code/Luau/AirshipComponent.cs +73 -94
  42. package/Runtime/Code/Luau/AirshipScript.cs +43 -2
  43. package/Runtime/Code/Luau/AssemblyInfo.cs +3 -0
  44. package/Runtime/Code/Luau/AssemblyInfo.cs.meta +3 -0
  45. package/Runtime/Code/Luau/Editor/LuauCoreEditor.cs +11 -3
  46. package/Runtime/Code/Luau/LuauMetadata.cs +51 -2
  47. package/Runtime/Code/Luau/LuauPlugin.cs +14 -0
  48. package/Runtime/Code/LuauAPI/Bridge.cs +60 -50
  49. package/Runtime/Code/Player/Character/Animation/ClipReplacer/AnimatorClipReplacer.cs +1 -2
  50. package/Runtime/Code/Player/Character/MovementSystem/CharacterMovement.cs +39 -6
  51. package/Runtime/Code/Steam/SteamLuauAPI.cs +16 -6
  52. package/Runtime/DevConsole/Runtime/DevConsoleMono.cs +5 -2
  53. package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
  54. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  55. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  56. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  57. package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
  58. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  59. package/Runtime/Prefabs/LuauCore.prefab +18 -50
  60. package/Runtime/Resources/Img/spinner-third-sharp-solid.png +0 -0
  61. package/ScriptableBuildPipeline/Editor/Shared/BuildContent.cs +1 -1
  62. package/URP/AirshipURPAssetBaked.asset +1 -1
  63. package/package.json +1 -1
  64. package/temp.txt +0 -0
  65. package/temp.txt.meta +7 -0
  66. package/Editor/EditorInternal/EditorGUIExtensions.cs +0 -5
  67. /package/Editor/EditorInternal/{EditorGUIExtensions.cs.meta → AirshipEditorInternals.cs.meta} +0 -0
@@ -7,7 +7,9 @@ using System;
7
7
  using System.Collections.Generic;
8
8
  using System.Linq;
9
9
  using System.Text;
10
+ using Airship.Editor;
10
11
  using Code.Luau;
12
+ using Editor.EditorInternal;
11
13
  using JetBrains.Annotations;
12
14
  using Luau;
13
15
  using UnityEditor.IMGUI.Controls;
@@ -62,7 +64,7 @@ public class ScriptBindingEditor : UnityEditor.Editor {
62
64
 
63
65
  if (binding.script != null && binding.script.m_metadata != null) {
64
66
  if (ShouldReconcile(binding)) {
65
- binding.ReconcileMetadata();
67
+ binding.ReconcileMetadata(ReconcileSource.Inspector);
66
68
  serializedObject.ApplyModifiedProperties();
67
69
  serializedObject.Update();
68
70
  }
@@ -160,16 +162,23 @@ public class ScriptBindingEditor : UnityEditor.Editor {
160
162
 
161
163
  private void CheckDefaults(AirshipComponent binding) {
162
164
  var metadata = serializedObject.FindProperty("metadata");
165
+ if (metadata == null) {
166
+ Debug.LogError($"Metadata is null on binding {binding.name}");
167
+ return;
168
+ }
163
169
 
164
170
  var metadataProperties = metadata.FindPropertyRelative("properties");
165
171
  var originalMetadataProperties = binding.script.m_metadata.properties;
166
-
172
+
167
173
  var setDefault = false;
168
174
 
169
175
  for (var i = 0; i < metadataProperties.arraySize; i++) {
170
176
  var metadataProperty = metadataProperties.GetArrayElementAtIndex(i);
171
177
  var propName = metadataProperty.FindPropertyRelative("name").stringValue;
172
178
  var originalProperty = originalMetadataProperties.Find((p) => p.name == propName);
179
+ if (originalProperty == null) {
180
+ continue;
181
+ }
173
182
 
174
183
  var modified = metadataProperty.FindPropertyRelative("modified");
175
184
  if (modified.boolValue) {
@@ -338,15 +347,28 @@ public class ScriptBindingEditor : UnityEditor.Editor {
338
347
  var propertyList = new List<SerializedProperty>();
339
348
  var indexDictionary = new Dictionary<string, int>();
340
349
 
341
- if (binding.script.m_metadata != null) {
342
- for (var i = 0; i < metadataProperties.arraySize; i++) {
343
- var property = metadataProperties.GetArrayElementAtIndex(i);
344
- propertyList.Add(property);
345
- indexDictionary.Add(binding.script.m_metadata.properties[i].name, i);
350
+ var bindingMetadata = binding.script.m_metadata;
351
+ var bindingProperties = bindingMetadata.properties;
352
+
353
+ var dataIsInvalid = false;
354
+
355
+ for (var i = 0; i < metadataProperties.arraySize; i++) {
356
+ var property = metadataProperties.GetArrayElementAtIndex(i);
357
+ var propertyName = property.FindPropertyRelative("name").stringValue;
358
+ var bindingPropertyIndex = bindingProperties.FindIndex(p => p.name == propertyName);
359
+ if (bindingPropertyIndex == -1) {
360
+ //#if AIRSHIP_INTERNAL
361
+ EditorGUILayout.LabelField(propertyName, "(Missing)", EditorStyles.miniLabel);
362
+ dataIsInvalid = true;
363
+ //#endif
364
+ continue;
346
365
  }
366
+
367
+ var bindingProperty = bindingProperties[bindingPropertyIndex];
368
+ propertyList.Add(property);
369
+ indexDictionary.Add(bindingProperty.name, bindingPropertyIndex);
347
370
  }
348
-
349
-
371
+
350
372
  // Sort properties by order in non-serialized object
351
373
  propertyList.Sort((p1, p2) =>
352
374
  indexDictionary[p1.FindPropertyRelative("name").stringValue] > indexDictionary[p2.FindPropertyRelative("name").stringValue] ? 1 : -1
@@ -355,8 +377,32 @@ public class ScriptBindingEditor : UnityEditor.Editor {
355
377
  foreach (var prop in propertyList) {
356
378
  DrawCustomProperty(binding.GetInstanceID(), binding.script.m_metadata, prop);
357
379
  }
380
+
381
+ #if AIRSHIP_DEBUG
382
+ AirshipEditorGUI.HorizontalLine();
383
+ EditorGUILayout.LabelField("Debug", EditorStyles.boldLabel);
384
+
385
+ GUI.enabled = false;
386
+ EditorGUILayout.LabelField("GUID", binding.guid);
387
+ EditorGUILayout.Toggle("Instance", PrefabUtility.IsPartOfAnyPrefab(binding));
388
+ EditorGUILayout.LabelField("File Hash", binding.script.sourceFileHash);
389
+ EditorGUILayout.LabelField("Component Hash", binding.componentHash);
390
+
391
+ GUI.enabled = true;
392
+
393
+ EditorGUILayout.BeginHorizontal();
394
+ {
395
+ GUILayout.FlexibleSpace();
396
+ if (GUILayout.Button("Reconcile")) {
397
+ AirshipReconciliationService.ReconcileComponent(binding);
398
+ }
399
+ }
400
+ EditorGUILayout.EndHorizontal();
401
+ #endif
358
402
  }
359
403
 
404
+ private bool showDebug = true;
405
+
360
406
  // NOTE: This will probably change. Whole "decorators" structure will probably be redesigned.
361
407
  private bool HasDecorator(SerializedProperty modifiers, string modifier) {
362
408
  for (var i = 0; i < modifiers.arraySize; i++) {
@@ -390,7 +436,12 @@ public class ScriptBindingEditor : UnityEditor.Editor {
390
436
 
391
437
  var documentation = bindingProp.Documentation;
392
438
  var tooltip = GetTooltip(documentation ?? "", decoratorDictionary);
393
-
439
+
440
+ var wasBold = AirshipEditorInternals.GetBoldDefaultFont();
441
+ var hasOverride = modified.boolValue && value.prefabOverride;
442
+ if (hasOverride) {
443
+ AirshipEditorInternals.SetBoldDefaultFont(true);
444
+ }
394
445
 
395
446
  var guiContent = new GUIContent(propNameDisplay, tooltip);
396
447
 
@@ -471,7 +522,20 @@ public class ScriptBindingEditor : UnityEditor.Editor {
471
522
  GUILayout.Label($"{propName.stringValue}: {type.stringValue} not yet supported");
472
523
  break;
473
524
  }
525
+
526
+ if (hasOverride && Event.current.type == EventType.Repaint) {
527
+ var lastRect = GUILayoutUtility.GetLastRect();
528
+
529
+ var modifiedRect = lastRect;
530
+ modifiedRect.x = 1;
531
+ modifiedRect.width = 2;
532
+ Graphics.DrawTexture(modifiedRect, EditorGUIUtility.whiteTexture, new Rect(), 0, 0, 0, 0, k_LiveModifiedMarginDarkThemeColor);
533
+ }
534
+
535
+ AirshipEditorInternals.SetBoldDefaultFont(wasBold);
474
536
  }
537
+
538
+ internal static Color k_LiveModifiedMarginDarkThemeColor = new(1f / 255f, 153f / 255f, 235f / 255f, 0.2f);
475
539
 
476
540
  private void DrawCustomArrayProperty(string scriptName, int componentInstanceId, string propName, GUIContent guiContent, SerializedProperty type, SerializedProperty modifiers, AirshipComponentPropertyType arrayElementType, SerializedProperty property, SerializedProperty modified) {
477
541
  if (!_openPropertyFoldouts.TryGetValue((scriptName, propName), out bool open))
@@ -136,7 +136,7 @@ namespace Code.Luau {
136
136
  var itemScriptBinding = item.ToObject<AirshipComponent>();
137
137
  return itemScriptBinding != null && IsBindableAsComponent(itemScriptBinding, script);
138
138
  }, null, script.m_metadata?.displayName ?? "AirshipBehaviour");
139
- view.SetSearchText($"h:t:ScriptBinding"); // #m_fileFullPath={script.m_path}
139
+ view.SetSearchText($"h:t:AirshipComponent airshipcomponent.script=\"{script.assetPath}\""); // #m_fileFullPath={script.m_path}
140
140
 
141
141
  evt.Use();
142
142
  GUIUtility.ExitGUI();
@@ -0,0 +1,224 @@
1
+ #if UNITY_EDITOR
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using System.Linq;
5
+ using JetBrains.Annotations;
6
+ using Luau;
7
+ using UnityEditor;
8
+ using UnityEditor.AssetImporters;
9
+ using UnityEngine;
10
+ using UnityEngine.Serialization;
11
+
12
+ namespace Airship.Editor {
13
+ [Serializable]
14
+ internal class ComponentData {
15
+
16
+ /// <summary>
17
+ /// The script path of this component
18
+ /// </summary>
19
+ public string script;
20
+ /// <summary>
21
+ /// The asset path of this component (if it's in a prefab)
22
+ /// </summary>
23
+ public string asset;
24
+ /// <summary>
25
+ /// The globally-unique identifier of this component
26
+ /// </summary>
27
+ public string guid;
28
+ /// <summary>
29
+ /// Metadata of this component
30
+ /// </summary>
31
+ public TypescriptCompilerMetadata metadata;
32
+
33
+ private AirshipComponent _component;
34
+ /// <summary>
35
+ /// Will find the component via <tt>Resources.FindObjectsOfTypeAll&lt;T&gt;</tt>, and cache the result
36
+ /// </summary>
37
+ [CanBeNull] public AirshipComponent Component {
38
+ get {
39
+ if (_component) return _component;
40
+ var components = Resources.FindObjectsOfTypeAll<AirshipComponent>();
41
+ foreach (var component in components) {
42
+ if (component.guid != guid) continue;
43
+
44
+ _component = component;
45
+ break;
46
+ }
47
+
48
+ return _component;
49
+ }
50
+ }
51
+
52
+ [CanBeNull] public GameObject Prefab => asset != null ? AssetDatabase.LoadAssetAtPath<GameObject>(asset) : null;
53
+
54
+ /// <summary>
55
+ /// Will return if the given component is synchronized with this data
56
+ /// </summary>
57
+ /// <param name="component">The component</param>
58
+ /// <returns>True if the component matches this data</returns>
59
+ public bool IsSyncedWith(AirshipComponent component) {
60
+ if (guid != component.guid) return false;
61
+ if (metadata == null) return false;
62
+
63
+ return component.componentHash == metadata.hash;
64
+ }
65
+ }
66
+
67
+ [Serializable]
68
+ internal class ComponentScriptAssetData {
69
+ public string script;
70
+ public TypescriptCompilerMetadata metadata;
71
+
72
+ /// <summary>
73
+ /// Will find the script via <tt>AssetDatabase.LoadAssetAtPath&lt;T&gt;(assetPath)</tt>
74
+ /// </summary>
75
+ public AirshipScript Script => AssetDatabase.LoadAssetAtPath<AirshipScript>(script);
76
+
77
+ /// <summary>
78
+ /// Will return whether or not the given component data is newer than the script data
79
+ /// </summary>
80
+ public bool IsNewerThan(ComponentData componentData) {
81
+ if (componentData.metadata == null) return true;
82
+ var componentMetadata = componentData.metadata;
83
+
84
+ // If the component is newer, than yes the script is outdated
85
+ return componentMetadata < metadata;
86
+ }
87
+
88
+ /// <summary>
89
+ /// Returns whether this component script data hash matches the given component script data hash
90
+ /// </summary>
91
+ public bool HasSameHashAs(ComponentData componentData) {
92
+ if (componentData.metadata == null) return false;
93
+ return componentData.metadata.hash == metadata.hash;
94
+ }
95
+
96
+
97
+ /// <summary>
98
+ /// Will return true if the hash of the component isn't the same as the DB stored script hash
99
+ /// </summary>
100
+ public bool IsNotSameHashAsComponent(AirshipComponent component) {
101
+ return component.componentHash != metadata.hash;
102
+ }
103
+ }
104
+
105
+ /// <summary>
106
+ /// The local artifact database for Airship's Editor - stored in <code>Library/AirshipArtifactDB</code>
107
+ /// This contains the state of the scripts and components for the local project
108
+ /// </summary>
109
+ [FilePath("Library/AirshipArtifactDB", FilePathAttribute.Location.ProjectFolder)]
110
+ internal class AirshipLocalArtifactDatabase : ScriptableSingleton<AirshipLocalArtifactDatabase> {
111
+ [SerializeField] internal ReconcilerVersion reconcilerVersion = ReconcilerVersion.Default;
112
+ [SerializeField] internal List<ComponentScriptAssetData> scripts = new();
113
+ [SerializeField] internal List<ComponentData> components = new();
114
+
115
+ /// <summary>
116
+ /// Gets or creates the script asset data in the artifact database for the given script
117
+ /// </summary>
118
+ internal ComponentScriptAssetData GetOrCreateScriptAssetData(AirshipScript script) {
119
+ var item = scripts.FirstOrDefault(f => f.script == script.assetPath);
120
+ if (item == null) {
121
+ item = new ComponentScriptAssetData() {
122
+ script = script.assetPath,
123
+ metadata = null,
124
+ };
125
+ scripts.Add(item);
126
+ }
127
+ return item;
128
+ }
129
+
130
+ /// <summary>
131
+ /// Will try to get the component data associated with the specified component (if applicable)
132
+ /// </summary>
133
+ internal bool TryGetComponentData(AirshipComponent component, out ComponentData componentData, string assetPath = null) {
134
+ var item = components.FirstOrDefault(f => f.guid == component.guid);
135
+ if (item != null) {
136
+ componentData = item;
137
+ return true;
138
+ }
139
+
140
+ componentData = null;
141
+ return false;
142
+ }
143
+
144
+ /// <summary>
145
+ /// Will try to get the script asset data associated with the specified script (if applicable)
146
+ /// </summary>
147
+ internal bool TryGetScriptAssetData(AirshipScript script, out ComponentScriptAssetData assetData) {
148
+ var item = scripts.FirstOrDefault(f => f.script == script.assetPath);
149
+ if (item != null) {
150
+ assetData = item;
151
+ return true;
152
+ }
153
+ assetData = null;
154
+ return false;
155
+ }
156
+
157
+ /// <summary>
158
+ /// Remove the component data for the given component - usually called when the component is destroyed or
159
+ /// no longer wants to be referenced in the database
160
+ /// </summary>
161
+ internal bool RemoveComponentData(AirshipComponent component) {
162
+ var item = components.FirstOrDefault(f => f.guid == component.guid);
163
+ if (item == null) return false;
164
+ components.Remove(item);
165
+ return true;
166
+ }
167
+
168
+ private void OnEnable() {
169
+ #if AIRSHIP_DEBUG
170
+ Debug.Log($"[LocalArtifactDB] Artifact DB enabled");
171
+ #endif
172
+
173
+ // Dictionary<string, AirshipScript> pathToScript = new();
174
+ // foreach (var script in Resources.FindObjectsOfTypeAll<AirshipScript>()) {
175
+ // if (pathToScript.ContainsKey(script.assetPath)) continue; // skip duplicates
176
+ // pathToScript.Add(script.assetPath, script);
177
+ // }
178
+
179
+ // When enabled we kind of want to run a validation of the component list
180
+ Dictionary<string, AirshipComponent> guidToComponent = new();
181
+ foreach (var component in Resources.FindObjectsOfTypeAll<AirshipComponent>()) {
182
+ if (component != null && guidToComponent.ContainsKey(component.guid)) continue; // skip duplicates
183
+ guidToComponent.Add(component.guid, component);
184
+ }
185
+
186
+ // Check each entry, if it has an active matching guid in memory we wanna skip, otherwise
187
+ // we'll yeet it from existence - we don't care, and unity isn't going to try to reconcile it.
188
+ foreach (var componentData in components.ToArray()) {
189
+ if (guidToComponent.TryGetValue(componentData.guid, out _)) continue;
190
+ components.Remove(componentData); // ??
191
+ #if AIRSHIP_DEBUG
192
+ Debug.Log($"[LocalArtifactDB] Clean out component guid {componentData.guid}");
193
+ #endif
194
+ }
195
+
196
+ // foreach (var scriptAssetData in scripts.ToArray()) { /// ???
197
+ // if (pathToScript.TryGetValue(scriptAssetData.assetPath, out _)) continue;
198
+ // scripts.Remove(scriptAssetData);
199
+ // #if AIRSHIP_DEBUG
200
+ // Debug.Log($"[LocalArtifactDB] Clean out script {scriptAssetData.assetPath}");
201
+ // #endif
202
+ // }
203
+ }
204
+
205
+ internal void Rebuild() {
206
+ this.components.Clear();
207
+ this.scripts.Clear();
208
+ }
209
+
210
+ private void OnDisable() {
211
+ #if AIRSHIP_DEBUG
212
+ Debug.Log($"[LocalArtifactDB] Artifact DB disabled");
213
+ #endif
214
+ }
215
+
216
+ /// <summary>
217
+ /// Modifies any changes to the artifact database
218
+ /// </summary>
219
+ internal void Modify() {
220
+ Save(true);
221
+ }
222
+ }
223
+ }
224
+ #endif
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: c8837870c53d42dc8cd6708f85a6bf24
3
+ timeCreated: 1742970275