commit
2cf51a058a
@ -8,7 +8,6 @@ import type { ButtonClickedEvent } from "./Events/ButtonClickedEvent";
|
|||||||
import { ClosePopupEvent, isClosePopupEvent } from "./Events/ClosePopupEvent";
|
import { ClosePopupEvent, isClosePopupEvent } from "./Events/ClosePopupEvent";
|
||||||
import { scriptUtils } from "./ScriptUtils";
|
import { scriptUtils } from "./ScriptUtils";
|
||||||
import { isGoToPageEvent } from "./Events/GoToPageEvent";
|
import { isGoToPageEvent } from "./Events/GoToPageEvent";
|
||||||
import { isCloseCoWebsite, CloseCoWebsiteEvent } from "./Events/CloseCoWebsiteEvent";
|
|
||||||
import {
|
import {
|
||||||
IframeErrorAnswerEvent,
|
IframeErrorAnswerEvent,
|
||||||
IframeQueryMap,
|
IframeQueryMap,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { coWebsiteManager, CoWebsite } from "../WebRtc/CoWebsiteManager";
|
|
||||||
import { playersStore } from "../Stores/PlayersStore";
|
import { playersStore } from "../Stores/PlayersStore";
|
||||||
import { chatMessagesStore } from "../Stores/ChatStore";
|
import { chatMessagesStore } from "../Stores/ChatStore";
|
||||||
import type { ChatEvent } from "./Events/ChatEvent";
|
import type { ChatEvent } from "./Events/ChatEvent";
|
||||||
|
@ -512,7 +512,7 @@ class CoWebsiteManager {
|
|||||||
if (this.coWebsites.length < 1) {
|
if (this.coWebsites.length < 1) {
|
||||||
this.loadMain();
|
this.loadMain();
|
||||||
} else if (this.coWebsites.length === 5) {
|
} else if (this.coWebsites.length === 5) {
|
||||||
throw new Error("Too many we");
|
throw new Error("Too many websites");
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.resolve(callback(this.cowebsiteBufferDom))
|
Promise.resolve(callback(this.cowebsiteBufferDom))
|
||||||
@ -580,7 +580,7 @@ class CoWebsiteManager {
|
|||||||
return reject();
|
return reject();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e) => console.error("Error loadCoWebsite >=> ", e));
|
.catch((e) => console.error("Error loadCoWebsite => ", e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
WA.room.onEnterLayer('myLayer').subscribe(() => {
|
WA.room.onEnterLayer('myLayer').subscribe(() => {
|
||||||
WA.chat.sendChatMessage("Hello!", 'Wooka');
|
WA.chat.sendChatMessage("Hello!", 'Woka');
|
||||||
});
|
});
|
||||||
|
|
||||||
WA.room.onLeaveLayer('myLayer').subscribe(() => {
|
WA.room.onLeaveLayer('myLayer').subscribe(() => {
|
||||||
WA.chat.sendChatMessage("Goodbye!", 'Wooka');
|
WA.chat.sendChatMessage("Goodbye!", 'Woka');
|
||||||
});
|
});
|
@ -12,12 +12,12 @@ WA.onInit().then(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function wookaSendMessage(message) {
|
function wokaSendMessage(message) {
|
||||||
WA.chat.sendChatMessage(message, 'Wooka');
|
WA.chat.sendChatMessage(message, 'Woka');
|
||||||
}
|
}
|
||||||
|
|
||||||
function unknownCommand() {
|
function unknownCommand() {
|
||||||
wookaSendMessage('Unknown command');
|
wokaSendMessage('Unknown command');
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeCommand(command, args) {
|
function executeCommand(command, args) {
|
||||||
@ -32,7 +32,7 @@ function executeCommand(command, args) {
|
|||||||
|
|
||||||
function coWebsiteCommand(args) {
|
function coWebsiteCommand(args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
wookaSendMessage('Too few arguments');
|
wokaSendMessage('Too few arguments');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,27 +52,27 @@ function coWebsiteCommand(args) {
|
|||||||
|
|
||||||
async function openCoWebsite(args) {
|
async function openCoWebsite(args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
wookaSendMessage('Too few arguments');
|
wokaSendMessage('Too few arguments');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = new URL(args[0]);
|
const url = new URL(args[0]);
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
wookaSendMessage('Parameter is not a valid URL !');
|
wokaSendMessage('Parameter is not a valid URL !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await WA.nav.openCoWebSite(args[0]).then(() => {
|
await WA.nav.openCoWebSite(args[0]).then(() => {
|
||||||
wookaSendMessage('Co-website has been opened !');
|
wokaSendMessage('Co-website has been opened !');
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
wookaSendMessage(`Something wrong happen during co-website opening: ${error.message}`);
|
wokaSendMessage(`Something wrong happen during co-website opening: ${error.message}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function closeCoWebsite(args) {
|
async function closeCoWebsite(args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
wookaSendMessage('Too few arguments');
|
wokaSendMessage('Too few arguments');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ async function closeCoWebsite(args) {
|
|||||||
coWebsites.forEach(coWebsite => {
|
coWebsites.forEach(coWebsite => {
|
||||||
coWebsite.close();
|
coWebsite.close();
|
||||||
});
|
});
|
||||||
wookaSendMessage('All co-websites has been closed !');
|
wokaSendMessage('All co-websites has been closed !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,13 +96,13 @@ async function closeCoWebsite(args) {
|
|||||||
coWebsites.find((coWebsite) => coWebsite.position === position);
|
coWebsites.find((coWebsite) => coWebsite.position === position);
|
||||||
|
|
||||||
if (!coWebsite) {
|
if (!coWebsite) {
|
||||||
wookaSendMessage('Unknown co-website');
|
wokaSendMessage('Unknown co-website');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await coWebsite.close().then(() => {
|
await coWebsite.close().then(() => {
|
||||||
wookaSendMessage('This co-websites has been closed !');
|
wokaSendMessage('This co-websites has been closed !');
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
wookaSendMessage(`Something wrong happen during co-website closing: ${error.message}`);
|
wokaSendMessage(`Something wrong happen during co-website closing: ${error.message}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user