From fa761af1a60037cc0df77f9e84db0fbbb6475c45 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 20 Dec 2016 23:37:54 +0000 Subject: [PATCH] update#2 --- .../resources/icons/tablet-icons/ignore.svg | 177 ++++++++++++++++++ .../resources/icons/tablet-icons/kick.svg | 140 ++++++++++++++ scripts/system/hmd.js | 1 + scripts/system/mod.js | 23 +-- 4 files changed, 327 insertions(+), 14 deletions(-) create mode 100644 interface/resources/icons/tablet-icons/ignore.svg create mode 100644 interface/resources/icons/tablet-icons/kick.svg diff --git a/interface/resources/icons/tablet-icons/ignore.svg b/interface/resources/icons/tablet-icons/ignore.svg new file mode 100644 index 0000000000..f315c5f249 --- /dev/null +++ b/interface/resources/icons/tablet-icons/ignore.svg @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/kick.svg b/interface/resources/icons/tablet-icons/kick.svg new file mode 100644 index 0000000000..1eed6e7f43 --- /dev/null +++ b/interface/resources/icons/tablet-icons/kick.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/system/hmd.js b/scripts/system/hmd.js index bfe2be7664..e6e8ed1c5c 100644 --- a/scripts/system/hmd.js +++ b/scripts/system/hmd.js @@ -53,6 +53,7 @@ function onClicked(){ } if (headset) { button = tablet.addButton({ + icon: "icons/tablet-icons/switch-a.svg", text: "SWITCH" }); onHmdChanged(HMD.active); diff --git a/scripts/system/mod.js b/scripts/system/mod.js index 7e5cc5d2a5..d3f384f63d 100644 --- a/scripts/system/mod.js +++ b/scripts/system/mod.js @@ -18,29 +18,24 @@ Script.include("/~/system/libraries/controllers.js"); // grab the toolbar -var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); +var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var ASSETS_PATH = Script.resolvePath("assets"); var TOOLS_PATH = Script.resolvePath("assets/images/tools/"); function buttonImageURL() { - return TOOLS_PATH + (Users.canKick ? 'kick.svg' : 'ignore.svg'); + return "icons/tablet-icons/" + (Users.canKick ? 'kick.svg' : 'ignore.svg'); } // setup the mod button and add it to the toolbar var button = toolbar.addButton({ - objectName: 'mod', - imageURL: buttonImageURL(), - visible: true, - buttonState: 1, - defaultState: 1, - hoverState: 3, - alpha: 0.9 + icon: buttonImageURL(), + text: "KICK" }); // if this user's kick permissions change, change the state of the button in the HUD Users.canKickChanged.connect(function(canKick){ - button.writeProperty('imageURL', buttonImageURL()); + button.editProperties({icon: buttonImageURL()}); }); var isShowingOverlays = false; @@ -69,9 +64,9 @@ function buttonClicked(){ isShowingOverlays = true; } - button.writeProperty('buttonState', isShowingOverlays ? 0 : 1); - button.writeProperty('defaultState', isShowingOverlays ? 0 : 1); - button.writeProperty('hoverState', isShowingOverlays ? 2 : 3); + //button.writeProperty('buttonState', isShowingOverlays ? 0 : 1); + //button.writeProperty('defaultState', isShowingOverlays ? 0 : 1); + //button.writeProperty('hoverState', isShowingOverlays ? 2 : 3); } button.clicked.connect(buttonClicked); @@ -251,7 +246,7 @@ triggerMapping.enable(); // cleanup the toolbar button and overlays when script is stopped Script.scriptEnding.connect(function() { - toolbar.removeButton('mod'); + tablet.removeButton(button); removeOverlays(); triggerMapping.disable(); });