private void UpdateText() { string tex = ""; m_label = this.GetComponent <UILabel>(); m_Text = m_label.text; string[] strs = split(m_Text, "({fa-?.+?-?.+?})"); foreach (var s in strs) { string iconsStr = GetValueAnd("{fa-", "}", s); if (string.IsNullOrEmpty(iconsStr)) { tex += s; continue; } //Debug.Log(iconsStr); iconsStr = FontAwesomeIcons.GetIcon("fa-" + iconsStr); int i = Int32.Parse(iconsStr.Substring(2), System.Globalization.NumberStyles.HexNumber); tex += char.ConvertFromUtf32(i); } m_label.text = tex; }
public static string GetIconName(this FontAwesomeIcons icon) { var intIcon = (int)icon; if (intIcon > 10000) { icon = (FontAwesomeIcons)(intIcon - 10000); } return(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(icon.ToString()).Replace("_", "")); }
public static string GetIcon(this FontAwesomeIcons icon) { if (icon == FontAwesomeIcons.None) { return(null); } var props = typeof(FontAwesomeIconsChar).GetRuntimeFields(); var prop = props.FirstOrDefault(p => p.Name == icon.ToString()); return(prop?.GetValue(null) as string); }
public PImage this[FontAwesomeIcons icon, float size, Color4 color] { get { if (!_cache.ContainsKey(icon)) { _cache[icon] = new Dictionary <float, Dictionary <Color4, PImage> >(); } if (!_cache[icon].ContainsKey(size)) { _cache[icon][size] = new Dictionary <Color4, PImage>(); } if (!_cache[icon][size].ContainsKey(color)) { _cache[icon][size][color] = _generator[(char)icon, size, color].texture; } return(_cache[icon][size][color]); } }
public override Icon[] characters() { return(FontAwesomeIcons.values()); }
public static DialogResults Show(string message, MessageBoxTypes msgType = MessageBoxTypes.Info, MessageBoxButtons buttons = MessageBoxButtons.OkCancel, SummerGUIWindow parent = null) { // *** Icon FontAwesomeIcons icon = FontAwesomeIcons.fa_anchor; ColorContexts colorContext = ColorContexts.Default; // init icon switch (msgType) { case MessageBoxTypes.Info: icon = FontAwesomeIcons.fa_info_circle; colorContext = ColorContexts.Information; break; case MessageBoxTypes.Success: icon = FontAwesomeIcons.fa_exclamation_circle; colorContext = ColorContexts.Success; break; case MessageBoxTypes.Warning: icon = FontAwesomeIcons.fa_warning; colorContext = ColorContexts.Warning; break; case MessageBoxTypes.Error: icon = FontAwesomeIcons.fa_times_circle; colorContext = ColorContexts.Danger; break; case MessageBoxTypes.Question: icon = FontAwesomeIcons.fa_question_circle; colorContext = ColorContexts.Question; break; case MessageBoxTypes.Help: icon = FontAwesomeIcons.fa_life_ring; colorContext = ColorContexts.Success; break; } MessageBoxOverlay box = new MessageBoxOverlay(parent, colorContext); box.InitIconImage((char)icon, colorContext); // *** Buttons box.InitButtons(buttons, colorContext); box.InitText(message.TrimRightLinebreaks() + "\n", colorContext); if (msgType == MessageBoxTypes.Error) { //box.InitCopyButton (); } box.Style.BackColorBrush.Color = Color.FromArgb(30, Color.DarkSlateGray); /*** ***/ box.Show(parent); box.Focus(); return(DialogResults.OK); /*** * if (box != null) * box.Dispose (); * return box.Result; ***/ }
public static DialogResults Show(string caption, string message, MessageBoxTypes msgType = MessageBoxTypes.Info, MessageBoxButtons buttons = MessageBoxButtons.OkCancel, SummerGUIWindow parent = null) { float scaling = 1; if (parent != null) { scaling = parent.ScaleFactor; } MessageBoxWindow box = new MessageBoxWindow("MsgBox", caption, (DefaultWidth * scaling).Ceil(), (DefaultHeight * scaling).Ceil(), parent); // *** Icon FontAwesomeIcons icon = FontAwesomeIcons.fa_anchor; ColorContexts colorContext = ColorContexts.Default; // init icon switch (msgType) { case MessageBoxTypes.Info: icon = FontAwesomeIcons.fa_info_circle; colorContext = ColorContexts.Information; break; case MessageBoxTypes.Success: icon = FontAwesomeIcons.fa_exclamation_circle; colorContext = ColorContexts.Success; break; case MessageBoxTypes.Warning: icon = FontAwesomeIcons.fa_warning; colorContext = ColorContexts.Warning; break; case MessageBoxTypes.Error: icon = FontAwesomeIcons.fa_times_circle; colorContext = ColorContexts.Danger; break; case MessageBoxTypes.Question: icon = FontAwesomeIcons.fa_question_circle; colorContext = ColorContexts.Question; break; case MessageBoxTypes.Help: icon = FontAwesomeIcons.fa_life_ring; colorContext = ColorContexts.Success; break; } box.InitIconImage((char)icon, colorContext); // *** Buttons box.InitButtons(buttons); box.InitText(message); if (msgType == MessageBoxTypes.Error) { box.InitCopyButton(); } box.ShowInTaskBar = false; box.Show(parent); if (box != null) { box.Dispose(); } return(box.Result); }
public static string GetIconName(this FontAwesomeIcons icon) { return(Enum.GetName(typeof(FontAwesomeIcons), icon).TrimStart('_').Replace("_", "-")); }
public IconExtension(FontAwesomeIcons icon) { Icon = icon; }