mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 01:03:59 +02:00
store settings
This commit is contained in:
parent
1eaac8605f
commit
37846d9f0c
1 changed files with 25 additions and 4 deletions
|
@ -8,14 +8,27 @@
|
|||
//
|
||||
|
||||
|
||||
var mappingName, basicMapping;
|
||||
var mappingName, basicMapping,isChecked;
|
||||
|
||||
var previousSetting = Settings.getValue('advancedMovementForHandControllersIsChecked');
|
||||
if (previousSetting === '') {
|
||||
previousSetting = false;
|
||||
isChecked=false;
|
||||
}
|
||||
|
||||
if(previousSetting===true){
|
||||
isChecked=true;
|
||||
}
|
||||
if(previousSetting===false){
|
||||
isChecked=false;
|
||||
}
|
||||
|
||||
function addAdvancedMovementItemToSettingsMenu() {
|
||||
Menu.addMenuItem({
|
||||
menuName: "Settings",
|
||||
menuItemName: "Advanced Movement For Hand Controllers",
|
||||
isCheckable: true,
|
||||
isChecked: false
|
||||
isChecked: previousSetting
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -63,15 +76,16 @@ function scriptEnding() {
|
|||
disableMappings();
|
||||
}
|
||||
|
||||
var isChecked = false;
|
||||
|
||||
function menuItemEvent(menuItem) {
|
||||
if (menuItem == "Advanced Movement For Hand Controllers") {
|
||||
print(" checked=" + Menu.isOptionChecked("Advanced Movement For Hand Controllers"));
|
||||
isChecked = Menu.isOptionChecked("Advanced Movement For Hand Controllers");
|
||||
if (isChecked === true) {
|
||||
Settings.setValue('advancedMovementForHandControllersIsChecked', true);
|
||||
disableMappings();
|
||||
} else if (isChecked === false) {
|
||||
Settings.setValue('advancedMovementForHandControllersIsChecked', false);
|
||||
enableMappings();
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +99,14 @@ Script.scriptEnding.connect(scriptEnding);
|
|||
Menu.menuItemEvent.connect(menuItemEvent);
|
||||
|
||||
registerBasicMapping();
|
||||
enableMappings();
|
||||
if (previousSetting === true) {
|
||||
print('JBP WAS SET TO TRUE')
|
||||
disableMappings();
|
||||
} else if (previousSetting === false) {
|
||||
print('JBP WAS SET TO FALSE')
|
||||
enableMappings();
|
||||
}
|
||||
|
||||
|
||||
HMD.displayModeChanged.connect(function(isHMDMode) {
|
||||
if (isHMDMode) {
|
||||
|
|
Loading…
Reference in a new issue