MatchMaster/assets/career2/script/move.ts
2026-07-30 20:01:07 +08:00

46 lines
1.4 KiB
TypeScript

// 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
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
this.node.on(cc.Node.EventType.TOUCH_START, this._onTopFadeTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTopFadeTouchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this._onTopFadeTouchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTopFadeTouchEnd, this);
}
//触摸开始
_onTopFadeTouchStart() {
this.node.parent.getChildByName("ScrollView").getComponent("CareerList2")._onTopFadeTouchStart();
}
//触摸移动
_onTopFadeTouchMove() {
this.node.parent.getChildByName("ScrollView").getComponent("CareerList2")._onTopFadeTouchMove();
}
//触摸结束
_onTopFadeTouchEnd() {
this.node.parent.getChildByName("ScrollView").getComponent("CareerList2")._onTopFadeTouchEnd();
}
// update (dt) {}
}