gg.easy.airship 0.1.2187 → 0.1.2189

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 (32) hide show
  1. package/Editor/CreateAssetBundles.cs +12 -0
  2. package/Editor/Publish/Deploy.cs +3 -1
  3. package/Generator/LuauDirectCallbackGenerator.dll +0 -0
  4. package/Runtime/Code/Accessories/Clothing/Editor/PlatformGearDownloader.cs +3 -2
  5. package/Runtime/Code/Accessories/Clothing/PlatformGear.cs +22 -4
  6. package/Runtime/Code/AirshipConst.cs +2 -0
  7. package/Runtime/Code/Luau/CallbackWrapper.cs +67 -43
  8. package/Runtime/Code/Luau/LuauAssembly/AttachContext.cs +4 -1
  9. package/Runtime/Code/Luau/LuauAssembly/BinaryBlob.cs +3 -1
  10. package/Runtime/Code/Luau/LuauCore.cs +3 -1
  11. package/Runtime/Code/Luau/LuauCoreCallbacks.cs +352 -203
  12. package/Runtime/Code/Luau/LuauCoreReflection.cs +184 -100
  13. package/Runtime/Code/Luau/LuauState.cs +5 -1
  14. package/Runtime/Code/LuauAPI/Bridge.cs +6 -3
  15. package/Runtime/Code/LuauAPI/PhysicsAPI.cs +5 -5
  16. package/Runtime/Code/LuauAPI/TransformAPI.cs +19 -9
  17. package/Runtime/Code/Network/Net.cs +3 -3
  18. package/Runtime/Code/Network/Simulation/AirshipNetworkedObject.cs +8 -12
  19. package/Runtime/Code/Network/Simulation/AirshipSimulationManager.cs +13 -11
  20. package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +26 -37
  21. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +4 -4
  22. package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
  23. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  24. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  25. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  26. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  27. package/ThirdParty/UniMic/Editor/MicEditor.cs +4 -5
  28. package/ThirdParty/UniMic/Runtime/Mic.cs +3 -34
  29. package/ThirdParty/UniVoice.AudioSourceOutput/Runtime/UniVoiceAudioSourceOutput.cs +5 -3
  30. package/ThirdParty/UniVoice.UniMicInput/Runtime/UniVoiceUniMicInput.cs +0 -11
  31. package/URP/AirshipURPAsset.asset +2 -2
  32. package/package.json +1 -1
@@ -481,6 +481,18 @@ public static class CreateAssetBundles {
481
481
  return true;
482
482
  }
483
483
 
484
+ #if UNITY_EDITOR
485
+ [MenuItem("Airship/Set Quality/Normal", false, 1901)]
486
+ static void MenuSetQualityLevel() {
487
+ CreateAssetBundles.SwapToQualityLevel("Normal");
488
+ }
489
+
490
+ [MenuItem("Airship/Set Quality/Low", false, 1902)]
491
+ static void MenuSetQualityLevelLow() {
492
+ CreateAssetBundles.SwapToQualityLevel("Low");
493
+ }
494
+ #endif
495
+
484
496
  public static void SwapToQualityLevel(string name) {
485
497
  #if UNITY_EDITOR
486
498
  if (name == "Low") {
@@ -530,9 +530,11 @@ public class Deploy {
530
530
  Debug.Log("<color=#77f777>Finished publish! Your game is live.</color> ");
531
531
  }
532
532
 
533
+ CreateAssetBundles.SwapToQualityLevel("Normal");
534
+
533
535
  if (shouldResumeTypescriptWatch) TypescriptCompilationService.StartCompilerServices();
534
536
  }
535
-
537
+
536
538
  private static IEnumerator UploadSingleGameFile(string url, string filePath, AirshipPlatform? platform, bool absolutePath = false) {
537
539
  var uploadInfo = new UploadInfo();
538
540
  if (platform.HasValue) uploadInfo.platform = platform.Value;
@@ -1,5 +1,4 @@
1
- // Assets/Editor/DownloadClothingWindow.cs
2
-
1
+ #if UNITY_EDITOR
3
2
  using System;
4
3
  using System.Collections.Generic;
5
4
  using System.Threading;
@@ -82,6 +81,7 @@ namespace Code.Accessories.Clothing.Editor {
82
81
  EditorUtility.DisplayDialog("Download Error", "Clothing was null.", "OK");
83
82
  } else {
84
83
  this.SpawnClothing(gear);
84
+ // PlatformGear.UnloadAssetBundle(gear.classId);
85
85
  status = "Complete";
86
86
  progress = 1f;
87
87
  Repaint();
@@ -143,3 +143,4 @@ namespace Code.Accessories.Clothing.Editor {
143
143
  }
144
144
  }
145
145
  }
146
+ #endif
@@ -19,14 +19,17 @@ namespace Code.Accessories.Clothing {
19
19
  }
20
20
  }
