/// <summary>
    /// Toggle the state of a button
    /// </summary>
    /// <param name="button">The button to toggle</param>
    /// <param name="state">The new state for the button</param>
    private void ToggleButtonState(Button button, ButtonState state)
    {
        Text buttonText = button.GetComponentInChildren <Text>();

        switch (state)
        {
        case ButtonState.Enabled:
            buttonText.color    = m_colorEnabled;
            button.interactable = true;

            m_wearHf.AddVoiceCommand(
                buttonText.text, VoiceCommandCallback);
            break;

        case ButtonState.Disabled:
            buttonText.color    = m_colorDisabled;
            button.interactable = false;

            m_wearHf.RemoveVoiceCommand(buttonText.text);
            break;
        }
    }
示例#2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="button">按钮</param>
    /// <param name="start">按钮的状态</param>
    private void ToggleButtonStart(Button button, ButtonStart start)
    {
        //获取button 里面的Text
        Text buttonText = button.GetComponentInChildren <Text>();

        switch (start)
        {
        case ButtonStart.Enable:
            //改变字体颜色
            buttonText.color    = m_colorEnable;
            button.interactable = true;

            m_weraHf.AddVoiceCommand(buttonText.text, VoiceCommandCallback);

            break;

        case ButtonStart.Disabled:
            buttonText.color    = m_colorDisable;
            button.interactable = false;
            m_weraHf.RemoveVoiceCommand(buttonText.text);
            break;
        }
    }
示例#3
0
 public void RemoveCommand(VoiceCommand command)
 {
     wearHf.RemoveVoiceCommand(command.text);
     commands.Remove(command);
 }