mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 02:36:04 +02:00
Merge branch 'master' of github.com:sethalves/hifi
This commit is contained in:
commit
b6bf9c3c3c
12 changed files with 168 additions and 119 deletions
|
@ -19,12 +19,11 @@ Original.CheckBox {
|
|||
|
||||
property int colorScheme: hifi.colorSchemes.light
|
||||
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
|
||||
|
||||
property bool isRedCheck: false
|
||||
property int boxSize: 14
|
||||
readonly property int boxRadius: 3
|
||||
readonly property int checkSize: Math.max(boxSize - 8, 10)
|
||||
readonly property int checkRadius: 2
|
||||
|
||||
activeFocusOnPress: true
|
||||
|
||||
style: CheckBoxStyle {
|
||||
|
@ -37,6 +36,7 @@ Original.CheckBox {
|
|||
border.color: pressed || hovered
|
||||
? hifi.colors.checkboxCheckedBorder
|
||||
: (checkBox.isLightColorScheme ? hifi.colors.checkboxLightFinish : hifi.colors.checkboxDarkFinish)
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0.2
|
||||
|
@ -68,9 +68,9 @@ Original.CheckBox {
|
|||
height: checkSize
|
||||
radius: checkRadius
|
||||
anchors.centerIn: parent
|
||||
color: hifi.colors.checkboxChecked
|
||||
color: isRedCheck ? hifi.colors.checkboxCheckedRed : hifi.colors.checkboxChecked
|
||||
border.width: 2
|
||||
border.color: hifi.colors.checkboxCheckedBorder
|
||||
border.color: isRedCheck? hifi.colors.checkboxCheckedBorderRed : hifi.colors.checkboxCheckedBorder
|
||||
visible: checked && !pressed || !checked && pressed
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@ import QtQuick.Controls 1.4
|
|||
import "../styles-uit"
|
||||
|
||||
Item {
|
||||
property var dialogTitleText;
|
||||
property var optionTitleText;
|
||||
property var optionBodyText;
|
||||
property var optionValues;
|
||||
property var selectedOptionIndex;
|
||||
property var dialogTitleText : "";
|
||||
property var optionTitleText: "";
|
||||
property var optionBodyText: "";
|
||||
property var optionValues: [];
|
||||
property var selectedOptionIndex: 0;
|
||||
property var callbackFunction;
|
||||
property int dialogWidth;
|
||||
property int dialogHeight;
|
||||
property int comboOptionTextSize: 18;
|
||||
|
@ -31,6 +32,14 @@ Item {
|
|||
populateComboListViewModel();
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
combo.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dialogBackground;
|
||||
anchors.fill: parent;
|
||||
|
@ -42,12 +51,12 @@ Item {
|
|||
id: dialogContainer;
|
||||
color: "white";
|
||||
anchors.centerIn: dialogBackground;
|
||||
width: dialogWidth;
|
||||
height: dialogHeight;
|
||||
width: combo.dialogWidth;
|
||||
height: combo.dialogHeight;
|
||||
|
||||
RalewayRegular {
|
||||
id: dialogTitle;
|
||||
text: dialogTitleText;
|
||||
text: combo.dialogTitleText;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 20;
|
||||
anchors.left: parent.left;
|
||||
|
@ -69,6 +78,7 @@ Item {
|
|||
anchors.bottom: parent.bottom;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
clip: true;
|
||||
model: comboListViewModel;
|
||||
delegate: comboListViewDelegate;
|
||||
|
||||
|
@ -77,7 +87,7 @@ Item {
|
|||
Rectangle {
|
||||
id: comboListViewItemContainer;
|
||||
// Size
|
||||
height: childrenRect.height + 10;
|
||||
height: optionTitle.height + optionBody.height + 20;
|
||||
width: dialogContainer.width;
|
||||
color: selectedOptionIndex === index ? '#cee6ff' : 'white';
|
||||
Rectangle {
|
||||
|
@ -100,9 +110,11 @@ Item {
|
|||
id: optionTitle;
|
||||
text: titleText;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 7;
|
||||
anchors.left: comboOptionSelected.right;
|
||||
anchors.leftMargin: 20;
|
||||
anchors.leftMargin: 10;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 10;
|
||||
height: 30;
|
||||
size: comboOptionTextSize;
|
||||
wrapMode: Text.WordWrap;
|
||||
|
@ -112,10 +124,10 @@ Item {
|
|||
id: optionBody;
|
||||
text: bodyText;
|
||||
anchors.top: optionTitle.bottom;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.left: comboOptionSelected.right;
|
||||
anchors.leftMargin: 25;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 10;
|
||||
size: comboOptionTextSize;
|
||||
wrapMode: Text.WordWrap;
|
||||
}
|
||||
|
@ -127,9 +139,8 @@ Item {
|
|||
onEntered: comboListViewItemContainer.color = hifi.colors.blueHighlight
|
||||
onExited: comboListViewItemContainer.color = selectedOptionIndex === index ? '#cee6ff' : 'white';
|
||||
onClicked: {
|
||||
GlobalServices.findableBy = optionValue;
|
||||
UserActivityLogger.palAction("set_availability", optionValue);
|
||||
print('Setting availability:', optionValue);
|
||||
callbackFunction(optionValue);
|
||||
combo.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,18 +148,10 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
combo.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function populateComboListViewModel() {
|
||||
comboListViewModel.clear();
|
||||
optionTitleText.forEach(function(titleText, index) {
|
||||
comboListViewModel.insert(index, {"titleText": titleText, "bodyText": optionBodyText[index], "optionValue": optionValues[index]});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ Rectangle {
|
|||
ComboDialog {
|
||||
id: comboDialog;
|
||||
z: 999; // Force the ComboDialog on top of everything else
|
||||
dialogWidth: parent.width - 100;
|
||||
dialogWidth: parent.width - 50;
|
||||
dialogHeight: parent.height - 100;
|
||||
}
|
||||
function letterbox(headerGlyph, headerText, message) {
|
||||
|
@ -66,7 +66,13 @@ Rectangle {
|
|||
letterboxMessage.visible = true;
|
||||
letterboxMessage.popupRadius = 0;
|
||||
}
|
||||
function popupComboDialogCallback(availability) {
|
||||
GlobalServices.findableBy = availability;
|
||||
UserActivityLogger.palAction("set_availability", availability);
|
||||
print('Setting availability:', JSON.stringify(GlobalServices.findableBy));
|
||||
}
|
||||
function popupComboDialog(dialogTitleText, optionTitleText, optionBodyText, optionValues) {
|
||||
comboDialog.callbackFunction = popupComboDialogCallback;
|
||||
comboDialog.dialogTitleText = dialogTitleText;
|
||||
comboDialog.optionTitleText = optionTitleText;
|
||||
comboDialog.optionBodyText = optionBodyText;
|
||||
|
@ -506,6 +512,7 @@ Rectangle {
|
|||
// If this is an "Ignore" checkbox, disable the checkbox if user isn't present.
|
||||
enabled: styleData.role === "ignore" ? (model ? model["isPresent"] : true) : true;
|
||||
boxSize: 24;
|
||||
isRedCheck: true
|
||||
onClicked: {
|
||||
var newValue = !model[styleData.role];
|
||||
nearbyUserModel.setProperty(model.userIndex, styleData.role, newValue);
|
||||
|
@ -605,7 +612,7 @@ Rectangle {
|
|||
"Bold names in the list are <b>avatar display names</b>.<br>" +
|
||||
"<font color='purple'>Purple borders around profile pictures are <b>connections</b></font>.<br>" +
|
||||
"<font color='green'>Green borders around profile pictures are <b>friends</b>.</font><br>" +
|
||||
"(TEMPORARY LANGUAGE) In some situations, you can also see others' usernames.<br>" +
|
||||
"Others can find you and see your username according to your <b>availability</b> settings.<br>" +
|
||||
"If you can see someone's username, you can GoTo them by selecting them in the PAL, then clicking their name.<br>" +
|
||||
"<br>If someone's display name isn't set, a unique <b>session display name</b> is assigned to them.<br>" +
|
||||
"<br>Administrators of this domain can also see the <b>username</b> or <b>machine ID</b> associated with each avatar present.");
|
||||
|
@ -942,7 +949,7 @@ Rectangle {
|
|||
}
|
||||
Item {
|
||||
id: upperRightInfoContainer;
|
||||
width: 160;
|
||||
width: 200;
|
||||
height: parent.height;
|
||||
anchors.top: parent.top;
|
||||
anchors.right: parent.right;
|
||||
|
@ -953,59 +960,53 @@ Rectangle {
|
|||
// Text size
|
||||
size: hifi.fontSizes.tabularData;
|
||||
// Anchors
|
||||
anchors.top: availabilityComboBox.bottom;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
anchors.top: myCard.top;
|
||||
anchors.left: parent.left;
|
||||
// Style
|
||||
color: hifi.colors.baseGrayHighlight;
|
||||
// Alignment
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignTop;
|
||||
}
|
||||
/*Rectangle {
|
||||
Rectangle {
|
||||
property var availabilityStrings: ["Everyone", "Friends and Connections", "Friends Only", "Appear Offline"];
|
||||
id: availabilityComboBox;
|
||||
color: hifi.colors.textFieldLightBackground
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.top: availabilityText.bottom;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
// Size
|
||||
width: parent.width;
|
||||
height: 40;
|
||||
function determineAvailabilityIndex() {
|
||||
return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy);
|
||||
}
|
||||
|
||||
function determineAvailabilityString() {
|
||||
return availabilityStrings[determineAvailabilityIndex()];
|
||||
}
|
||||
RalewayRegular {
|
||||
text: myData.userName === "Unknown user" ? "Login to Set" : availabilityComboBox.determineAvailabilityString();
|
||||
anchors.fill: parent;
|
||||
anchors.leftMargin: 10;
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
size: 16;
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
anchors.fill: parent;
|
||||
enabled: myData.userName !== "Unknown user";
|
||||
hoverEnabled: true;
|
||||
onClicked: {
|
||||
popupComboDialog("Set your list visibility",
|
||||
["Everyone", "Friends and Connections", "Friends Only", "Appear Offline"],
|
||||
["You will be invisible in everyone's 'People' list.\nAnyone will be able to jump to your location if the domain allows.",
|
||||
"You will be visible in the 'People' list only for those with whom you are connected or friends.\nThey will be able to jump to your location if the domain allows.",
|
||||
"You will be visible in the 'People' list only for those with whom you are friends.\nThey will be able to jump to your location if the domain allows.",
|
||||
"You will not be visible in the 'People' list of any other users."],
|
||||
popupComboDialog("Set your availability:",
|
||||
availabilityComboBox.availabilityStrings,
|
||||
["Your username will be visible in everyone's 'Nearby' list.\nAnyone will be able to jump to your location from within the 'Nearby' list.",
|
||||
"Your location will be visible in the 'Connections' list only for those with whom you are connected or friends.\nThey will be able to jump to your location if the domain allows.",
|
||||
"Your location will be visible in the 'Connections' list only for those with whom you are friends.\nThey will be able to jump to your location if the domain allows.",
|
||||
"Your location will not be visible in the 'Connections' list of any other users. Only domain admins will be able to see your username in the 'Nearby' list."],
|
||||
["all", "connections", "friends", "none"]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
HifiControlsUit.ComboBox {
|
||||
function determineAvailabilityIndex() {
|
||||
return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy)
|
||||
}
|
||||
id: availabilityComboBox;
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
// Size
|
||||
width: parent.width;
|
||||
height: 40;
|
||||
currentIndex: determineAvailabilityIndex();
|
||||
model: ListModel {
|
||||
id: availabilityComboBoxListItems
|
||||
ListElement { text: "Everyone"; value: "all"; }
|
||||
ListElement { text: "All Connections"; value: "connections"; }
|
||||
ListElement { text: "Friends Only"; value: "friends"; }
|
||||
ListElement { text: "Appear Offline"; value: "none" }
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
GlobalServices.findableBy = availabilityComboBoxListItems.get(currentIndex).value;
|
||||
UserActivityLogger.palAction("set_availability", availabilityComboBoxListItems.get(currentIndex).value);
|
||||
print('Setting availability:', JSON.stringify(GlobalServices.findableBy));
|
||||
onEntered: availabilityComboBox.color = hifi.colors.lightGrayText;
|
||||
onExited: availabilityComboBox.color = hifi.colors.textFieldLightBackground;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,9 @@ Item {
|
|||
readonly property color indigoAccent: "#9495FF"
|
||||
readonly property color magentaHighlight: "#EF93D1"
|
||||
readonly property color magentaAccent: "#A2277C"
|
||||
readonly property color checkboxCheckedRed: "#FF0000"
|
||||
readonly property color checkboxCheckedBorderRed: "#D00000"
|
||||
|
||||
// Semitransparent
|
||||
readonly property color darkGray30: "#4d121212"
|
||||
readonly property color darkGray0: "#00121212"
|
||||
|
|
|
@ -54,7 +54,7 @@ void DiscoverabilityManager::updateLocation() {
|
|||
const QString CONNECTED_KEY_IN_LOCATION = "connected";
|
||||
locationObject.insert(CONNECTED_KEY_IN_LOCATION, discoverable && domainHandler.isConnected());
|
||||
|
||||
if (discoverable) { // Don't consider changes to these as update-worthy if we're not discoverable.
|
||||
if (discoverable || _lastLocationObject.isEmpty()) { // Don't consider changes to these as update-worthy if we're not discoverable.
|
||||
const QString PATH_KEY_IN_LOCATION = "path";
|
||||
locationObject.insert(PATH_KEY_IN_LOCATION, pathString);
|
||||
|
||||
|
|
|
@ -1204,7 +1204,7 @@ void Rig::updateFromHandAndFeetParameters(const HandAndFeetParameters& params, f
|
|||
} else {
|
||||
_animVars.unset("leftFootPosition");
|
||||
_animVars.unset("leftFootRotation");
|
||||
_animVars.set("leftFootType", (int)IKTarget::Type::HipsRelativeRotationAndPosition);
|
||||
_animVars.set("leftFootType", (int)IKTarget::Type::RotationAndPosition);
|
||||
}
|
||||
|
||||
if (params.isRightFootEnabled) {
|
||||
|
@ -1214,7 +1214,7 @@ void Rig::updateFromHandAndFeetParameters(const HandAndFeetParameters& params, f
|
|||
} else {
|
||||
_animVars.unset("rightFootPosition");
|
||||
_animVars.unset("rightFootRotation");
|
||||
_animVars.set("rightFootType", (int)IKTarget::Type::HipsRelativeRotationAndPosition);
|
||||
_animVars.set("rightFootType", (int)IKTarget::Type::RotationAndPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -581,7 +581,9 @@ QObject* OffscreenQmlSurface::finishQmlLoad(std::function<void(QQmlContext*, QOb
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
_qmlEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||
newObject->setProperty("eventBridge", QVariant::fromValue(this));
|
||||
|
||||
newContext->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject));
|
||||
|
||||
f(newContext, newObject);
|
||||
|
|
|
@ -974,6 +974,8 @@ void ScriptEngine::run() {
|
|||
return; // bail early - avoid setting state in init(), as evaluate() will bail too
|
||||
}
|
||||
|
||||
scriptInfoMessage("Script Engine starting:" + getFilename());
|
||||
|
||||
if (!_isInitialized) {
|
||||
init();
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
|
||||
QObject::connect(quickItem, SIGNAL(windowClosed()), this, SLOT(desktopWindowClosed()));
|
||||
|
||||
QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
|
||||
QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SLOT(emitWebEvent(QVariant)), Qt::DirectConnection);
|
||||
|
||||
// forward qml surface events to interface js
|
||||
connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
|
||||
|
@ -271,12 +271,17 @@ bool TabletProxy::isMessageDialogOpen() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void TabletProxy::emitWebEvent(QVariant msg) {
|
||||
emit webEventReceived(msg);
|
||||
}
|
||||
|
||||
void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
_qmlOffscreenSurface = qmlOffscreenSurface;
|
||||
_qmlTabletRoot = qmlTabletRoot;
|
||||
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
||||
QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
|
||||
|
||||
QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SLOT(emitWebEvent(QVariant)), Qt::DirectConnection);
|
||||
|
||||
// forward qml surface events to interface js
|
||||
connect(dynamic_cast<OffscreenQmlSurface*>(_qmlOffscreenSurface), &OffscreenQmlSurface::fromQml, [this](QVariant message) {
|
||||
|
@ -398,7 +403,7 @@ void TabletProxy::popFromStack() {
|
|||
auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
|
||||
if (stack) {
|
||||
QMetaObject::invokeMethod(stack, "popSource");
|
||||
} else {
|
||||
} else {
|
||||
qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
|
||||
}
|
||||
} else {
|
||||
|
@ -708,4 +713,3 @@ void TabletButtonProxy::editProperties(QVariantMap properties) {
|
|||
}
|
||||
|
||||
#include "TabletScriptingInterface.moc"
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ signals:
|
|||
protected slots:
|
||||
void addButtonsToHomeScreen();
|
||||
void desktopWindowClosed();
|
||||
void emitWebEvent(QVariant msg);
|
||||
protected:
|
||||
void removeButtonsFromHomeScreen();
|
||||
void loadHomeScreen(bool forceOntoHomeScreen);
|
||||
|
|
|
@ -16,66 +16,92 @@
|
|||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var tabletButton = tablet.addButton({
|
||||
text: "SOUNDS"
|
||||
text: "SOUNDS",
|
||||
icon: "http://s3.amazonaws.com/hifi-public/tony/icons/trombone-i.png",
|
||||
activeIcon: "http://s3.amazonaws.com/hifi-public/tony/icons/trombone-a.png"
|
||||
});
|
||||
|
||||
var WEB_BRIDGE_TEST_HTML = "https://s3.amazonaws.com/hifi-public/tony/webBridgeTest.html?2";
|
||||
|
||||
var TROMBONE_URL = "https://s3.amazonaws.com/hifi-public/tony/audio/sad-trombone.wav";
|
||||
var tromboneSound = SoundCache.getSound(TROMBONE_URL);
|
||||
var tromboneInjector;
|
||||
|
||||
var SCREAM_URL = "https://s3.amazonaws.com/hifi-public/tony/audio/wilhelm-scream.wav";
|
||||
var screamSound = SoundCache.getSound(SCREAM_URL);
|
||||
var screamInjector;
|
||||
|
||||
tabletButton.clicked.connect(function () {
|
||||
tablet.gotoWebScreen(WEB_BRIDGE_TEST_HTML);
|
||||
if (shown) {
|
||||
tablet.gotoHomeScreen();
|
||||
} else {
|
||||
tablet.gotoWebScreen(WEB_BRIDGE_TEST_HTML);
|
||||
}
|
||||
});
|
||||
|
||||
// hook up to the event bridge
|
||||
tablet.webEventReceived.connect(function (msg) {
|
||||
var shown = false;
|
||||
|
||||
function onScreenChanged(type, url) {
|
||||
if (type === "Web" && url === WEB_BRIDGE_TEST_HTML) {
|
||||
tabletButton.editProperties({isActive: true});
|
||||
|
||||
if (!shown) {
|
||||
// hook up to the event bridge
|
||||
tablet.webEventReceived.connect(onWebEventReceived);
|
||||
}
|
||||
shown = true;
|
||||
} else {
|
||||
tabletButton.editProperties({isActive: false});
|
||||
|
||||
if (shown) {
|
||||
// disconnect from the event bridge
|
||||
tablet.webEventReceived.disconnect(onWebEventReceived);
|
||||
}
|
||||
shown = false;
|
||||
}
|
||||
}
|
||||
|
||||
tablet.screenChanged.connect(onScreenChanged);
|
||||
|
||||
// ctor
|
||||
function SoundBuddy(url) {
|
||||
this.sound = SoundCache.getSound(url);
|
||||
this.injector = null;
|
||||
}
|
||||
|
||||
SoundBuddy.prototype.play = function (options, doneCallback) {
|
||||
if (this.sound.downloaded) {
|
||||
if (this.injector) {
|
||||
this.injector.setOptions(options);
|
||||
this.injector.restart();
|
||||
} else {
|
||||
this.injector = Audio.playSound(this.sound, options);
|
||||
this.injector.finished.connect(function () {
|
||||
if (doneCallback) {
|
||||
doneCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var tromboneSound = new SoundBuddy(TROMBONE_URL);
|
||||
var screamSound = new SoundBuddy(SCREAM_URL);
|
||||
var soundOptions = { position: MyAvatar.position, volume: 1.0, loop: false, localOnly: true };
|
||||
|
||||
function onWebEventReceived(msg) {
|
||||
Script.print("HIFI: recv web event = " + JSON.stringify(msg));
|
||||
if (msg === "button-1-play") {
|
||||
|
||||
// play sad trombone
|
||||
if (tromboneSound.downloaded) {
|
||||
if (tromboneInjector) {
|
||||
tromboneInjector.restart();
|
||||
} else {
|
||||
tromboneInjector = Audio.playSound(tromboneSound, { position: MyAvatar.position,
|
||||
volume: 1.0,
|
||||
loop: false });
|
||||
}
|
||||
}
|
||||
|
||||
// wait until sound is finished then send a done event
|
||||
Script.setTimeout(function () {
|
||||
soundOptions.position = MyAvatar.position;
|
||||
tromboneSound.play(soundOptions, function () {
|
||||
tablet.emitScriptEvent("button-1-done");
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
if (msg === "button-2-play") {
|
||||
|
||||
// play scream
|
||||
if (screamSound.downloaded) {
|
||||
if (screamInjector) {
|
||||
screamInjector.restart();
|
||||
} else {
|
||||
screamInjector = Audio.playSound(screamSound, { position: MyAvatar.position,
|
||||
volume: 1.0,
|
||||
loop: false });
|
||||
}
|
||||
}
|
||||
|
||||
// wait until sound is finished then send a done event
|
||||
Script.setTimeout(function () {
|
||||
});
|
||||
} else if (msg === "button-2-play") {
|
||||
soundOptions.position = MyAvatar.position;
|
||||
screamSound.play(soundOptions, function () {
|
||||
tablet.emitScriptEvent("button-2-done");
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
tablet.removeButton(tabletButton);
|
||||
if (shown) {
|
||||
tablet.webEventReceived.disconnect(onWebEventReceived);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -266,6 +266,13 @@
|
|||
}
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
|
||||
// if we reload scripts in tablet mode make sure we close the currently open window, by calling gotoHomeScreen
|
||||
var tabletProxy = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
if (tabletProxy && tabletProxy.toolbarMode) {
|
||||
tabletProxy.gotoHomeScreen();
|
||||
}
|
||||
|
||||
var tabletID = HMD.tabletID;
|
||||
Entities.deleteEntity(tabletID);
|
||||
Overlays.deleteOverlay(tabletID);
|
||||
|
|
Loading…
Reference in a new issue