mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-16 07:01:03 +00:00
适配v3版本的step功能
This commit is contained in:
parent
554e60cdff
commit
ee0f22bec8
@ -38,7 +38,11 @@ export class GoogleAnalytics {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
} as MeasurementBody),
|
} as MeasurementBody),
|
||||||
});
|
})
|
||||||
|
.then(() => {})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
public async fireEvent(name: string) {
|
public async fireEvent(name: string) {
|
||||||
if (!this.isChromeEnv()) {
|
if (!this.isChromeEnv()) {
|
||||||
@ -60,7 +64,11 @@ export class GoogleAnalytics {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
} as MeasurementBody),
|
} as MeasurementBody),
|
||||||
});
|
})
|
||||||
|
.then(() => {})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
async clickButton(btn: GA_Button) {
|
async clickButton(btn: GA_Button) {
|
||||||
await this.fireEventWithParam(GA_EventName.ButtonClicked, btn);
|
await this.fireEventWithParam(GA_EventName.ButtonClicked, btn);
|
||||||
|
@ -416,6 +416,9 @@ export class Inspector extends InjectEvent {
|
|||||||
let propPath = path.concat(propName);
|
let propPath = path.concat(propName);
|
||||||
let itemData = this._genInfoData(value, propName, propPath);
|
let itemData = this._genInfoData(value, propName, propPath);
|
||||||
if (itemData) {
|
if (itemData) {
|
||||||
|
if (itemData instanceof NumberData && options.step !== undefined) {
|
||||||
|
itemData.step = options.step;
|
||||||
|
}
|
||||||
data.add(new Property(propName, itemData));
|
data.add(new Property(propName, itemData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +475,10 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private getStep(node: any, key: string) {
|
private getStep(node: any, key: string | number) {
|
||||||
|
if (typeof key !== "string") {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
const cfgArray: Array<{ type: any; keys: Array<{ key: string; step: number }> }> = [];
|
const cfgArray: Array<{ type: any; keys: Array<{ key: string; step: number }> }> = [];
|
||||||
if (cc.Node) {
|
if (cc.Node) {
|
||||||
cfgArray.push({
|
cfgArray.push({
|
||||||
@ -482,9 +488,18 @@ export class Inspector extends InjectEvent {
|
|||||||
{ key: "anchorY", step: 0.1 },
|
{ key: "anchorY", step: 0.1 },
|
||||||
{ key: "scaleX", step: 0.1 },
|
{ key: "scaleX", step: 0.1 },
|
||||||
{ key: "scaleY", step: 0.1 },
|
{ key: "scaleY", step: 0.1 },
|
||||||
|
{ key: "scale", step: 0.1 },
|
||||||
|
{ key: "worldScale", step: 0.1 },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const tr = cc.UITransformComponent || cc.UITransform;
|
||||||
|
if (tr) {
|
||||||
|
cfgArray.push({
|
||||||
|
type: tr,
|
||||||
|
keys: [{ key: "anchorPoint", step: 0.1 }],
|
||||||
|
});
|
||||||
|
}
|
||||||
for (let i = 0; i < cfgArray.length; i++) {
|
for (let i = 0; i < cfgArray.length; i++) {
|
||||||
const { type, keys } = cfgArray[i];
|
const { type, keys } = cfgArray[i];
|
||||||
if (node instanceof type) {
|
if (node instanceof type) {
|
||||||
@ -518,9 +533,7 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
case "number": {
|
case "number": {
|
||||||
const info = new NumberData(propertyValue);
|
const info = new NumberData(propertyValue);
|
||||||
if (typeof key === "string") {
|
info.step = this.getStep(node, key);
|
||||||
info.step = this.getStep(node, key);
|
|
||||||
}
|
|
||||||
return make(info);
|
return make(info);
|
||||||
}
|
}
|
||||||
case "string": {
|
case "string": {
|
||||||
@ -563,6 +576,7 @@ export class Inspector extends InjectEvent {
|
|||||||
path: path,
|
path: path,
|
||||||
data: new Vec3Data(),
|
data: new Vec3Data(),
|
||||||
keys: ["x", "y", "z"],
|
keys: ["x", "y", "z"],
|
||||||
|
step: this.getStep(node, key),
|
||||||
value: propertyValue,
|
value: propertyValue,
|
||||||
});
|
});
|
||||||
if (info) {
|
if (info) {
|
||||||
@ -584,6 +598,7 @@ export class Inspector extends InjectEvent {
|
|||||||
ctor: cc.Vec2,
|
ctor: cc.Vec2,
|
||||||
path: path,
|
path: path,
|
||||||
data: new Vec2Data(),
|
data: new Vec2Data(),
|
||||||
|
step: this.getStep(node, key),
|
||||||
keys: ["x", "y"],
|
keys: ["x", "y"],
|
||||||
value: propertyValue,
|
value: propertyValue,
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@ export interface BuildArrayOptions {
|
|||||||
export interface BuildVecOptions {
|
export interface BuildVecOptions {
|
||||||
path: string[];
|
path: string[];
|
||||||
keys: string[];
|
keys: string[];
|
||||||
|
step?: number;
|
||||||
ctor: Function;
|
ctor: Function;
|
||||||
value: Object;
|
value: Object;
|
||||||
data: Vec3Data | Vec2Data;
|
data: Vec3Data | Vec2Data;
|
||||||
|
@ -170,7 +170,11 @@ export function getSimpleProperties(typeName: string): string[] {
|
|||||||
"worldScale",
|
"worldScale",
|
||||||
// "worldRotation",// 渲染有问题,暂时先不支持这个属性
|
// "worldRotation",// 渲染有问题,暂时先不支持这个属性
|
||||||
];
|
];
|
||||||
config[CompType.UITransform] = ["anchor", "size"];
|
config[CompType.UITransform] = [
|
||||||
|
"anchorPoint", //vec2类型,step会正确处理
|
||||||
|
// "anchor",// FIXME: 会被Inspector属性配对,无法正确处理step
|
||||||
|
"size",
|
||||||
|
];
|
||||||
config[CompType.Widget] = [
|
config[CompType.Widget] = [
|
||||||
"left",
|
"left",
|
||||||
"right",
|
"right",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user