|
|
@@ -53,6 +53,11 @@ namespace BansheeEditor
|
|
|
private GUIIntField guiInputB;
|
|
|
private GUIIntField guiInputA;
|
|
|
|
|
|
+ private GUIButton guiOK;
|
|
|
+ private GUIButton guiCancel;
|
|
|
+
|
|
|
+ private Action<bool, Color> closedCallback;
|
|
|
+
|
|
|
public enum ColorBoxMode
|
|
|
{
|
|
|
BG_R,
|
|
|
@@ -77,9 +82,12 @@ namespace BansheeEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static ColorPicker Show()
|
|
|
+ public static ColorPicker Show(Action<bool, Color> closedCallback = null)
|
|
|
{
|
|
|
- return new ColorPicker();
|
|
|
+ ColorPicker picker = new ColorPicker();
|
|
|
+ picker.closedCallback = closedCallback;
|
|
|
+
|
|
|
+ return picker;
|
|
|
}
|
|
|
|
|
|
protected ColorPicker()
|
|
|
@@ -120,6 +128,9 @@ namespace BansheeEditor
|
|
|
guiInputB = new GUIIntField();
|
|
|
guiInputA = new GUIIntField();
|
|
|
|
|
|
+ guiOK = new GUIButton("OK");
|
|
|
+ guiCancel = new GUIButton("Cancel");
|
|
|
+
|
|
|
guiColorBoxBtn.OnClick += OnColorBoxModeChanged;
|
|
|
guiColorModeBtn.OnClick += OnSliderModeChanged;
|
|
|
|
|
|
@@ -134,6 +145,9 @@ namespace BansheeEditor
|
|
|
guiInputB.OnChanged += OnInputBChanged;
|
|
|
guiInputA.OnChanged += OnInputAChanged;
|
|
|
|
|
|
+ guiOK.OnClick += OnOK;
|
|
|
+ guiCancel.OnClick += OnCancel;
|
|
|
+
|
|
|
GUILayout v0 = GUI.layout.AddLayoutY();
|
|
|
|
|
|
GUILayout h0 = v0.AddLayoutX();
|
|
|
@@ -186,6 +200,15 @@ namespace BansheeEditor
|
|
|
h5.AddFlexibleSpace();
|
|
|
h5.AddElement(guiInputA);
|
|
|
|
|
|
+ v0.AddSpace(20);
|
|
|
+
|
|
|
+ GUILayout h6 = v0.AddLayoutX();
|
|
|
+ h6.AddFlexibleSpace();
|
|
|
+ h6.AddElement(guiOK);
|
|
|
+ h6.AddSpace(10);
|
|
|
+ h6.AddElement(guiCancel);
|
|
|
+ h6.AddFlexibleSpace();
|
|
|
+
|
|
|
GUIArea overlay = GUI.AddArea(0, 0, Width, Height, -1, GUILayoutType.Explicit);
|
|
|
overlay.layout.AddElement(guiSliderVert);
|
|
|
overlay.layout.AddElement(guiSliderRHorz);
|
|
|
@@ -526,6 +549,18 @@ namespace BansheeEditor
|
|
|
guiSliderAHorz.Percent = colAlpha;
|
|
|
}
|
|
|
|
|
|
+ void OnOK()
|
|
|
+ {
|
|
|
+ if (closedCallback != null)
|
|
|
+ closedCallback(true, SelectedColor);
|
|
|
+ }
|
|
|
+
|
|
|
+ void OnCancel()
|
|
|
+ {
|
|
|
+ if (closedCallback != null)
|
|
|
+ closedCallback(false, SelectedColor);
|
|
|
+ }
|
|
|
+
|
|
|
void UpdateInputBoxValues()
|
|
|
{
|
|
|
bool isHSV = sliderMode == SliderMode.HSV;
|