Merge pull request #1551 from thecodingmachine/deprecate-onenterzone
Updates API documentation (other than room) following onEnterZone & onLeaveZone deprecation
This commit is contained in:
commit
78698ff17f
@ -15,7 +15,7 @@ When controls are disabled, the user cannot move anymore using keyboard input. T
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
WA.room.onEnterZone('myZone', () => {
|
WA.room.onEnterLayer('myZone').subscribe(() => {
|
||||||
WA.controls.disablePlayerControls();
|
WA.controls.disablePlayerControls();
|
||||||
WA.ui.openPopup("popupRectangle", 'This is an imporant message!', [{
|
WA.ui.openPopup("popupRectangle", 'This is an imporant message!', [{
|
||||||
label: "Got it!",
|
label: "Got it!",
|
||||||
@ -25,5 +25,5 @@ WA.room.onEnterZone('myZone', () => {
|
|||||||
popup.close();
|
popup.close();
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
@ -49,7 +49,7 @@ Example:
|
|||||||
let helloWorldPopup;
|
let helloWorldPopup;
|
||||||
|
|
||||||
// Open the popup when we enter a given zone
|
// Open the popup when we enter a given zone
|
||||||
helloWorldPopup = WA.room.onEnterZone('myZone', () => {
|
helloWorldPopup = WA.room.onEnterLayer("myZone").subscribe(() => {
|
||||||
WA.ui.openPopup("popupRectangle", 'Hello world!', [{
|
WA.ui.openPopup("popupRectangle", 'Hello world!', [{
|
||||||
label: "Close",
|
label: "Close",
|
||||||
className: "primary",
|
className: "primary",
|
||||||
@ -57,13 +57,13 @@ helloWorldPopup = WA.room.onEnterZone('myZone', () => {
|
|||||||
// Close the popup when the "Close" button is pressed.
|
// Close the popup when the "Close" button is pressed.
|
||||||
popup.close();
|
popup.close();
|
||||||
}
|
}
|
||||||
});
|
}]);
|
||||||
}]);
|
});
|
||||||
|
|
||||||
// Close the popup when we leave the zone.
|
// Close the popup when we leave the zone.
|
||||||
WA.room.onLeaveZone('myZone', () => {
|
WA.room.onLeaveLayer("myZone").subscribe(() => {
|
||||||
helloWorldPopup.close();
|
helloWorldPopup.close();
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add custom menu
|
### Add custom menu
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
WA.onInit().then(() => {
|
WA.onInit().then(() => {
|
||||||
let message;
|
let message;
|
||||||
|
|
||||||
WA.room.onEnterZone("carpet", () => {
|
WA.room.onEnterLayer("carpet").subscribe(() => {
|
||||||
message = WA.ui.displayActionMessage({
|
message = WA.ui.displayActionMessage({
|
||||||
message: "This is a test message. Press space to display a chat message. Walk out to hide the message.",
|
message:
|
||||||
|
"This is a test message. Press space to display a chat message. Walk out to hide the message.",
|
||||||
callback: () => {
|
callback: () => {
|
||||||
WA.chat.sendChatMessage("Hello world!", "The bot");
|
WA.chat.sendChatMessage("Hello world!", "The bot");
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
WA.room.onLeaveZone("carpet", () => {
|
|
||||||
|
WA.room.onLeaveLayer("carpet").subscribe(() => {
|
||||||
message && message.remove();
|
message && message.remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user