Skip to content

Commit

Permalink
Color management window
Browse files Browse the repository at this point in the history
  • Loading branch information
DMagic1 committed Feb 21, 2017
1 parent aa4784e commit 952f20f
Show file tree
Hide file tree
Showing 9 changed files with 2,529 additions and 0 deletions.
116 changes: 116 additions & 0 deletions SCANsat.Unity/Interfaces/ISCAN_Color.cs
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace SCANsat.Unity.Interfaces
{
public interface ISCAN_Color
{
string ResourcePlanet { get; set; }

string ResourceCurrent { get; set; }

string TerrainPlanet { get; set; }

string TerrainPalette { get; set; }

string TerrainPaletteStyle { get; set; }

bool BiomeBigMapStockColor { get; set; }

bool BiomeBigMapWhiteBoder { get; set; }

bool BiomeSmallMapStockColor { get; set; }

bool BiomeSmallMapWhiteBorder { get; set; }

bool TerrainClampOn { get; set; }

bool TerrainReverse { get; set; }

bool TerrainDiscrete { get; set; }

bool TerrainHasSize { get; }

float BiomeTransparency { get; set; }

float SlopeCutoff { get; set; }

float ResourceMin { get; set; }

float ResourceMax { get; set; }

float ResourceTransparency { get; set; }

float TerrainCurrentMin { get; set; }

float TerrainGlobalMin { get; }

float TerrainCurrentMax { get; set; }

float TerrainGlobalMax { get; }

float TerrainClamp { get; set; }

int TerrainSize { get; set; }

int TerrainSizeMin { get; }

int TerrainSizeMax { get; }

Color BiomeColorOne { get; }

Color BiomeColorTwo { get; }

Color SlopeColorOneLo { get; }

Color SlopeColorOneHi { get; }

Color SlopeColorTwoLo { get; }

Color SlopeColorTwoHi { get; }

Color ResourceColorOne { get; }

Color ResourceColorTwo { get; }

Texture2D TerrainPaletteOld { get; }

Texture2D TerrainPaletteNew { get; }

IList<KeyValuePair<string, Texture2D>> TerrainPalettes { get; }

IList<string> Resources { get; }

IList<string> CelestialBodies { get; }

IList<string> PaletteStyleNames { get; }

void BiomeApply(Color one, Color two);

void BiomeDefault();

void SlopeApply(Color oneLow, Color oneHigh, Color twoLow, Color twoHigh);

void SlopeDefault();

void ResourceApply(Color one, Color two);

void ResourceApplyToAll(Color one, Color two);

void ResourceDefault();

void ResourceDefaultToAll();

void ResourceSaveToConfig(Color one, Color two);

void TerrainApply();

void TerrainDefault();

void TerrainSaveToConfig();

void Refresh();
}
}
91 changes: 91 additions & 0 deletions SCANsat.Unity/SCAN_ColorPicker.cs
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using SCANsat.Unity.HSVPicker.UI;

namespace SCANsat.Unity
{
public class SCAN_ColorPicker : MonoBehaviour
{
[SerializeField]
private ColorImage m_ColorOne = null;
[SerializeField]
private ColorImage m_ColorTwo = null;
[SerializeField]
private Image m_OldColorOne = null;
[SerializeField]
private Image m_OldColorTwo = null;

private ColorPicker picker;

public Color GetColorOne
{
get { return m_ColorOne.CurrentColor; }
}

public Color GetColorTwo
{
get { return m_ColorTwo.CurrentColor; }
}

private void Awake()
{
picker = GetComponent<ColorPicker>();
}

public void Setup(Color one, Color two, bool reset)
{
if (picker != null && reset)
picker.CurrentColor = one;

if (m_ColorOne != null)
{
m_ColorOne.SetColor(one);

if (reset)
m_ColorOne.IsActive = true;
}

if (m_ColorTwo != null)
m_ColorTwo.SetColor(two);

if (m_OldColorOne != null)
m_OldColorOne.color = one;

if (m_OldColorTwo != null)
m_OldColorTwo.color = two;
}

public void ColorOne(bool isOn)
{
if (m_ColorOne == null)
return;

m_ColorOne.IsActive = isOn;

if (isOn)
picker.CurrentColor = m_ColorOne.CurrentColor;
}

public void ColorTwo(bool isOn)
{
if (m_ColorTwo == null)
return;

m_ColorTwo.IsActive = isOn;

if (isOn)
picker.CurrentColor = m_ColorTwo.CurrentColor;
}

public void Apply()
{
if (m_OldColorOne != null && m_ColorOne != null)
m_OldColorOne.color = m_ColorOne.CurrentColor;

if (m_OldColorTwo != null && m_ColorTwo != null)
m_OldColorTwo.color = m_ColorTwo.CurrentColor;
}
}
}

0 comments on commit 952f20f

Please sign in to comment.