| 1234567891011121314151617181920212223242526272829303132333435 |
- import { _decorator, Component, Node,Button,director,assetManager,Prefab, tween } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('LoadMainScene')
- export class LoadMainScene extends Component {
- @property(Button)
- private button: Button | null = null;
- onLoad() {
- if (this.button) {
- this.button.node.on(Button.EventType.CLICK, this.callback, this);
- }
- }
- start() {
- }
- update(deltaTime: number) {
-
- }
- callback() {
- const sceneName = 'Main';
- director.loadScene(sceneName, (err, scene) => {
- if (err) {
- console.error('场景加载失败:', err);
- return;
- }
- });
- }
- }
|