Exemplo n.º 1
0
        private void DrawSkill(UISpriteBatch batch, int x, int y, int skill)
        {
            double p = (SkillValues[skill] / 1000.0);
            //Color barcol = new Color((byte)(5 * (1 - p)), (byte)(100 * p + 97 * (1 - p)), (byte)(9 * p + 90 * (1 - p)));
            Color barcol = Color.Teal;
            Color bgcol  = Color.BlueViolet;

            //Color bgcol = new Color((byte)(5 * p + 100*(1-p)), (byte)(97 * p), (byte)(90 * p));

            batch.Draw(Filler, LocalRect(x, y, 60, 5), bgcol);
            batch.Draw(Filler, LocalRect(x, y, (int)(60 * p), 5), barcol);
            batch.Draw(Filler, LocalRect(x + (int)(60 * p), y, 1, 5), Color.Black);
            var style = TextStyle.DefaultLabel.Clone();

            style.Size = 8;



            var temp = style.Color;

            style.Color = Color.Black;
            DrawLocalString(batch, SkillNames[skill], new Vector2(x + 1, y - 12), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center); //shadow

            style.Color = temp;
            DrawLocalString(batch, SkillNames[skill], new Vector2(x, y - 13), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center);
        }
Exemplo n.º 2
0
        public override void Draw(UISpriteBatch batch)
        {
            base.Draw(batch);
            if (!Visible)
            {
                return;
            }
            Vector2 dir = new Vector2();
            var     res = EditorResource.Get();

            if (MouseDrag || Destination != null)
            {
                //draw Line bg
                dir = new Vector2(ArrowVec.X, ArrowVec.Y);
                dir.Normalize();
                DrawLine(res.WhiteTex, dir * 10, ArrowVec - dir * 5, batch, 6, Color.White);
            }

            //draw Node
            DrawLocalTexture(batch, res.NodeOutline, new Vector2(res.NodeOutline.Width / -2, res.NodeOutline.Height / -2));
            DrawLocalTexture(batch, res.Node, null, new Vector2(res.Node.Width / -2, res.Node.Height / -2), new Vector2(1f, 1f), NodeColors[Type]);

            if (MouseDrag || Destination != null)
            {
                //draw Arrow
                var arrowDir = (float)Math.Atan2(-dir.X, dir.Y);
                var arrowPos = LocalPoint(ArrowVec);
                batch.Draw(res.ArrowHeadOutline, arrowPos, null, Color.White, arrowDir, new Vector2(9, 19), _Scale, SpriteEffects.None, 0);
                batch.Draw(res.ArrowHead, arrowPos, null, NodeColors[Type], arrowDir, new Vector2(9, 19), _Scale, SpriteEffects.None, 0);

                //draw Line
                DrawLine(res.WhiteTex, dir * 10, ArrowVec - dir * 5, batch, 4, NodeColors[Type]);
            }

            Texture2D icon;

            switch (Type)
            {
            case NodeType.False:
                icon = res.FalseNode;
                break;

            case NodeType.True:
                icon = res.TrueNode;
                break;

            default:
                icon = res.DoneNode;
                break;
            }
            DrawLocalTexture(batch, icon, IconPos[Direction] - new Vector2(icon.Width / 2, icon.Height / 2));
            var shadRect = SmallShad[Direction];

            DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(shadRect.X, shadRect.Y), new Vector2(shadRect.Width, shadRect.Height), Color.Black * 0.15f);
        }
