You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
|
|
//*********************
|
|
// create by 流云
|
|
// time: Tue May 27 2025
|
|
// desc:
|
|
//*********************
|
|
import { _decorator, Component, Node, find, Vec4, isValid, UITransform } from 'cc';
|
|
import { Auto_LayerGuide } from './Auto_LayerGuide';
|
|
import { Hole2 } from 'db://assets/res/eff/Hole2';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('UILayerGuide')
|
|
export class UILayerGuide extends Auto_LayerGuide {
|
|
|
|
@property(Node)
|
|
template: Node;
|
|
|
|
onLoad(): void {
|
|
super.onLoad();
|
|
}
|
|
|
|
onEnable(): void {
|
|
super.onEnable();
|
|
}
|
|
|
|
onDisable(): void {
|
|
super.onDisable();
|
|
}
|
|
|
|
onInit(): void {
|
|
|
|
}
|
|
|
|
protected start(): void {
|
|
this.scheduleOnce(() => {
|
|
this.getComponentInChildren(Hole2).showHole(this.getPointDatas());
|
|
},2);
|
|
}
|
|
|
|
private getPointDatas() {
|
|
let pointDatas: Vec4[] = [];
|
|
if (this.template && isValid(this.template)) {
|
|
let pos = this.node.getComponent(UITransform).convertToNodeSpaceAR(this.template.worldPosition);
|
|
//let size = this.targetNode.getComponent(UITransform).getBoundingBox();
|
|
let pointData = new Vec4();
|
|
pointData.x = pos.x;
|
|
pointData.y = pos.y;
|
|
pointData.z = 100;
|
|
pointData.w = 0.02;
|
|
pointDatas.push(pointData);
|
|
}
|
|
return pointDatas;
|
|
}
|
|
}
|
|
|