mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
make HUD bubble/shield button optional
Adds an menu item in "Settings" to toggle the HUD shield/bubble button on or off. Shield button remains available in the tablet or toolbar, it is called "HUD shield button" but suggestions are welcome fixes https://github.com/vircadia/vircadia/issues/1210
This commit is contained in:
parent
f062d64223
commit
0cf71bd3e1
1 changed files with 24 additions and 0 deletions
|
@ -46,6 +46,27 @@
|
|||
});
|
||||
}
|
||||
|
||||
//create a menu item in "Setings" to toggle the bubble/shield HUD button
|
||||
var menuItemName = "HUD shield button";
|
||||
Menu.addMenuItem({
|
||||
menuName: "Settings",
|
||||
menuItemName: menuItemName,
|
||||
isCheckable: true,
|
||||
isChecked: AvatarInputs.showBubbleTools
|
||||
});
|
||||
Menu.menuItemEvent.connect(onToggleHudShieldButton);
|
||||
AvatarInputs.showBubbleToolsChanged.connect(showBubbleToolsChanged);
|
||||
|
||||
function onToggleHudShieldButton(menuItem) {
|
||||
if (menuItem == menuItemName) {
|
||||
AvatarInputs.setShowBubbleTools(Menu.isOptionChecked(menuItem))
|
||||
};
|
||||
}
|
||||
|
||||
function showBubbleToolsChanged(show) {
|
||||
Menu.setIsOptionChecked(menuItemName, show);
|
||||
}
|
||||
|
||||
// Make the bubble overlay visible, set its position, and play the sound
|
||||
function createOverlays() {
|
||||
var nowTimestamp = Date.now();
|
||||
|
@ -191,6 +212,9 @@
|
|||
|
||||
// Cleanup the tablet button and overlays when script is stopped
|
||||
Script.scriptEnding.connect(function () {
|
||||
Menu.menuItemEvent.disconnect(onToggleHudShieldButton);
|
||||
AvatarInputs.showBubbleToolsChanged.disconnect(showBubbleToolsChanged);
|
||||
Menu.removeMenuItem("Settings", menuItemName);
|
||||
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||
if (tablet) {
|
||||
tablet.removeButton(button);
|
||||
|
|
Loading…
Reference in a new issue