using UnityEngine;

namespace Genesis.POISystem.Editor
{
    public class EditorUtilities
    {
        public static void DrawTitleBox(string title, Color textColor, Color backgroundColor)
        {
            GUIStyle titleBoxStyle = new GUIStyle(GUI.skin.box)
            {
                normal = { textColor = textColor, background = MakeTex(2, 2, backgroundColor) },
                alignment = TextAnchor.MiddleCenter,
                fontSize = 15,
                fontStyle = FontStyle.Bold,
                padding = new RectOffset(5, 5, 5, 5)
            };

            GUILayout.Box(title, titleBoxStyle, GUILayout.ExpandWidth(true));
        }

        public static Texture2D MakeTex(int width, int height, Color color)
        {
            Color[] pixels = new Color[width * height];
            for (int i = 0; i < pixels.Length; i++)
            {
                pixels[i] = color;
            }

            Texture2D result = new Texture2D(width, height);
            result.SetPixels(pixels);
            result.Apply();
            return result;
        }
    }
}