mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:07:07 +02:00
Merge pull request #13262 from danteruiz/add-back-notifactions
adding back notifcations to default scripts
This commit is contained in:
commit
9d5d4c52c0
2 changed files with 1 additions and 49 deletions
|
@ -23,6 +23,7 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/makeUserConnection.js",
|
"system/makeUserConnection.js",
|
||||||
"system/tablet-goto.js",
|
"system/tablet-goto.js",
|
||||||
"system/marketplaces/marketplaces.js",
|
"system/marketplaces/marketplaces.js",
|
||||||
|
"system/notifications.js",
|
||||||
"system/commerce/wallet.js",
|
"system/commerce/wallet.js",
|
||||||
"system/edit.js",
|
"system/edit.js",
|
||||||
"system/dialTone.js",
|
"system/dialTone.js",
|
||||||
|
|
|
@ -79,11 +79,7 @@
|
||||||
var frame = 0;
|
var frame = 0;
|
||||||
var ctrlIsPressed = false;
|
var ctrlIsPressed = false;
|
||||||
var ready = true;
|
var ready = true;
|
||||||
var MENU_NAME = 'Tools > Notifications';
|
|
||||||
var PLAY_NOTIFICATION_SOUNDS_MENU_ITEM = "Play Notification Sounds";
|
|
||||||
var NOTIFICATION_MENU_ITEM_POST = " Notifications";
|
var NOTIFICATION_MENU_ITEM_POST = " Notifications";
|
||||||
var PLAY_NOTIFICATION_SOUNDS_SETTING = "play_notification_sounds";
|
|
||||||
var PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE = "play_notification_sounds_type_";
|
|
||||||
var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications";
|
var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications";
|
||||||
|
|
||||||
var NotificationType = {
|
var NotificationType = {
|
||||||
|
@ -401,11 +397,6 @@
|
||||||
alpha: backgroundAlpha
|
alpha: backgroundAlpha
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) &&
|
|
||||||
Menu.isOptionChecked(NotificationType.getMenuString(notificationType))) {
|
|
||||||
randomSounds.playRandom();
|
|
||||||
}
|
|
||||||
|
|
||||||
return notify(noticeProperties, buttonProperties, height, imageProperties);
|
return notify(noticeProperties, buttonProperties, height, imageProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,30 +609,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup() {
|
|
||||||
var type;
|
|
||||||
Menu.addMenu(MENU_NAME);
|
|
||||||
var checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING);
|
|
||||||
checked = checked === '' ? true : checked;
|
|
||||||
Menu.addMenuItem({
|
|
||||||
menuName: MENU_NAME,
|
|
||||||
menuItemName: PLAY_NOTIFICATION_SOUNDS_MENU_ITEM,
|
|
||||||
isCheckable: true,
|
|
||||||
isChecked: Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING)
|
|
||||||
});
|
|
||||||
Menu.addSeparator(MENU_NAME, "Play sounds for:");
|
|
||||||
for (type in NotificationType.properties) {
|
|
||||||
checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + (parseInt(type, 10) + 1));
|
|
||||||
checked = checked === '' ? true : checked;
|
|
||||||
Menu.addMenuItem({
|
|
||||||
menuName: MENU_NAME,
|
|
||||||
menuItemName: NotificationType.properties[type].text + NOTIFICATION_MENU_ITEM_POST,
|
|
||||||
isCheckable: true,
|
|
||||||
isChecked: checked
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// When our script shuts down, we should clean up all of our overlays
|
// When our script shuts down, we should clean up all of our overlays
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
var notificationIndex;
|
var notificationIndex;
|
||||||
|
@ -649,27 +616,14 @@
|
||||||
Overlays.deleteOverlay(notifications[notificationIndex]);
|
Overlays.deleteOverlay(notifications[notificationIndex]);
|
||||||
Overlays.deleteOverlay(buttons[notificationIndex]);
|
Overlays.deleteOverlay(buttons[notificationIndex]);
|
||||||
}
|
}
|
||||||
Menu.removeMenu(MENU_NAME);
|
|
||||||
Messages.unsubscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
|
Messages.unsubscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
function menuItemEvent(menuItem) {
|
|
||||||
if (menuItem === PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) {
|
|
||||||
Settings.setValue(PLAY_NOTIFICATION_SOUNDS_SETTING, Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var notificationType = NotificationType.getTypeFromMenuItem(menuItem);
|
|
||||||
if (notificationType !== notificationType.UNKNOWN) {
|
|
||||||
Settings.setValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + notificationType, Menu.isOptionChecked(menuItem));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
Controller.mousePressEvent.connect(mousePressEvent);
|
Controller.mousePressEvent.connect(mousePressEvent);
|
||||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
Menu.menuItemEvent.connect(menuItemEvent);
|
|
||||||
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
||||||
Window.stillSnapshotTaken.connect(onSnapshotTaken);
|
Window.stillSnapshotTaken.connect(onSnapshotTaken);
|
||||||
Window.snapshot360Taken.connect(onSnapshotTaken);
|
Window.snapshot360Taken.connect(onSnapshotTaken);
|
||||||
|
@ -684,7 +638,4 @@
|
||||||
|
|
||||||
Messages.subscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
|
Messages.subscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
|
||||||
Messages.messageReceived.connect(onMessageReceived);
|
Messages.messageReceived.connect(onMessageReceived);
|
||||||
|
|
||||||
setup();
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue