no message

This commit is contained in:
DESKTOP-FMM8UI0\CLV 2021-03-22 16:10:21 +01:00
parent 0ffbf8b4b7
commit 3ef3561b57
10 changed files with 74 additions and 125 deletions

View File

@ -1176,27 +1176,27 @@ div.action p.action-body{
border-radius: 15px; border-radius: 15px;
} }
.popUpElement{ .popUpElement{
animation-duration: 1s;
animation-delay: 3s;
animation-name: slidein;
}
.popUpElement p {
font-family: 'Press Start 2P'; font-family: 'Press Start 2P';
text-align: left; text-align: left;
font-size: 10px;
background-color: #727678;
color: white; color: white;
} }
.popUpElement div { .popUpElement div {
width: 300px; font-family: 'Press Start 2P';
height: 120px; font-size: 10px;
background-color: #727678; background-color: #727678;
} }
.popUpElement button { .popUpElement button {
font-family: 'Press Start 2P'; position: relative;
position: center;
font-size: 10px; font-size: 10px;
border-image-repeat: revert;
margin-right: 5px;
}
.popUpElement .buttonContainer {
float: right;
background-color: inherit;
} }

View File

@ -336,7 +336,7 @@ export class ConsoleGlobalMessageManager {
} }
active(){ active(){
this.userInputManager.clearAllKeys(); this.userInputManager.disableControls();
this.divMainConsole.style.top = '0'; this.divMainConsole.style.top = '0';
this.activeConsole = true; this.activeConsole = true;
} }

View File

@ -30,11 +30,11 @@ class IframeListener {
private readonly _closePopupStream: Subject<ClosePopupEvent> = new Subject(); private readonly _closePopupStream: Subject<ClosePopupEvent> = new Subject();
public readonly closePopupStream = this._closePopupStream.asObservable(); public readonly closePopupStream = this._closePopupStream.asObservable();
private readonly _displayBubble: Subject<void> = new Subject(); private readonly _displayBubbleStream: Subject<void> = new Subject();
public readonly displayBubble = this._displayBubble.asObservable(); public readonly displayBubbleStream = this._displayBubbleStream.asObservable();
private readonly _removeBubble: Subject<void> = new Subject(); private readonly _removeBubbleStream: Subject<void> = new Subject();
public readonly removeBubble = this._removeBubble.asObservable(); public readonly removeBubbleStream = this._removeBubbleStream.asObservable();
private readonly iframes = new Set<HTMLIFrameElement>(); private readonly iframes = new Set<HTMLIFrameElement>();
private readonly scripts = new Map<string, HTMLIFrameElement>(); private readonly scripts = new Map<string, HTMLIFrameElement>();
@ -67,14 +67,14 @@ class IframeListener {
else if (payload.type === 'disablePlayerControl'){ else if (payload.type === 'disablePlayerControl'){
this._disablePlayerControlStream.next(); this._disablePlayerControlStream.next();
} }
else if (payload.type === 'enablePlayerControl'){ else if (payload.type === 'restorePlayerControl'){
this._enablePlayerControl.next(); this._enablePlayerControl.next();
} }
else if (payload.type === 'displayBubble'){ else if (payload.type === 'displayBubble'){
this._displayBubble.next(); this._displayBubbleStream.next();
} }
else if (payload.type === 'removeBubble'){ else if (payload.type === 'removeBubble'){
this._removeBubble.next(); this._removeBubbleStream.next();
} }
} }

View File

