Example #1
0
        public ColorGradient Gradient(String Name)
        {
            ColorGradient cg = null;

            Gradients.TryGetValue(Name, out cg);
            return(cg);
        }
Example #2
0
        public Color LifeColorForCreature(ClientCreature Creature)
        {
            ColorGradient cg = UIContext.Skin.Gradient("Health");

            if (cg != null)
            {
                return(cg.Sample(Creature.HealthPercent));
            }
            return(new Color(255, 255, 255));
        }
Example #3
0
        public void Load(System.IO.Stream File)
        {
            //
            float[] cutoffs = { 0.00f, 0.05f, 0.33f, 0.99f, 1f };
            Color[] colors  =
            {
                new Color(100,   0,   0),
                new Color(187,  46,  46),
                new Color(187, 187,   0),
                new Color(100, 187, 100),
                new Color(0,   187, 0)
            };
            Gradients["Health"] = new ColorGradient(cutoffs, colors);

            // Create a texture to use as draw source for shapes
            WhiteTexture = new Texture2D(UIContext.Graphics.GraphicsDevice, 1, 1);
            WhiteTexture.SetData(new Color[] { Color.White });

            //
            UISkinElement e;

            e = new UISkinElement(UIElementType.Frame);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(106, 183, 4, 17));
            e.Set(UISkinOrientation.Top, new Rectangle(114, 183, 96, 17));
            e.Set(UISkinOrientation.TopRight, new Rectangle(110, 183, 4, 17));
            e.Set(UISkinOrientation.Left, new Rectangle(256, 0, 4, 96));
            e.Set(UISkinOrientation.Center, new Rectangle(0, 0, 96, 96));
            e.Set(UISkinOrientation.Right, new Rectangle(260, 0, 4, 96));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(98, 193, 4, 4));
            e.Set(UISkinOrientation.Bottom, new Rectangle(2, 193, 96, 4));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(102, 193, 4, 4));
            AddElement(e);

            e = new UISkinElement(UIElementType.Window);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(106, 184, 4, 3));
            e.Set(UISkinOrientation.Top, new Rectangle(2, 211, 96, 3));
            e.Set(UISkinOrientation.TopRight, new Rectangle(110, 184, 4, 3));
            e.Set(UISkinOrientation.Left, new Rectangle(256, 0, 4, 96));
            e.Set(UISkinOrientation.Center, new Rectangle(0, 0, 96, 96));
            e.Set(UISkinOrientation.Right, new Rectangle(260, 0, 4, 96));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(98, 193, 4, 4));
            e.Set(UISkinOrientation.Bottom, new Rectangle(2, 193, 96, 4));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(102, 193, 4, 4));
            AddElement(e);

            e = new UISkinElement(UIElementType.BorderlessWindow);
            e.Set(UISkinOrientation.Center, new Rectangle(0, 0, 96, 96));
            AddElement(e);

            e = new UISkinElement(UIElementType.Button);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(174, 138, 1, 1));
            e.Set(UISkinOrientation.Top, new Rectangle(175, 138, 32, 1));
            e.Set(UISkinOrientation.TopRight, new Rectangle(207, 138, 1, 1));
            e.Set(UISkinOrientation.Left, new Rectangle(174, 139, 1, 18));
            e.Set(UISkinOrientation.Center, new Rectangle(175, 139, 32, 18));
            e.Set(UISkinOrientation.Right, new Rectangle(207, 139, 1, 18));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(174, 157, 1, 1));
            e.Set(UISkinOrientation.Bottom, new Rectangle(175, 157, 32, 1));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(207, 157, 1, 1));
            AddElement(e);

            e = new UISkinElement(UIElementType.TabHighlight);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(114, 200, 2, 2));
            e.Set(UISkinOrientation.Top, new Rectangle(116, 200, 91, 2));
            e.Set(UISkinOrientation.TopRight, new Rectangle(208, 200, 2, 2));
            e.Set(UISkinOrientation.Left, new Rectangle(114, 202, 2, 16));
            e.Set(UISkinOrientation.Center, new Rectangle(116, 202, 91, 16));
            e.Set(UISkinOrientation.Right, new Rectangle(208, 202, 2, 16));
            //e.Set(UISkinOrientation.BottomLeft,     new Rectangle(98,       193,    4,      4));
            //e.Set(UISkinOrientation.Bottom,         new Rectangle(2,        193,    96,     4));
            //e.Set(UISkinOrientation.BottomRight,    new Rectangle(102,      193,    4,      4));
            AddElement(e);

            e = new UISkinElement(UIElementType.Tab);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(210, 200, 2, 2));
            e.Set(UISkinOrientation.Top, new Rectangle(212, 200, 91, 2));
            e.Set(UISkinOrientation.TopRight, new Rectangle(304, 200, 2, 2));
            e.Set(UISkinOrientation.Left, new Rectangle(210, 202, 2, 14));
            e.Set(UISkinOrientation.Center, new Rectangle(212, 202, 91, 14));
            e.Set(UISkinOrientation.Right, new Rectangle(304, 202, 2, 14));
            //e.Set(UISkinOrientation.BottomLeft,     new Rectangle(98,       193,    4,      4));
            //e.Set(UISkinOrientation.Bottom,         new Rectangle(2,        193,    96,     4));
            //e.Set(UISkinOrientation.BottomRight,    new Rectangle(102,      193,    4,      4));
            AddElement(e);

            e = new UISkinElement(UIElementType.ButtonHighlight);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(174, 158, 1, 1));
            e.Set(UISkinOrientation.Top, new Rectangle(175, 158, 32, 1));
            e.Set(UISkinOrientation.TopRight, new Rectangle(207, 158, 1, 1));
            e.Set(UISkinOrientation.Left, new Rectangle(174, 159, 1, 18));
            e.Set(UISkinOrientation.Center, new Rectangle(175, 159, 32, 18));
            e.Set(UISkinOrientation.Right, new Rectangle(207, 159, 1, 18));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(174, 177, 1, 1));
            e.Set(UISkinOrientation.Bottom, new Rectangle(175, 177, 32, 1));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(207, 177, 1, 1));
            AddElement(e);


            // FIXME (ivucica#4#) looks like the "unchecked checkbox" is not the same as "textbox" -- see: "XPlike Tibia.pic" for more info
            e = new UISkinElement(UIElementType.Textbox);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(308, 96, 1, 1));                                  // in fact it looks like we have to HARDCODE this piece of skin.
            e.Set(UISkinOrientation.Top, new Rectangle(309, 96, 10, 1));
            e.Set(UISkinOrientation.TopRight, new Rectangle(319, 96, 1, 1));
            e.Set(UISkinOrientation.Left, new Rectangle(308, 97, 1, 10));
            e.Set(UISkinOrientation.Center, new Rectangle(309, 97, 10, 10));
            e.Set(UISkinOrientation.Right, new Rectangle(319, 97, 1, 10));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(308, 107, 1, 1));
            e.Set(UISkinOrientation.Bottom, new Rectangle(309, 107, 10, 1));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(319, 107, 1, 1));
            AddElement(e);

            /*
             * e = new UISkinElement(UIElementType.Window);
             * e.Set(UISkinOrientation.TopLeft,       new Rectangle(308,	108,	1,		1));
             * e.Set(UISkinOrientation.Top,           new Rectangle(309,	108,	10,		1));
             * e.Set(UISkinOrientation.TopRight,      new Rectangle(319,	108,	1,		1));
             * e.Set(UISkinOrientation.Left,          new Rectangle(308,	109,	1,		10));
             * e.Set(UISkinOrientation.Center,        new Rectangle(309,	109,	10,		10));
             * e.Set(UISkinOrientation.Right,         new Rectangle(319,	109,	1,		10));
             * e.Set(UISkinOrientation.BottomLeft,    new Rectangle(308,	119,	1,		1));
             * e.Set(UISkinOrientation.Bottom,        new Rectangle(309,	119,	10,		1));
             * e.Set(UISkinOrientation.BottomRight,   new Rectangle(319,	119,	1,		1));
             * AddElement(e);
             *
             *
             * e = new UISkinElement(UIElementType.Window);
             * e.Set(UISkinOrientation.TopLeft,       new Rectangle(44,		226,	5,		5));
             * e.Set(UISkinOrientation.Top,           new Rectangle(43,		214,	32,		5));
             * e.Set(UISkinOrientation.TopRight,      new Rectangle(49,		226,	5,		5));
             * e.Set(UISkinOrientation.Left,          new Rectangle(0,		    214,	5,		32));
             * e.Set(UISkinOrientation.Center,        new Rectangle(11,		214,	32,		32));
             * e.Set(UISkinOrientation.Right,         new Rectangle(6,		    214,	5,		32));
             * e.Set(UISkinOrientation.BottomLeft,    new Rectangle(44,		231,	5,		5));
             * e.Set(UISkinOrientation.Bottom,        new Rectangle(43,		219,	32,		5));
             * e.Set(UISkinOrientation.BottomRight,   new Rectangle(49,		231,	5,		5));
             * AddElement(e);
             */
            e = new UISkinElement(UIElementType.InventorySlot);
            e.Set(UISkinOrientation.TopLeft, new Rectangle(186, 64, 1, 1));
            e.Set(UISkinOrientation.Top, new Rectangle(187, 64, 31, 1));
            e.Set(UISkinOrientation.TopRight, new Rectangle(219, 64, 1, 1));
            e.Set(UISkinOrientation.Left, new Rectangle(186, 65, 1, 32));
            e.Set(UISkinOrientation.Center, new Rectangle(187, 65, 32, 32));
            e.Set(UISkinOrientation.Right, new Rectangle(219, 65, 1, 32));
            e.Set(UISkinOrientation.BottomLeft, new Rectangle(186, 97, 1, 1));
            e.Set(UISkinOrientation.Bottom, new Rectangle(187, 97, 32, 1));
            e.Set(UISkinOrientation.BottomRight, new Rectangle(219, 97, 1, 1));
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarTop);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            //e.Set(UISkinOrientation.Left,          null);
            e.Set(UISkinOrientation.Center, new Rectangle(232, 64, 12, 12));
            //e.Set(UISkinOrientation.Right,         null);
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarTopHighlight);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            //e.Set(UISkinOrientation.Left,          null);
            e.Set(UISkinOrientation.Center, new Rectangle(234, 122, 12, 12));
            //e.Set(UISkinOrientation.Right,         null);
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarBottom);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            //e.Set(UISkinOrientation.Left,          null);
            e.Set(UISkinOrientation.Center, new Rectangle(244, 64, 12, 12));
            //e.Set(UISkinOrientation.Right,         null);
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarBottomHighlight);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            //e.Set(UISkinOrientation.Left,          null);
            e.Set(UISkinOrientation.Center, new Rectangle(246, 122, 12, 12));
            //e.Set(UISkinOrientation.Right,         null);
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarGem);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            //e.Set(UISkinOrientation.Left,          null);
            e.Set(UISkinOrientation.Center, new Rectangle(220, 64, 12, 12));
            //e.Set(UISkinOrientation.Right,         null);
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);

            e = new UISkinElement(UIElementType.ScrollbarBackground);
            //e.Set(UISkinOrientation.TopLeft,       null);
            //e.Set(UISkinOrientation.Top,           null);
            //e.Set(UISkinOrientation.TopRight,      null);
            e.Set(UISkinOrientation.Left, new Rectangle(264, 0, 1, 96));
            e.Set(UISkinOrientation.Center, new Rectangle(265, 0, 10, 96));
            e.Set(UISkinOrientation.Right, new Rectangle(275, 0, 1, 96));
            //e.Set(UISkinOrientation.BottomLeft,    null);
            //e.Set(UISkinOrientation.Bottom,        null);
            //e.Set(UISkinOrientation.BottomRight,   null);
            AddElement(e);
        }