Exemplo n.º 3
0
        void DrawMotive(UISpriteBatch batch, int x, int y, int motive, bool inDynamic)
        {
            if (inDynamic)
            {
                var    mdat   = MotiveValues[motive] + 100;
                double p      = Math.Min(1, mdat / 200.0);
                Color  barcol = new Color((byte)(57 * (1 - p)), (byte)(213 * p + 97 * (1 - p)), (byte)(49 * p + 90 * (1 - p)));
                Color  bgcol  = new Color((byte)(57 * p + 214 * (1 - p)), (byte)(97 * p), (byte)(90 * p));

                batch.Draw(Filler, LocalRect(x, y, 60, 5), bgcol);
                batch.Draw(Filler, LocalRect(x, y, (int)(60 * p), 5), barcol);
                batch.Draw(Filler, LocalRect(x + (int)(60 * p), y, 1, 5), Color.Black);

                if (mdat > 200)
                {
                    var p2 = Math.Min(1, (mdat - 200) / 200.0);
                    batch.Draw(Filler, LocalRect(x, y, (int)(60 * p2), 5), Color.White);
                    batch.Draw(Filler, LocalRect(x + (int)(60 * p2), y, 1, 5), Color.Black);

                    //MotiveStyle.Shadow = true;
                    //DrawLocalString(batch, "+" + ((mdat-200) / 2f).ToString() + "%", new Vector2(x, y), MotiveStyle, new Rectangle(0, 0, 60, 5), TextAlignment.Center | TextAlignment.Middle);
                }

                var arrowState = ArrowStates[motive];
                var arrow      = TextureGenerator.GetMotiveArrow(batch.GraphicsDevice);
                if (arrowState > 0)
                {
                    for (int i = 0; i < Math.Ceiling(arrowState / 60f); i++)
                    {
                        DrawLocalTexture(batch, arrow, new Rectangle(2, 0, 3, 5), new Vector2(x + 61 + i * 4, y), new Vector2(1, 1), new Color(0x00, 0xCB, 0x39) * Math.Min(1f, arrowState / 60f - i));
                    }
                }
                else if (arrowState < 0)
                {
                    arrowState = -arrowState;
                    for (int i = 0; i < Math.Ceiling(arrowState / 60f); i++)
                    {
                        DrawLocalTexture(batch, arrow, new Rectangle(0, 0, 3, 5), new Vector2(x - 4 - i * 4, y), new Vector2(1, 1), new Color(0xD6, 0x00, 0x00) * Math.Min(1f, arrowState / 60f - i));
                    }
                }
            }
            else
            {
                var style = MotiveStyle;

                var temp = TextStyle.DefaultLabel.Color;
                style.Color = Color.Black;
                DrawLocalString(batch, MotiveNames[motive], new Vector2(x + 1, y - 14), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center); //shadow

                style.Color = temp;
                DrawLocalString(batch, MotiveNames[motive], new Vector2(x, y - 15), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center);
            }
        }
Exemplo n.º 4
0
        public void ShadDraw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }
            if (Destination != null && Destination.Dead)
            {
                Destination = null;
            }

            var res = EditorResource.Get();

            DrawLocalTexture(batch, res.NodeOutline, null, new Vector2(res.NodeOutline.Width / -2 + 5, res.NodeOutline.Height / -2 + 5), new Vector2(1f, 1f), ShadCol);

            if (!MouseDrag && Destination == null)
            {
                return;
            }

            var contextPos = Parent.Position + Position;

            ArrowVec = (MouseDrag)?DragVec:(Destination.NearestDestPt(contextPos) - contextPos);

            var dir = new Vector2(ArrowVec.X, ArrowVec.Y);

            dir.Normalize();

            DrawLine(res.WhiteTex, dir * 10 + new Vector2(5, 5), (ArrowVec - dir * 5) + new Vector2(5, 5), batch, 6, ShadCol);
            var arrowDir = (float)Math.Atan2(-dir.X, dir.Y);
            var arrowPos = LocalPoint((ArrowVec) + new Vector2(5, 5));

            batch.Draw(res.ArrowHeadOutline, arrowPos, null, ShadCol, arrowDir, new Vector2(9, 19), _Scale, SpriteEffects.None, 0);
        }
