Merge branch 'develop' of github.com:thecodingmachine/workadventure
This commit is contained in:
@@ -5,6 +5,7 @@ export const isGameStateEvent = new tg.IsInterface()
|
||||
roomId: tg.isString,
|
||||
mapUrl: tg.isString,
|
||||
nickname: tg.isString,
|
||||
language: tg.isUnion(tg.isString, tg.isUndefined),
|
||||
uuid: tg.isUnion(tg.isString, tg.isUndefined),
|
||||
startLayerName: tg.isUnion(tg.isString, tg.isNull),
|
||||
tags: tg.isArray(tg.isString),
|
||||
|
||||
@@ -13,6 +13,12 @@ export const setPlayerName = (name: string) => {
|
||||
playerName = name;
|
||||
};
|
||||
|
||||
let playerLanguage: string | undefined;
|
||||
|
||||
export const setPlayerLanguage = (language: string | undefined) => {
|
||||
playerLanguage = language;
|
||||
};
|
||||
|
||||
let tags: string[] | undefined;
|
||||
|
||||
export const setTags = (_tags: string[]) => {
|
||||
@@ -61,6 +67,15 @@ export class WorkadventurePlayerCommands extends IframeApiContribution<Workadven
|
||||
return playerName;
|
||||
}
|
||||
|
||||
get language(): string {
|
||||
if (playerLanguage === undefined) {
|
||||
throw new Error(
|
||||
"Player language not initialized yet. You should call WA.player.language within a WA.onInit callback."
|
||||
);
|
||||
}
|
||||
return playerLanguage;
|
||||
}
|
||||
|
||||
get tags(): string[] {
|
||||
if (tags === undefined) {
|
||||
throw new Error("Tags not initialized yet. You should call WA.player.tags within a WA.onInit callback.");
|
||||
|
||||
Reference in New Issue
Block a user