-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何实现横屏游戏 #222
Comments
https://github.com/eva-engine/FlashArrowMan 主动旋转游戏容器 |
我搬了代码过来,不过我在屏幕的点击事件还是没有触发到最终的gameobject上来。
然后我创建game就是这个样: const rendererSystem = new RendererSystem({ const game = new Game({ |
|
我的问题是没有触发tap跟touchend,那个touchstart跟move就正常。奇怪。 |
手机设置竖排方向锁定。你加我微信maydayfantast |
因为 makeHorizental 方法使用了 可以通过以下手段解决。 export const fixPIXI = (game: Game) => {
game.getSystem(RendererSystem).application.renderer.plugins.interaction.onPointerComplete = function onPointerComplete(originalEvent, cancelled, func) {
var events = this.normalizeToPointerData(originalEvent);
var eventLen = events.length;
// if the event wasn't targeting our canvas, then consider it to be pointerupoutside
// in all cases (unless it was a pointercancel)
// var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';
// 这里不加outside了
var eventAppend = '';
for (var i = 0; i < eventLen; i++) {
var event = events[i];
var interactionData = this.getInteractionDataForPointerId(event);
var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
interactionEvent.data.originalEvent = originalEvent;
// perform hit testing for events targeting our canvas or cancel events
this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend);
this.emit(cancelled ? 'pointercancel' : 'pointerup' + eventAppend, interactionEvent);
if (event.pointerType === 'mouse' || event.pointerType === 'pen') {
var isRightButton = event.button === 2;
this.emit(isRightButton ? 'rightup' + eventAppend : 'mouseup' + eventAppend, interactionEvent);
} else if (event.pointerType === 'touch') {
this.emit(cancelled ? 'touchcancel' : 'touchend' + eventAppend, interactionEvent);
this.releaseInteractionDataForPointerId(event.pointerId, interactionData);
}
}
};
} |
Originally posted by @zhiqiuyiye in #140 (comment)
The text was updated successfully, but these errors were encountered: