48 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-07-15 18:23:35 +08:00
import { _decorator, Component, Node } from 'cc';
import * as cc from 'cc';
2022-07-16 03:37:18 +08:00
import { RollingLottery } from './RollingLottery';
2022-07-15 18:23:35 +08:00
const { ccclass, property } = _decorator;
@ccclass('main')
export class main extends Component {
/* ------------------------------- segmentation ------------------------------- */
start() {
2022-07-16 03:37:18 +08:00
let comp = this.node.getComponentInChildren(RollingLottery);
2022-07-16 04:02:04 +08:00
// comp.loop(1500);
2022-07-16 01:54:43 +08:00
// let indexN = 0;
// this.node.on(
// cc.Node.EventType.TOUCH_END,
// () => {
2022-07-16 04:02:04 +08:00
// comp.scroll(0, {});
2022-07-16 01:54:43 +08:00
// },
// this
// );
2022-07-16 04:02:04 +08:00
comp.scroll(10, {});
2022-07-16 01:54:43 +08:00
2022-07-16 04:02:04 +08:00
// comp.reset();
// comp.loop(-1500);
2022-07-16 03:37:18 +08:00
// setTimeout(() => {
// comp.scroll(-10, {
// tweenIndexN: 3,
// endCBF: () => {
// // comp.scroll(25, {
// // tweenIndexN: 3
// // });
// }
// });
// }, 3000);
2022-07-15 18:23:35 +08:00
}
/* ------------------------------- segmentation ------------------------------- */
eventItemUpdate(node_: cc.Node, indexN_: number): void {
node_.getComponentInChildren(cc.Label).string = indexN_ + '';
}
2022-07-16 01:54:43 +08:00
2022-07-16 04:02:04 +08:00
eventCenterNode(indexN_: number): void {
2022-07-16 01:54:43 +08:00
cc.log('当前下标', indexN_);
}
2022-07-16 04:02:04 +08:00
eventScrollEnd(): void {
2022-07-16 01:54:43 +08:00
cc.log('滚动结束');
}
2022-07-15 18:23:35 +08:00
}