예제 #1
0
 void Awake()
 {
     canvasGroup = GetComponent <CanvasGroup>();
     lineWidthSlider.onValueChanged.AddListener(LineWidthValueChanged);
     minLineDistanceSlider.onValueChanged.AddListener(MinDistanceLineWidthValueChanged);
     canvasGroup.alpha = 0;
     options           = GetComponentsInChildren <VRControllerOption>()
                         .Where(v => v != this).ToArray();
     selectedOption = options[currentOption];
 }
예제 #2
0
        void FocusOption(bool rightDirection)
        {
            if (rightDirection)
            {
                if (currentOption >= options.Length - 1)
                {
                    currentOption = 0;
                }
                else
                {
                    currentOption++;
                }
            }
            else
            {
                if (currentOption == 0)
                {
                    currentOption = options.Length - 1;
                }
                else
                {
                    currentOption--;
                }
            }

            selectedOption = options[currentOption];

            foreach (VRControllerOption option in options)
            {
                CanvasGroup optionCanvasGroup = option.GetComponent <CanvasGroup>();
                if (optionCanvasGroup == null)
                {
                    continue;
                }

                if (option == selectedOption)
                {
                    optionCanvasGroup.alpha = 1.0f;
                    option.IsFocused        = true;
                    if (option is VRDrawColor)
                    {
                        colorLabel.text = ((VRDrawColor)option).ColorName;
                    }
                }
                else
                {
                    option.IsFocused        = false;
                    option.IsSelected       = false;
                    optionCanvasGroup.alpha = 0.3f;
                }
            }
        }
예제 #3
0
 void SelectOption(bool active)
 {
     selectedOption = options[currentOption];
     if (selectedOption.IsFocused)
     {
         selectedOption.IsSelected = active;
         if (active)
         {
             VRDrawColor drawColor = (VRDrawColor)selectedOption;
             drawColor.ColorSelect();
         }
     }
 }