@ -698,17 +698,20 @@ export class GameScene extends ResizableScene implements CenterListener {
objectLayerSquare = this.getObjectLayerData(openPopupEvent.targetObject) as ITiledMapObject; objectLayerSquare = this.getObjectLayerData(openPopupEvent.targetObject) as ITiledMapObject;
} }
else{ else{
console.error("Cannot find an Object with name " + openPopupEvent.targetObject + "The name of your rectangle object is not matching with your param targetObject, check the two names.") console.error("'Cannot find an Object with name '" + openPopupEvent.targetObject + ". The name of your rectangle object is not matching with your param targetObject, check the two names.");
return; return;
} }
const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message); const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message);
let html = `<div id="container" <div class="nes-container with-title is-centered" let html = `<div id="container"><div class="nes-container with-title is-centered"
> >
${escapedMessage} ${escapedMessage}
</div> </div>`; </div> </div>`;
let buttonContainer = `<div class="buttonContainer"</div>`;
html += buttonContainer;
let id = 0; let id = 0;
for (const button of openPopupEvent.buttons) { for (const button of openPopupEvent.buttons) {
html += `<button type="button" class="nes-btn is-${HtmlUtils.escapeHtml(button.className ?? '')}" id="popup-${openPopupEvent.popupId}-${id}">${HtmlUtils.escapeHtml(button.label)}</button>`; html += `<button type="button" class="nes-btn is-${HtmlUtils.escapeHtml(button.className ?? '')}" id="popup-${openPopupEvent.popupId}-${id}">${HtmlUtils.escapeHtml(button.label)}</button>`;
id++; id++;
} }
const domElement = this.add.dom(objectLayerSquare.x + objectLayerSquare.width/2 , const domElement = this.add.dom(objectLayerSquare.x + objectLayerSquare.width/2 ,
@ -716,7 +719,6 @@ ${escapedMessage}
let container : HTMLDivElement = domElement.getChildByID("container") as HTMLDivElement; let container : HTMLDivElement = domElement.getChildByID("container") as HTMLDivElement;
container.style.width = objectLayerSquare.width + "px"; container.style.width = objectLayerSquare.width + "px";
container.style.height = objectLayerSquare.height + "px";
domElement.scale = 0; domElement.scale = 0;
domElement.setClassName('popUpElement'); domElement.setClassName('popUpElement');
@ -761,19 +763,19 @@ ${escapedMessage}
}); });
iframeListener.disablePlayerControlStream.subscribe(()=>{ iframeListener.disablePlayerControlStream.subscribe(()=>{
this.userInputManager.clearAllKeys(); this.userInputManager.disableControls();
}) })
iframeListener.enablePlayerControl.subscribe(()=>{ iframeListener.enablePlayerControl.subscribe(()=>{
this.userInputManager.restoreAllKeys(); this.userInputManager.restoreControls();
}) })
let sprite : Sprite; let scriptedBubbleSprite : Sprite;
iframeListener.displayBubble.subscribe(()=>{ iframeListener.displayBubbleStream.subscribe(()=>{
sprite = new Sprite(this,this.CurrentPlayer.x + 25,this.CurrentPlayer.y,'circleSprite-white'); scriptedBubbleSprite = new Sprite(this,this.CurrentPlayer.x + 25,this.CurrentPlayer.y,'circleSprite-white');
sprite.setDisplayOrigin(48, 48); scriptedBubbleSprite.setDisplayOrigin(48, 48);
this.add.existing(sprite); this.add.existing(scriptedBubbleSprite);
}) })
iframeListener.removeBubble.subscribe(()=>{ iframeListener.removeBubbleStream.subscribe(()=>{
sprite.destroy(); scriptedBubbleSprite.destroy();
}) })
} }
@ -1305,8 +1307,6 @@ ${escapedMessage}
if (object.name === objectName) { if (object.name === objectName) {
return object; return object;
} }
else continue;
} }
} }
} }
@ -1368,7 +1368,7 @@ ${escapedMessage}
//todo: into onConnexionMessage //todo: into onConnexionMessage
private bannedUser(){ private bannedUser(){
this.cleanupClosingScene(); this.cleanupClosingScene();
this.userInputManager.clearAllKeys(); this.userInputManager.disableControls();
this.scene.start(ErrorSceneName, { this.scene.start(ErrorSceneName, {
title: 'Banned', title: 'Banned',
subTitle: 'You were banned from WorkAdventure', subTitle: 'You were banned from WorkAdventure',
@ -1380,7 +1380,7 @@ ${escapedMessage}
if (event.type === ConnexionMessageEventTypes.worldFull) { if (event.type === ConnexionMessageEventTypes.worldFull) {
this.cleanupClosingScene(); this.cleanupClosingScene();
this.scene.stop(ReconnectingSceneName); this.scene.stop(ReconnectingSceneName);
this.userInputManager.clearAllKeys(); this.userInputManager.disableControls();
this.scene.start(ErrorSceneName, { this.scene.start(ErrorSceneName, {
title: 'Connection rejected', title: 'Connection rejected',
subTitle: 'The world you are trying to join is full. Try again later.', subTitle: 'The world you are trying to join is full. Try again later.',

View File

@ -61,7 +61,7 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement {
this.opened = true; this.opened = true;
gameManager.getCurrentGameScene(this.scene).userInputManager.clearAllKeys(); gameManager.getCurrentGameScene(this.scene).userInputManager.disableControls();
this.scene.tweens.add({ this.scene.tweens.add({
targets: this, targets: this,

View File

@ -64,12 +64,12 @@ export class UserInputManager {
this.Scene.input.keyboard.removeAllListeners(); this.Scene.input.keyboard.removeAllListeners();
} }
clearAllKeys(){ disableControls(){
this.Scene.input.keyboard.removeAllKeys(); this.Scene.input.keyboard.removeAllKeys();
this.isInputDisable = true; this.isInputDisable = true;
} }
restoreAllKeys(){ restoreControls(){
this.initKeyBoardEvent(); this.initKeyBoardEvent();
this.isInputDisable = false; this.isInputDisable = false;
} }

View File

@ -70,12 +70,12 @@ export class DiscussionManager {
const inputMessage: HTMLInputElement = document.createElement('input'); const inputMessage: HTMLInputElement = document.createElement('input');
inputMessage.onfocus = () => { inputMessage.onfocus = () => {
if(this.userInputManager) { if(this.userInputManager) {
this.userInputManager.clearAllKeys(); this.userInputManager.disableControls();
} }
} }
inputMessage.onblur = () => { inputMessage.onblur = () => {
if(this.userInputManager) { if(this.userInputManager) {
this.userInputManager.initKeyBoardEvent(); this.userInputManager.restoreControls();
} }
} }
inputMessage.type = "text"; inputMessage.type = "text";

View File

@ -14,7 +14,7 @@ interface WorkAdventureApi {
onLeaveZone(name: string, callback: () => void): void; onLeaveZone(name: string, callback: () => void): void;
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup; openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
disablePlayerControl() : void; disablePlayerControl() : void;
enablePlayerControl() : void; restorePlayerControl() : void;
displayBubble() : void; displayBubble() : void;
removeBubble() : void; removeBubble() : void;
} }
@ -84,8 +84,8 @@ window.WA = {
window.parent.postMessage({'type' : 'disablePlayerControl'},'*'); window.parent.postMessage({'type' : 'disablePlayerControl'},'*');
}, },
enablePlayerControl() : void { restorePlayerControl() : void {
window.parent.postMessage({'type' : 'enablePlayerControl'},'*'); window.parent.postMessage({'type' : 'restorePlayerControl'},'*');
}, },
displayBubble() : void { displayBubble() : void {

File diff suppressed because one or more lines are too long

View File

@ -10,18 +10,18 @@ function launchTuto (){
WA.openPopup(targetObjectTutoBubble, textFirstPopup, [ WA.openPopup(targetObjectTutoBubble, textFirstPopup, [
{ {
label: "Next", label: "Next",
className: "normal", className: "popUpElement",
callback: (popup) => { callback: (popup) => {
popup.close(); popup.close();
WA.openPopup(targetObjectTutoChat, textSecondPopup, [ WA.openPopup(targetObjectTutoChat, textSecondPopup, [
{ {
label: "Open Chat", label: "Open Chat",
className: "normal", className: "popUpElement",
callback: (popup1) => { callback: (popup1) => {
WA.sendChatMessage("Hey you can talk here too ! ", 'WA Guide'); WA.sendChatMessage("Hey you can talk here too ! ", 'WA Guide');
popup1.close(); popup1.close();
WA.enablePlayerControl(); WA.restorePlayerControl();
} }
} }
@ -54,17 +54,17 @@ WA.onEnterZone('popupZone', () => {
isFirstTimeTuto = true; isFirstTimeTuto = true;
launchTuto(); launchTuto();
} }
else popUpExplanation = WA.openPopup(targetObjectTutoBubble,'Do you want to review the explantion', [ else popUpExplanation = WA.openPopup(targetObjectTutoChat,'Do you want to review the explanation ? ', [
{ {
label: "No", label: "No",
className: "normal", className: "popUpElementReviewexplanation",
callback: (popup) => { callback: (popup) => {
popup.close(); popup.close();
} }
}, },
{ {
label: "Yes", label: "Yes",
className: "normal", className: "popUpElementReviewexplanation",
callback: (popup) => { callback: (popup) => {
popup.close(); popup.close();
launchTuto(); launchTuto();