public void SaveConfig()
        {
            ViveRoleBindingsHelper.LoadBindingConfigFromRoleMap();
            ViveRoleBindingsHelper.SaveBindingConfigToFile(VIUSettings.bindingConfigFilePath);

            m_dirtySymble.SetActive(false);
        }
    public void UnbindAll()
    {
        ViveRoleBindingsHelper.UnbindAllCurrentBindings();

        if (OnUnbindAllComplete != null)
        {
            OnUnbindAllComplete.Invoke();
        }
    }
        public void SaveConfig()
        {
            ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load = m_toggleApplyOnStart.isOn;

            ViveRoleBindingsHelper.LoadBindingConfigFromRoleMap();
            ViveRoleBindingsHelper.SaveBindingConfigToFile(ViveRoleBindingsHelper.AUTO_LOAD_CONFIG_PATH);

            m_dirtySymble.SetActive(false);
        }
    public void BindAll()
    {
        ViveRoleBindingsHelper.BindAllCurrentDeviceClassMappings(VRModuleDeviceClass.Controller);
        ViveRoleBindingsHelper.BindAllCurrentDeviceClassMappings(VRModuleDeviceClass.GenericTracker);

        if (OnBindAllComplete != null)
        {
            OnBindAllComplete.Invoke();
        }
    }
Esempio n. 5
0
        public void RefreshDisplayInfo(ViveRole.IMap roleMap)
        {
            var roleInfo    = roleMap.RoleValueInfo;
            var roleValue   = roleMap.GetBoundRoleValueByDevice(deviceSN);
            var deviceModel = ViveRoleBindingsHelper.GetDeviceModelHint(deviceSN);

            m_deviceSN.text = deviceSN;
            m_roleName.text = roleInfo.GetNameByRoleValue(roleValue);

            BindingInterfaceSpriteManager.SetupDeviceIcon(m_modelIcon, deviceModel, VRModule.IsDeviceConnected(deviceSN));
        }
        private void Awake()
        {
            if (EventSystem.current == null)
            {
                new GameObject("[EventSystem]", typeof(EventSystem)).AddComponent <StandaloneInputModule>();
            }
            else if (EventSystem.current.GetComponent <StandaloneInputModule>() == null)
            {
                EventSystem.current.gameObject.AddComponent <StandaloneInputModule>();
            }

            ViveRoleBindingsHelper.AutoLoadConfig();

            m_toggleApplyOnStart.isOn = ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load;
        }
        public void ReloadConfig()
        {
            ViveRoleBindingsHelper.LoadBindingConfigFromFile(VIUSettings.bindingConfigFilePath);

            // Unbind all applied bindings
            for (int i = 0, imax = ViveRoleEnum.ValidViveRoleTable.Count; i < imax; ++i)
            {
                var roleType = ViveRoleEnum.ValidViveRoleTable.GetValueByIndex(i);
                var roleMap  = ViveRole.GetMap(roleType);

                roleMap.UnbindAll();
            }

            ViveRoleBindingsHelper.ApplyBindingConfigToRoleMap();

            m_dirtySymble.SetActive(false);
        }