Exemplo n.º 5
0
        public override void Draw(UISpriteBatch batch)
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            batch.Draw(TextureGenerator.GetPxWhite(batch.GraphicsDevice), new Rectangle(0, 0, ScreenWidth, ScreenHeight), new Color(0x09, 0x18, 0x2F));
            base.Draw(batch);
        }
Exemplo n.º 6
0
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }

            var layout = m_LayoutCache.Calculate("layout", x => CalculateLayout());

            batch.Draw(m_Texture, layout.TrackStartTo, layout.TrackStartFrom, Color.White, 0, Vector2.Zero, _Scale, SpriteEffects.None, 0);
            batch.Draw(m_Texture, layout.TrackMiddleTo, layout.TrackMiddleFrom, Color.White, 0, Vector2.Zero, layout.TrackMiddleScale, SpriteEffects.None, 0);
            batch.Draw(m_Texture, layout.TrackEndTo, layout.TrackEndFrom, Color.White, 0, Vector2.Zero, _Scale, SpriteEffects.None, 0);

            if (m_MaxValue > m_MinValue)
            {
                var buttonPosition = m_LayoutCache.Calculate("btn", x => CalculateButtonPosition(layout));
                batch.Draw(m_Texture, buttonPosition, layout.ThumbFrom, Color.White, 0, Vector2.Zero, _Scale, SpriteEffects.None, 0);
            }
        }
Exemplo n.º 7
0
        //public override void Update(TSOClient.Code.UI.Model.UpdateState state)
        //{
        //    base.Update(state);

        //    /** Hit test **/
        //    color = Color.White;
        //    if (HitTestArea(state, new Microsoft.Xna.Framework.Rectangle(0, 0, 50, 50)))
        //    {

        //    }

        //    //color
        //}


        public override void Draw(UISpriteBatch batch)
        {
            var whiteRectangle = new Texture2D(batch.GraphicsDevice, 1, 1);

            whiteRectangle.SetData(new[] { color });

            var pos = LocalRect(0, 0, 50, 50);

            batch.Draw(whiteRectangle, pos, Color.White);
        }
Exemplo n.º 8
0
        //public override void Update(TSOClient.Code.UI.Model.UpdateState state)
        //{
        //    base.Update(state);

        //    /** Hit test **/
        //    color = Color.White;
        //    if (HitTestArea(state, new Microsoft.Xna.Framework.Rectangle(0, 0, 50, 50)))
        //    {

        //    }

        //    //color
        //}


        public override void Draw(UISpriteBatch batch)
        {
            var whiteRectangle = new Texture2D(batch.GraphicsDevice, 1, 1);

            whiteRectangle.SetData(new[] { color });

            var pos = LocalRect(_Mouse.Region.X, _Mouse.Region.Y, _Mouse.Region.Width, _Mouse.Region.Height);

            batch.Draw(whiteRectangle, pos, Color.White);
        }
