gg.easy.airship 0.1.2182 → 0.1.2184
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/Runtime/Code/AirshipConst.cs +2 -1
- package/Runtime/Code/Luau/LuauCoreCallbacks.cs +19 -5
- package/Runtime/Code/Luau/ReflectionList.cs +3 -0
- package/Runtime/Code/LuauAPI/InputControlAPI.cs +31 -0
- package/Runtime/Code/LuauAPI/InputControlAPI.cs.meta +3 -0
- package/Runtime/Code/LuauHelper/LuauHelper.cs +8 -0
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// ReSharper disable InconsistentNaming
|
|
2
2
|
|
|
3
3
|
namespace Code {
|
|
4
|
+
[LuauAPI]
|
|
4
5
|
public static class AirshipConst {
|
|
5
|
-
public const int playerVersion =
|
|
6
|
+
public const int playerVersion = 17;
|
|
6
7
|
|
|
7
8
|
/// <summary>
|
|
8
9
|
/// The server will kick clients that have a playerVersion lower than this value.
|
|
@@ -1064,33 +1064,47 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
1064
1064
|
/// <returns>True if successful, otherwise false if nothing was written.</returns>
|
|
1065
1065
|
private static bool FastGetAndWriteValueProperty(IntPtr thread, object objectReference, PropertyGetReflectionCache cacheData) {
|
|
1066
1066
|
var propType = cacheData.propertyInfo.PropertyType;
|
|
1067
|
-
if (propType
|
|
1067
|
+
if (IsOfType(propType, intType)) {
|
|
1068
1068
|
var intValue = GetValue<int>(objectReference, cacheData);
|
|
1069
1069
|
WritePropertyToThreadInt32(thread, intValue);
|
|
1070
1070
|
return true;
|
|
1071
1071
|
}
|
|
1072
|
-
if (propType
|
|
1072
|
+
if (IsOfType(propType, doubleType)) {
|
|
1073
1073
|
var doubleVal = GetValue<double>(objectReference, cacheData);
|
|
1074
1074
|
WritePropertyToThreadDouble(thread, doubleVal);
|
|
1075
1075
|
return true;
|
|
1076
1076
|
}
|
|
1077
|
-
if (propType
|
|
1077
|
+
if (IsOfType(propType, floatType)) {
|
|
1078
1078
|
var shortVal = GetValue<float>(objectReference, cacheData);
|
|
1079
1079
|
WritePropertyToThreadSingle(thread, shortVal);
|
|
1080
1080
|
return true;
|
|
1081
1081
|
}
|
|
1082
|
-
if (propType
|
|
1082
|
+
if (IsOfType(propType, vector3Type)) {
|
|
1083
1083
|
var vecValue = GetValue<Vector3>(objectReference, cacheData);
|
|
1084
1084
|
WritePropertyToThreadVector3(thread, vecValue);
|
|
1085
1085
|
return true;
|
|
1086
1086
|
}
|
|
1087
|
-
if (propType
|
|
1087
|
+
if (IsOfType(propType, vector2Type)) {
|
|
1088
|
+
var vecValue = GetValue<Vector2>(objectReference, cacheData);
|
|
1089
|
+
WritePropertyToThreadVector2(thread, vecValue);
|
|
1090
|
+
return true;
|
|
1091
|
+
}
|
|
1092
|
+
if (IsOfType(propType, quaternionType)) {
|
|
1088
1093
|
var quatValue = GetValue<Quaternion>(objectReference, cacheData);
|
|
1089
1094
|
WritePropertyToThreadQuaternion(thread, quatValue);
|
|
1090
1095
|
return true;
|
|
1091
1096
|
}
|
|
1092
1097
|
return false;
|
|
1093
1098
|
}
|
|
1099
|
+
|
|
1100
|
+
/// <summary>
|
|
1101
|
+
/// Checks if type is of specified ofType including if it is a reference of the ofType.
|
|
1102
|
+
/// </summary>
|
|
1103
|
+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
1104
|
+
private static bool IsOfType(Type type, Type ofType) {
|
|
1105
|
+
if (type.IsByRef) return type == ofType.MakeByRefType();
|
|
1106
|
+
return type == ofType;
|
|
1107
|
+
}
|
|
1094
1108
|
|
|
1095
1109
|
public static string GetRequirePath(string originalScriptPath, string fileNameStr) {
|
|
1096
1110
|
Profiler.BeginSample("GetRequirePath");
|
|
@@ -208,6 +208,8 @@ namespace Luau {
|
|
|
208
208
|
[typeof(SpriteRenderer)] = LuauContextAll,
|
|
209
209
|
[typeof(ParticleSystem.MinMaxGradient)] = LuauContextAll,
|
|
210
210
|
[typeof(Input)] = LuauContextAll,
|
|
211
|
+
[typeof(Touch)] = LuauContextAll,
|
|
212
|
+
[typeof(TouchPhase)] = LuauContextAll,
|
|
211
213
|
// Tween
|
|
212
214
|
[typeof(NativeTween)] = LuauContextAll,
|
|
213
215
|
// Visual Effects
|
|
@@ -242,6 +244,7 @@ namespace Luau {
|
|
|
242
244
|
["AudioMixerGroupController"] = LuauContextAll,
|
|
243
245
|
#endif
|
|
244
246
|
["Toggle"] = LuauContextAll, // "no idea why this needs to be a string...
|
|
247
|
+
["UnityEngine.InputSystem.FastTouchscreen"] = LuauContextAll,
|
|
245
248
|
};
|
|
246
249
|
|
|
247
250
|
private static readonly HashSet<string> SkipNamespaces = new() {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine.InputSystem;
|
|
3
|
+
using UnityEngine.InputSystem.Controls;
|
|
4
|
+
|
|
5
|
+
[LuauAPI]
|
|
6
|
+
public class InputControlAPI : BaseLuaAPIClass {
|
|
7
|
+
public override Type GetAPIType() {
|
|
8
|
+
return typeof(InputControl);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public override Type[] GetDescendantTypes() {
|
|
12
|
+
return new Type[] {
|
|
13
|
+
typeof(UnityEngine.InputSystem.Controls.AxisControl),
|
|
14
|
+
typeof(UnityEngine.InputSystem.Controls.ButtonControl),
|
|
15
|
+
typeof(UnityEngine.InputSystem.Controls.DeltaControl),
|
|
16
|
+
typeof(UnityEngine.InputSystem.Controls.DoubleControl),
|
|
17
|
+
typeof(UnityEngine.InputSystem.Controls.IntegerControl),
|
|
18
|
+
typeof(UnityEngine.InputSystem.Controls.DpadControl),
|
|
19
|
+
typeof(UnityEngine.InputSystem.Controls.KeyControl),
|
|
20
|
+
typeof(UnityEngine.InputSystem.Controls.QuaternionControl),
|
|
21
|
+
typeof(UnityEngine.InputSystem.Controls.StickControl),
|
|
22
|
+
typeof(UnityEngine.InputSystem.Controls.TouchControl),
|
|
23
|
+
typeof(UnityEngine.InputSystem.Controls.Vector2Control),
|
|
24
|
+
typeof(UnityEngine.InputSystem.Controls.Vector3Control),
|
|
25
|
+
typeof(UnityEngine.InputSystem.Controls.AnyKeyControl),
|
|
26
|
+
typeof(UnityEngine.InputSystem.Controls.DiscreteButtonControl),
|
|
27
|
+
typeof(UnityEngine.InputSystem.Controls.TouchPhaseControl),
|
|
28
|
+
typeof(UnityEngine.InputSystem.Controls.TouchPressControl),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -82,6 +82,14 @@ public class LuauHelper : Singleton<LuauHelper> {
|
|
|
82
82
|
var instance = (BaseLuaAPIClass)Activator.CreateInstance(type);
|
|
83
83
|
var apiType = instance.GetAPIType();
|
|
84
84
|
ReflectionList.AddToReflectionList(apiType, typeAttribute.AllowedContextsMask);
|
|
85
|
+
|
|
86
|
+
var descendantTypes = instance.GetDescendantTypes();
|
|
87
|
+
if (descendantTypes != null) {
|
|
88
|
+
foreach (var descendant in descendantTypes) {
|
|
89
|
+
ReflectionList.AddToReflectionList(descendant, typeAttribute.AllowedContextsMask);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
LuauCore.CoreInstance.RegisterBaseAPI(instance);
|
|
86
94
|
|
|
87
95
|
// Override context of individual methods / members
|