void Awake()
 {
     instance = this;
     transform.GetChild(0).gameObject.SetActive(true);
     GetComponentInChildren<HSVPicker>().onValueChanged.AddListener((color) => OnColorChange(color));
     Hide();
 }
예제 #2
0
 void Awake()
 {
     instance = this;
     transform.GetChild(0).gameObject.SetActive(true);
     GetComponentInChildren <HSVPicker>().onValueChanged.AddListener((color) => OnColorChange(color));
     Hide();
 }
예제 #3
0
 /// <summary>
 /// Sets the initial color of the display, and the ColorPickerUI that is
 /// changing colors.
 /// </summary>
 /// <param name="pickerUI">The UI that asked to show the display.</param>
 public void ShowDisplay(ColorPickerUI pickerUI)
 {
     SelectingUI        = pickerUI;
     ColorDisplay.color = SelectingUI.GetJSONColor().GetColor();
     RedSelection.SetColorValue(SelectingUI.GetJSONColor().R);
     GreenSelection.SetColorValue(SelectingUI.GetJSONColor().G);
     BlueSelection.SetColorValue(SelectingUI.GetJSONColor().B);
 }
예제 #4
0
    void Start()
    {
        // Clear selection so we can't manipulate things
        Selection.activeGameObject = null;

        SetupPreferences();

        if (primary)
        {
            this.AddRayVisibilitySettings(rayOrigin, this, false, false);
            SetupBrushUI();
            HandleBrushSize(m_Preferences.brushSize);

            m_ColorPickerActivator = this.InstantiateUI(m_ColorPickerActivatorPrefab);
            var otherRayOrigin = otherRayOrigins.First();
            var otherAltMenu   = this.GetCustomAlternateMenuOrigin(otherRayOrigin);

            const float UIOffset = 0.1f;
            m_ColorPickerActivator.transform.SetParent(otherAltMenu);
            m_ColorPickerActivator.transform.localRotation = Quaternion.identity;
            m_ColorPickerActivator.transform.localPosition = (node == Node.LeftHand ? Vector3.left : Vector3.right) * UIOffset;
            m_ColorPickerActivator.transform.localScale    = Vector3.one;

            var activator = m_ColorPickerActivator.GetComponentInChildren <ColorPickerActivator>();

            m_ColorPicker = activator.GetComponentInChildren <ColorPickerUI>(true);
            m_ColorPicker.onHideCalled  = HideColorPicker;
            m_ColorPicker.toolRayOrigin = rayOrigin;
            m_ColorPicker.onColorPicked = OnColorPickerValueChanged;
            OnColorPickerValueChanged(m_Preferences.annotationColor);

            activator.node            = node.Value;
            activator.rayOrigin       = otherRayOrigin;
            activator.showColorPicker = ShowColorPicker;
            activator.hideColorPicker = HideColorPicker;

            activator.undoButtonClick += Undo.PerformUndo;
            activator.redoButtonClick += Undo.PerformRedo;
        }
    }
예제 #5
0
 public void ShowColorSelectionPanel(ColorPickerUI callingUI)
 {
     ColorSelectionPanel.transform.parent.gameObject.SetActive(true);
     ColorSelectionPanel.ShowDisplay(callingUI);
 }