mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:36:54 +02:00
sending and recieving jump to event
This commit is contained in:
parent
59aea60be0
commit
fc1e588588
2 changed files with 39 additions and 4 deletions
|
@ -217,7 +217,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<input type="button" data-dismiss="modal" value="Cancel">
|
<input type="button" data-dismiss="modal" value="Cancel">
|
||||||
<input type="button" data-dismiss="modal" value="OK">
|
<input type="button" data-dismiss="modal" id="jump-to-confirm-button" value="OK">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -328,6 +328,16 @@
|
||||||
modal.find(".modal-title").text("Jump to " + username + " @ " + placename);
|
modal.find(".modal-title").text("Jump to " + username + " @ " + placename);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$("#jump-to-confirm-button").click(function() {
|
||||||
|
var jumpToObject = {
|
||||||
|
"type": "jump-to",
|
||||||
|
"data": {
|
||||||
|
"username": "Alan_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(jumpToObject));
|
||||||
|
});
|
||||||
|
|
||||||
// Listen for events from hifi
|
// Listen for events from hifi
|
||||||
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
|
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,26 @@
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
var USERS_URL = "https://hifi-content.s3.amazonaws.com/faye/tablet-dev/users.html";
|
var USERS_URL = "https://hifi-content.s3.amazonaws.com/faye/tablet-dev/users.html";
|
||||||
|
|
||||||
var FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";
|
var FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";
|
||||||
var FRIENDS_WINDOW_WIDTH = 290;
|
var FRIENDS_WINDOW_WIDTH = 290;
|
||||||
var FRIENDS_WINDOW_HEIGHT = 500;
|
var FRIENDS_WINDOW_HEIGHT = 500;
|
||||||
var FRIENDS_WINDOW_TITLE = "Add/Remove Friends";
|
var FRIENDS_WINDOW_TITLE = "Add/Remove Friends";
|
||||||
|
|
||||||
|
// Initialise visibility based on global service
|
||||||
|
var VISIBILITY_VALUES_SET = {};
|
||||||
|
VISIBILITY_VALUES_SET["all"] = true;
|
||||||
|
VISIBILITY_VALUES_SET["friends"] = true;
|
||||||
|
VISIBILITY_VALUES_SET["none"] = true;
|
||||||
|
var myVisibility;
|
||||||
|
if (GlobalServices.findableBy in VISIBILITY_VALUES_SET) {
|
||||||
|
myVisibility = GlobalServices.findableBy;
|
||||||
|
} else {
|
||||||
|
// default to friends if it can't be determined
|
||||||
|
myVisibility = "friends";
|
||||||
|
GlobalServices.findableBy = myVisibilty;
|
||||||
|
}
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
icon: "icons/tablet-icons/people-i.svg",
|
icon: "icons/tablet-icons/people-i.svg",
|
||||||
|
@ -35,10 +51,13 @@
|
||||||
// send username to html
|
// send username to html
|
||||||
var myUsername = GlobalServices.username;
|
var myUsername = GlobalServices.username;
|
||||||
var object = {
|
var object = {
|
||||||
"type": "sendUsername",
|
"type": "user-info",
|
||||||
"data": {"username": myUsername}
|
"data": {
|
||||||
|
"username": myUsername,
|
||||||
|
"visibility": myVisibility
|
||||||
|
}
|
||||||
};
|
};
|
||||||
print("sending username: " + myUsername);
|
print("sending user info: " + JSON.stringify(object));
|
||||||
tablet.emitScriptEvent(JSON.stringify(object));
|
tablet.emitScriptEvent(JSON.stringify(object));
|
||||||
}
|
}
|
||||||
if (event.type === "manage-friends") {
|
if (event.type === "manage-friends") {
|
||||||
|
@ -53,6 +72,12 @@
|
||||||
friendsWindow.setVisible(true);
|
friendsWindow.setVisible(true);
|
||||||
friendsWindow.raise();
|
friendsWindow.raise();
|
||||||
}
|
}
|
||||||
|
if (event.type === "jump-to") {
|
||||||
|
if (typeof event.data.username !== undefined) {
|
||||||
|
// teleport to selected user from the online users list
|
||||||
|
location.goToUser(event.data.username);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
Loading…
Reference in a new issue