예제 #1
0
        private void updateLoadTransforms()
        {
            _loadCondition = new LoadCondition(Forces, Moments);
            Vector3d lz = Vector3d.Negate(Vector3d.ZAxis); //default local z

            if (!(ReferenceLine is null))
            {
                if (!ReferenceLine.DirectionLocalZ.IsTiny())
                {
                    lz = ReferenceLine.DirectionLocalZ;
                }
            }
            _loadCondition.Transforms.AddRange(DrawUtil.GetCurveTransforms(Value, UseHostLocal, lz, null, DrawUtil.ScaleFactorLoads, DrawUtil.DensityFactorLoads));
        }
예제 #2
0
        protected override void Draw(int x, int y, bool active, ApplicationState state)
        {
            if (!active)
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
            }

            if (_active)
            {
                Console.BackgroundColor = ConsoleColor.DarkGray;
            }
            DrawUtil.Outline(x, y, Width, Height);
            DrawUtil.Text(x + 1, y + 1, Text);
            Console.ResetColor();
        }
        // draw nodes representing scene root GameObject in a special color
        public override Rect DrawContent(ObjectNode entity, EntityDrawContext drawContext)
        {
            if (!entity.IsSceneObject)
            {
                return(DrawUtil.DrawContent(GetContent(entity), drawContext));
            }

            var colorBackup = drawContext.style.backgroundColor;

            drawContext.style.backgroundColor = sceneNodeColor;
            var rect = DrawUtil.DrawContent(GetContent(entity), drawContext);

            drawContext.style.backgroundColor = colorBackup;
            return(rect);
        }
예제 #4
0
 private void AdjustBackColor()
 {
     if (_selected)
     {
         this.BackColor = Color.Orange;
     }
     else if (_hilight)
     {
         this.BackColor = DrawUtil.LightColor(Color.Orange);
     }
     else
     {
         this.BackColor = SystemColors.Window;
     }
 }
        void InitDraw()
        {
            // Draw all points
            using (DrawingContext dc = _drawingVisual.RenderOpen())
            {
                // Clear background
                DrawUtil.ClearBackground(dc, Rect);

                // Draw all points
                DrawUtil.DrawDots(dc, _algorithm.Points, Rect);

                dc.Close();
            }
            _renderTargetBitmap.Render(_drawingVisual);
        }
예제 #6
0
        /// <summary>
        /// 重绘函数
        /// </summary>
        /// <param name="g"></param>
        void DrawVehicle(Graphics g, Vehicle v)
        {
#if moni
            Rectangle rect = new Rectangle(v.BeginY * ConstDefine.g_NodeLength, (int)v.BeginX * ConstDefine.g_NodeLength, ConstDefine.g_NodeLength - 2, ConstDefine.g_NodeLength - 2);
            DrawUtil.FillRectangle(g, v.showColor, rect);

            PointF p = new PointF((int)((v.BeginY) * ConstDefine.g_NodeLength), (int)((v.BeginX) * ConstDefine.g_NodeLength));
            DrawUtil.DrawString(g, v.Id, ConstDefine.g_NodeLength / 2, Color.Black, p);
#else
            Rectangle rect = new Rectangle((int)(v.RealY) * ConstDefine.g_NodeLength, (int)v.RealX * ConstDefine.g_NodeLength, ConstDefine.g_NodeLength - 2, ConstDefine.g_NodeLength - 2);
            DrawUtil.FillRectangle(g, v.showColor, rect);

            PointF p = new PointF((int)((v.RealY) * ConstDefine.g_NodeLength), (int)((v.RealX) * ConstDefine.g_NodeLength));
            DrawUtil.DrawString(g, v.Id, ConstDefine.g_NodeLength / 2, Color.Black, p);
#endif
        }
예제 #7
0
        private static void CreateColor()
        {
            _selectedColors = new DrawUtil.RoundRectColors();
            _selectedColors.border_color     = DrawUtil.ToCOLORREF(Color.DarkRed);
            _selectedColors.inner_color      = DrawUtil.ToCOLORREF(Color.Orange);
            _selectedColors.outer_color      = DrawUtil.ToCOLORREF(SystemColors.Window);
            _selectedColors.lightlight_color = DrawUtil.MergeColor(_selectedColors.border_color, _selectedColors.outer_color);
            _selectedColors.light_color      = DrawUtil.MergeColor(_selectedColors.lightlight_color, _selectedColors.border_color);

            _hilightColors = new DrawUtil.RoundRectColors();
            _hilightColors.border_color     = DrawUtil.ToCOLORREF(Color.Pink);
            _hilightColors.inner_color      = DrawUtil.ToCOLORREF(DrawUtil.LightColor(Color.Orange));
            _hilightColors.outer_color      = DrawUtil.ToCOLORREF(SystemColors.Window);
            _hilightColors.lightlight_color = DrawUtil.MergeColor(_hilightColors.border_color, _hilightColors.outer_color);
            _hilightColors.light_color      = DrawUtil.MergeColor(_hilightColors.lightlight_color, _hilightColors.border_color);
        }
