コード例 #1
0
ファイル: UILotButton.cs プロジェクト: JDrocks450/FreeSO
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible || Thumb == null)
            {
                return;
            }
            var ThumbImg = Thumb.LotTexture;

            if (ThumbImg != null && BgImg != null && HoverImg != null)
            {
                var     terrain = ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer;
                var     Size = new Vector2(80, 50);
                Vector2 startVec = new Vector2(40, 25) + Position, end = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId);
                Vector2 start = end;

                // position line around border
                float threshold = 5f;
                if (start.X > Position.X + Size.X)
                {
                    start.X = Position.X + Size.X - threshold;
                }
                else if (start.X < Position.X)
                {
                    start.X = Position.X + threshold;
                }
                if (start.Y > Position.Y + Size.Y)
                {
                    start.Y = Position.Y + Size.Y - threshold;
                }
                else if (start.Y < Position.Y)
                {
                    start.Y = Position.Y + threshold;
                }
                if (Math.Abs(start.X - end.X) < 30)
                {
                    start.X = Size.X / 2 + Position.X;
                }
                if (Math.Abs(start.Y - end.Y) < 30)
                {
                    start.Y = Size.Y / 2 + Position.Y;
                }

                UITerrainHighlight.DrawArrow(batch, terrain,
                                             start * FSOEnvironment.DPIScaleFactor, (int)LotId, Target.Value.Lot_IsOnline ? default : new Color(80, 80, 80));
                DrawLocalTexture(batch, (m_isOver && !m_isDown) ? HoverImg : BgImg, new Vector2());

                var scale = new Vector2(0.25f, 0.25f);
                DrawLocalTexture(batch, ThumbImg, null, new Vector2(40, 25) - new Vector2(32, 32), scale);
                var px = TextureGenerator.GetPxWhite(batch.GraphicsDevice);
                DrawLocalTexture(batch, px, null, new Vector2(0, 50), new Vector2(80, 16 * NameLabel.NumLines + 7), Color.Black * 0.6f);

                base.Draw(batch);
            }
        }
コード例 #2
0
ファイル: UIMapWaypoint.cs プロジェクト: RHY3756547/FreeSO
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }
            var     terrain  = ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer;
            Vector2 startVec = (new Vector2(60 / 2, 60 / 2) + Position);
            Vector2?dest     = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId);

            if (!dest.HasValue)
            {
                return;
            }

            Vector2 end   = dest.Value / FSOEnvironment.DPIScaleFactor;
            Vector2 start = end;

            //position line around border all pretty like
            float threshold = 5f;

            if (start.X > Position.X + SizeW)
            {
                start.X = Position.X + SizeW - threshold;
            }
            else if (start.X < Position.X)
            {
                start.X = Position.X + threshold;
            }
            if (start.Y > Position.Y + SizeH)
            {
                start.Y = Position.Y + SizeH - threshold;
            }
            else if (start.Y < Position.Y)
            {
                start.Y = Position.Y + threshold;
            }
            if (Math.Abs(start.X - end.X) < 30)
            {
                start.X = SizeW / 2 + Position.X;
            }
            if (Math.Abs(start.Y - end.Y) < 30)
            {
                start.Y = SizeH / 2 + Position.Y;
            }

            UITerrainHighlight.DrawArrow(batch, terrain,
                                         start * FSOEnvironment.DPIScaleFactor, (int)LotId,
                                         (Style == UIMapWaypointStyle.YourHouseHere) ? new Color(70, 185, 142) : new Color(129, 103, 152));
            DrawLocalTexture(batch, BgImg, null, new Vector2(), new Vector2(1), Color.White * (m_isOver ? .75f : 1f));
        }
コード例 #3
0
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible)
            {
                return;
            }
            if (ThumbImg != null && BgImg != null && HoverImg != null)
            {
                UITerrainHighlight.DrawArrow(batch, ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer, Position + new Vector2(40, 25), (int)LotId);
                DrawLocalTexture(batch, (m_isOver && !m_isDown) ? HoverImg : BgImg, new Vector2());

                var scale = new Vector2(0.25f, 0.25f);
                DrawLocalTexture(batch, ThumbImg, null, new Vector2(40, 25) - new Vector2(32, 32), scale);
                var px = TextureGenerator.GetPxWhite(batch.GraphicsDevice);
                DrawLocalTexture(batch, px, null, new Vector2(0, 50), new Vector2(80, 16 * NameLabel.NumLines + 7), Color.Black * 0.6f);

                base.Draw(batch);
            }
        }
コード例 #4
0
        public override void Draw(UISpriteBatch batch)
        {
            //simple overide that always draws lots that are community regardless of their online status
            //Visible=cityview (don't draw in lotview), Lot_IsOnline= lotthread is open(blinking red on map), CLots= list with specific overrides based on db location
            if (!Visible || Thumb == null || (!Target.Value.Lot_IsOnline && !WorldObjectCatalog.CLots.Contains(Convert.ToString(LotId))))
            {
                return;
            }
            var ThumbImg = Thumb.LotTexture;

            if (ThumbImg != null && BgImg != null && HoverImg != null)
            {
                UITerrainHighlight.DrawArrow(batch, ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer, Position + new Vector2(40, 25), (int)LotId);
                DrawLocalTexture(batch, (m_isOver && !m_isDown) ? HoverImg : BgImg, new Vector2());

                var scale = new Vector2(0.25f, 0.25f);
                DrawLocalTexture(batch, ThumbImg, null, new Vector2(40, 25) - new Vector2(32, 32), scale);
                var px = TextureGenerator.GetPxWhite(batch.GraphicsDevice);
                DrawLocalTexture(batch, px, null, new Vector2(0, 50), new Vector2(80, 16 * NameLabel.NumLines + 7), Color.Black * 0.6f);

                base.Draw(batch);
            }
        }