Exemplo n.º 9
0
        private void DrawRel(UISpriteBatch batch, int x, int y, int value)
        {
            double p      = (value + 100) / 200.0;
            Color  barcol = new Color((byte)(57 * (1 - p)), (byte)(213 * p + 97 * (1 - p)), (byte)(49 * p + 90 * (1 - p)));
            Color  bgcol  = new Color((byte)(57 * p + 214 * (1 - p)), (byte)(97 * p), (byte)(90 * p));

            var Filler = TextureGenerator.GetPxWhite(batch.GraphicsDevice);

            batch.Draw(Filler, LocalRect(x + 1, y + 1, 80, 6), new Color(23, 38, 55));
            batch.Draw(Filler, LocalRect(x, y, 80, 6), bgcol);
            batch.Draw(Filler, LocalRect(x, y, (int)(80 * p), 6), barcol);
            batch.Draw(Filler, LocalRect(x + (int)(80 * p), y, 1, 6), Color.Black);

            var style = TextStyle.DefaultLabel.Clone();

            style.Size   = 7;
            style.Shadow = true;

            DrawLocalString(batch, value.ToString(), new Vector2(x + 84, y - 5), style, new Rectangle(0, 0, 1, 1), TextAlignment.Left);
        }
        private void DrawMotive(UISpriteBatch batch, int x, int y, int motive)
        {
            double p      = (MotiveValues[motive] + 100) / 200.0;
            Color  barcol = new Color((byte)(57 * (1 - p)), (byte)(213 * p + 97 * (1 - p)), (byte)(49 * p + 90 * (1 - p)));
            Color  bgcol  = new Color((byte)(57 * p + 214 * (1 - p)), (byte)(97 * p), (byte)(90 * p));

            batch.Draw(Filler, LocalRect(x, y, 60, 5), bgcol);
            batch.Draw(Filler, LocalRect(x, y, (int)(60 * p), 5), barcol);
            batch.Draw(Filler, LocalRect(x + (int)(60 * p), y, 1, 5), Color.Black);
            var style = TextStyle.DefaultLabel.Clone();

            style.Size = 8;

            var temp = style.Color;

            style.Color = Color.Black;
            DrawLocalString(batch, MotiveNames[motive], new Vector2(x + 1, y - 12), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center); //shadow

            style.Color = temp;
            DrawLocalString(batch, MotiveNames[motive], new Vector2(x, y - 13), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center);
        }
        private void DrawMotive(UISpriteBatch batch, int x, int y, int motive)
        {
            double p      = (MotiveValues[motive] + 100) / 200.0;
            Color  barcol = new Color((byte)(57 * (1 - p)), (byte)(213 * p + 97 * (1 - p)), (byte)(49 * p + 90 * (1 - p)));
            Color  bgcol  = new Color((byte)(57 * p + 214 * (1 - p)), (byte)(97 * p), (byte)(90 * p));

            batch.Draw(Filler, LocalRect(x, y, 60, 5), bgcol);
            batch.Draw(Filler, LocalRect(x, y, (int)(60 * p), 5), barcol);
            batch.Draw(Filler, LocalRect(x + (int)(60 * p), y, 1, 5), Color.Black);
            var style = TextStyle.DefaultLabel.Clone();

            style.Size = 8;

            var temp = style.Color;

            style.Color = Color.Black;
            DrawLocalString(batch, MotiveNames[motive], new Vector2(x + 1, y - 14), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center); //shadow

            style.Color = temp;
            DrawLocalString(batch, MotiveNames[motive], new Vector2(x, y - 15), style, new Rectangle(0, 0, 60, 12), TextAlignment.Center);

            var arrowState = ArrowStates[motive];
            var arrow      = TextureGenerator.GetMotiveArrow(batch.GraphicsDevice, Color.White, Color.Transparent);

            if (arrowState > 0)
            {
                for (int i = 0; i < Math.Ceiling(arrowState / 60f); i++)
                {
                    DrawLocalTexture(batch, arrow, new Rectangle(2, 0, 3, 5), new Vector2(x + 61 + i * 4, y), new Vector2(1, 1), new Color(0x00, 0xCB, 0x39) * Math.Min(1f, arrowState / 60f - i));
                }
            }
            else if (arrowState < 0)
            {
                arrowState = -arrowState;
                for (int i = 0; i < Math.Ceiling(arrowState / 60f); i++)
                {
                    DrawLocalTexture(batch, arrow, new Rectangle(0, 0, 3, 5), new Vector2(x - 4 - i * 4, y), new Vector2(1, 1), new Color(0xD6, 0x00, 0x00) * Math.Min(1f, arrowState / 60f - i));
                }
            }
        }
Exemplo n.º 12
0
 public override void Draw(UISpriteBatch batch)
 {
     batch.Draw(TextureGenerator.GetPxWhite(batch.GraphicsDevice),
                new Rectangle(0, 0, batch.GraphicsDevice.Viewport.Width, batch.GraphicsDevice.Viewport.Height), new Color(0x09, 0x18, 0x2F));
     base.Draw(batch);
 }