예제 #8
0
        public void draw(SpriteBatch sb)
        {
            if (!isDocked)
            {
                //TODO: C'mon, you know this is janky
                sb.End();
                sb.Begin();
                DrawUtil.drawLine(sb, rect.getCollisionRectangle().Center.ToVector2(), dest.getCollisionRectangle().Center.ToVector2(), angle + Math.PI / 2);
                sb.End();
                sb.Begin(SpriteSortMode.Deferred, null,
                         null, null, null, null, Globals.camera.TranslationMatrix);
            }

            sb.Draw(texture, new Rectangle(rect.getDrawingRectangle().X + width / 2, rect.getDrawingRectangle().Y + height / 2, width, height),
                    null, color, (float)angle, new Vector2(texture.Width / 2, texture.Height / 2),
                    SpriteEffects.None, 0f);
        }
        private void DrawTab_Document(Graphics g, DockContent content, Rectangle rect)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle rectText = rect;

            rectText.X     += DocumentTextExtraWidth / 2;
            rectText.Width -= DocumentTextExtraWidth;
            if (DockPane.ActiveContent == content)
            {
                DrawUtil.DrawVSTab(g, rect, Color.WhiteSmoke, Color.Black, false);;

//				g.FillRectangle(MainForm.DarkColor //ActiveBackBrush
//					, rect);
//				g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height);
//				g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X + rect.Width - 1, rect.Y);
//				g.DrawLine(OutlineInnerPen,
//					rect.X + rect.Width - 1, rect.Y,
//					rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
                if (DockPane.IsActiveDocumentPane)
                {
                    using (Font boldFont = new Font(this.Font, FontStyle.Bold))
                    {
                        g.DrawString(content.Text, boldFont, ActiveTextBrush, rectText, DocumentTextStringFormat);
                    }
                }
                else
                {
                    g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
                }
            }
            else
            {
//				if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(content) + 1)
//				{
//										g.DrawLine(TabSeperatorPen,
//											rect.X + rect.Width - 1, rect.Y,
//											rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - DocumentTabGapTop);
//
//					DrawUtil.DrawVSTab(g,rect,Color.Silver,Color.Gray,false);
//				}
                DrawUtil.DrawVSTab(g, rect, Color.Gainsboro, Color.Silver, false);
                g.DrawLine(Pens.Black, rect.Right, rect.Bottom - 1, rect.Left - 10, rect.Bottom - 1);
                g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
            }
        }
예제 #10
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            if (ActiveFormSkin == null || ActiveFormSkin.NormalState.Image == null)
            {
                return;
            }

            Rectangle srcRect =
                DrawUtil.ExcludePadding(new Rectangle(Point.Empty, ActiveFormSkin.NormalState.Image.Size),
                                        ActiveFormSkin.ClientAreaPadding);

            Padding margins =
                DrawUtil.SubstractPadding(ActiveFormSkin.NormalState.StretchMargins, ActiveFormSkin.ClientAreaPadding);

            DrawUtil.DrawImage(e.Graphics, ActiveFormSkin.NormalState.Image, srcRect, ClientRectangle, null, margins);
        }
예제 #11
0
        protected TextDecoration SelectBackgroundColor(TextDecoration dec, int index)
        {
            RenderProfile prof = GetRenderProfile();
            ESColor       c    = prof.ESColorSet[index];

            Color color;

            if (prof.DarkenEsColorForBackground && !c.IsExactColor)
            {
                color = DrawUtil.DarkColor(c.Color);
            }
            else
            {
                color = c.Color;
            }

            return(dec.GetCopyWithBackColor(color));
        }
예제 #12
0
    // Initialization Event
    void Start()
    {
        // Components
        prim = new DrawPrim(screen_width, screen_height);
        util = new DrawUtil(prim);
        util.drawFill(Color.clear);
        screen_tex = prim.texture;
        GameObject img_obj = createImage(screen_tex);

        img_obj.name = "Screen";
        img          = img_obj.GetComponent <RawImage>();
        img.GetComponent <RectTransform>().localScale = new Vector3(screen_scale, screen_scale, 1f);

        // Variables
        camera_position = Vector2.zero;

        player_ship = gameObject.AddComponent <ShipBehaviour>();
    }
