feat: 适配APP横屏

This commit is contained in:
unanmed 2024-05-01 10:49:54 +08:00
parent 518f5a5815
commit 471b3071f9
4 changed files with 23 additions and 6 deletions

View File

@ -73,7 +73,7 @@ main.floors.MT54=
[648,648,648,648,103, 21,648,648,648,648,539,648,648,648,648], [648,648,648,648,103, 21,648,648,648,648,539,648,648,648,648],
[648, 28,648, 0, 28,482,648, 0, 27, 0, 33, 0, 28, 0,648], [648, 28,648, 0, 28,482,648, 0, 27, 0, 33, 0, 28, 0,648],
[648, 33,648,596,648,648,648,596,648,648,494,648,648,249,648], [648, 33,648,596,648,648,648,596,648,648,494,648,648,249,648],
[648, 27,243, 0, 0, 0, 0, 0, 0,129,376,378,381,491,648], [648, 27,243, 0, 0,381, 0,482, 0,129,376,378,381,491,648],
[648,648,648,648, 93,648,648,648,648,648,648,648,648,648,648] [648,648,648,648, 93,648,648,648,648,648,648,648,648,648,648]
], ],
"bgmap": [ "bgmap": [

View File

@ -51,11 +51,11 @@ main.floors.MT55=
[648,657,648,648,648,648,648, 0, 27, 0,482,648,648,243,648], [648,657,648,648,648,648,648, 0, 27, 0,482,648,648,243,648],
[648, 0, 0, 0, 0, 0,660,381,103,648,648,648, 0, 0, 94], [648, 0, 0, 0, 0, 0,660,381,103,648,648,648, 0, 0, 94],
[648,648,648,648,492,648,648, 0, 28,656, 0, 0, 0, 0,648], [648,648,648,648,492,648,648, 0, 28,656, 0, 0, 0, 0,648],
[648, 0, 0,601, 0, 0,648,494,648,648,657,648,648,648,648], [648, 27, 29,601, 0, 28,648,494,648,648,657,648,648,648,648],
[648, 0, 0,648, 0, 0,492, 0, 0, 0, 0,648, 0, 0,648], [648,482, 28,648, 27, 0,492, 0,381,482, 0,648, 29, 28,648],
[648,240,648,648,648,492,648,243,648,648,648,648, 0, 0,648], [648,240,648,648,648,492,648,243,648,648,648,648, 27, 33,648],
[648, 0, 0,648, 0, 0,648, 0,648, 0, 0,648,648,220,648], [648,484,378,648,376,491,648, 0,648, 0, 28,648,648,220,648],
[648, 0, 0,249, 0, 0,648, 0,657, 0, 0, 0, 0, 0,648], [648,376,381,249,403,378,648, 33,657, 0, 27, 0,482, 0,648],
[648,648,648,648,648,648,648,648,648,648,648,648,648,648,648] [648,648,648,648,648,648,648,648,648,648,648,648,648,648,648]
], ],
"bgmap": [ "bgmap": [

View File

@ -385,12 +385,20 @@ export async function triggerFullscreen(full: boolean) {
if (!Mota.Plugin.inited) return; if (!Mota.Plugin.inited) return;
const { maxGameScale } = Mota.Plugin.require('utils_g'); const { maxGameScale } = Mota.Plugin.require('utils_g');
if (!!document.fullscreenElement && !full) { if (!!document.fullscreenElement && !full) {
if (window.jsinterface) {
window.jsinterface.requestPortrait();
return;
}
await document.exitFullscreen(); await document.exitFullscreen();
requestAnimationFrame(() => { requestAnimationFrame(() => {
maxGameScale(1); maxGameScale(1);
}); });
} }
if (full && !document.fullscreenElement) { if (full && !document.fullscreenElement) {
if (window.jsinterface) {
window.jsinterface.requestLandscape();
return;
}
await document.body.requestFullscreen(); await document.body.requestFullscreen();
requestAnimationFrame(() => { requestAnimationFrame(() => {
maxGameScale(); maxGameScale();

9
src/types/util.d.ts vendored
View File

@ -541,6 +541,15 @@ interface Utils {
declare const utils: new () => Utils; declare const utils: new () => Utils;
interface JSInterface {
requestLandscape(): void;
requestPortrait(): void;
}
interface Window {
jsinterface: JSInterface;
}
declare const jsinterface: JSInterface;
/** /**
* *
*/ */