chore: update coin icon
parent
e3515cc6e4
commit
f5cd5fb092
File diff suppressed because it is too large
Load Diff
|
@ -12662,7 +12662,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 103.36,
|
||||
"width": 103.359375,
|
||||
"height": 113.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -12828,7 +12828,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "c0993ac2-edd6-48ee-bb90-bf184f69913e@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
@ -15305,7 +15305,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -38.5,
|
||||
"x": -43.5,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15414,7 +15414,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -89.5,
|
||||
"x": -92,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15453,7 +15453,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 82,
|
||||
"width": 77,
|
||||
"height": 77
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -15484,7 +15484,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "7e3111b9-bb1b-4c4e-a9ed-c2c20880cc74@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
|
|
@ -15316,7 +15316,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "c0993ac2-edd6-48ee-bb90-bf184f69913e@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
@ -17811,7 +17811,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -38.5,
|
||||
"x": -43.5,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -17920,7 +17920,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -89.5,
|
||||
"x": -92,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -17959,7 +17959,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 82,
|
||||
"width": 77,
|
||||
"height": 77
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -17990,7 +17990,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "7e3111b9-bb1b-4c4e-a9ed-c2c20880cc74@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
|
|
@ -12844,7 +12844,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 103.36,
|
||||
"width": 103.359375,
|
||||
"height": 113.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -13010,7 +13010,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "c0993ac2-edd6-48ee-bb90-bf184f69913e@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
@ -15505,7 +15505,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -38.5,
|
||||
"x": -43.5,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15614,7 +15614,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -89.5,
|
||||
"x": -92,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15653,7 +15653,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 82,
|
||||
"width": 77,
|
||||
"height": 77
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -15684,7 +15684,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "7e3111b9-bb1b-4c4e-a9ed-c2c20880cc74@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
|
|
@ -12936,8 +12936,8 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 73,
|
||||
"height": 73
|
||||
"width": 326,
|
||||
"height": 339
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
@ -12967,7 +12967,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "c0993ac2-edd6-48ee-bb90-bf184f69913e@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
@ -15444,7 +15444,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -38.5,
|
||||
"x": -43.5,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15553,7 +15553,7 @@
|
|||
"_prefab": null,
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -89.5,
|
||||
"x": -92,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
@ -15592,7 +15592,7 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 82,
|
||||
"width": 77,
|
||||
"height": 77
|
||||
},
|
||||
"_anchorPoint": {
|
||||
|
@ -15623,7 +15623,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "7e3111b9-bb1b-4c4e-a9ed-c2c20880cc74@f9941",
|
||||
"__uuid__": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
|
|
@ -12978,8 +12978,8 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 109,
|
||||
"height": 106
|
||||
"width": 77,
|
||||
"height": 77
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
@ -13009,12 +13009,12 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "1e035de6-1763-4993-9ad8-3cda9c98a74d@f9941",
|
||||
"__uuid__": "422f743c-069b-4263-968d-64d67c5a0377@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 1,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
|
@ -15960,8 +15960,8 @@
|
|||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 96,
|
||||
"height": 107
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
@ -15991,7 +15991,7 @@
|
|||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "93bbfa1f-4594-4b44-9ab8-f0ad90dbc4a8@f9941",
|
||||
"__uuid__": "422f743c-069b-4263-968d-64d67c5a0377@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, director, Director, Node } from 'cc';
|
||||
import { Component } from 'cc';
|
||||
|
||||
export default function registerGizmos(constructor: new () => Component) {
|
||||
const w = window as any;
|
||||
|
|
|
@ -20,10 +20,12 @@ if (Editor) {
|
|||
for (let i = 0; i < w._componentsGizmos.length; i++) {
|
||||
const comps: Component[] = root.getComponentsInChildren(w._componentsGizmos[i]);
|
||||
comps.forEach((comp) => {
|
||||
if (comp.node.active && comp.enabled) {
|
||||
comp.onDrawGizmos?.();
|
||||
if (selectedList.includes(comp.node.uuid)) {
|
||||
comp.onDrawGizmosSelected?.();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
import { _decorator, CCObject, Color, Component, Graphics, IVec2Like, Layers, Node, toRadian, Vec3 } from 'cc';
|
||||
import {
|
||||
_decorator,
|
||||
CCObject,
|
||||
Color,
|
||||
Component,
|
||||
Graphics,
|
||||
IVec2Like,
|
||||
Label,
|
||||
Layers,
|
||||
Node,
|
||||
Sprite,
|
||||
SpriteFrame,
|
||||
toRadian,
|
||||
Vec2,
|
||||
Vec3,
|
||||
} from 'cc';
|
||||
|
||||
const { ccclass, executeInEditMode } = _decorator;
|
||||
|
||||
|
@ -10,6 +25,12 @@ class GizmosRenderer {
|
|||
this._drawCalls.push(drawCall);
|
||||
}
|
||||
|
||||
public addDrawTextCall(labelID: string, drawCall: () => void) {
|
||||
this._drawCalls.push(() => drawCall());
|
||||
}
|
||||
|
||||
public addDrawSpriteCall(spriteID: string, drawCall: (sprite: Sprite) => void) {}
|
||||
|
||||
constructor(graphic: Graphics) {
|
||||
this._graphic = graphic;
|
||||
}
|
||||
|
@ -35,16 +56,33 @@ class GizmosRenderer {
|
|||
@executeInEditMode
|
||||
class GizmosDebugDraw extends Component {
|
||||
private _renderers: Map<string, GizmosRenderer> = new Map();
|
||||
private _labelMap: Map<string, Label> = new Map();
|
||||
private _spriteMap: Map<string, Sprite> = new Map();
|
||||
private _color: Color = Gizmos2D.DEFAULT_COLOR;
|
||||
private _useLocalPosition: boolean = false;
|
||||
private _layer: Layers.Enum = Gizmos2D.DEFAULT_LAYER;
|
||||
private _drawCallsNoneGeometry: (() => void)[] = [];
|
||||
|
||||
protected lateUpdate(dt: number): void {
|
||||
this._labelMap.forEach((label) => {
|
||||
label.string = '';
|
||||
});
|
||||
|
||||
this._spriteMap.forEach((sprite) => {
|
||||
sprite.spriteFrame = null;
|
||||
});
|
||||
|
||||
this._renderers.forEach((renderer) => {
|
||||
renderer.clear();
|
||||
renderer.draw();
|
||||
});
|
||||
|
||||
this._drawCallsNoneGeometry.forEach((drawCall) => {
|
||||
drawCall();
|
||||
});
|
||||
|
||||
this._drawCallsNoneGeometry = [];
|
||||
|
||||
this._color = Gizmos2D.DEFAULT_COLOR;
|
||||
this._useLocalPosition = false;
|
||||
this._layer = Gizmos2D.DEFAULT_LAYER;
|
||||
|
@ -79,6 +117,30 @@ class GizmosDebugDraw extends Component {
|
|||
return local;
|
||||
}
|
||||
|
||||
private getSprite(id: string) {
|
||||
let sprite = this._spriteMap.get(id);
|
||||
if (!sprite) {
|
||||
sprite = new Node('spriteID: ' + id).addComponent(Sprite);
|
||||
this._spriteMap.set(id, sprite);
|
||||
sprite.node.layer = this.node.layer;
|
||||
sprite.node.setParent(this.node);
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
private getLabel(id: string): Label {
|
||||
let label = this._labelMap.get(id);
|
||||
if (!label) {
|
||||
label = new Node('labelID: ' + id).addComponent(Label);
|
||||
this._labelMap.set(id, label);
|
||||
label.node.layer = this.node.layer;
|
||||
label.node.setParent(this.node);
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
public setColor(color: Color) {
|
||||
this._color = color;
|
||||
}
|
||||
|
@ -91,6 +153,47 @@ class GizmosDebugDraw extends Component {
|
|||
this._layer = layer;
|
||||
}
|
||||
|
||||
public drawSprite(
|
||||
id: string,
|
||||
spriteFrame: SpriteFrame,
|
||||
position: IVec2Like,
|
||||
scale: Vec2 = Vec2.ONE,
|
||||
color: Color = Color.WHITE,
|
||||
) {
|
||||
const sprite = this.getSprite(id);
|
||||
sprite.node.layer = this._layer;
|
||||
this._drawCallsNoneGeometry.push(() => {
|
||||
sprite.color = color;
|
||||
sprite.spriteFrame = spriteFrame;
|
||||
sprite.node.setScale(new Vec3(scale.x, scale.y));
|
||||
const p = new Vec3(position.x, position.y);
|
||||
if (this._useLocalPosition) {
|
||||
sprite.node.setPosition(p);
|
||||
} else {
|
||||
sprite.node.setWorldPosition(p);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public drawLabel(id: string, text: string, position: IVec2Like, fontSize: number = 40, scale: Vec2 = Vec2.ONE) {
|
||||
const color = this._color.clone();
|
||||
const label = this.getLabel(id);
|
||||
label.node.layer = this._layer;
|
||||
this._drawCallsNoneGeometry.push(() => {
|
||||
label.color = color;
|
||||
label.fontSize = fontSize;
|
||||
label.lineHeight = fontSize;
|
||||
label.string = text;
|
||||
label.node.setScale(new Vec3(scale.x, scale.y));
|
||||
const p = new Vec3(position.x, position.y);
|
||||
if (this._useLocalPosition) {
|
||||
label.node.setPosition(p);
|
||||
} else {
|
||||
label.node.setWorldPosition(p);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public drawLine(point1: IVec2Like, point2: IVec2Like) {
|
||||
const color = this._color.clone();
|
||||
const renderer = this.getRenderer(color);
|
||||
|
@ -284,7 +387,7 @@ export default class Gizmos2D {
|
|||
private static getDebugNode(node: Node) {
|
||||
let debugNode = node.getComponentInChildren(GizmosDebugDraw);
|
||||
if (!debugNode) {
|
||||
debugNode = new Node('DEBUG_DRAW_NODE').addComponent(GizmosDebugDraw);
|
||||
debugNode = new Node('DEBUG_DRAW2D_NODE').addComponent(GizmosDebugDraw);
|
||||
debugNode.node.layer = this.DEFAULT_LAYER;
|
||||
debugNode.node.hideFlags |= CCObject.Flags.DontSave | CCObject.Flags.HideInHierarchy;
|
||||
debugNode.node.parent = node;
|
||||
|
@ -305,6 +408,28 @@ export default class Gizmos2D {
|
|||
this.getDebugNode(node).setUseLocalPosition(false);
|
||||
}
|
||||
|
||||
public static drawSprite(
|
||||
node: Node,
|
||||
id: string,
|
||||
spriteFrame: SpriteFrame,
|
||||
position: IVec2Like,
|
||||
scale: Vec2 = Vec2.ONE,
|
||||
color: Color = Color.WHITE,
|
||||
) {
|
||||
this.getDebugNode(node).drawSprite(id, spriteFrame, position, scale, color);
|
||||
}
|
||||
|
||||
public static drawLabel(
|
||||
node: Node,
|
||||
id: string,
|
||||
text: string,
|
||||
point: IVec2Like,
|
||||
fontSize: number = 40,
|
||||
scale: Vec2 = Vec2.ONE,
|
||||
) {
|
||||
this.getDebugNode(node).drawLabel(id, text, point, fontSize, scale);
|
||||
}
|
||||
|
||||
public static beginLayer(node: Node, layer: Layers.Enum) {
|
||||
this.getDebugNode(node).setLayer(layer);
|
||||
}
|
||||
|
|
|
@ -7,12 +7,15 @@ import {
|
|||
director,
|
||||
geometry,
|
||||
GeometryRenderer,
|
||||
gfx,
|
||||
Label,
|
||||
Layers,
|
||||
Mat4,
|
||||
Material,
|
||||
Node,
|
||||
RenderRoot2D,
|
||||
Sprite,
|
||||
SpriteFrame,
|
||||
toRadian,
|
||||
Vec2,
|
||||
Vec3,
|
||||
} from 'cc';
|
||||
import { cce } from './Define';
|
||||
|
@ -26,14 +29,23 @@ class GizmosDebugDraw extends Component {
|
|||
private _renderer: GeometryRenderer = null;
|
||||
private _depthTest: boolean = true;
|
||||
private _useLocalPosition: boolean = false;
|
||||
private _components: (new () => Component)[] = [];
|
||||
private _camera: Node;
|
||||
private _labelMap: Map<string, Label> = new Map();
|
||||
private _spriteMap: Map<string, Sprite> = new Map();
|
||||
private _root2D: Node;
|
||||
private _drawCalls2D: (() => void)[] = [];
|
||||
|
||||
protected onLoad(): void {
|
||||
this._root2D = new Node('Root2D');
|
||||
this._root2D.addComponent(RenderRoot2D);
|
||||
this._root2D.setParent(this.node);
|
||||
if (cce) {
|
||||
this._camera = cce.Camera._camera.camera.node;
|
||||
cce.Camera._camera.camera.initGeometryRenderer();
|
||||
this._renderer = cce.Camera._camera.camera.geometryRenderer;
|
||||
} else {
|
||||
const camera = director.getScene().getComponentInChildren(Camera).camera;
|
||||
this._camera = camera.node;
|
||||
camera.initGeometryRenderer();
|
||||
this._renderer = camera.geometryRenderer;
|
||||
}
|
||||
|
@ -46,6 +58,19 @@ class GizmosDebugDraw extends Component {
|
|||
}
|
||||
|
||||
protected lateUpdate(dt: number): void {
|
||||
this._labelMap.forEach((label) => {
|
||||
label.string = '';
|
||||
label.node.setRotationFromEuler(this._camera.eulerAngles);
|
||||
});
|
||||
|
||||
this._spriteMap.forEach((sprite) => {
|
||||
sprite.spriteFrame = null;
|
||||
sprite.node.setRotationFromEuler(this._camera.eulerAngles);
|
||||
});
|
||||
|
||||
this._drawCalls2D.forEach((drawCall) => drawCall());
|
||||
|
||||
this._drawCalls2D = [];
|
||||
this._color = Gizmos3D.DEFAULT_COLOR;
|
||||
this._useLocalPosition = false;
|
||||
}
|
||||
|
@ -60,10 +85,6 @@ class GizmosDebugDraw extends Component {
|
|||
this._depthTest = value;
|
||||
}
|
||||
|
||||
public registerDrawGizmos(component: new () => Component) {
|
||||
this._components.push(component);
|
||||
}
|
||||
|
||||
public setColor(color: Color) {
|
||||
this._color = color;
|
||||
}
|
||||
|
@ -93,6 +114,57 @@ class GizmosDebugDraw extends Component {
|
|||
return result;
|
||||
}
|
||||
|
||||
private getSprite(id: string): Sprite {
|
||||
let sprite = this._spriteMap.get(id);
|
||||
if (!sprite) {
|
||||
sprite = new Node('spriteID: ' + id).addComponent(Sprite);
|
||||
this._spriteMap.set(id, sprite);
|
||||
sprite.node.setParent(this._root2D);
|
||||
}
|
||||
return sprite;
|
||||
}
|
||||
|
||||
private getLabel(id: string): Label {
|
||||
let label = this._labelMap.get(id);
|
||||
if (!label) {
|
||||
label = new Node('LabelID: ' + id).addComponent(Label);
|
||||
this._labelMap.set(id, label);
|
||||
label.node.setParent(this._root2D);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
public drawSprite(id: string, spriteFrame: SpriteFrame, position: Vec3, scale: Vec2, color: Color = Color.WHITE) {
|
||||
const sprite = this.getSprite(id);
|
||||
this._drawCalls2D.push(() => {
|
||||
sprite.spriteFrame = spriteFrame;
|
||||
sprite.color = color;
|
||||
sprite.node.setScale(new Vec3(scale.x, scale.y));
|
||||
if (this._useLocalPosition) {
|
||||
sprite.node.setPosition(position);
|
||||
} else {
|
||||
sprite.node.setWorldPosition(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public drawLabel(id: string, text: string, position: Vec3, fontSize: number = 40, scale: number = 1) {
|
||||
const color = this._color.clone();
|
||||
const label = this.getLabel(id);
|
||||
this._drawCalls2D.push(() => {
|
||||
label.string = text;
|
||||
label.color = color;
|
||||
label.fontSize = fontSize;
|
||||
label.lineHeight = fontSize;
|
||||
label.node.setScale(new Vec3(scale, scale));
|
||||
if (this._useLocalPosition) {
|
||||
label.node.setPosition(position);
|
||||
} else {
|
||||
label.node.setWorldPosition(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public drawLine(point1: Vec3, point2: Vec3) {
|
||||
const color = this._color.clone();
|
||||
const p1 = this._useLocalPosition ? this.worldToLocal(point1) : point1;
|
||||
|
@ -274,7 +346,7 @@ class GizmosDebugDraw extends Component {
|
|||
const color = this._color.clone();
|
||||
const p = this._useLocalPosition ? this.worldToLocal(position) : position;
|
||||
const transform = this.rotate(p, rot);
|
||||
let box = geometry?.AABB.create(p.x, p.y, p.z, size.x / 2, size.y / 2, size.z / 2);
|
||||
let box = geometry?.AABB.create(p.x, p.y, p.z, size.x, size.y, size.z);
|
||||
this._renderer?.addBoundingBox(box, color, wireFrame, this._depthTest, false, true, transform);
|
||||
}
|
||||
|
||||
|
@ -348,29 +420,13 @@ class GizmosDebugDraw extends Component {
|
|||
}
|
||||
|
||||
export default class Gizmos3D {
|
||||
private static _mat: Material;
|
||||
|
||||
public static get DEFAULT_MAT() {
|
||||
if (!this._mat) {
|
||||
this._mat = new Material();
|
||||
this._mat.initialize({
|
||||
effectName: 'builtin-unlit',
|
||||
defines: { USE_VERTEX_COLOR: true },
|
||||
states: { primitive: gfx.PrimitiveMode.LINE_LOOP },
|
||||
});
|
||||
this._mat.passes.forEach((v) => v.tryCompile());
|
||||
}
|
||||
|
||||
return this._mat;
|
||||
}
|
||||
|
||||
public static readonly DEFAULT_COLOR = Color.BLUE;
|
||||
public static readonly DEFAULT_LAYER = Layers.Enum.GIZMOS;
|
||||
|
||||
private static getDebugNode(node: Node) {
|
||||
let debugNode = node.getComponentInChildren(GizmosDebugDraw);
|
||||
if (!debugNode) {
|
||||
debugNode = new Node('DEBUG_DRAW_NODE').addComponent(GizmosDebugDraw);
|
||||
debugNode = new Node('DEBUG_DRAW3D_NODE').addComponent(GizmosDebugDraw);
|
||||
debugNode.node.layer = this.DEFAULT_LAYER;
|
||||
debugNode.node.hideFlags |= CCObject.Flags.DontSave | CCObject.Flags.HideInHierarchy;
|
||||
debugNode.node.parent = node;
|
||||
|
@ -391,6 +447,28 @@ export default class Gizmos3D {
|
|||
this.getDebugNode(node)?.setUseLocalPosition(false);
|
||||
}
|
||||
|
||||
public static drawSprite(
|
||||
node: Node,
|
||||
id: string,
|
||||
spriteFrame: SpriteFrame,
|
||||
position: Vec3,
|
||||
scale: Vec2 = Vec2.ONE,
|
||||
color: Color = Color.WHITE,
|
||||
) {
|
||||
this.getDebugNode(node).drawSprite(id, spriteFrame, position, scale, color);
|
||||
}
|
||||
|
||||
public static drawLabel(
|
||||
node: Node,
|
||||
id: string,
|
||||
text: string,
|
||||
position: Vec3,
|
||||
fontSize: number = 15,
|
||||
scale: number = 1,
|
||||
) {
|
||||
this.getDebugNode(node)?.drawLabel(id, text, position, fontSize, scale);
|
||||
}
|
||||
|
||||
public static drawLine(node: Node, point1: Vec3, point2: Vec3) {
|
||||
const debugNode = this.getDebugNode(node);
|
||||
debugNode?.drawLine(point1, point2);
|
||||
|
@ -408,7 +486,7 @@ export default class Gizmos3D {
|
|||
|
||||
public static drawDashLineList(node: Node, points: Vec3[], close: boolean = false) {
|
||||
const debugNode = this.getDebugNode(node);
|
||||
debugNode?.drawDashLineList(points, close);
|
||||
debugNode?.drawLineList(points, close);
|
||||
}
|
||||
|
||||
public static drawCircle(node: Node, center: Vec3, radius: number, rot: Vec3 = Vec3.ZERO, segments: number = 32) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
"ver": "1.0.26",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "658aebbc-3d9a-4bb4-a02c-631f56f7595f",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "658aebbc-3d9a-4bb4-a02c-631f56f7595f@6c48a",
|
||||
"displayName": "Coin",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "658aebbc-3d9a-4bb4-a02c-631f56f7595f",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "658aebbc-3d9a-4bb4-a02c-631f56f7595f@f9941",
|
||||
"displayName": "Coin",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 236,
|
||||
"height": 259,
|
||||
"rawWidth": 236,
|
||||
"rawHeight": 259,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-118,
|
||||
-129.5,
|
||||
0,
|
||||
118,
|
||||
-129.5,
|
||||
0,
|
||||
-118,
|
||||
129.5,
|
||||
0,
|
||||
118,
|
||||
129.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
259,
|
||||
236,
|
||||
259,
|
||||
0,
|
||||
0,
|
||||
236,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-118,
|
||||
-129.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
118,
|
||||
129.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "658aebbc-3d9a-4bb4-a02c-631f56f7595f@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "658aebbc-3d9a-4bb4-a02c-631f56f7595f@f9941"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
"ver": "1.0.26",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "422f743c-069b-4263-968d-64d67c5a0377",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "422f743c-069b-4263-968d-64d67c5a0377@6c48a",
|
||||
"displayName": "Coin",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "422f743c-069b-4263-968d-64d67c5a0377",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "422f743c-069b-4263-968d-64d67c5a0377@f9941",
|
||||
"displayName": "Coin",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 160,
|
||||
"height": 163,
|
||||
"rawWidth": 160,
|
||||
"rawHeight": 163,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-80,
|
||||
-81.5,
|
||||
0,
|
||||
80,
|
||||
-81.5,
|
||||
0,
|
||||
-80,
|
||||
81.5,
|
||||
0,
|
||||
80,
|
||||
81.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
163,
|
||||
160,
|
||||
163,
|
||||
0,
|
||||
0,
|
||||
160,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-80,
|
||||
-81.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
80,
|
||||
81.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "422f743c-069b-4263-968d-64d67c5a0377@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "422f743c-069b-4263-968d-64d67c5a0377@f9941"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
"ver": "1.0.26",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "b1bf542e-dc26-466f-a84d-2072fe3ed641",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "b1bf542e-dc26-466f-a84d-2072fe3ed641@6c48a",
|
||||
"displayName": "Coin",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "b1bf542e-dc26-466f-a84d-2072fe3ed641",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941",
|
||||
"displayName": "Coin",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 326,
|
||||
"height": 339,
|
||||
"rawWidth": 326,
|
||||
"rawHeight": 339,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-163,
|
||||
-169.5,
|
||||
0,
|
||||
163,
|
||||
-169.5,
|
||||
0,
|
||||
-163,
|
||||
169.5,
|
||||
0,
|
||||
163,
|
||||
169.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
339,
|
||||
326,
|
||||
339,
|
||||
0,
|
||||
0,
|
||||
326,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-163,
|
||||
-169.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
163,
|
||||
169.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "b1bf542e-dc26-466f-a84d-2072fe3ed641@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "b1bf542e-dc26-466f-a84d-2072fe3ed641@f9941"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 108 KiB |
|
@ -2,10 +2,10 @@
|
|||
"__version__": "1.3.7",
|
||||
"splash-setting": {
|
||||
"logo": {
|
||||
"image": "project://settings/Asset 3@4x.png",
|
||||
"type": "default"
|
||||
"image": "project://settings/image_2023-10-18_15_39_48.png",
|
||||
"type": "custom"
|
||||
},
|
||||
"displayRatio": 1,
|
||||
"displayRatio": 2,
|
||||
"background": {
|
||||
"type": "default"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue