This commit is contained in:
xu_yanfeng 2025-01-29 20:53:10 +08:00
parent bc2052e2b7
commit 8e67104ec6
3 changed files with 206 additions and 201 deletions

View File

@ -1,12 +1,13 @@
declare const cc: any; declare const cc: any;
export const enumConfig: Array<{ export function getEnumListConfig() {
const enumConfig: Array<{
type: any; type: any;
list: Array<{ list: Array<{
key: string; key: string;
values: () => Array<{ name: string; value: number }>; values: () => Array<{ name: string; value: number }>;
}>; }>;
}> = [ }> = [
{ {
type: cc.Widget, type: cc.Widget,
list: [ list: [
@ -221,4 +222,6 @@ export const enumConfig: Array<{
}, },
], ],
}, },
]; ];
return enumConfig;
}

View File

@ -2,7 +2,7 @@
import { uniq } from "lodash"; import { uniq } from "lodash";
import { Msg, PluginEvent, RequestLogData, RequestNodeInfoData, RequestSetPropertyData, ResponseGameInfoData, ResponseNodeInfoData, ResponseSetPropertyData, ResponseSupportData, ResponseTreeInfoData } from "../../core/types"; import { Msg, PluginEvent, RequestLogData, RequestNodeInfoData, RequestSetPropertyData, ResponseGameInfoData, ResponseNodeInfoData, ResponseSetPropertyData, ResponseSupportData, ResponseTreeInfoData } from "../../core/types";
import { ArrayData, BoolData, ColorData, DataType, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectCircleData, ObjectData, Property, StringData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../../views/devtools/data"; import { ArrayData, BoolData, ColorData, DataType, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectCircleData, ObjectData, Property, StringData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../../views/devtools/data";
import { enumConfig } from "./enumConfig"; import { getEnumListConfig } from "./enumConfig";
import { InjectEvent } from "./event"; import { InjectEvent } from "./event";
import { Hint } from "./hint"; import { Hint } from "./hint";
import { injectView } from "./inject-view"; import { injectView } from "./inject-view";
@ -517,8 +517,9 @@ export class Inspector extends InjectEvent {
return false; return false;
} }
private getEnum(node: any, key: string): Array<{ name: string; value: number }> | null { private getEnum(node: any, key: string): Array<{ name: string; value: number }> | null {
for (let i = 0; i < enumConfig.length; i++) { const cfgArray = getEnumListConfig();
const { type, list } = enumConfig[i]; for (let i = 0; i < cfgArray.length; i++) {
const { type, list } = cfgArray[i];
if (type && node instanceof type) { if (type && node instanceof type) {
const ret = list.find((item) => item.key === key); const ret = list.find((item) => item.key === key);
if (ret) { if (ret) {

View File

@ -94,6 +94,7 @@ export function getSimpleProperties(typeName: string): string[] {
config[CompType.RichText] = [ config[CompType.RichText] = [
"string", "string",
"horizontalAlign", "horizontalAlign",
"verticalAlign",
"fontSize", "fontSize",
"font", "font",
"fontFamily", "fontFamily",