HeavenStudio/Assets/Scripts/LevelEditor/Theme.cs
minenice55 6e12e5dafe Change Project License to MIT (#700)
* license change

replace unneeded package

* reword this
2024-02-16 01:22:24 -05:00

65 lines
1.8 KiB
C#

using HeavenStudio.Util;
using HeavenStudio.Editor.Track;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Editor
{
[Serializable]
public class Theme
{
public string name;
public Properties properties;
[Serializable]
public class Properties
{
public string SpecialLayersCol;
public string TempoLayerCol;
public string MusicLayerCol;
public string SectionLayerCol;
public string Layer1Col;
public string Layer2Col;
public string Layer3Col;
public string Layer4Col;
public string Layer5Col;
public string[] LayerColors = null;
public string EventSelectedCol;
public string EventNormalCol;
public string BeatMarkerCol;
public string CurrentTimeMarkerCol;
public string BoxSelectionCol;
public string BoxSelectionOutlineCol;
}
[JsonIgnore]
public Gradient LayersGradient { get; private set; }
public void SetLayersGradient()
{
if (properties.LayerColors == null) return;
LayersGradient = new Gradient();
var colorKeys = new List<GradientColorKey>();
for (var i = 0; i < properties.LayerColors.Length; i++)
{
var color = properties.LayerColors[i];
colorKeys.Add(new GradientColorKey(color.Hex2RGB(), (float)i / (properties.LayerColors.Length - 1)));
}
LayersGradient.colorKeys = colorKeys.ToArray();
}
public Color LayerGradientIndex(int layer)
{
return EditorTheme.theme.LayersGradient.Evaluate(layer / (float)(Timeline.instance.LayerCount - 1));
}
}
}