cocos-基础

import { _decorator, Component, Node , EventTouch, EventMouse, Touch, systemEvent, SystemEvent} from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Uimain')
export class Uimain extends Component {
    @property(Node)
    public playerPlane: Node = null;

    // @property(Node)
    // bgo2: Node = null;
    start () {
                // console.log(this);
        // console.log(this.node);
        // console.log('start');
        // systemEvent.on(SystemEvent.EventType.TOUCH_START,this._touchStart, this);
        // systemEvent.on(SystemEvent.EventType.TOUCH_END,this._touchEnd, this);

        // systemEvent.on(SystemEvent.EventType.TOUCH_MOVE,this._touchMove, this);

        systemEvent.on(SystemEvent.EventType.MOUSE_UP, this.onMouseUp, this);
    }

    onMouseUp(event: EventMouse) {
        // console.log('onMouseUp');

        if (event.getButton() === 0) {
            console.log('onMouseUp 11');
        }
        else if (event.getButton() === 2) {
            console.log('onMouseUp 22');
        }

    }

    _touchStart(touch:Touch,event:EventTouch){
        console.log('TOUCH start');
}
_touchEnd(touch:Touch,event:EventTouch){
    console.log('TOUCH END');
}
_touchMove(touch:Touch,event:EventTouch){
    console.log('TOUCH move');
}
update (deltaTime: number) {
    // [4]
    // this.bgo1.setPosition(0, 100 ,0);
}

}

你可能感兴趣的:(Cocos,javascript,开发语言,ecmascript)