예제 #13
0
        protected override void Paint(SpriteBatch spriteBatch, Rectangle bounds)
        {
            var    center      = new Point((this.Size.X / 2), this.Size.Y / 2);
            var    left        = HorizontalAlignment.Center;
            var    top         = VerticalAlignment.Top;
            string title       = "Did You Know:";
            int    titleHeight = (int)this.BigFont.MeasureString(title).Height;
            int    titleWidth  = (int)this.BigFont.MeasureString(title).Width;
            var    titleCenter = new Point(center.X - (titleWidth / 2), center.Y - (titleHeight / 2));

            spriteBatch.DrawStringOnCtrl(this, title, this.BigFont, new Rectangle(titleCenter.X, LoadScreenPanel.TOP_PADDING, titleWidth, titleHeight), Color.White, false, true, 2, left, top);
            string wrappedTip = DrawUtil.WrapText(this.Font, this.SelectedTip, this.Width - LoadScreenPanel.RIGHT_PADDING);
            int    tipHeight  = (int)this.Font.MeasureString(wrappedTip).Height;
            int    tipWidth   = (int)this.Font.MeasureString(wrappedTip).Width;
            var    tipCenter  = new Point(center.X - (tipWidth / 2), center.Y - (tipHeight / 2));

            spriteBatch.DrawStringOnCtrl(this, wrappedTip, this.Font, new Rectangle(tipCenter.X, tipCenter.Y, tipWidth, tipHeight), Color.White, false, true, 2, left, top);
        }
        /// <summary>
        /// Draws the tabs of a toolwindow/pane
        /// </summary>
        /// <param name="g"></param>
        /// <param name="content"></param>
        /// <param name="rect"></param>
        private void DrawTab_ToolWindow(Graphics g, DockContent content, Rectangle rect)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle rectIcon = new Rectangle(
                rect.X + ToolWindowImageGapLeft,
                rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
                ToolWindowImageWidth, ToolWindowImageHeight);
            Rectangle rectText = rectIcon;

            rectText.X    += rectIcon.Width + ToolWindowImageGapRight;
            rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
                             ToolWindowImageGapRight - ToolWindowTextGapRight;

            if (DockPane.ActiveContent == content)
            {
                DrawUtil.DrawTab(g, rect, Corners.RB, GradientType.Flat, ColorMixer.LightColor, ColorMixer.LightColor, Color.Black, false);
//				DrawUtil.DrawVSTab(g,rect,Color.WhiteSmoke,Color.DimGray,false);
//				g.FillRectangle(ActiveBackBrush, rect);
//				g.DrawLine(OutlineOuterPen,
//					rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1);
//				g.DrawLine(OutlineInnerPen,
//					rect.X, rect.Y + rect.Height - 1, rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
//				g.DrawLine(OutlineInnerPen,
//					rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
                g.DrawString(content.TabText, Font, new SolidBrush(ColorMixer.DarkDarkColor), rectText, ToolWindowTextStringFormat);
            }
            else
            {
                if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(content) + 1)
                {
                    g.DrawLine(TabSeperatorPen,
                               rect.X + rect.Width - 1,
                               rect.Y + ToolWindowTabSeperatorGapTop,
                               rect.X + rect.Width - 1,
                               rect.Y + rect.Height - 1 - ToolWindowTabSeperatorGapBottom);
                }
                g.DrawString(content.TabText, Font, InactiveTextBrush, rectText, ToolWindowTextStringFormat);
            }

            if (rect.Contains(rectIcon))
            {
                g.DrawIcon(content.Icon, rectIcon);
            }
        }
