123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
- import { Options } from "../GameUI/PopManger";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class PopComponet extends cc.Component {
- Options: Options = null
- MyPopBronTime: number = 0
- onLoad() {
- this.MyPopBronTime = cc.sys.now()
- let Mask = this.node.getChildByName("Mask")
- Mask.on(cc.Node.EventType.TOUCH_START, (event: cc.Event.EventTouch) => {
- event.stopPropagation()
- if (cc.sys.now() - this.MyPopBronTime>500) {
- this.Surpclose()
- }
- })
- }
- Surpclose() {
- this.node.destroy()
- }
- //带有 Widget 的节点 经过动画之后 会不正确的显示
- OpenAniOver() {
- this.scheduleOnce(() => {
- this.getComponentsInChildren((cc.Widget)).forEach((e) => {
- e.updateAlignment()
- })
- }, 0)
- }
- }
|