Пример #1
0
        public static void ApplyButtonStyle(ProgramaticStyle programaticStyle, int w, int weight, TriangleDirection direction)
        {
            programaticStyle.Border = new RectOffset(weight + 1, weight + 1, weight + 1, weight + 1);

            var size = new Point(w, w);
            int pixels = w <= 20 ? 4 : 5; // the "height" of the triangle in pixels

            //programaticStyle.FontSize = 30;
            //programaticStyle.NormalTextColor = Color.grey;
            programaticStyle.NormalGraphics = new GraphicGroup(w, w,
                                                               new Rect(
                                                                   new Fill(NormalColor),
                                                                   new Stroke(weight) { Color = StrokeColor }
                                                               ),
                                                               new Triangle(new Fill(ColorMixer.FromHex(0x666666).ToColor())) { Direction = direction, Pixels = pixels }
                );
            //programaticStyle.HoverTextColor = Color.white;
            programaticStyle.HoverGraphics = new GraphicGroup(w, w,
                                                              new Rect(
                                                                  new Fill(HoverColor),
                                                                  new Stroke(weight) { Color = StrokeColor }
                                                               ),
                                                              new Triangle(new Fill(Color.black)) { Direction = direction, Pixels = pixels }
                );
            //programaticStyle.ActiveTextColor = Color.white;
            programaticStyle.ActiveGraphics = new GraphicGroup(w, w,
                                                               new Rect(
                                                                   new Fill(ActiveColor),
                                                                   new Stroke(weight) { Color = StrokeColor }
                                                               ),
                                                               new Triangle(new Fill(ColorMixer.FromHex(0x333333).ToColor())) { Direction = direction, Pixels = pixels }
                );
        }
        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(10, 10, 10, 10)
                         };

            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();
            //_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.white;
            //_style.NormalGraphics = new Rect(w, w, new Fill(RgbColor.FromHex(0x214078).ToColor())); /*new Color(0.3f, 0.3f, 0.3f, 0.85f)*/
            _style.NormalGraphics = new Rect(w, w, new Fill(ColorMixer.FromHex(0xFF0000).ToColor())); /*new Color(0.3f, 0.3f, 0.3f, 0.85f)*/
            
            _style.Commit();
        }
Пример #3
0
        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();
        }
Пример #4
0
        private static void Initialize()
        {
            //Debug.Log("FormHeadingStyle initializer");

            _style = new ProgramaticStyle
                         {
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             Padding = new RectOffset(10, 10, 10, 10),
                             Font = FontMapper.GetDefault().Font,
                             Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                             //FontSize = 30,
                             FontStyle = FontStyle.Italic,
                             NormalTextColor = new Color(1f, 0.7f, 0f, 1)
                         };

            //_style.Font = CoreSkinMapper.Instance.System.font;

            //const int w = (Weight + 1)*2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;

            //_style.NormalGraphics = new Rect(w, w,
            //                                 new Fill(new Color(0.3f, 0.3f, 0.3f, 0.2f))
            //    );
            
            _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()
        {
            //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();
        }
Пример #7
0
        //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();
        }
Пример #8
0
        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();
        }
Пример #9
0
        private static void Initialize()
        {
            _instance.name = "PurpleButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             Padding = new RectOffset(6, 6, 3, 3)
                         };

            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.white;
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(Purple),
                                             new Stroke(Weight) { Color = Color.black }
                                    );

            _style.HoverTextColor = Color.white;
            _style.HoverGraphics = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0x8E56FF).ToColor()),
                                             new Stroke(Weight) { Color = Color.black }
                                    );

            _style.Commit();
        }
Пример #10
0
        private static void Initialize()
        {
            _instance.name = "ListOverlayStyle";

            _style = new ProgramaticStyle();
            _style.Style = _instance;

            //_style.Alignment = TextAnchor.MiddleCenter;

            //_style.Font = FontMapper.GetDefault();

            const int w = (Weight + 1) * 2;

            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            //_style.Padding = new RectOffset(2, 2, 2, 2);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.white;
            _style.NormalGraphics = new Rect(w, w, new Fill(new Color(1, 1, 1, 0)), new Stroke(Weight) { Color = Color.grey });

            //_style.HoverGraphics = new Rect(w, w, new Fill(new Color(1, 1, 1, 0)), new Stroke(new Color(0.2f, 0.2f, 0.2f, 1), Weight));

            //_style.ActiveGraphics = new Rect(w, w, new Fill(new Color(1, 1, 1, 0)), new Stroke(new Color(0.1f, 0.1f, 0.1f, 1), Weight));

            _style.Commit();

        }
