mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Color picker UI integration
This commit is contained in:
21
Assets/ConformalDecals/ColorBoxSlider.cs
Normal file
21
Assets/ConformalDecals/ColorBoxSlider.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ConformalDecals.UI {
|
||||
public class ColorBoxSlider : MonoBehaviour {
|
||||
[SerializeField] private ColorPickerController.ChannelUpdateEvent _onXChannelChanged = new ColorPickerController.ChannelUpdateEvent();
|
||||
[SerializeField] private ColorPickerController.ChannelUpdateEvent _onYChannelChanged = new ColorPickerController.ChannelUpdateEvent();
|
||||
|
||||
[SerializeField] private Vector2 _value;
|
||||
[SerializeField] private Vector2Int _channel;
|
||||
[SerializeField] private bool _hsl;
|
||||
|
||||
[SerializeField] private BoxSlider _slider;
|
||||
[SerializeField] private Image _image;
|
||||
|
||||
public void OnSliderUpdate(Vector2 value) { }
|
||||
|
||||
public void OnColorUpdate(Color rgb, ColorHSL hsl) { }
|
||||
}
|
||||
}
|
23
Assets/ConformalDecals/ColorChannelSlider.cs
Normal file
23
Assets/ConformalDecals/ColorChannelSlider.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ConformalDecals.UI {
|
||||
public class ColorChannelSlider : MonoBehaviour {
|
||||
[SerializeField] private ColorPickerController.ChannelUpdateEvent _onChannelChanged = new ColorPickerController.ChannelUpdateEvent();
|
||||
|
||||
[SerializeField] private float _value;
|
||||
[SerializeField] private int _channel;
|
||||
[SerializeField] private bool _hsl;
|
||||
|
||||
[SerializeField] private Selectable _textBox;
|
||||
[SerializeField] private Slider _slider;
|
||||
[SerializeField] private Image _image;
|
||||
|
||||
public void OnTextBoxUpdate(string text) { }
|
||||
|
||||
public void OnSliderUpdate(float value) { }
|
||||
|
||||
public void OnColorUpdate(Color rgb, ColorHSL hsl) { }
|
||||
}
|
||||
}
|
12
Assets/ConformalDecals/ColorHSL.cs
Normal file
12
Assets/ConformalDecals/ColorHSL.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Util {
|
||||
public struct ColorHSL {
|
||||
public float h;
|
||||
public float s;
|
||||
public float l;
|
||||
public float a;
|
||||
}
|
||||
}
|
27
Assets/ConformalDecals/ColorPickerController.cs
Normal file
27
Assets/ConformalDecals/ColorPickerController.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ConformalDecals.UI {
|
||||
public class ColorPickerController : MonoBehaviour {
|
||||
[Serializable]
|
||||
public class ColorUpdateEvent : UnityEvent<Color, ColorHSL> { }
|
||||
|
||||
[Serializable]
|
||||
public class ChannelUpdateEvent : UnityEvent<float, int, bool> { }
|
||||
|
||||
[SerializeField] private ColorUpdateEvent _onColorChanged = new ColorUpdateEvent();
|
||||
|
||||
[SerializeField] private Color _value;
|
||||
[SerializeField] private Image _previewImage;
|
||||
[SerializeField] private Selectable _hexTextBox;
|
||||
|
||||
public void OnClose() { }
|
||||
|
||||
public void OnHexColorUpdate(string text) { }
|
||||
|
||||
public void OnChannelUpdate(float value, int channel, bool hsl) { }
|
||||
}
|
||||
}
|
@ -2,11 +2,9 @@ using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.UI {
|
||||
public class FontMenuController : MonoBehaviour {
|
||||
|
||||
[SerializeField] private GameObject _menuItem;
|
||||
[SerializeField] private GameObject _menuList;
|
||||
|
||||
public void OnClose() {
|
||||
}
|
||||
public void OnClose() { }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user