release: v0.2.2 fix optional chaining, static self, destructuring, mixed imports and add UnLua.Delegate/Input types

This commit is contained in:
szy73711 committed 2026-11-29 03:34:45 +08:00
1 parent 70630f689f
commit cb1539d738
9 files changed
+754 -36

No files matched your search

+66 -2
View File
@@ -33,6 +33,70 @@ declare namespace UnLua {
function Unref(obj: UE.UObject): void;
/** @noSelf */
function HotReload(moduleNames?: string[]): void;
/** @noSelf */
function Log(...args: any[]): void;
/** @noSelf */
function LogWarn(...args: any[]): void;
/** @noSelf */
function LogError(...args: any[]): void;
/**
* 编译期宏:生成 UnLua 单播动态委托绑定表 `{ target, callback }`,
* 用于传给 `K2_SetTimerDelegate`、`LoadAsset`、`BindToAnimationFinished` 等接收 `UE.FScriptDelegate` 参数的 UE API。
* 编译后直接内联为 `{ target, callback }`,零运行时开销。
* @noSelf
*/
function Delegate<TCallback extends (...args: any[]) => any>(
target: UE.UObject,
callback: TCallback
): UE.FScriptDelegate<TCallback>;
interface InputBindingArgs {
ConsumeInput?: boolean;
ExecuteWhenPaused?: boolean;
OverrideParentBinding?: boolean;
Ctrl?: boolean;
Alt?: boolean;
Shift?: boolean;
Cmd?: boolean;
}
namespace Input {
/** @noSelf */
function BindKey<TSelf = any>(
module: unknown,
keyName: string,
keyEvent: "Pressed" | "Released" | "Repeat" | "DoubleClick" | "Axis",
handler: (this: TSelf, key: any) => void,
args?: InputBindingArgs
): void;
/** @noSelf */
function BindAction<TSelf = any>(
module: unknown,
actionName: string,
keyEvent: "Pressed" | "Released" | "Repeat" | "DoubleClick" | "Axis",
handler: (this: TSelf, key: any) => void,
args?: InputBindingArgs
): void;
/** @noSelf */
function BindAxis<TSelf = any>(
module: unknown,
axisName: string,
handler: (this: TSelf, axisValue: number) => void,
args?: InputBindingArgs
): void;
}
namespace EnhancedInput {
/** @noSelf */
function BindAction<TSelf = any>(
module: unknown,
actionPath: string,
triggerEvent: "Triggered" | "Started" | "Ongoing" | "Canceled" | "Completed",
handler: (this: TSelf, actionValue: any, elapsedSeconds?: number, triggeredSeconds?: number, sourceAction?: any) => void,
args?: Record<string, unknown>
): void;
}
}
/**
@@ -98,7 +162,7 @@ declare namespace UE {
Execute(...args: Parameters<TCallback>): ReturnType<TCallback>;
}
interface TArray<T> {
interface TArray<T> extends LuaPairsIterable<number, T> {
Length(): number;
Num(): number;
Add(item: T): number;
@@ -124,7 +188,7 @@ declare namespace UE {
}
function TArray<T>(this: void, elementType: any): TArray<T>;
interface TMap<K, V> {
interface TMap<K, V> extends LuaPairsIterable<K & {}, V> {
Length(): number;
Num(): number;
Add(key: K, value: V): void;