兼容2x camera.clearFlags的属性

This commit is contained in:
xu_yanfeng 2025-02-14 14:44:21 +08:00
parent ab6b98a99d
commit a54c27c32b
4 changed files with 28 additions and 2 deletions

View File

@ -9,7 +9,7 @@ function i18n(key: string) {
const manifest: CocosPluginManifest = {
name: pkgName,
version: "2.1.9",
version: "2.1.10",
description: "Debug games made with CocosCreator and display node trees and node properties",
store: "https://store.cocos.com/app/detail/2002",
author: "xu_yanfeng",

View File

@ -0,0 +1,3 @@
export function help() {
debugger;
}

View File

@ -1,3 +1,5 @@
import { help } from "./connect-me";
declare const cc: any;
export function getEnumListConfig() {
@ -268,7 +270,10 @@ export function getEnumListConfig() {
{
key: "clearFlags",
values() {
return cc.Camera.ClearFlag.__enums__;
return adaptEnum(
cc.Camera.ClearFlags || // TODO: 2x是个掩码不是枚举
cc.Camera.ClearFlag // 3.x是枚举
);
},
},
{
@ -307,3 +312,20 @@ export function getEnumListConfig() {
];
return enumConfig;
}
function adaptEnum(list: any): Array<{ name: string; value: number }> {
const target = list.__enums__;
if (!target) {
const arr = Object.keys(list).map((key) => {
return {
name: key,
value: list[key],
};
});
return arr;
}
if (!Array.isArray(target)) {
help();
}
return target;
}

View File

@ -123,6 +123,7 @@ export class HintV3 extends HintAdapter {
return camera;
}
private getLayerID() {
// FIXME: https://forum.cocos.org/t/topic/165550
return cc.Layers.Enum.GIZMOS;
}
getRectPoints(node: any): RectPoints | null {