mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-08 06:08:27 +02:00
Optimize + refactor code
This commit is contained in:
@@ -2,7 +2,7 @@ import { BxIcon } from "@utils/bx-icon";
|
||||
import { createButton, ButtonStyle } from "@utils/html";
|
||||
import { BaseGameBarAction } from "./action-base";
|
||||
import { t } from "@utils/translation";
|
||||
import { Screenshot } from "@/utils/screenshot";
|
||||
import { ScreenshotManager } from "@/utils/screenshot-manager";
|
||||
|
||||
export class ScreenshotAction extends BaseGameBarAction {
|
||||
$content: HTMLElement;
|
||||
@@ -20,6 +20,6 @@ export class ScreenshotAction extends BaseGameBarAction {
|
||||
|
||||
onClick(e: Event): void {
|
||||
super.onClick(e);
|
||||
Screenshot.takeScreenshot();
|
||||
ScreenshotManager.getInstance().takeScreenshot();
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,6 @@ export class TrueAchievementsAction extends BaseGameBarAction {
|
||||
|
||||
onClick(e: Event) {
|
||||
super.onClick(e);
|
||||
TrueAchievements.open(false);
|
||||
TrueAchievements.getInstance().open(false);
|
||||
}
|
||||
}
|
||||
|
@@ -11,11 +11,13 @@ import { getPref, StreamTouchController, type GameBarPosition } from "@/utils/se
|
||||
import { TrueAchievementsAction } from "./action-true-achievements";
|
||||
import { SpeakerAction } from "./action-speaker";
|
||||
import { RendererAction } from "./action-renderer";
|
||||
import { BxLogger } from "@/utils/bx-logger";
|
||||
|
||||
|
||||
export class GameBar {
|
||||
private static instance: GameBar;
|
||||
public static getInstance = () => GameBar.instance ?? (GameBar.instance = new GameBar());
|
||||
private readonly LOG_TAG = 'GameBar';
|
||||
|
||||
private static readonly VISIBLE_DURATION = 2000;
|
||||
|
||||
@@ -27,6 +29,8 @@ export class GameBar {
|
||||
private actions: BaseGameBarAction[] = [];
|
||||
|
||||
private constructor() {
|
||||
BxLogger.info(this.LOG_TAG, 'constructor()');
|
||||
|
||||
let $container;
|
||||
|
||||
const position = getPref(PrefKey.GAME_BAR_POSITION) as GameBarPosition;
|
||||
|
Reference in New Issue
Block a user