[add] first

This commit is contained in:
2023-11-07 09:17:57 +08:00
commit 23924175a2
1102 changed files with 313997 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { _decorator, Component, LabelComponent, Vec3, UITransform, Size, isValid, AnimationComponent } from 'cc';
import {PoolManager} from '../../framework/poolManager';
const { ccclass, property } = _decorator;
@ccclass('Tips')
export class Tips extends Component {
@property(LabelComponent)
lbTips: LabelComponent = null!;
targetPos: any;
show (content: string, callback?: Function) {
this.targetPos = new Vec3(0, 0, 0);
this.node.setPosition(this.targetPos);
this.lbTips.string = content;
let size: Size = this.lbTips.node.getComponent(UITransform)?.contentSize as Size;
if (!isValid(size)) {
PoolManager.instance.putNode(this.node);
return;
}
this.node.getComponent(UITransform)?.setContentSize(size.width + 100 < 240 ? 240 : size.width + 100, size.height + 30);
let animation: AnimationComponent = this.node.getComponent(AnimationComponent) as AnimationComponent;
animation.play();
animation.once(AnimationComponent.EventType.FINISHED, () => {
callback && callback();
PoolManager.instance.putNode(this.node);
})
}
}

View File

@@ -0,0 +1,11 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "a91d7339-e96d-451b-8be6-e1c5dbf91132",
"files": [],
"subMetas": {},
"userData": {
"simulateGlobals": []
}
}