* Fix games with custom touch control sometimes not showing touch icon

* Create game-bar with screenshot button

* Disable Game bar when opening the Guide

* Remove SCREENSHOT_BUTTON_POSITION pref

* Make the touch control action functional

* Show game bar when the game starts

* Fix 720p/High not working (#387)

* Update icons

* Update game bar's animations

* Reset states of Game bar actions before playing

* Don't show Touch control action on non-touch-supported devices

* Clean up

* Update translations

* Update actions' texts

* Clean up
This commit is contained in:
redphx
2024-05-10 18:35:40 +07:00
committed by GitHub
parent b66ca192b2
commit b2e932cc4c
23 changed files with 533 additions and 315 deletions

View File

@@ -1,3 +1,4 @@
import { GameBar } from "@modules/game-bar/game-bar";
import { BxEvent } from "@utils/bx-event";
import { STATES } from "@utils/global";
import { getPref, PrefKey } from "@utils/preferences";
@@ -15,25 +16,12 @@ enum InputType {
export const BxExposed = {
onPollingModeChanged: (mode: 'All' | 'None') => {
if (!STATES.isPlaying) {
return false;
GameBar.disable();
return;
}
const $screenshotBtn = document.querySelector('.bx-screenshot-button');
const $touchControllerBar = document.getElementById('bx-touch-controller-bar');
if (mode !== 'None') {
// Hide screenshot button
$screenshotBtn && $screenshotBtn.classList.add('bx-gone');
// Hide touch controller bar
$touchControllerBar && $touchControllerBar.classList.add('bx-gone');
} else {
// Show screenshot button
$screenshotBtn && $screenshotBtn.classList.remove('bx-gone');
// Show touch controller bar
$touchControllerBar && $touchControllerBar.classList.remove('bx-gone');
}
// Toggle Game bar
mode !== 'None' ? GameBar.disable() : GameBar.enable();
},
getTitleInfo: () => STATES.currentStream.titleInfo,