21
21
 
22
+ [Serializable]
22
23
  public class GearFetchResponse {
23
24
  public GearDto gear;
24
25
  }
25
26
 
27
+ [Serializable]
26
28
  public class GearDto {
27
29
  public GearListingDto gear;
28
30
  }
29
31
 
32
+ [Serializable]
30
33
  public class GearListingDto {
31
34
  public string category;
32
35
  public string subcategory;
@@ -55,14 +58,28 @@ namespace Code.Accessories.Clothing {
55
58
 
56
59
  [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
57
60
  public static void OnReload() {
58
- // foreach (var bundle in loadedPlatformGearBundles) {
59
- // bundle.Value.assetBundle.Unload(true);
60
- // }
61
- // loadedPlatformGearBundles.Clear();
61
+ foreach (var bundle in loadedPlatformGearBundles) {
62
+ if (bundle.Value.assetBundle != null) {
63
+ bundle.Value.assetBundle.Unload(true);
64
+ }
65
+ }
66
+ loadedPlatformGearBundles.Clear();
62
67
  inProgressDownloads.Clear();
63
68
  classIdToAirIdCache.Clear();
64
69
  }
65
70
 
71
+ public static void UnloadAssetBundle(string classId) {
72
+ if (Application.isPlaying) {
73
+ throw new Exception("PlatformGear.UnloadAssetBundle cannot be called during play mode.");
74
+ }
75
+ if (classIdToAirIdCache.TryGetValue(classId, out var airId)) {
76
+ if (loadedPlatformGearBundles.TryGetValue(airId, out var bundle)) {
77
+ bundle.assetBundle.Unload(true);
78
+ loadedPlatformGearBundles.Remove(airId);
79
+ }
80
+ }
81
+ }
82
+
66
83
  public static async Task<PlatformGear> DownloadYielding(string classId) {
67
84
  if (classIdToAirIdCache.TryGetValue(classId, out string airId)) {
68
85
  return await DownloadYielding(classId, airId);
@@ -79,6 +96,7 @@ namespace Code.Accessories.Clothing {
79
96
 
80
97
  var gearRes = JsonUtility.FromJson<GearFetchResponse>(req.downloadHandler.text);
81
98
  airId = gearRes.gear.gear.airAssets[0];
99
+ classIdToAirIdCache[classId] = airId;
82
100
  }
83
101
 
84
102
  return await DownloadYielding(classId, airId);
@@ -9,6 +9,8 @@ namespace Code {
9
9
  public const int playerVersion = 20;
10
10
  public static readonly IReadOnlyList<string> playerFlags = new string[] {
11
11
  "SkipLoading",
12
+ "LagCompCheckIdIsInt",
13
+ "PlatformGearDownloadClassId",
12
14
  };
13
15
 
14
16
 
@@ -1,16 +1,25 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+ using Unity.Collections.LowLevel.Unsafe;
3
4
  using UnityEngine;
4
5
  using UnityEngine.Profiling;
5
6
 
6
7
  namespace Luau
7
8
  {
8
9
  public class CallbackWrapper {
9
- public LuauContext context;
10
+ /// <summary>
11
+ /// The LuauContext that this callback was created in (and will fire in). This is only relevant if
12
+ /// validateContext is true (used for stuff like network events where we don't want protected broadcasts
13
+ /// to be listened to in game context).
14
+ /// </summary>
15
+ public LuauContext callbackContext;
10
16
  public int handle;
11
17
  public int luauRef;
12
18
  public IntPtr thread;
13
19
  public string methodName;
20
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
21
+ private string profilerTagName;
22
+ #endif
14
23
  /// <summary>
15
24
  /// If true we will not send an event if the first variable (context) doesn't match the creation context
16
25
  /// </summary>
@@ -25,9 +34,12 @@ namespace Luau
25
34
  }
26
35
 
27
36
  public CallbackWrapper(LuauContext context, IntPtr thread, string methodName, int handle, bool validateContext) {
28
- this.context = context;
37
+ this.callbackContext = context;
29
38
  this.thread = thread;
30
39
  this.methodName = methodName;
40
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
41
+ profilerTagName = $"EngineEvent.{methodName}";
42
+ #endif
31
43
  this.handle = handle;
32
44
  this.validateContext = validateContext;
33
45
 
@@ -55,18 +67,6 @@ namespace Luau
55
67
 
56
68
  }
57
69
 
58
- static void WritePropertyToThread(IntPtr thread, object parameter)
59
- {
60
- if (parameter == null)
61
- {
62
- LuauCore.WritePropertyToThread(thread, null, null);
63
- }
64
- else
65
- {
66
- LuauCore.WritePropertyToThread(thread, parameter, parameter.GetType());
67
- }
68
- }
69
-
70
70
 
71
71
  unsafe public void HandleEventDelayed0()
72
72
  {
@@ -76,28 +76,28 @@ namespace Luau
76
76
  {
77
77
  if (thread.m_error) return;
78
78
 
79
- Profiler.BeginSample("HandleEventDelayed0 " + this.methodName);
79
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
80
+ Profiler.BeginSample(profilerTagName);
81
+ #endif
80
82
  System.Int32 integer = (System.Int32)handle;
81
83
  int retValue = LuauPlugin.CallMethodOnThread(this.thread, new IntPtr(value: &integer), 0, numParameters);
82
84
  if (retValue < 0)
83
85
  {
84
86
  ThreadDataManager.Error(this.thread);
85
87
  }
88
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
86
89
  Profiler.EndSample();
90
+ #endif
87
91
  }
88
92
  }
89
93
 
90
- private bool IsBlockedByInvalidContext(object param0) {
94
+ private bool IsBlockedByInvalidContext(LuauContext callContext) {
91
95
  if (!validateContext) return false;
92
- if (param0 is null) return false;
93
- if (param0 is not LuauContext lc) return false;
94
- var isBlocked = lc != context;
95
- // if (isBlocked) Debug.Log("Blocked by invalid context: lc=" + lc + " context=" + context + " mn=" + methodName);
96
- return isBlocked;
96
+ return callContext != callbackContext;
97
97
  }
98
98
 
99
- unsafe public void HandleEventDelayed1(object param0) {
100
- if (IsBlockedByInvalidContext(param0)) return;
99
+ unsafe public void HandleEventDelayed1<A>(A param0) {
100
+ if (typeof(A) == typeof(LuauContext) && IsBlockedByInvalidContext(UnsafeUtility.As<A, LuauContext>(ref param0))) return;
101
101
 
102
102
  int numParameters = 1;
103
103
  ThreadData thread = ThreadDataManager.GetThreadDataByPointer(this.thread);
@@ -105,21 +105,27 @@ namespace Luau
105
105
  {
106
106
  if (thread.m_error) return;
107
107
 
108
- Profiler.BeginSample("EngineEvent." + this.methodName);
109
- WritePropertyToThread(this.thread, param0);
108
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
109
+ Profiler.BeginSample(profilerTagName);
110
+ #endif
111
+ Profiler.BeginSample("WriteProperties");
112
+ LuauCore.WritePropertyToThread(this.thread, param0);
113
+ Profiler.EndSample();
110
114
  System.Int32 integer = (System.Int32)handle;
111
115
  int retValue = LuauPlugin.CallMethodOnThread(this.thread, new IntPtr(value: &integer), 0, numParameters);
112
116
  if (retValue < 0)
113
117
  {
114
118
  ThreadDataManager.Error(this.thread);
115
119
  }
120
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
116
121
  Profiler.EndSample();
122
+ #endif
117
123
  }
118
124
  }
119
125
 
120
126
 
121
- unsafe public void HandleEventDelayed2(object param0, object param1) {
122
- if (IsBlockedByInvalidContext(param0)) return;
127
+ unsafe public void HandleEventDelayed2<A, B>(A param0, B param1) {
128
+ if (typeof(A) == typeof(LuauContext) && IsBlockedByInvalidContext(UnsafeUtility.As<A, LuauContext>(ref param0))) return;
123
129
 
124
130
  int numParameters = 2;
125
131
  ThreadData thread = ThreadDataManager.GetThreadDataByPointer(this.thread);
@@ -130,21 +136,27 @@ namespace Luau
130
136
  return;
131
137
  }
132
138
 
133
- Profiler.BeginSample("EngineEvent." + this.methodName);
134
- WritePropertyToThread(this.thread, param0);
135
- WritePropertyToThread(this.thread, param1);
139
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
140
+ Profiler.BeginSample(profilerTagName);
141
+ #endif
142
+ Profiler.BeginSample("WriteProperties");
143
+ LuauCore.WritePropertyToThread<A>(this.thread, param0);
144
+ LuauCore.WritePropertyToThread<B>(this.thread, param1);
145
+ Profiler.EndSample();
136
146
  System.Int32 integer = (System.Int32)handle;
137
147
  int retValue = LuauPlugin.CallMethodOnThread(this.thread, new IntPtr(value: &integer), 0, numParameters);
138
148
  if (retValue < 0)
139
149
  {
140
150
  ThreadDataManager.Error(this.thread);
141
151
  }
152
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
142
153
  Profiler.EndSample();
154
+ #endif
143
155
  }
144
156
  }
145
157
 
146
- unsafe public void HandleEventDelayed3(object param0, object param1, object param2) {
147
- if (IsBlockedByInvalidContext(param0)) return;
158
+ unsafe public void HandleEventDelayed3<A, B, C>(A param0, B param1, C param2) {
159
+ if (typeof(A) == typeof(LuauContext) && IsBlockedByInvalidContext(UnsafeUtility.As<A, LuauContext>(ref param0))) return;
148
160
 
149
161
  int numParameters = 3;
150
162
  ThreadData thread = ThreadDataManager.GetThreadDataByPointer(this.thread);
@@ -153,22 +165,28 @@ namespace Luau
153
165
 
154
166
  if (thread.m_error) return;
155
167
 
156
- Profiler.BeginSample("EngineEvent." + this.methodName);
157
- WritePropertyToThread(this.thread, param0);
158
- WritePropertyToThread(this.thread, param1);
159
- WritePropertyToThread(this.thread, param2);
168
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
169
+ Profiler.BeginSample(profilerTagName);
170
+ #endif
171
+ Profiler.BeginSample("WriteProperties");
172
+ LuauCore.WritePropertyToThread<A>(this.thread, param0);
173
+ LuauCore.WritePropertyToThread<B>(this.thread, param1);
174
+ LuauCore.WritePropertyToThread<C>(this.thread, param2);
175
+ Profiler.EndSample();
160
176
  System.Int32 integer = (System.Int32)handle;
161
177
  int retValue = LuauPlugin.CallMethodOnThread(this.thread, new IntPtr(value: &integer), 0, numParameters);
162
178
  if (retValue < 0)
163
179
  {
164
180
  ThreadDataManager.Error(this.thread);
165
181
  }
182
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
166
183
  Profiler.EndSample();
184
+ #endif
167
185
  }
168
186
  }
169
187
 
170
- unsafe public void HandleEventDelayed4(object param0, object param1, object param2, object param3) {
171
- if (IsBlockedByInvalidContext(param0)) return;
188
+ unsafe public void HandleEventDelayed4<A, B, C, D>(A param0, B param1, C param2, D param3) {
189
+ if (typeof(A) == typeof(LuauContext) && IsBlockedByInvalidContext(UnsafeUtility.As<A, LuauContext>(ref param0))) return;
172
190
 
173
191
  int numParameters = 4;
174
192
  ThreadData thread = ThreadDataManager.GetThreadDataByPointer(this.thread);
@@ -177,18 +195,24 @@ namespace Luau
177
195
 
178
196
  if (thread.m_error) return;
179
197
 
180
- Profiler.BeginSample("EngineEvent." + this.methodName);
181
- WritePropertyToThread(this.thread, param0);
182
- WritePropertyToThread(this.thread, param1);
183
- WritePropertyToThread(this.thread, param2);
184
- WritePropertyToThread(this.thread, param3);
198
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
199
+ Profiler.BeginSample(profilerTagName);
200
+ #endif
201
+ Profiler.BeginSample("WriteProperties");
202
+ LuauCore.WritePropertyToThread<A>(this.thread, param0);
203
+ LuauCore.WritePropertyToThread<B>(this.thread, param1);
204
+ LuauCore.WritePropertyToThread<C>(this.thread, param2);
205
+ LuauCore.WritePropertyToThread<D>(this.thread, param3);
206
+ Profiler.EndSample();
185
207
  System.Int32 integer = (System.Int32)handle;
186
208
  int retValue = LuauPlugin.CallMethodOnThread(this.thread, new IntPtr(value: &integer), 0, numParameters);
187
209
  if (retValue < 0)
188
210
  {
189
211
  ThreadDataManager.Error(this.thread);
190
212
  }
213
+ #if DEVELOPMENT_BUILD || UNITY_EDITOR
191
214
  Profiler.EndSample();
215
+ #endif
192
216
  }
193
217
  }
194
218
  }
@@ -2,7 +2,10 @@ using System;
2
2
 
3
3
  namespace Code.Luau {
4
4
  /// <summary>
5
- /// This will cause an event to only fire for the context provided as the first argument.
5
+ /// This will cause an event to only fire for the context provided as the first argument. If used on a method
6
+ /// the generated type will exclude the context and it will be forced to the calling context in C#.
7
+ ///
8
+ /// In both cases the first parameter should be a LuauContext.
6
9
  /// </summary>
7
10
  [AttributeUsage(AttributeTargets.Event | AttributeTargets.Method)]
8
11
  public class AttachContext : Attribute {
@@ -1,4 +1,5 @@
1
1
  using System;
2
+ using System.Linq;
2
3
  using System.Runtime.InteropServices;
3
4
  using Mirror;
4
5
  using Code.Util;
@@ -42,7 +43,8 @@ namespace Assets.Luau {
42
43
  }
43
44
 
44
45
  public bool Equals(BinaryBlob other) {
45
- return this.DataSize == other?.DataSize;
46
+ if (DataSize != other?.DataSize) return false;
47
+ return Data.SequenceEqual(other.Data);
46
48
  }
47
49
 
48
50
  /// <summary>
@@ -205,7 +205,9 @@ public partial class LuauCore : MonoBehaviour {
205
205
  _taskId++;
206
206
  _completedTasks.Clear();
207
207
  eventConnections.Clear();
208
- propertyGetCache.Clear();
208
+ memberGetCache.Clear();
209
+ fastMemberGetCacheKeys.AsSpan().Clear();
210
+ fastMemberGetCacheValues.AsSpan().Clear();
209
211
  _propertySetterCache.Clear();
210
212
  WriteMethodFunctions.Clear();
211
213
  LuauProtection.CurrentContext = LuauContext.Game;