Пример #11
0
        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();
        }
Пример #12
0
        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(7, 7, 7, 7),
                             Font = FontMapper.GetDefault().Font,
                             Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                             //FontSize = 8,
                             NormalTextColor = Color.white// new Color(0.3f, 0.3f, 0.3f, 1f)
                         };

            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();

            //const int w = (Weight + 1)*2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;

            //_style.NormalGraphics = new Rect(w, w, new Fill(new Color(0.3f, 0.4f, 0.9f, 1f)));
            
            _style.Commit();
        }
Пример #13
0
 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();
 }
Пример #14
0
        private static void Initialize()
        {
            _instance.name = "LockButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             Padding = new RectOffset(15, 15, 8, 8)
                         };

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            Color c = ColorMixer.FromHex(0xFFFFFF).ToColor();
            c.a = 0.5f;

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(c),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() }
                );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics = new Rect(w, w,
                                            new Fill(new Color(1f, 1f, 1f, 1f)),
                                            new Stroke(Weight) { Color = Color.grey }
                );
            //_style.ActiveTextColor = Color.white;
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics = new Rect(w, w,
                                             new Fill(new Color(0.75f, 0.75f, 0.75f, 1)),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() }
                );
            
            _style.OnNormalTextColor = Color.white;
            _style.OnNormalGraphics = new Rect(w, w,
                                               new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                               new Stroke(Weight) { Color = ColorMixer.FromHex(0xD3D3D3).ToColor() }
                );

            _style.Commit();

            //_style.FixedHeight = 20;
            //_style.FixedWidth = 100;
        }
Пример #15
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
                         {
                             Style = _instance,
                             Alignment = TextAnchor.MiddleLeft,
                             Padding = new RectOffset(12, 12, 6, 6),
                             Font = FontMapper.Get("olney").Font,
                             FontSize = 40,
                             NormalTextColor = Color.white
                         };

            _style.Commit();
        }
        private static void Initialize()
        {
            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             Padding = new RectOffset(6, 6, 3, 3)
                         };

            const int w = (Weight + 1) * 2;
            int w2 = 18;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0xC0C0C0).ToColor()),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() }
                );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics = new Rect(w, w,
                                            new Fill(new Color(1f, 1f, 1f, 1f)),
                                            new Stroke(Weight) { Color = Color.grey }
                );
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0xD3D3D3).ToColor() }
                );

            _style.OnNormalTextColor = Color.white;
            _style.OnNormalGraphics = new Rect(w, w,
                                               new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                               new Stroke(Weight) { Color = ColorMixer.FromHex(0xD3D3D3).ToColor() }
                );

            ScrollbarHelper.ApplyButtonStyle(_style, w2, Weight, TriangleDirection.Up);

            _style.FixedWidth = w2;
            _style.FixedHeight = w2;

            _style.Commit();

            //_style.FixedHeight = 20;
            //_style.FixedWidth = 100;
        }
Пример #17
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
                         {
                             Style = _instance
                         };

            const int w = (Weight + 1) * 2;

            _style.NormalGraphics = new Rect(w, w, new Fill(Color.white));

            _style.Commit();

        }
