Correction form review and checks
This commit is contained in:
parent
8a1c57c434
commit
da5ae02a06
@ -7,6 +7,7 @@
|
|||||||
import {AdminMessageEventTypes} from "../../Connexion/AdminMessagesService";
|
import {AdminMessageEventTypes} from "../../Connexion/AdminMessagesService";
|
||||||
import type {GameScene} from "../../Phaser/Game/GameScene";
|
import type {GameScene} from "../../Phaser/Game/GameScene";
|
||||||
import type {Quill} from "quill";
|
import type {Quill} from "quill";
|
||||||
|
import {LoginSceneName} from "../../Phaser/Login/LoginScene";
|
||||||
|
|
||||||
//toolbar
|
//toolbar
|
||||||
export const toolbarOptions = [
|
export const toolbarOptions = [
|
||||||
@ -35,10 +36,7 @@
|
|||||||
export let game: Game;
|
export let game: Game;
|
||||||
export let gameManager: GameManager;
|
export let gameManager: GameManager;
|
||||||
|
|
||||||
let gameScene: GameScene;
|
let gameScene = gameManager.getCurrentGameScene(game.scene.getScene(LoginSceneName));
|
||||||
if (gameManager.currentGameSceneName) {
|
|
||||||
gameScene = gameManager.getCurrentGameScene(game.scene.getScene(gameManager.currentGameSceneName));
|
|
||||||
}
|
|
||||||
let quill: Quill;
|
let quill: Quill;
|
||||||
let INPUT_CONSOLE_MESSAGE: HTMLDivElement;
|
let INPUT_CONSOLE_MESSAGE: HTMLDivElement;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import {AdminMessageEventTypes} from "../../Connexion/AdminMessagesService";
|
import {AdminMessageEventTypes} from "../../Connexion/AdminMessagesService";
|
||||||
import type {PlayGlobalMessageInterface} from "../../Connexion/ConnexionModels";
|
import type {PlayGlobalMessageInterface} from "../../Connexion/ConnexionModels";
|
||||||
import uploadFile from "../images/music-file.svg";
|
import uploadFile from "../images/music-file.svg";
|
||||||
import type {GameScene} from "../../Phaser/Game/GameScene";
|
import {LoginSceneName} from "../../Phaser/Login/LoginScene";
|
||||||
|
|
||||||
interface EventTargetFiles extends EventTarget {
|
interface EventTargetFiles extends EventTarget {
|
||||||
files: Array<File>;
|
files: Array<File>;
|
||||||
@ -15,10 +15,7 @@
|
|||||||
export let game: Game;
|
export let game: Game;
|
||||||
export let gameManager: GameManager;
|
export let gameManager: GameManager;
|
||||||
|
|
||||||
let gameScene: GameScene;
|
let gameScene = gameManager.getCurrentGameScene(game.scene.getScene(LoginSceneName));
|
||||||
if (gameManager.currentGameSceneName) {
|
|
||||||
gameScene = gameManager.getCurrentGameScene(game.scene.getScene(gameManager.currentGameSceneName));
|
|
||||||
}
|
|
||||||
let fileinput: HTMLInputElement;
|
let fileinput: HTMLInputElement;
|
||||||
let filename: string;
|
let filename: string;
|
||||||
let filesize: string;
|
let filesize: string;
|
||||||
@ -29,24 +26,24 @@
|
|||||||
|
|
||||||
async function SendAudioMessage() {
|
async function SendAudioMessage() {
|
||||||
const inputAudio = HtmlUtils.getElementByIdOrFail<HTMLInputElement>("input-send-audio");
|
const inputAudio = HtmlUtils.getElementByIdOrFail<HTMLInputElement>("input-send-audio");
|
||||||
const selectedFile = inputAudio.files ? inputAudio.files[0] : null;
|
const selectedFile = inputAudio.files ? inputAudio.files[0] : null;
|
||||||
if (!selectedFile) {
|
if (!selectedFile) {
|
||||||
errorfile = true;
|
errorfile = true;
|
||||||
throw 'no file selected';
|
throw 'no file selected';
|
||||||
}
|
}
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', selectedFile);
|
fd.append('file', selectedFile);
|
||||||
const res = await gameScene.connection.uploadAudio(fd);
|
const res = await gameScene.connection.uploadAudio(fd);
|
||||||
|
|
||||||
const GlobalMessage: PlayGlobalMessageInterface = {
|
const GlobalMessage: PlayGlobalMessageInterface = {
|
||||||
id: (res as { id: string }).id,
|
id: (res as { id: string }).id,
|
||||||
message: (res as { path: string }).path,
|
message: (res as { path: string }).path,
|
||||||
type: AUDIO_TYPE
|
type: AUDIO_TYPE
|
||||||
}
|
}
|
||||||
inputAudio.value = '';
|
inputAudio.value = '';
|
||||||
gameScene.connection.emitGlobalMessage(GlobalMessage);
|
gameScene.connection.emitGlobalMessage(GlobalMessage);
|
||||||
disableConsole();
|
disableConsole();
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputAudioFile(event: Event) {
|
function inputAudioFile(event: Event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user