예제 #15
0
        public void DrawMap()
        {
            //横纵坐标的控制变量
            int point_x, point_y;

            //节点类型

            point_x = 0;
            point_y = 0;

            for (int i = 0; i < Elc.HeightNum; i++)
            {
                point_x = 0;
                for (int j = 0; j < Elc.WidthNum; j++)
                {
                    //Elc.mapnode[i, j] = new MapNode(point_x, point_y, Node_number, point_type);
                    Elc.mapnode[i, j].X = point_x;
                    Elc.mapnode[i, j].Y = point_y;
                    point_x            += ConstDefine.g_NodeLength;
                }
                point_y += ConstDefine.g_NodeLength;
            }

            for (int i = 0; i < Elc.HeightNum; i++)
            {
                for (int j = 0; j < Elc.WidthNum; j++)
                {
                    drawArrow(i, j);

                    //绘制标尺
                    if (i == 0 || i == Elc.HeightNum - 1)
                    {
                        DrawUtil.FillRectangle(g, Color.FromArgb(180, 0, 0, 0), Elc.mapnode[i, j].X - 1, Elc.mapnode[i, j].Y - 1, ConstDefine.g_NodeLength - 2, ConstDefine.g_NodeLength - 2);
                        DrawUtil.DrawString(g, j, ConstDefine.g_NodeLength / 2, Color.Yellow, Elc.mapnode[i, j].X - 1, Elc.mapnode[i, j].Y - 1);
                    }
                    if (j == 0 || j == Elc.WidthNum - 1)
                    {
                        DrawUtil.FillRectangle(g, Color.FromArgb(180, 0, 0, 0), Elc.mapnode[i, j].X - 1, Elc.mapnode[i, j].Y - 1, ConstDefine.g_NodeLength - 2, ConstDefine.g_NodeLength - 2);
                        DrawUtil.DrawString(g, i, ConstDefine.g_NodeLength / 2, Color.Yellow, Elc.mapnode[i, j].X - 1, Elc.mapnode[i, j].Y - 1);
                    }
                }
            }
        }
예제 #16
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (Value != null)
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorStructuralElements;
                }
                else
                {
                    drawLocalFrame(args.Pipeline);
                }

                args.Pipeline.DrawBrepWires(Value, col, -1);
            }
        }
예제 #17
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (AdornedElement != null)
            {
                var screenPos = new Win32.POINT();
                if (Win32.GetCursorPos(ref screenPos))
                {
                    var pos = AdornedElement.PointFromScreen(new Point(screenPos.X + 10, screenPos.Y + 10));

                    var ft   = DrawUtil.DrawText(_tip, _fgBrush);
                    var rect = new Rect(pos.X, pos.Y, ft.Width + 10, ft.Height + 6);

                    drawingContext.DrawRectangle(_bgBrush, null, rect);
                    drawingContext.DrawText(ft, new Point(pos.X + 5, pos.Y + 3));
                }
            }
        }
예제 #18
0
        private void DrawTab_Document(Graphics g, DockContent content, Rectangle rect)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle rectText = rect;

            rectText.X     += DocumentTextExtraWidth / 2;
            rectText.Width -= DocumentTextExtraWidth;
            if (DockPane.ActiveContent == content)
            {
                DrawUtil.DrawTab(g, rect, Corners.RT, GradientType.Bell, ColorMixer.DarkColor, ColorMixer.LightColor, Color.Black, false);

//				g.FillRectangle(MainForm.DarkColor //ActiveBackBrush
//					, rect);
//				g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height);
//				g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X + rect.Width - 1, rect.Y);
//				g.DrawLine(OutlineInnerPen,
//					rect.X + rect.Width - 1, rect.Y,
//					rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
                if (DockPane.IsActiveDocumentPane)
                {
                    using (Font boldFont = new Font(this.Font, FontStyle.Bold))
                    {
                        g.DrawString(content.Text, boldFont, ActiveTextBrush, rectText, DocumentTextStringFormat);
                    }
                }
                else
                {
                    g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
                }
            }
            else
            {
                if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(content) + 1)
                {
                    g.DrawLine(TabSeperatorPen,
                               rect.X + rect.Width - 1, rect.Y,
                               rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - DocumentTabGapTop);
                }

                g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat);
            }
        }
예제 #19
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;

            g.CompositingQuality = CompositingQuality.HighQuality;
            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.AntiAlias;

            GraphicsPath path  = DrawUtil.CreateRoundedRectanglePath(new Rectangle(0, 0, Width, Height), Height / 4);
            Brush        brush = new SolidBrush(Color.FromArgb(210, 36, 33, 28));

            g.FillPath(brush, path);
            SizeF sizef = g.MeasureString(Content, Font);

            g.DrawString(Content, Font, Brushes.White, new RectangleF((Width - sizef.Width) / 2, (Height - sizef.Height) / 2, sizef.Width, sizef.Height));

            path.Dispose();
            brush.Dispose();
        }
