private static void Initialize() { //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault(); //Debug.Log("LabelStyle initializer"); _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleLeft, Padding = new RectOffset(6, 8, 4, 4), Font = FontMapper.GetWithFallback("pixel").Font }; //_style.Font = CoreSkinMapper.Instance.System.font; //_style.Font = FontMapper.GetDefault(); const int w = (Weight + 1) * 2; //_style.FixedWidth = 100; //_style.FixedHeight = 100; _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1); //_style.FontSize = 8; _style.NormalTextColor = Color.black; _style.NormalGraphics = new Rect(w, w, new Fill(new Color(1, 1, 1, 0))); _style.Commit(); }
private static void Initialize() { //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault(); //Debug.Log("TooltipStyle initializer"); _style = new ProgramaticStyle(); _style.Style = _instance; _style.Alignment = TextAnchor.MiddleLeft; _style.Padding = new RectOffset(6, 6, 4, 4); //_style.Font = CoreSkinMapper.Instance.System.font; //_style.Font = FontMapper.GetDefault(); _style.Font = FontMapper.GetWithFallback("pixel").Font; const int w = (Weight + 1) * 2; //_style.FixedWidth = 100; //_style.FixedHeight = 100; _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1); //_style.FontSize = 8; _style.NormalTextColor = Color.black; _style.NormalGraphics = new Rect(w, w, new Fill(new Color(0.9f, 0.9f, 0.3f, 1)), new Stroke(1) { Color = Color.black }); _style.Commit(); }
//private const int Weight = 2; private static void Initialize() { //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault(); //Debug.Log("LabelStyle initializer"); _style = new ProgramaticStyle { Style = _instance, // changed from MiddleLeft on 20131006 because of the // button skin layout (having label left aligned because of using Left, Right..) // should check the AbsoluteLayout why it doesn't take horizonral and vertical align as priority //Alignment = TextAnchor.MiddleLeft, Alignment = TextAnchor.MiddleLeft, //Padding = new RectOffset(6, 6, 4, 4), Font = FontMapper.GetWithFallback("pixel").Font, //Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1), NormalTextColor = Color.white, TextClipping = TextClipping.Clip // clip! //TextClipping = TextClipping.Overflow }; _style.Commit(); }
private static void Initialize() { //Debug.Log("InspectorOverlayLabelStyle initializer"); _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleCenter, Padding = new RectOffset(6, 6, 3, 4), Font = FontMapper.GetWithFallback("pixel").Font }; //_style.Font = FontMapper.GetDefault(); //Debug.Log("Initialized * " + _style.Font); /*if (FontMapper.IsMapping("pixel")) * _style.Font = FontMapper.Get("pixel");*/ const int w = (Weight + 1) * 2; _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1); _style.NormalTextColor = Color.white; // we'll tint it from outside _style.NormalGraphics = new Rect(w, w, new Fill(Color.white)); // we'll tint it from outside _style.Commit(); }
private static void Initialize() { _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleCenter, Font = FontMapper.GetWithFallback("pixel").Font, NormalTextColor = Color.white, TextClipping = TextClipping.Clip }; _style.Commit(); }
///<summary> /// Note: sanity check done outside (in DefaultValuesFactory class) ///</summary> ///<returns></returns> public object GetDefault() { /* XOR! */ //if (null == ProxyType ^ !string.IsNullOrEmpty(ProxyMemberName)) // throw new Exception("When using proxy, both ProxyType and ProxyMemberName have to be defined: " + GetType()); try { /** * 1. Proxy takes precedence * */ if (null != ProxyType) { return(string.IsNullOrEmpty(ProxyMemberName) ? StyleProxyReader.GetProxySingleton(ProxyType) : StyleProxyReader.GetProxyMemberValue(ProxyType, ProxyMemberName)); } /** * 2. Color * */ if (IsValidColor()) { return(ColorMixer.FromHexAndAlpha((int)Default, 1f).ToColor()); } /** * 3. Font * */ if (IsValidFont()) { var fontMapperId = Default as string; /* Use the font mapper */ return(string.IsNullOrEmpty(fontMapperId) ? FontMapper.GetDefault().Font : // get default font FontMapper.GetWithFallback(fontMapperId).Font); // get named font } /** * 3. Default value * */ return(Default); } catch (Exception ex) { throw new Exception("Problem processing style attribute " + Name + ": ", ex); } }
private GUIStyle GetLabelStyle() { if (null == _labelStyle) { _labelStyle = new GUIStyle(); ProgramaticStyle style = new ProgramaticStyle { Style = _labelStyle, Alignment = TextAnchor.MiddleCenter, Font = FontMapper.GetWithFallback("pixel").Font, NormalTextColor = Color.white }; style.Commit(); } return(_labelStyle); }
private static void Initialize() { const int w = (Weight + 1) * 2; _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleCenter, Padding = new RectOffset(6, 6, 3, 4), Font = FontMapper.GetWithFallback("pixel").Font, Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1), NormalTextColor = Color.white, // we'll tint it from outside NormalGraphics = new Rect(w, w, new Fill(Color.white)) // we'll tint it from outside }; _style.Commit(); }
private static void Initialize() { _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleLeft, Padding = new RectOffset(6, 6, 4, 4), Font = FontMapper.GetWithFallback("pixel").Font }; const int w = (Weight + 1) * 2; _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1); _style.NormalTextColor = Color.white; _style.NormalGraphics = new Rect(w, w, new Fill(ColorMixer.FromHex(0x1261c1).ToColor())); _style.Commit(); }
private static void Initialize() { _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleLeft, Padding = new RectOffset(6, 6, 6, 6), Font = FontMapper.GetWithFallback("pixel").Font, TextClipping = TextClipping.Clip }; int w = (Weight + 1) * 2; _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1); _style.NormalTextColor = Color.black; //Color.grey; _style.NormalGraphics = new Rect(w, w, new Fill(Color.white), new Stroke(Weight) { Color = Color.black } ); _style.HoverTextColor = Color.black; _style.HoverGraphics = new Rect(w, w, new Fill(Color.white), new Stroke(Weight) { Color = Color.black } ); _style.ActiveTextColor = Color.black; _style.ActiveGraphics = new Rect(w, w, new Fill(Color.white), new Stroke(Weight) { Color = Color.black } ); _style.Commit(); }
private static void Initialize() { //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault(); //Debug.Log("ImageStyle initializer"); const int w = (Weight + 1) * 2; _style = new ProgramaticStyle { Style = _instance, Alignment = TextAnchor.MiddleLeft, Padding = new RectOffset(Weight, Weight, Weight, Weight), Margin = new RectOffset(0, 0, 0, 0), Font = FontMapper.GetWithFallback("pixel").Font, Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1), NormalGraphics = new Rect(w, w, new Fill(ColorMixer.FromHex(0xC0C0C0).ToColor()), new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() } ) }; //_style.Font = CoreSkinMapper.Instance.System.font; //_style.Font = FontMapper.GetDefault(); //_style.FixedWidth = 100; //_style.FixedHeight = 100; //_style.FontSize = 8; //_style.NormalTextColor = Color.white; _style.Commit(); }