gg.easy.airship 0.1.2181 → 0.1.2183
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 +31 -8
- package/Runtime/Code/Luau/ReflectionList.cs +1 -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.
|
|
@@ -760,7 +760,7 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
760
760
|
try {
|
|
761
761
|
ret = GetProperty(context, thread, instanceId, classNamePtr, classNameSize, propertyName, propertyNameLength, propertyNameAtom);
|
|
762
762
|
} catch (Exception e) {
|
|
763
|
-
ret = LuauError(thread, e.Message);
|
|
763
|
+
ret = LuauError(thread, $"{e.GetType()}: {e.Message}");
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
return ret;
|
|
@@ -789,8 +789,17 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
789
789
|
// Get PropertyInfo from cache if possible -- otherwise put it in cache
|
|
790
790
|
PropertyGetReflectionCache? cacheData;
|
|
791
791
|
if (!(cacheData = LuauCore.GetPropertyCacheValue(classType, propName)).HasValue) {
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
PropertyInfo propertyInfo = null;
|
|
793
|
+
try {
|
|
794
|
+
propertyInfo = classType.GetProperty(propName,
|
|
795
|
+
BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
|
796
|
+
} catch (AmbiguousMatchException) {
|
|
797
|
+
// If we get an ambiguous match we should use the type declared explicitly in this static class
|
|
798
|
+
// (rather than whatever inherited static is causing the ambiguity)
|
|
799
|
+
propertyInfo = classType.GetProperty(propName,
|
|
800
|
+
BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
|
|
801
|
+
}
|
|
802
|
+
|
|
794
803
|
cacheData = LuauCore.SetPropertyCacheValue(classType, propName, propertyInfo);
|
|
795
804
|
}
|
|
796
805
|
|
|
@@ -1055,33 +1064,47 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
1055
1064
|
/// <returns>True if successful, otherwise false if nothing was written.</returns>
|
|
1056
1065
|
private static bool FastGetAndWriteValueProperty(IntPtr thread, object objectReference, PropertyGetReflectionCache cacheData) {
|
|
1057
1066
|
var propType = cacheData.propertyInfo.PropertyType;
|
|
1058
|
-
if (propType
|
|
1067
|
+
if (IsOfType(propType, intType)) {
|
|
1059
1068
|
var intValue = GetValue<int>(objectReference, cacheData);
|
|
1060
1069
|
WritePropertyToThreadInt32(thread, intValue);
|
|
1061
1070
|
return true;
|
|
1062
1071
|
}
|
|
1063
|
-
if (propType
|
|
1072
|
+
if (IsOfType(propType, doubleType)) {
|
|
1064
1073
|
var doubleVal = GetValue<double>(objectReference, cacheData);
|
|
1065
1074
|
WritePropertyToThreadDouble(thread, doubleVal);
|
|
1066
1075
|
return true;
|
|
1067
1076
|
}
|
|
1068
|
-
if (propType
|
|
1077
|
+
if (IsOfType(propType, floatType)) {
|
|
1069
1078
|
var shortVal = GetValue<float>(objectReference, cacheData);
|
|
1070
1079
|
WritePropertyToThreadSingle(thread, shortVal);
|
|
1071
1080
|
return true;
|
|
1072
1081
|
}
|
|
1073
|
-
if (propType
|
|
1082
|
+
if (IsOfType(propType, vector3Type)) {
|
|
1074
1083
|
var vecValue = GetValue<Vector3>(objectReference, cacheData);
|
|
1075
1084
|
WritePropertyToThreadVector3(thread, vecValue);
|
|
1076
1085
|
return true;
|
|
1077
1086
|
}
|
|
1078
|
-
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)) {
|
|
1079
1093
|
var quatValue = GetValue<Quaternion>(objectReference, cacheData);
|
|
1080
1094
|
WritePropertyToThreadQuaternion(thread, quatValue);
|
|
1081
1095
|
return true;
|
|
1082
1096
|
}
|
|
1083
1097
|
return false;
|
|
1084
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
|
+
}
|
|
1085
1108
|
|
|
1086
1109
|
public static string GetRequirePath(string originalScriptPath, string fileNameStr) {
|
|
1087
1110
|
Profiler.BeginSample("GetRequirePath");
|
|
@@ -242,6 +242,7 @@ namespace Luau {
|
|
|
242
242
|
["AudioMixerGroupController"] = LuauContextAll,
|
|
243
243
|
#endif
|
|
244
244
|
["Toggle"] = LuauContextAll, // "no idea why this needs to be a string...
|
|
245
|
+
["UnityEngine.InputSystem.FastTouchscreen"] = LuauContextAll,
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
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
|