Esempio n. 8
0
        private void Awake()
        {
            ViveRole.Initialize();
            ViveRoleBindingsHelper.AutoLoadConfig();

            RefreshRoleSelection();

            // select the role that have largest binding count
            for (int i = 0, imax = m_roleSetButtonList.Count; i < imax; ++i)
            {
                if (!m_roleSetButtonList[i].roleMap.Handler.BlockBindings && m_roleSetButtonList[i].roleMap.BindingCount == m_maxBindingCount)
                {
                    SelectRoleSet(i);
                    break;
                }
            }
        }
    public void SaveBindings()
    {
        if (!Directory.Exists(Path.GetDirectoryName(inputFilePath.text)))
        {
            Directory.CreateDirectory(Path.GetDirectoryName(inputFilePath.text));
        }

        ViveRoleBindingsHelper.SaveRoleBindings(inputFilePath.text, prettyPrint);

        SaveConfig();

        textConsole.text = "Bindings Save Complete...";

        if (OnSaveComplete != null)
        {
            OnSaveComplete.Invoke();
        }
    }
    public void Awake()
    {
        if (!LoadConfigPath() || string.IsNullOrEmpty(inputFilePath.text))
        {
            inputFilePath.text = ViveRoleBindingsHelper.AUTO_LOAD_CONFIG_PATH;
        }

        if (!string.IsNullOrEmpty(inputFilePath.text) && File.Exists(inputFilePath.text))
        {
            ViveRoleBindingsHelper.LoadBindingConfigFromFile(inputFilePath.text);

            autoLoadBindings = ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load;

            if (autoLoadBindings)
            {
                ViveRoleBindingsHelper.ApplyBindingConfigToRoleMap();
            }
        }
    }
        public void ReloadConfig()
        {
            ViveRoleBindingsHelper.LoadBindingConfigFromFile(ViveRoleBindingsHelper.AUTO_LOAD_CONFIG_PATH);

            // Unbind all applied bindings
            for (int i = 0, imax = ViveRoleEnum.ValidViveRoleTable.Count; i < imax; ++i)
            {
                var roleType = ViveRoleEnum.ValidViveRoleTable.GetValueByIndex(i);
                var roleMap  = ViveRole.GetMap(roleType);

                roleMap.UnbindAll();
            }

            ViveRoleBindingsHelper.ApplyBindingConfigToRoleMap();

            m_toggleApplyOnStart.isOn = ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load;

            m_dirtySymble.SetActive(false);
        }
    public void LoadBindings()
    {
        if (!File.Exists(inputFilePath.text))
        {
            Debug.LogWarning("LoadBindings config " + inputFilePath.text + " not found");
            textConsole.text = "Bindings Load Fail! config file not found...";
            return;
        }

        ViveRoleBindingsHelper.LoadRoleBindings(inputFilePath.text);

        SaveConfig();

        textConsole.text = "Bindings Load Complete...";

        if (OnLoadComplete != null)
        {
            OnLoadComplete.Invoke();
        }
    }
Esempio n. 13
0
 public void CheckInputDeviceSN(string inputStr)
 {
     if (string.IsNullOrEmpty(inputStr))
     {
         m_buttonCheck.interactable = false;
         m_modelIcon.gameObject.SetActive(false);
     }
     else
     {
         m_buttonCheck.interactable = true;
         m_modelIcon.gameObject.SetActive(true);
         uint deviceIndex;
         if (VRModule.TryGetConnectedDeviceIndex(inputStr, out deviceIndex))
         {
             BindingInterfaceSpriteManager.SetupDeviceIcon(m_modelIcon, VRModule.GetCurrentDeviceState(deviceIndex).deviceModel, true);
         }
         else
         {
             BindingInterfaceSpriteManager.SetupDeviceIcon(m_modelIcon, ViveRoleBindingsHelper.GetDeviceModelHint(inputStr), false);
         }
     }
 }
    public void LoadBindings()
    {
        if (!File.Exists(inputFilePath.text))
        {
            Debug.LogWarning("LoadBindings config " + inputFilePath.text + " not found");
            textConsole.text = "Bindings Load Fail! config file not found...";
            return;
        }

        ViveRoleBindingsHelper.LoadBindingConfigFromFile(inputFilePath.text);
        ViveRoleBindingsHelper.ApplyBindingConfigToRoleMap();

        autoLoadBindings = ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load;

        SaveConfigPath();

        textConsole.text = "Bindings Load Complete...";

        if (OnLoadComplete != null)
        {
            OnLoadComplete.Invoke();
        }
    }
    public void SaveBindings()
    {
        ViveRoleBindingsHelper.LoadBindingConfigFromRoleMap();

        ViveRoleBindingsHelper.bindingConfig.apply_bindings_on_load = autoLoadBindings;

        var configDir = Path.GetDirectoryName(inputFilePath.text);

        if (!string.IsNullOrEmpty(configDir) && !Directory.Exists(configDir))
        {
            Directory.CreateDirectory(configDir);
        }

        ViveRoleBindingsHelper.SaveBindingConfigToFile(inputFilePath.text, prettyPrint);

        SaveConfigPath();

        textConsole.text = "Bindings Save Complete...";

        if (OnSaveComplete != null)
        {
            OnSaveComplete.Invoke();
        }
    }
 public void Start()
 {
     ViveRoleBindingsHelper.LoadRoleBindings(configPath);
 }
 public void CloseBindingInterface()
 {
     ViveRoleBindingsHelper.DisableBindingInterface();
 }