using Debug = Trinket.Debug; // Automatically generated by CodeGenerator.cs.

using UnityEngine;
using System.Collections;

public static class UtilitiesUI
{
	public static string MarkupNativeText(string inText, Color inColor, bool inBold, bool inItalic)
	{
		var text = "<color=#" + UtilitiesColor.ColorToRGBHex(inColor) + ">" + inText + "</color>";
		if(inBold)
			text = "<b>" + text + "</b>";
		if(inItalic)
			text = "<i>" + text + "</i>";
		return text;
	}

	public static string MarkupNGUIText(string inText, Color inColor, bool inBold, bool inItalic)
	{
		var text = "[" + UtilitiesColor.ColorToRGBHex(inColor) + "]" + inText + "[-]";
		if(inBold)
			text = "[b]" + text + "[/b]";
		if(inItalic)
			text = "[i]" + text + "[/i]";
		return text;
	}

	public static string ColorizeAllCapsWords(string inText, Color color)
	{
		var text = inText;
		if(!string.IsNullOrEmpty(inText))
		{
			var split = inText.Split(' ');
			for(int i = 0; i < split.Length; ++i)
			{
				if(split[i].IsAllCaps() && split[i].Length > 1)
				{
                    string prefix, alphaContent, suffix;
                    split[i].GetAlphaTrimPunctuationAndDigits(out prefix, out alphaContent, out suffix);
					if (alphaContent.Length > 1)
						split[i] = prefix + MarkupNGUIText(alphaContent, color, true, false) + suffix;
				}
			}
			return string.Join(" ", split, 0, split.Length);
		}
		return text;
	}

    public static bool ShouldUseBitmapLabel(string inText)
	{
		if(inText != null)
        {
		    return inText.Contains("[") && inText.Contains("]");
        }
        return false;
	}
}