- 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后接类型
-
for (const monsterid in G_Data.MonsterManual) {
const race = G_Data.CharacterProtos[monsterid].race
if (data[race] == undefined)
data[race] = []
data[race].push(monsterid)
} -
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
’==‘ 等值符 类型相同时,比较值;类型不同时,转换成相同类型再比较值
- 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.
- const [canlock] = MonsterManualModel.checkUnLock(G_Player, data)
[canlock] 这个方括号是什么语法,后面的函数返回两个值,这个变量只有一个
17.&:多个类型合并成一个类型 (交叉类型?)or 多个类型取交集
18.为什么在VS中CinemachineBlendDefinition存在却全局搜不到