Minor changes
This commit is contained in:
parent
8764fe5de5
commit
98aa94bb12
@ -40,8 +40,8 @@ class IframeListener {
|
|||||||
private readonly _disablePlayerControlStream: Subject<void> = new Subject();
|
private readonly _disablePlayerControlStream: Subject<void> = new Subject();
|
||||||
public readonly disablePlayerControlStream = this._disablePlayerControlStream.asObservable();
|
public readonly disablePlayerControlStream = this._disablePlayerControlStream.asObservable();
|
||||||
|
|
||||||
private readonly _enablePlayerControl: Subject<void> = new Subject();
|
private readonly _enablePlayerControlStream: Subject<void> = new Subject();
|
||||||
public readonly enablePlayerControl = this._enablePlayerControl.asObservable();
|
public readonly enablePlayerControlStream = this._enablePlayerControlStream.asObservable();
|
||||||
|
|
||||||
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();
|
||||||
@ -96,7 +96,7 @@ class IframeListener {
|
|||||||
this._disablePlayerControlStream.next();
|
this._disablePlayerControlStream.next();
|
||||||
}
|
}
|
||||||
else if (payload.type === 'restorePlayerControl'){
|
else if (payload.type === 'restorePlayerControl'){
|
||||||
this._enablePlayerControl.next();
|
this._enablePlayerControlStream.next();
|
||||||
}
|
}
|
||||||
else if (payload.type === 'displayBubble'){
|
else if (payload.type === 'displayBubble'){
|
||||||
this._displayBubbleStream.next();
|
this._displayBubbleStream.next();
|
||||||
|
@ -2,24 +2,22 @@ import {coWebsiteManager} from "../WebRtc/CoWebsiteManager";
|
|||||||
|
|
||||||
class ScriptUtils {
|
class ScriptUtils {
|
||||||
|
|
||||||
public openTab(url : string){
|
public openTab(url : string){
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public goToPage(url : string){
|
public goToPage(url : string){
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public openCoWebsite(url : string){
|
|
||||||
coWebsiteManager.loadCoWebsite(url,url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public closeCoWebSite(){
|
|
||||||
coWebsiteManager.closeCoWebsite();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public openCoWebsite(url : string){
|
||||||
|
coWebsiteManager.loadCoWebsite(url,url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public closeCoWebSite(){
|
||||||
|
coWebsiteManager.closeCoWebsite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const scriptUtils = new ScriptUtils();
|
export const scriptUtils = new ScriptUtils();
|
||||||
|
@ -694,17 +694,15 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
iframeListener.openPopupStream.subscribe((openPopupEvent) => {
|
iframeListener.openPopupStream.subscribe((openPopupEvent) => {
|
||||||
|
|
||||||
let objectLayerSquare : ITiledMapObject;
|
let objectLayerSquare : ITiledMapObject;
|
||||||
if (this.getObjectLayerData(openPopupEvent.targetObject) !== undefined){
|
const targetObjectData = this.getObjectLayerData(openPopupEvent.targetObject);
|
||||||
objectLayerSquare = this.getObjectLayerData(openPopupEvent.targetObject) as ITiledMapObject;
|
if (targetObjectData !== undefined){
|
||||||
}
|
objectLayerSquare = targetObjectData;
|
||||||
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("Error while opening a popup. Cannot find an object on the map with name '" + openPopupEvent.targetObject + "'. The first parameter of WA.openPopup() must be the name of a rectangle object in your map.");
|
||||||
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>`;
|
||||||
const buttonContainer = `<div class="buttonContainer"</div>`;
|
const buttonContainer = `<div class="buttonContainer"</div>`;
|
||||||
@ -765,7 +763,7 @@ ${escapedMessage}
|
|||||||
iframeListener.disablePlayerControlStream.subscribe(()=>{
|
iframeListener.disablePlayerControlStream.subscribe(()=>{
|
||||||
this.userInputManager.disableControls();
|
this.userInputManager.disableControls();
|
||||||
})
|
})
|
||||||
iframeListener.enablePlayerControl.subscribe(()=>{
|
iframeListener.enablePlayerControlStream.subscribe(()=>{
|
||||||
this.userInputManager.restoreControls();
|
this.userInputManager.restoreControls();
|
||||||
})
|
})
|
||||||
let scriptedBubbleSprite : Sprite;
|
let scriptedBubbleSprite : Sprite;
|
||||||
|
@ -31,11 +31,11 @@ export class ActiveEventList {
|
|||||||
export class UserInputManager {
|
export class UserInputManager {
|
||||||
private KeysCode!: UserInputManagerDatum[];
|
private KeysCode!: UserInputManagerDatum[];
|
||||||
private Scene: GameScene;
|
private Scene: GameScene;
|
||||||
private isInputDisable : boolean;
|
private isInputDisabled : boolean;
|
||||||
constructor(Scene : GameScene) {
|
constructor(Scene : GameScene) {
|
||||||
this.Scene = Scene;
|
this.Scene = Scene;
|
||||||
this.initKeyBoardEvent();
|
this.initKeyBoardEvent();
|
||||||
this.isInputDisable = false;
|
this.isInputDisabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
initKeyBoardEvent(){
|
initKeyBoardEvent(){
|
||||||
@ -66,16 +66,18 @@ export class UserInputManager {
|
|||||||
|
|
||||||
disableControls(){
|
disableControls(){
|
||||||
this.Scene.input.keyboard.removeAllKeys();
|
this.Scene.input.keyboard.removeAllKeys();
|
||||||
this.isInputDisable = true;
|
this.isInputDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreControls(){
|
restoreControls(){
|
||||||
this.initKeyBoardEvent();
|
this.initKeyBoardEvent();
|
||||||
this.isInputDisable = false;
|
this.isInputDisabled = false;
|
||||||
}
|
}
|
||||||
getEventListForGameTick(): ActiveEventList {
|
getEventListForGameTick(): ActiveEventList {
|
||||||
const eventsMap = new ActiveEventList();
|
const eventsMap = new ActiveEventList();
|
||||||
if (this.isInputDisable) return eventsMap;
|
if (this.isInputDisabled) {
|
||||||
|
return eventsMap;
|
||||||
|
}
|
||||||
this.KeysCode.forEach(d => {
|
this.KeysCode.forEach(d => {
|
||||||
if (d. keyInstance.isDown) {
|
if (d. keyInstance.isDown) {
|
||||||
eventsMap.set(d.event, true);
|
eventsMap.set(d.event, true);
|
||||||
|
@ -18,11 +18,11 @@ function launchTuto (){
|
|||||||
label: "Open Chat",
|
label: "Open Chat",
|
||||||
className: "popUpElement",
|
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.openPopup("TutoFinal","You are good to go ! You can meet the dev team and discover the features in the next room !",[
|
WA.openPopup("TutoFinal","You are good to go! You can meet the dev team and discover the features in the next room!",[
|
||||||
{
|
{
|
||||||
label: "Got it !",
|
label: "Got it!",
|
||||||
className : "success",callback:(popup2 => {
|
className : "success",callback:(popup2 => {
|
||||||
popup2.close();
|
popup2.close();
|
||||||
WA.restorePlayerControl();
|
WA.restorePlayerControl();
|
||||||
@ -39,21 +39,7 @@ function launchTuto (){
|
|||||||
WA.disablePlayerControl();
|
WA.disablePlayerControl();
|
||||||
|
|
||||||
}
|
}
|
||||||
WA.onChatMessage((message => {
|
|
||||||
console.log('CHAT MESSAGE RECEIVED BY SCRIPT');
|
|
||||||
WA.sendChatMessage('Poly Parrot says: "'+message+'"', 'Poly Parrot');
|
|
||||||
}));
|
|
||||||
|
|
||||||
WA.onEnterZone('myTrigger', () => {
|
|
||||||
WA.sendChatMessage("Don't step on my carpet!", 'Poly Parrot');
|
|
||||||
})
|
|
||||||
|
|
||||||
WA.onLeaveZone('popupZone', () => {
|
|
||||||
})
|
|
||||||
|
|
||||||
WA.onEnterZone('notExist', () => {
|
|
||||||
WA.sendChatMessage("YOU SHOULD NEVER SEE THIS", 'Poly Parrot');
|
|
||||||
})
|
|
||||||
|
|
||||||
WA.onEnterZone('popupZone', () => {
|
WA.onEnterZone('popupZone', () => {
|
||||||
WA.displayBubble();
|
WA.displayBubble();
|
||||||
@ -61,23 +47,25 @@ WA.onEnterZone('popupZone', () => {
|
|||||||
isFirstTimeTuto = true;
|
isFirstTimeTuto = true;
|
||||||
launchTuto();
|
launchTuto();
|
||||||
}
|
}
|
||||||
else popUpExplanation = WA.openPopup(targetObjectTutoExplanation,'Do you want to review the explanation ? ', [
|
else {
|
||||||
{
|
popUpExplanation = WA.openPopup(targetObjectTutoExplanation, 'Do you want to review the explanation?', [
|
||||||
label: "No",
|
{
|
||||||
className: "error",
|
label: "No",
|
||||||
callback: (popup) => {
|
className: "error",
|
||||||
popup.close();
|
callback: (popup) => {
|
||||||
|
popup.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Yes",
|
||||||
|
className: "success",
|
||||||
|
callback: (popup) => {
|
||||||
|
popup.close();
|
||||||
|
launchTuto();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
])
|
||||||
{
|
}
|
||||||
label: "Yes",
|
|
||||||
className: "success",
|
|
||||||
callback: (popup) => {
|
|
||||||
popup.close();
|
|
||||||
launchTuto();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
])
|
|
||||||
});
|
});
|
||||||
|
|
||||||
WA.onLeaveZone('popupZone', () => {
|
WA.onLeaveZone('popupZone', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user