TS&LUA问题

  1. const mainCamera = UE.GameObject.Find(“/Main Camera”);
    //Find方法没找到

解:在C#中搜索GameObject类的Find方法

2.function Typeof<T extends { prototype: any }>(this: void, v: T): T[“prototype”]
//T[“prototype”]这句语法不太懂

 function Typeof<T extends { prototype: any }>(this: void, v: T): T["prototype"]

4.function CinemachineBlendDefinition(style:CS.Cinemachine.CinemachineBlendDefinition.Style,time:number):CS.Cinemachine.CinemachineBlendDefinition;
//CinemachineBlendDefinition 我也找不到这个方法在VS C#中的实现

type Record<K extends keyof any, T> = {
[P in K]: T;
};

//不太懂这个类型的构成

6.function type(shapeModel?: string): T {
if (shapeModel) {
return shapeModel as any
}
return true as any
}

type MonsterManual = Record<SetId<“CharacterProtos”>, MonsterManualInfo>

//MonsterManual 这个类型我不太懂

8.typeof 操作符表示着:获取指定变量的类型 typeof 后接变量
type p = typeof q // p和q是同一类型
keyof 操作符表示着:获取指定类型的key keyof后接类型

  1. for (const monsterid in G_Data.MonsterManual) {
    const race = G_Data.CharacterProtos[monsterid].race
    if (data[race] == undefined)
    data[race] = []
    data[race].push(monsterid)
    }

  2. const [n1,n2] = SetMultiReturnValue();
    // e.g.SetMultiReturnValue返回两个值的话,接收多个返回值用中括号,[n1,n2]

type Record<K extends keyof any, T> = {
    [P in K]: T;
};

type Record1<K extends keyof any,T> = {
    string:T
    number:T
    symbol:T
}

上面两种方式是否一样?

13 . ’===‘ 等同符 类型相同时,比较值,值相同时返回true ,不同时返回false

’==‘ 等值符 类型相同时,比较值;类型不同时,转换成相同类型再比较值

  1. G.d.ts 的 load方法没找到实现

15.This language extension allows typing of Lua functions that return multiple values. For example, consider Lua’s string.find, it returns two indices: the start of the found substring and the end of the found substring. In TypeScript, functions can only return one value so a special type is needed to indicate to tstl there are multiple return values. This is the LuaMultiReturn<> type.

  1. const [canlock] = MonsterManualModel.checkUnLock(G_Player, data)

[canlock] 这个方括号是什么语法,后面的函数返回两个值,这个变量只有一个

17.&:多个类型合并成一个类型 (交叉类型?)or 多个类型取交集

18.为什么在VS中CinemachineBlendDefinition存在却全局搜不到

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值