Пример #18
0
        private static void Initialize()
        {
            _instance.name = "TabButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             Padding = new RectOffset(6, 6, 3, 3)
                         };

            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; // Color.white;
            _style.NormalGraphics = new Rect(w, w,
                                             //new Fill(RgbColor.FromHex(0x965FFF).ToColor()),
                                             new Fill(ColorMixer.FromHex(0xc0c0c0).ToColor()),
                                             new Stroke(Weight) { Color = Color.grey }
                );
            //_style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            //_style.HoverGraphics = new Rect(w, w,
            //                                new Fill(new Color(1f, 1f, 1f, 1f)),
            //                                new Stroke(Color.grey, Weight)
            //    );
            _style.ActiveTextColor = Color.white;
            _style.ActiveGraphics = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0xA97FFF).ToColor()),
                                             new Stroke(Weight) { Color = Color.grey }
                );

            //_style.OnNormalTextColor = Color.white;
            //_style.OnNormalGraphics = new Rect(w, w,
            //                                   new Fill(RgbColor.FromHex(0x808080).ToColor()),
            //                                   new Stroke(RgbColor.FromHex(0xD3D3D3).ToColor(), Weight)
            //     );

            //_style.ImagePosition = ImagePosition.ImageAbove;

            _style.ContentOffset = new Vector2(-3, 0);

            _style.Commit();
        }
        private static void Initialize()
        {
            _style = new ProgramaticStyle {Style = _instance};

            int w = (BorderWidth + 1) * 2;

            _style.Border = new RectOffset(BorderWidth + 1, BorderWidth + 1, BorderWidth + 1, BorderWidth + 1);

            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(new Color(0.9f, 0.9f, 0.9f, 0)), // transparent fill!
                                             new Stroke(BorderWidth) { Color = BorderColor }
                );

            _style.Commit();
        }
Пример #20
0
        private static void Initialize()
        {
            _instance.name = "OnePxBorderStyle";

            _style = new ProgramaticStyle {Style = _instance};

            var border = new BorderMetrics(1); // 1px border
            var w = border.GetRenderingWidth();
            var h = border.GetRenderingHeight();
            //Debug.Log("w: " + w + ", h:" + h);

            _style.Border = border.ToGUIStyleBorder();
            _style.NormalGraphics = new Rect(w, h, new Stroke(border) { Color = Color.white });
            _style.Commit();
        }
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style = _instance
            };

            const int w = (Weight + 1) * 2;

            _style.NormalGraphics = new Rect(w, w, new Stroke(Weight) { Color = Color.white });
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            _style.Commit();

        }
Пример #22
0
        private static void Initialize()
        {
            _instance.name = "CheckBoxStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             ContentOffset = new Vector2(-1, -1) // fix bad Unity offset
                             //Padding = new RectOffset(6, 6, 3, 3) // no GUIStyle padding
                         };

            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 = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(Color.white), // RgbColor.FromHex(0xC0C0C0).ToColor()
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() }
                );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics = new Rect(w, w,
                                            new Fill(new Color(1f, 1f, 1f, 1f)),
                                            new Stroke(Weight) { Color = Color.grey }
                );
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0xD3D3D3).ToColor() }
                );

            //_style.OnNormalTextColor = Color.white;
            //_style.OnNormalGraphics = new Rect(w, w,
            //                                   new Fill(RgbColor.FromHex(0x808080).ToColor()),
            //                                   new Stroke(RgbColor.FromHex(0xD3D3D3).ToColor(), Weight)
            //     );

            _style.Commit();

            //_style.FixedHeight = 20;
            //_style.FixedWidth = 100;
        }
Пример #23
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
                         {
                             Style = _instance,
                             Alignment = TextAnchor.UpperLeft,
                             Padding = new RectOffset(6, 6, 6, 6),
                             WordWrap = true,
                             TextClipping = TextClipping.Clip,
                             Font = FontMapper.GetDefault().Font
                         };

            int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.Font = FontMapper.Get("pixel");
            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black; //Color.grey;
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(Color.white),
                //new Fill(new Color(0.9f, 0.9f, 0.9f, 1f)),
                                             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.FocusedGraphics = new Rect(w, w,
            //                                  new Fill(Color.blue),
            //                                  new Stroke(Color.yellow, Weight)
            //    );

            _style.WordWrap = true;
            _style.Alignment = TextAnchor.UpperLeft;

            _style.Commit();
        }
        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();
        }
Пример #25
0
        private static void Initialize()
        {
            //Debug.Log("FocusIndicatorStyle initializer");

            _style = new ProgramaticStyle {Style = _instance};

            // NOTE: we don't need font if we are not calculating the styled label size!
            
            int w = (BorderWidth + 1) * 2;

            int p = BorderWidth + 1;
            _style.Border = new RectOffset(p, p, p, p);
            _style.Overflow = new RectOffset(BorderWidth - 1, BorderWidth - 1, BorderWidth - 1, BorderWidth - 1);

            _style.NormalGraphics = new Rect(w, w, new Stroke(BorderWidth) { Color = BorderColor, Border = new BorderMetrics(BorderWidth) });

            _style.Commit();
        }