예제 #20
0
        public void DrawViewportMeshes(GH_PreviewMeshArgs args)
        {
            if (Value != null)
            {
                System.Drawing.Color          col = args.Material.Diffuse;
                Rhino.Display.DisplayMaterial areaStrcMaterial = new Rhino.Display.DisplayMaterial(args.Material);
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorStructuralElements;

                    areaStrcMaterial.Diffuse      = col;
                    areaStrcMaterial.Specular     = col;
                    areaStrcMaterial.Emission     = col;
                    areaStrcMaterial.BackDiffuse  = col;
                    areaStrcMaterial.BackSpecular = col;
                    areaStrcMaterial.BackEmission = col;
                }

                args.Pipeline.DrawBrepShaded(Value, areaStrcMaterial);
            }
        }
예제 #21
0
        private void updateLocalFrameTransforms()
        {
            _localFrame.Transforms.Clear();

            var dz = DirectionLocalZ.IsTiny() ? -1 * Vector3d.ZAxis : DirectionLocalZ;

            if (DrawUtil.DensityFactorLocalFrame < 0.001)
            {
                double    p      = Value.Domain.ParameterAt(0.5);
                Point3d   pMid   = Value.PointAt(p);
                Vector3d  tMid   = Value.TangentAt(p);
                Transform tScale = Rhino.Geometry.Transform.Scale(Point3d.Origin, DrawUtil.ScaleFactorLocalFrame);
                Transform tOri   = TransformUtils.GetGlobalTransformLine(tMid, dz);
                Transform tTrans = Rhino.Geometry.Transform.Translation(new Vector3d(pMid));
                _localFrame.Transforms.Add(tTrans * tOri * tScale);
            }
            else
            {
                _localFrame.Transforms.AddRange(DrawUtil.GetCurveTransforms(Value, true, dz, null, DrawUtil.ScaleFactorLocalFrame, DrawUtil.DensityFactorLocalFrame));
            }
        }
예제 #22
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!_cplCond.isValid)
            {
                updateECoupling();
            }

            System.Drawing.Color col = args.Color;
            if (!DrawUtil.CheckSelection(col))
            {
                col = System.Drawing.Color.DarkViolet;
            }
            else
            {
                drawInfoPanel(args.Pipeline, args.Viewport);
            }

            _cplCond.Draw(args.Pipeline, col);
        }
        private PlayerNotification(string title, AsyncTexture2D icon, string message)
        {
            _icon = icon;

            Opacity          = 0f;
            Size             = new Point(NOTIFICATION_WIDTH, NOTIFICATION_HEIGHT);
            Location         = new Point(60, 60 + (NOTIFICATION_HEIGHT + 15) * _visibleNotifications);
            BasicTooltipText = "Right click to view profile";

            var wrappedTitle = DrawUtil.WrapText(Content.DefaultFont14, title, Width - NOTIFICATION_HEIGHT - 20 - 32);
            var titleLbl     = new Label
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, 0),
                Size     = new Point(Width - NOTIFICATION_HEIGHT - 10 - 32, Height / 2),
                Font     = Content.DefaultFont14,
                Text     = wrappedTitle
            };

            var wrapped    = DrawUtil.WrapText(Content.DefaultFont14, message, Width - NOTIFICATION_HEIGHT - 20 - 32);
            var messageLbl = new Label
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, Height / 2),
                Size     = new Point(Width - NOTIFICATION_HEIGHT - 10 - 32, Height / 2),
                Text     = wrapped
            };

            _visibleNotifications++;

            RightMouseButtonReleased += delegate
            {
                GameService.Overlay.BlishHudWindow.Show();
                GameService.Overlay.BlishHudWindow.Navigate(
                    KillProofModule.ModuleInstance.BuildKillProofPanel(GameService.Overlay.BlishHudWindow,
                                                                       new CommonFields.Player(null, title, 0, 0, false)));
                Dispose();
            };
        }
예제 #24
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);

            if (!_cplCond.isValid)
            {
                updateSpring();
            }

            System.Drawing.Color col = args.Color;
            if (!DrawUtil.CheckSelection(col))
            {
                col = DrawUtil.DrawColorSupports;
            }
            else
            {
                _cplCond.DrawInfo(args);
            }

            _cplCond.Draw(args.Pipeline, col);
        }
