using UnityEngine;
using XGame.Database;

namespace FL
{
    public static class ColorDefine
    {
        /// <summary>
        /// 橙色
        /// 火
        /// </summary>
        public static readonly Color orange = new Color32(0xFF, 0x5E, 0x2D, 0xFF);
        /// <summary>
        /// 黄色
        /// 雷
        /// </summary>
        public static readonly Color yellow = new Color32(0xFF, 0xE7, 0x1D, 0xFF);
        /// <summary>
        /// 蓝色
        /// 水,冰
        /// </summary>
        public static readonly Color blue = new Color32(0x01, 0xB4, 0xFF, 0xFF);
        /// <summary>
        /// 紫色
        /// 毒
        /// </summary>
        public static readonly Color purple = new Color32(0xD6, 0x5A, 0xFF, 0xFF);
        /// <summary>
        /// 青色
        /// 风
        /// </summary>
        public static readonly Color cyan = new Color32(0x85, 0xFF, 0x6D, 0xFF);

        /// <summary>
        /// 绿色
        /// 加血
        /// </summary>
        public static readonly Color green = new Color32(0x1D, 0xFF, 0x06, 0xFF);
        /// <summary>
        /// 红色
        /// 暴击
        /// </summary>
        public static readonly Color red = new Color32(0xF0, 0x38, 0x38, 0xFF);
        /// <summary>
        /// 元素的伤害值颜色
        /// </summary>
        /// <param name="elementType"></param>
        /// <returns></returns>
        public static Color ToDamageColor(this EElementType elementType)
        {
            return elementType switch
            {
                EElementType.Fire => orange,
                EElementType.Thunder => yellow,
                EElementType.Ice => blue,
                EElementType.Poison => purple,
                EElementType.Wind => cyan,
                _ => Color.white,
            };
        }


        public static readonly Color quualityWhite = new Color32(0xC1, 0xC1, 0xC1, 0xFF);
        public static readonly Color quualityGreen = new Color32(0x82, 0xA4, 0x6E, 0xFF);
        public static readonly Color quualityBlue = new Color32(0x43, 0x89, 0xB6, 0xFF);
        public static readonly Color quualityPurple = new Color32(0xA2, 0x65, 0xA9, 0xFF);
        public static readonly Color quualityYellow = new Color32(0xD8, 0xCE, 0x5A, 0xFF);
        public static readonly Color quualityOrange = new Color32(0xF1, 0x86, 0x3E, 0xFF);
        public static readonly Color quualityRed = new Color32(0xE1, 0x48, 0x47, 0xFF);
        public static readonly Color quualityPink = new Color32(0xE9, 0x96, 0xCC, 0xFF);
        public static readonly Color quualityBlueDiamond = new Color32(0xE9, 0xE4, 0x70, 0xFF);
        public static readonly Color quualityGilding = new Color32(0xFC, 0xF1, 0x76, 0xFF);
        public static readonly Color quualityBright = new Color32(0x36, 0xD7, 0xF7, 0xFF);

        /// <summary>
        /// 装备名称(品质颜色)
        /// </summary>
        /// <param name="quality"></param>
        /// <returns></returns>
        public static Color ToEquipNameColor(this EQualityLevel quality)
        {
            return quality switch
            {
                EQualityLevel.White => quualityWhite,
                EQualityLevel.Green => quualityGreen,
                EQualityLevel.Blue => quualityBlue,
                EQualityLevel.Purple => quualityPurple,
                EQualityLevel.Yellow => quualityYellow,
                EQualityLevel.Orange => quualityOrange,
                EQualityLevel.Red => quualityRed,
                EQualityLevel.Pink => quualityPink,
                EQualityLevel.BlueDiamond => quualityBlueDiamond,
                EQualityLevel.Gilding => quualityGilding,
                EQualityLevel.Bright => quualityBright,
                _ => quualityWhite,
            };
        }
    }
}
