Phaser on iOS (sometimes) stay paused

Đang mở
#668 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
game-dev, mobile-dev

Hướng nghiên cứu

Start by comparing the iOS pause and resume handling with the related issue #663 and the Phaser version discussed in #665; the payload does not name source files or tests. Reproduce the tab-switch behavior on iOS 12.4.6 using the linked video, then trace why resume is not called. Done means the game reliably resumes after returning to its browser tab without the reported manual touch listener.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

This issue may be similar to https://github.com/photonstorm/phaser-ce/issues/663.

Problem is, that when you click icon for browsing tabs (top right corner - see image below) and immediately click on tab with game, then game stays paused=true and looks like frozen. All buttons work, but game stays paused. It looks like resume is not called.
BrowseTabs

It does not happen always. Usually, it happens when you just opend browser and loaded game. I shot video of what happens and it is in .zip below (my iOS version is 12.4.6, I also tried Phaser engine version you attached to case https://github.com/photonstorm/phaser-ce/issues/665, but without success):
paused.zip

As a fix I subscribed to onPause signal in Boot state:

game.onPause.add(this.onPauseHandler, this);

onPauseHandler() looks like this:

    onPauseHandler: function() {
        if (game.device.iOS) {
            this.addMyCanvasListener();
        }
    },

and finally addMyCanvasListener() like this:

    addMyCanvasListener: function() {
        var can = document.getElementById('game-container');
        can.addEventListener('touchstart', function _listener() {
            game.paused = false;
            can.removeEventListener('touchstart', _listener, false);
        }, false);
    },

With this setup I can unpause game if it is still paused after selecting tab.

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
485
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phaserjs/phaser-ce

Tất cả issue của phaserjs/phaser-ce

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.