Пример #26
0
        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(10, 10, 4, 4),
                             Font = FontMapper.GetDefault().Font
                         };

            //_style.Font = CoreSkinMapper.Instance.System.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.grey;
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(new Color(0.9f, 0.9f, 0.9f, 1f)),
                                             new Stroke(Weight) { Color = Color.grey }
                );
            _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.FocusedGraphics = new Rect(w, w,
            //                                  new Fill(Color.blue),
            //                                  new Stroke(Color.yellow, Weight)
            //    );

            _style.FixedWidth = 320;
            _style.FixedHeight = 25;

            _style.Commit();
        }
Пример #28
0
        private static void Initialize()
        {
            _instance.name = "PanelBackgroundStyle";

            _style = new ProgramaticStyle {Style = _instance, Alignment = TextAnchor.MiddleCenter};

            //_style.Font = FontMapper.GetDefault();

            const int w = (Weight + 1) * 2;

            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.Padding = new RectOffset(2, 2, 2, 2);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.white;
            //_style.NormalGraphics = new Rect(w, w, new Fill(RgbColor.FromHex(0xBBD4F6).ToColor())/*, new Stroke(Color.grey, Weight)*/); //new Color(1, 1, 1, 1)
            _style.NormalGraphics = new Rect(w, w, new Fill(new Color(1, 1, 1, 1)));

            _style.Commit();

        }
Пример #29
0
        private static void Initialize()
        {
            _instance.name = "ButtonSingleStateStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
                         {
                             Font = FontMapper.GetDefault().Font,
                             Style = _instance,
                             Alignment = TextAnchor.MiddleCenter,
                             ContentOffset = new Vector2(-1, -1) // fix bad Unity offset
                         };

            const int w = (Weight + 1) * 2;

            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(Color.white),
                                             new Stroke(Weight) { Color = ColorMixer.FromHex(0x404040).ToColor() });
            _style.Commit();
        }
Пример #30
0
        public static void ApplyBackgroundStyle(ProgramaticStyle programaticStyle, int w, int weight)
        {
            programaticStyle.Border = new RectOffset(weight + 1, weight + 1, weight + 1, weight + 1);

            //programaticStyle.FontSize = 30;
            //programaticStyle.NormalTextColor = Color.grey;
            programaticStyle.NormalGraphics = new Rect(w, w,
                                                       new Fill(Color.white),
                                                       new Stroke(weight) { Color = Color.black }
                );
            //programaticStyle.HoverTextColor = Color.white;
            programaticStyle.HoverGraphics = new Rect(w, w,
                                                      new Fill(Color.white),
                                                      new Stroke(weight) { Color = Color.grey }
                );
            //programaticStyle.ActiveTextColor = Color.white;
            programaticStyle.ActiveGraphics = new Rect(w, w,
                                                       new Fill(Color.white), //new Color(0.2f, 0.9f, 0.2f, 1f)),
                                                       new Stroke(weight) { Color = Color.grey }
                );
        }
Пример #31
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Font      = FontMapper.GetDefault().Font,
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(6, 6, 3, 3)
            };

            const int w  = (Weight + 1) * 2;
            int       w2 = 18;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0xC0C0C0).ToColor()),
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0x404040).ToColor()
            }
                                              );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(new Color(1f, 1f, 1f, 1f)),
                                             new Stroke(Weight)
            {
                Color = Color.grey
            }
                                             );
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0xD3D3D3).ToColor()
            }
                                              );

            _style.OnNormalTextColor = Color.white;
            _style.OnNormalGraphics  = new Rect(w, w,
                                                new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                                new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0xD3D3D3).ToColor()
            }
                                                );

            ScrollbarHelper.ApplyButtonStyle(_style, w2, Weight, TriangleDirection.Up);

            _style.FixedWidth  = w2;
            _style.FixedHeight = w2;

            _style.Commit();

            //_style.FixedHeight = 20;
            //_style.FixedWidth = 100;
        }