Improvements to UI and ColorPickerPresets inspector.
- Picker 2.0.prefab UI now collapses preoperly when showing/hiding HSV/RGB slider sets. - ColorPickerPresets now has an inspector with a button that can be clicked to open the saved JSON file.pull/413/head
parent
d88a010755
commit
d5d94a2076
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.ColorPicker
|
||||
{
|
||||
[CustomEditor(typeof(ColorPickerPresets))]
|
||||
public class ColorPickerPresetsEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
var colorPickerPresets = (ColorPickerPresets)target;
|
||||
if (colorPickerPresets.saveMode != ColorPickerPresets.SaveType.JsonFile)
|
||||
return;
|
||||
|
||||
string fileLocation = colorPickerPresets.JsonFilePath;
|
||||
|
||||
if (!System.IO.File.Exists(fileLocation))
|
||||
return;
|
||||
|
||||
if (GUILayout.Button("Open JSON file."))
|
||||
{
|
||||
Application.OpenURL(fileLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0dc729b738fb01043ac4c04b78575a98
|
||||
timeCreated: 1520733906
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -374,6 +374,7 @@ GameObject:
|
|||
- component: {fileID: 114049142773139156}
|
||||
- component: {fileID: 114944968534304742}
|
||||
- component: {fileID: 114201033012213840}
|
||||
- component: {fileID: 114691045547694264}
|
||||
m_Layer: 5
|
||||
m_Name: Sampler Cursor
|
||||
m_TagString: Untagged
|
||||
|
@ -1027,6 +1028,8 @@ GameObject:
|
|||
- component: {fileID: 114799971414450548}
|
||||
- component: {fileID: 114815558728215868}
|
||||
- component: {fileID: 114036039765377976}
|
||||
- component: {fileID: 114901563279858126}
|
||||
- component: {fileID: 114650760055890134}
|
||||
m_Layer: 5
|
||||
m_Name: Picker 2.0
|
||||
m_TagString: Untagged
|
||||
|
@ -1249,7 +1252,6 @@ GameObject:
|
|||
- component: {fileID: 222296062884740248}
|
||||
- component: {fileID: 114658104212027736}
|
||||
- component: {fileID: 114747320076705866}
|
||||
- component: {fileID: 114876387791592476}
|
||||
- component: {fileID: 114243302911122948}
|
||||
m_Layer: 5
|
||||
m_Name: Presets
|
||||
|
@ -3383,6 +3385,19 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &114650760055890134
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1690214001722854}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &114653495342648380
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -3547,6 +3562,25 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &114691045547694264
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1253054250139268}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 1
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &114700355984099128
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -4319,19 +4353,6 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &114876387791592476
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1948116634810616}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &114876499293328720
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -4370,6 +4391,28 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &114901563279858126
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1690214001722854}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 1
|
||||
--- !u!114 &114907783115635454
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -4921,10 +4964,10 @@ RectTransform:
|
|||
m_Father: {fileID: 224077522108235048}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 50}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!224 &224065357170845628
|
||||
RectTransform:
|
||||
|
@ -5005,7 +5048,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 24, y: -8}
|
||||
m_SizeDelta: {x: 216, y: 377}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!224 &224081059910409654
|
||||
RectTransform:
|
||||
|
@ -5165,9 +5208,9 @@ RectTransform:
|
|||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 170}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 108, y: 0}
|
||||
m_SizeDelta: {x: 216, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!224 &224200636104118804
|
||||
RectTransform:
|
||||
|
@ -5294,9 +5337,9 @@ RectTransform:
|
|||
m_Father: {fileID: 224077522108235048}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 108, y: -403}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &224332528811507018
|
||||
|
@ -5729,9 +5772,9 @@ RectTransform:
|
|||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 3, y: 23}
|
||||
m_SizeDelta: {x: -6, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!224 &224614331221918950
|
||||
RectTransform:
|
||||
|
@ -6177,10 +6220,10 @@ RectTransform:
|
|||
m_Father: {fileID: 224077522108235048}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -50}
|
||||
m_SizeDelta: {x: 216, y: 157}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!224 &224927269330184902
|
||||
RectTransform:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,12 +23,12 @@ namespace UnityEngine.UI.Extensions.ColorPicker
|
|||
|
||||
public enum SaveType { None, PlayerPrefs, JsonFile }
|
||||
[SerializeField]
|
||||
protected SaveType saveMode = SaveType.None;
|
||||
public SaveType saveMode = SaveType.None;
|
||||
|
||||
[SerializeField]
|
||||
protected string playerPrefsKey;
|
||||
|
||||
protected virtual string JsonFilePath
|
||||
public virtual string JsonFilePath
|
||||
{
|
||||
get { return Application.persistentDataPath + "/" + playerPrefsKey + ".json"; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue