From 0e1b6793d535bf75a0c70a35d59b75258af2ebd1 Mon Sep 17 00:00:00 2001 From: lujun <495904500@qq.com> Date: Mon, 6 Feb 2023 09:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/lcc-ui-sorting-group/sorting-group.ts | 5 +- assets/test/scenes/test-scene-sorting.scene | 446 ++++++++++++++++++- 2 files changed, 438 insertions(+), 13 deletions(-) diff --git a/assets/lcc-ui-sorting-group/sorting-group.ts b/assets/lcc-ui-sorting-group/sorting-group.ts index 688f623..efa5be9 100644 --- a/assets/lcc-ui-sorting-group/sorting-group.ts +++ b/assets/lcc-ui-sorting-group/sorting-group.ts @@ -1,11 +1,12 @@ import { _decorator, Component, Node, ccenum, CCInteger, CCFloat, Enum, director, UI, UIRenderer } from 'cc'; import { DEFAULT_SORTING_PRIORITY, ORDER_IN_LAYER_MAX, SortingLayer } from './sorting-define'; -const { ccclass, property, type, disallowMultiple, requireComponent } = _decorator; +const { ccclass, property, type, disallowMultiple, requireComponent, executeInEditMode } = _decorator; @ccclass('lcc-ui/SortingGroup') @requireComponent(UIRenderer) -@disallowMultiple +@disallowMultiple(true) +@executeInEditMode(true) export class SortingGroup extends Component { /** * 排序层 diff --git a/assets/test/scenes/test-scene-sorting.scene b/assets/test/scenes/test-scene-sorting.scene index e20bb34..3ac39b4 100644 --- a/assets/test/scenes/test-scene-sorting.scene +++ b/assets/test/scenes/test-scene-sorting.scene @@ -27,11 +27,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 29 + "__id__": 42 }, "autoReleaseAssets": false, "_globals": { - "__id__": 30 + "__id__": 43 }, "_id": "b977450f-1cd5-49fa-a8db-db655012dcf5" }, @@ -224,21 +224,24 @@ }, { "__id__": 10 + }, + { + "__id__": 25 } ], "_active": true, "_components": [ { - "__id__": 25 + "__id__": 38 }, { - "__id__": 26 + "__id__": 39 }, { - "__id__": 27 + "__id__": 40 }, { - "__id__": 28 + "__id__": 41 } ], "_prefab": null, @@ -850,6 +853,427 @@ "_atlas": null, "_id": "66BxXNowJNgJ1a+TyU6kmL" }, + { + "__type__": "cc.Node", + "_name": "Node", + "_objFlags": 0, + "_parent": { + "__id__": 7 + }, + "_children": [ + { + "__id__": 26 + }, + { + "__id__": 30 + }, + { + "__id__": 33 + } + ], + "_active": false, + "_components": [ + { + "__id__": 37 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "50aoPOa8xDDZX7bBk/TBe3" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "_parent": { + "__id__": 25 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 28 + }, + { + "__id__": 29 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 86.86400000000003, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "78yNXm8OhNFLWNCAIae7EY" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 318.81, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "34fYi8MbJLoJF6CVgWhZlP" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "label111111111111", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 40, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_id": "1fInPmRQBBP6E5Xdr8aJhF" + }, + { + "__type__": "5c8c9BaV+VA1Z3pK+Zsi3Cb", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": null, + "sortingLayer": 1, + "orderInLayer": 0, + "_id": "efCgxc/lVEPqsH8au8/ebz" + }, + { + "__type__": "cc.Node", + "_name": "SpriteSplash", + "_objFlags": 0, + "_parent": { + "__id__": 25 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 31 + }, + { + "__id__": 32 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 4.493000000000052, + "y": 7.488500000000045, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "9eUGMhsQ5O44Vp94x7srUD" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 30 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 654.13, + "height": 378.563 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d6wtcLq39FF4+nTRUnDOlt" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 30 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 0, + "b": 0, + "a": 136 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "f8jFuhTsBCK7BSe6FQJtJ4" + }, + { + "__type__": "cc.Node", + "_name": "Label-001", + "_objFlags": 0, + "_parent": { + "__id__": 25 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 34 + }, + { + "__id__": 35 + }, + { + "__id__": 36 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -47.92500000000001, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "1b8C+SFfJLEb4nx0wQ8Zue" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 329.22, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d1Gx80qUFP5LRgmFxRFjWw" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "label22222222222", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 40, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_id": "27iorVNlhOCpEZnibntFMV" + }, + { + "__type__": "5c8c9BaV+VA1Z3pK+Zsi3Cb", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": null, + "sortingLayer": 1, + "orderInLayer": 0, + "_id": "126CLe+FtLK6NZ5f0v9mHT" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "c0+Znh+wNM+4H6zrz3BEP5" + }, { "__type__": "cc.UITransform", "_name": "", @@ -955,19 +1379,19 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 31 + "__id__": 44 }, "shadows": { - "__id__": 32 + "__id__": 45 }, "_skybox": { - "__id__": 33 + "__id__": 46 }, "fog": { - "__id__": 34 + "__id__": 47 }, "octree": { - "__id__": 35 + "__id__": 48 } }, {