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;
}
.popUpElement{
animation-duration: 1s;
animation-delay: 3s;
animation-name: slidein;
}
.popUpElement p {
font-family: 'Press Start 2P';
text-align: left;
font-size: 10px;
background-color: #727678;
color: white;
}
.popUpElement div {
width: 300px;
height: 120px;
font-family: 'Press Start 2P';
font-size: 10px;
background-color: #727678;
}
.popUpElement button {
font-family: 'Press Start 2P';
position: center;
position: relative;
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(){
this.userInputManager.clearAllKeys();
this.userInputManager.disableControls();
this.divMainConsole.style.top = '0';
this.activeConsole = true;
}

View File

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

View File

@ -698,14 +698,17 @@ export class GameScene extends ResizableScene implements CenterListener {
objectLayerSquare = this.getObjectLayerData(openPopupEvent.targetObject) as ITiledMapObject;
}
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;
}
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}
</div> </div>`;
let buttonContainer = `<div class="buttonContainer"</div>`;
html += buttonContainer;
let id = 0;
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>`;
@ -716,7 +719,6 @@ ${escapedMessage}
let container : HTMLDivElement = domElement.getChildByID("container") as HTMLDivElement;
container.style.width = objectLayerSquare.width + "px";
container.style.height = objectLayerSquare.height + "px";
domElement.scale = 0;
domElement.setClassName('popUpElement');
@ -761,19 +763,19 @@ ${escapedMessage}
});
iframeListener.disablePlayerControlStream.subscribe(()=>{
this.userInputManager.clearAllKeys();
this.userInputManager.disableControls();
})
iframeListener.enablePlayerControl.subscribe(()=>{
this.userInputManager.restoreAllKeys();
this.userInputManager.restoreControls();
})
let sprite : Sprite;
iframeListener.displayBubble.subscribe(()=>{
sprite = new Sprite(this,this.CurrentPlayer.x + 25,this.CurrentPlayer.y,'circleSprite-white');
sprite.setDisplayOrigin(48, 48);
this.add.existing(sprite);
let scriptedBubbleSprite : Sprite;
iframeListener.displayBubbleStream.subscribe(()=>{
scriptedBubbleSprite = new Sprite(this,this.CurrentPlayer.x + 25,this.CurrentPlayer.y,'circleSprite-white');
scriptedBubbleSprite.setDisplayOrigin(48, 48);
this.add.existing(scriptedBubbleSprite);
})
iframeListener.removeBubble.subscribe(()=>{
sprite.destroy();
iframeListener.removeBubbleStream.subscribe(()=>{
scriptedBubbleSprite.destroy();
})
}
@ -1305,8 +1307,6 @@ ${escapedMessage}
if (object.name === objectName) {
return object;
}
else continue;
}
}
}
@ -1368,7 +1368,7 @@ ${escapedMessage}
//todo: into onConnexionMessage
private bannedUser(){
this.cleanupClosingScene();
this.userInputManager.clearAllKeys();
this.userInputManager.disableControls();
this.scene.start(ErrorSceneName, {
title: 'Banned',
subTitle: 'You were banned from WorkAdventure',
@ -1380,7 +1380,7 @@ ${escapedMessage}
if (event.type === ConnexionMessageEventTypes.worldFull) {
this.cleanupClosingScene();
this.scene.stop(ReconnectingSceneName);
this.userInputManager.clearAllKeys();
this.userInputManager.disableControls();
this.scene.start(ErrorSceneName, {
title: 'Connection rejected',
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;
gameManager.getCurrentGameScene(this.scene).userInputManager.clearAllKeys();
gameManager.getCurrentGameScene(this.scene).userInputManager.disableControls();
this.scene.tweens.add({
targets: this,

View File

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

View File

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

View File

@ -14,7 +14,7 @@ interface WorkAdventureApi {
onLeaveZone(name: string, callback: () => void): void;
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
disablePlayerControl() : void;
enablePlayerControl() : void;
restorePlayerControl() : void;
displayBubble() : void;
removeBubble() : void;
}
@ -84,8 +84,8 @@ window.WA = {
window.parent.postMessage({'type' : 'disablePlayerControl'},'*');
},
enablePlayerControl() : void {
window.parent.postMessage({'type' : 'enablePlayerControl'},'*');
restorePlayerControl() : void {
window.parent.postMessage({'type' : 'restorePlayerControl'},'*');
},
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, [
{
label: "Next",
className: "normal",
className: "popUpElement",
callback: (popup) => {
popup.close();
WA.openPopup(targetObjectTutoChat, textSecondPopup, [
{
label: "Open Chat",
className: "normal",
className: "popUpElement",
callback: (popup1) => {
WA.sendChatMessage("Hey you can talk here too ! ", 'WA Guide');
popup1.close();
WA.enablePlayerControl();
WA.restorePlayerControl();
}
}
@ -54,17 +54,17 @@ WA.onEnterZone('popupZone', () => {
isFirstTimeTuto = true;
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",
className: "normal",
className: "popUpElementReviewexplanation",
callback: (popup) => {
popup.close();
}
},
{
label: "Yes",
className: "normal",
className: "popUpElementReviewexplanation",
callback: (popup) => {
popup.close();
launchTuto();