예제 #25
0
        protected override void Draw(int x, int y, bool active, ApplicationState state)
        {
            var maxTextWidth      = _items.Max(v => v.Title.Length);
            var maxComponentWidth = _items.Max(v => v.Component.Width);

            var width  = Math.Max(maxTextWidth + maxComponentWidth, _submit.Width) + 3;
            var height = _items.Select(v => v.Component.Height).Append(_submit.Height).Sum() + 2;

            if (!active)
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
            }
            DrawUtil.Outline(x, y, width, height, _title);

            var yOffset = 0;

            foreach (var item in _items)
            {
                var textSize = DrawUtil.MeasureText(item.Title);

                if (active)
                {
                    Console.ResetColor();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                }
                DrawUtil.Text(x + 1, y + yOffset + item.Component.Height / 2 + 1, $"{item.Title}:");
                item.Component.Render(state, x + maxTextWidth + 2, y + yOffset + 1);

                yOffset += Math.Max(textSize.Height, item.Component.Height);
            }

            _submit.Render(state, x + 1, yOffset + 1);

            DrawUtil.Text(x + _submit.Width + 2, yOffset + _submit.Height / 2 + 1, _result);
        }
예제 #26
0
        public void drawNoTransform(SpriteBatch sb)
        {
            //Draw line from ship to mouse
            if (shipLookingForDestination != null)
            {
                Color  lineColor   = Color.Red;
                Planet hoverPlanet = PlanetUtil.getPlanetMouseHoveringOver();

                if (hoverPlanet != null)
                {
                    if (PlanetUtil.isPlanetInRange(hoverPlanet, shipLookingForDestination))
                    {
                        lineColor = Color.Green;
                        InputHandler.Instance.tempMouseTexture = this.hoverPlanetSuccessText;
                    }
                    else
                    {
                        InputHandler.Instance.tempMouseTexture = this.hoverPlanetErrorText;
                    }
                }
                DrawUtil.drawLine(sb, shipLookingForDestination.getCollisionRectangle().Center.ToVector2(), input.pos, lineColor);
            }
        }
예제 #27
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null)) //if no point or, force AND moment are zero, nothing to draw
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                args.Pipeline.DrawPoint(Value.Location, Rhino.Display.PointStyle.X, 5, DrawUtil.DrawColorLoads);

                if (!(Forces.IsTiny() && Moments.IsTiny()) && DrawUtil.ScaleFactorLoads > 0.0001)
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
예제 #28
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //draw clippingbox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (!(Value is null))
            {
                System.Drawing.Color col = args.Color;
                if (!DrawUtil.CheckSelection(col))
                {
                    col = DrawUtil.DrawColorLoads;
                }
                args.Pipeline.DrawCurve(Value, DrawUtil.DrawColorLoads, args.Thickness + 1);

                if (DrawUtil.ScaleFactorLoads > 0.0001 && !(Forces.IsTiny() && Moments.IsTiny()))
                {
                    if (!_loadCondition.isValid)
                    {
                        updateLoadTransforms();
                    }
                    _loadCondition.Draw(args.Pipeline, col);
                }
            }
        }
예제 #29
0
 public void DrawMap()
 {
     for (int i = 0; i < Elc.HeightNum; i++)
     {
         for (int j = 0; j < Elc.WidthNum; j++)
         {
             drawArrow(i, j);
             //绘制标尺
             if (i == 0 || i == Elc.HeightNum - 1)
             {
                 int Y = (i == 0 ? 0 : Elc.mapnode[i, j].Y + ConstDefine.g_NodeLength);
                 DrawUtil.DrawString(g, j, ConstDefine.g_NodeLength / 2, Color.Yellow, Elc.mapnode[i, j].X - 1, Y);
             }
             if (j == 0 || j == Elc.WidthNum - 1)
             {
                 int X = (j == 0 ? 0 : Elc.mapnode[i, j].X + ConstDefine.g_NodeLength);
                 DrawUtil.DrawString(g, i, ConstDefine.g_NodeLength / 2, Color.Yellow, X, Elc.mapnode[i, j].Y - 1);
             }
             //绘制图标
             DrawIcon(i, j);
         }
     }
 }
예제 #30
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            //ClippingBox
            //args.Pipeline.DrawBox(ClippingBox, System.Drawing.Color.Black);
            if (Value != null)
            {
                System.Drawing.Color colStr = args.Color;
                System.Drawing.Color colSup = args.Color;
                if (!DrawUtil.CheckSelection(colStr))
                {
                    colStr = DrawUtil.DrawColorStructuralElements;
                    colSup = System.Drawing.Color.Black;
                }
                else
                {
                    drawLocalFrame(args.Pipeline);
                }

                args.Pipeline.DrawPoint(Value.Location, Rhino.Display.PointStyle.X, 5, colStr);

                drawSupportPoint(args.Pipeline, colSup, false);
            }
        }