void Awake() { instance = this; transform.GetChild(0).gameObject.SetActive(true); GetComponentInChildren<HSVPicker>().onValueChanged.AddListener((color) => OnColorChange(color)); Hide(); }
void Awake() { instance = this; transform.GetChild(0).gameObject.SetActive(true); GetComponentInChildren <HSVPicker>().onValueChanged.AddListener((color) => OnColorChange(color)); Hide(); }
/// <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); }
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; } }
public void ShowColorSelectionPanel(ColorPickerUI callingUI) { ColorSelectionPanel.transform.parent.gameObject.SetActive(true); ColorSelectionPanel.ShowDisplay(callingUI); }