Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="mtx"></param>
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }

            /**
             * If opacity is not 100% we need to draw to a texture
             * and then paint that with our opacity value
             */
            if (_HasOpacity)
            {
                if (AlphaBlendedScene != null)
                {
                    batch.Draw(AlphaBlendedScene, Vector2.Zero, _BlendColor);
                }
            }
            else
            {
                lock (Children)
                {
                    foreach (var child in Children)
                    {
                        child.Draw(batch);
                    }
                }
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
 }
Esempio n. 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="mtx"></param>
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }

            /**
             * If opacity is not 100% we need to draw to a texture
             * and then paint that with our opacity value
             */
            if (_HasOpacity)
            {
                if (AlphaBlendedScene != null)
                {
                    batch.Draw(AlphaBlendedScene, Vector2.Zero, _BlendColor);
                }
            }
            else
            {
                lock (Children)
                {
                    foreach (var child in Children)
                    {
                        child.Draw(batch);
                    }
                }
            }
        }