/* * Tencent is pleased to support the open source community by making Puerts available. * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. * Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms. * This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package. */ declare module "ue" { type ArgumentTypes = T extends (... args: infer U ) => infer R ? U: never; interface $CallbackID {} interface $Delegate any> { Bind(fn : T): void; Bind(target: Object, methodName: string): void; Unbind(): void; IsBound(): boolean; Execute(...a: ArgumentTypes) : ReturnType; } interface $MulticastDelegate any> { Add(fn : T): void; Add(target: Object, methodName: string): void; Remove(fn : T): void; Broadcast(...a: ArgumentTypes) : ReturnType; Clear(): void; } interface FixSizeArray { Num(): number; Get(Index: number): T; GetRef(Index: number): T; Set(Index: number, Value: T): void; } interface TArray { Num(): number; Add(...args: T[]): void; Get(Index: number): T; GetRef(Index: number): T; Set(Index: number, Value: T): void; Contains(Value: T): boolean; FindIndex(Value: T): number; RemoveAt(Index: number): void; IsValidIndex(Index: number): boolean; Empty(): void; [Symbol.iterator](): IterableIterator; } interface TSet { Num(): number; Add(Value: T): void; Get(Index: number): T; // TODO - 这个接口要用Index吗? GetRef(Index: number): T; // Set(Index: number, Value: T): void; Contains(Value: T): boolean; FindIndex(Value: T): number; RemoveAt(Index: number): void; GetMaxIndex(): number; // TODO - GetMaxIndex的返回值是InvalidIndex,合理吗?(GetMaxIndex的解释应该是:最大合法index+1),当调用Empty,返回值为0 IsValidIndex(Index: number): boolean; Empty(): void; [Symbol.iterator](): IterableIterator; } interface TMap { Num(): number; Add(Key: TKey, Value: TValue): void; Get(Key: TKey): TValue | undefined; GetRef(Key: TKey): TValue | undefined; Set(Key: TKey, Value: TValue): void; // 即Add()。TODO - 有存在的必要吗? Remove(Key: TKey): void; GetMaxIndex(): number; // TODO - 接口注释要说明返回的是kv的索引。只有调用了Empty后才会返回0 IsValidIndex(Index: number): boolean; GetKey(Index: number): TKey; // TODO - 对于非法index,是否应该返回undefined Empty(): void; [Symbol.iterator](): IterableIterator<[TKey, TValue]>; } interface TSharedPtr { __tid_SharedPtr: T Equals(other: TSharedPtr):boolean } type BuiltinBool = 0; type BuiltinByte = 1; type BuiltinInt = 2; type BuiltinFloat = 3; type BuiltinDouble = 4; type BuiltinInt64 = 5; type BuiltinString = 6; type BuiltinText = 7; type BuiltinName = 8; const BuiltinBool = 0; const BuiltinByte = 1; const BuiltinInt = 2; const BuiltinFloat = 3; const BuiltinDouble = 4; const BuiltinInt64 = 5; const BuiltinString = 6; const BuiltinText = 7; const BuiltinName = 8; type ContainerKVType = T extends BuiltinBool ? boolean : T extends BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble ? number : T extends BuiltinInt64 ? bigint : T extends BuiltinString | BuiltinText | BuiltinName ? string : T extends {__typeKeyDoNoAccess: infer R} ? R : T extends {new (...args:any[]): infer R} ? R : never; type SupportedContainerKVType = BuiltinBool | BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble | BuiltinInt64 | BuiltinString | BuiltinText | BuiltinName | {StaticClass(): Class} | {StaticStruct(): ScriptStruct} | {__typeKeyDoNoAccess: any} function NewArray(t: T): TArray>; function NewSet(t: T): TSet>; function NewMap(k: TKey, v: TValue): TMap, ContainerKVType>; type DataPropertyNames = { [K in keyof T]: T[K] extends (...args: any) => any ? never : K; }[keyof T]; type DataPropertiesOnly = { [P in DataPropertyNames]: T[P] extends object ? DataPropertiesOnly : T[P] }; function NewObject(Cls: Class, Outer?: Object, Name?:string, ObjectFlags?: number, JsTakeRef?: boolean): Object; function NewStruct(St: ScriptStruct): object; function FNameLiteral(str:string):string; type TWeakObjectPtr = { [K in keyof T]: T[K]; } type TSoftObjectPtr = { Get():T; LoadSynchronous(): T; } type TLazyObjectPtr = { [K in keyof T]: T[K]; } type TSubclassOf = { [K in keyof T]: T[K]; } type TSoftClassPtr = { Get():Class; LoadSynchronous(): Class; } class UInt64Ptr { } class FloatPtr { } class DoublePtr { } class Int64Ptr { } class UInt32Ptr { } class Int32Ptr { } class CharPtr { } class ShortPtr { } class BoolPtr { } class StringPtr { } }