Ejemplo n.º 1
0
    public void UpdateTip(GameObject obj, string text, Vector3 vPosition, Color color, float alpha, float fscale)
    {
        TooltipContainer tipContainer = this.GetTipContainer(obj);

        if (tipContainer != null)
        {
            if (!tipContainer.tooltip.IsVisible)
            {
                tipContainer.tooltip.Show();
            }
            dfGUIManager manager      = tipContainer.tooltip.GetManager();
            Vector2      screenSize   = manager.GetScreenSize();
            Camera       renderCamera = manager.RenderCamera;
            Camera       main         = Camera.main;
            Vector3      position     = Camera.main.WorldToScreenPoint(vPosition);
            position.x  = screenSize.x * (position.x / main.pixelWidth);
            position.y  = screenSize.y * (position.y / main.pixelHeight);
            position    = (Vector3)manager.ScreenToGui(position);
            position.x -= (tipContainer.tooltip.Width / 2f) * tipContainer.tooltip.transform.localScale.x;
            position.y -= tipContainer.tooltip.Height * tipContainer.tooltip.transform.localScale.y;
            tipContainer.tooltip.RelativePosition = position;
            tipContainer.tooltip_label.Text       = text;
            tipContainer.tooltip_label.Color      = color;
            tipContainer.tooltip.Opacity          = alpha;
            tipContainer.lastSeen = Time.frameCount;
            tipContainer.target   = obj;
            tipContainer.tooltip.transform.localScale = new Vector3(fscale, fscale, fscale);
        }
    }
Ejemplo n.º 2
0
        public EventScroller()
        {
            InitializeComponent();

            comboBoxEnumControl1.EnumType              = typeof(TimePeriod);
            comboBoxEnumControl1.DefaultEnum           = TimePeriod.ONEHOUR;
            comboBoxEnumControl1.SelectedItem          = TimePeriod.ONEHOUR;
            comboBoxEnumControl1.SelectedIndexChanged += comboBoxEnumControl_SelectedIndexChanged;

            doubleBuffer1.MouseWheel += DoubleBuffer1_MouseWheel;
            doubleBuffer1.MouseClick += DoubleBuffer1_MouseClick;
            _timer = new Timer {
                Interval = 1000
            };
            _timer.Tick += Timer_Tick;
            _timer.Start();

            _ttC        = new TooltipContainer(doubleBuffer1);
            _dirtyTable = true;

            _t1 = DateTime.Now;
            _updateTimePeriod();

            Application.Idle += Application_Idle;
        }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();
            Application.AddMessageFilter(this);
            pictureBox1.MouseWheel += PictureBox1_MouseWheel;
            textBoxPickRadius.Text  = _pickRadius.ToString();
            textBoxMaxVect.Text     = _nVect.ToString();
            _stressTable            = new StressTable();
            _azimImage              = _buildAZIM(Color.FromArgb(100, Color.White));
            _azimImageUser          = _buildAZIM(Color.HotPink);
            _azimImageClose         = _buildAZIM(Color.Orange);
            pictureBox1.BackColor   = Color.Black;
            _layerMap         = new Layer(_paintMAP);
            _layerStress      = new Layer(_paintSTRESS);
            _layerDynamic1    = new Layer(_paintDYNAMIC1);
            _layerDynamic2    = new Layer(_paintDYNAMIC2);
            _activeTransBrush = new SolidBrush(Color.FromArgb(100, Color.Red));
            _radBrush         = new SolidBrush(Color.FromArgb(50, Color.White));
            _mapLinePen       = new Pen(Color.FromArgb(50, Color.LightSteelBlue));
            _mapThickPen      = new Pen(Color.FromArgb(200, Color.LightSteelBlue));
            _rwmap            = new WSMMap();
            _rwmap.Color(RegionInfo.CurrentRegion.EnglishName, Brushes.Orchid);
            _citiesMAJOR = new WSMCities(Properties.Resources.citiesMAJOR);
            _citiesALL   = new WSMCities(Properties.Resources.citiesALL);
            _ttC         = new TooltipContainer(pictureBox1);
            Width        = 1000;
            Height       = 1000;

            _mapLines();

            _updateProjection();
            toolStripDropDownButton1.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
        private void _drawBox(Graphics graphics, AR_PersectiveBox box, TooltipContainer ttC)
        {
            List <PointF> drawPt = new List <PointF>();

            foreach (var item in box.Points)
            {
                drawPt.Add(_data2screen(item));
            }
            Pen pen = new Pen(Color.SkyBlue); pen.DashStyle = DashStyle.Dot;

            graphics.DrawLine(Pens.LightBlue, drawPt[0], drawPt[1]);
            graphics.DrawLine(Pens.LightBlue, drawPt[2], drawPt[3]);
            graphics.DrawLine(pen, drawPt[1], drawPt[2]);
            graphics.DrawLine(pen, drawPt[0], drawPt[3]);
            if (box.VanishingPoint != null)
            {
                var vp = _data2screen(box.VanishingPoint);
                graphics.DrawLine(pen, vp, drawPt[0]);
                graphics.DrawLine(pen, vp, drawPt[1]);
                graphics.DrawLine(pen, vp, drawPt[2]);
                graphics.DrawLine(pen, vp, drawPt[3]);
            }

            int idx = -1;

            foreach (var item in drawPt)
            {
                idx++;
                RectangleF rect = new RectangleF(item.X - 2, item.Y - 2, 5f, 5f);
                graphics.DrawRectangle(Pens.DodgerBlue, rect);
                rect.Inflate(10, 10);
                ttC.Add(rect, null, idx);
            }
        }
 public override void CreateAdditionalTooltips(TooltipContainer tooltipContainer)
 {
     if (PreferencesManager.Instance.TipTooltipsEnabled)
     {
         TooltipUI tooltipUI = tooltipContainer.InstantiateTooltip("RequireFreeCapacity_Title");
         string    body      = "RequireFreeCapacity".Localize(new LocalizedIntegers(GetParamInt()));
         tooltipUI?.Set(null, body);
     }
 }
Ejemplo n.º 6
0
 public override void CreateAdditionalTooltips(TooltipContainer tooltipContainer)
 {
     if (PreferencesManager.Instance.TipTooltipsEnabled)
     {
         TooltipUI tooltipUI = tooltipContainer.InstantiateTooltip("MustPlayOnPyre_Title");
         string    body      = "MustPlayOnPyre".Localize();
         tooltipUI?.Set(null, body);
     }
 }
Ejemplo n.º 7
0
        private void _drawPoint(Graphics g, PointD pt, Brush br, TooltipContainer ttc)
        {
            if (pt == null)
            {
                return;
            }
            var        vp0   = _data2screen(pt);
            RectangleF rectA = new RectangleF(vp0.X - 2, vp0.Y - 2, 5f, 5f);

            g.FillRectangle(br, rectA);
            rectA.Inflate(3, 3);
            ttc.Add(rectA, null, pt);
        }
Ejemplo n.º 8
0
 private void Start()
 {
     Singleton = this;
     for (int i = 0; i < 0x10; i++)
     {
         TooltipContainer item = new TooltipContainer();
         GameObject       obj2 = (GameObject)Object.Instantiate(this.tooltipPrefab);
         obj2.transform.parent = base.transform;
         item.tooltip          = obj2.GetComponent <dfControl>();
         item.tooltip_label    = obj2.GetComponent <dfLabel>();
         item.lastSeen         = 0;
         this.tooltips.Add(item);
     }
 }
Ejemplo n.º 9
0
        public Form1()
        {
            InitializeComponent();

            appLocalPath = ApplicationNiceties.ApplicationSetup.CreateApplicationResourcesPath();
            //bm = new Bitmap(@"C:\Users\James\Documents\Visual Studio 2017\Projects\_JP_Hobby Apps\ArtRoom\ArtRoom\TestImages\FullSizeRender.jpg");
            // scrolledDoubleBuffer1.DataWidth = bm.Width;
            // scrolledDoubleBuffer1.DataHeight = bm.Height;
            scrolledDoubleBuffer1.DataWidth  = 1000;
            scrolledDoubleBuffer1.DataHeight = 1000;

            dbuffer             = scrolledDoubleBuffer1.DoubleBuffer;
            dbuffer.PaintEvent += DoubleBuffer_PaintEvent;
            dbuffer.MouseClick += Dbuffer_MouseClick;
            dbuffer.MouseDown  += Dbuffer_MouseDown;
            dbuffer.MouseMove  += Dbuffer_MouseMove;
            dbuffer.MouseUp    += Dbuffer_MouseUp;

            ddH            = new DragAndDropHelper(dbuffer);
            ddH.FileAction = dropFileAction;
            ddH.Extensions = new string[] { ".*" };

            ttC0 = new TooltipContainer(dbuffer);
            ttC1 = new TooltipContainer(dbuffer);
            ttcA = new TooltipContainer(dbuffer);

            // read settings
            lastFile = System.IO.Path.Combine(appLocalPath, "lastSettings");
            // default settings
            if (!readSettings(lastFile))
            {
                defaultSettings();
            }

            _uiUpdate();
            _geometryUpdate();
            scrolledDoubleBuffer1.Invalidate();
        }
Ejemplo n.º 10
0
        private void generateTest(bool cursorlessTooltip)
        {
            testContainer.Clear();

            CursorContainer cursor = null;

            if (!cursorlessTooltip)
            {
                cursor = new RectangleCursorContainer();
                testContainer.Add(cursor);
            }

            TooltipContainer ttc;

            testContainer.Add(ttc = new TooltipContainer(cursor)
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Container
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Children     = new[]
                        {
                            new TooltipBox
                            {
                                TooltipText = "Outer Tooltip",
                                Colour      = Color4.CornflowerBlue,
                                Size        = new Vector2(300, 300),
                                Anchor      = Anchor.Centre,
                                Origin      = Anchor.Centre
                            },
                            new TooltipBox
                            {
                                TooltipText = "Inner Tooltip",
                                Size        = new Vector2(150, 150),
                                Anchor      = Anchor.Centre,
                                Origin      = Anchor.Centre
                            },
                        }
                    },
                    new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Direction        = FillDirection.Vertical,
                        Spacing          = new Vector2(0, 10),
                        Children         = new Drawable[]
                        {
                            new TooltipSpriteText("this text has a tooltip!"),
                            new TooltipSpriteText("this one too!"),
                            new TooltipTextbox
                            {
                                Text = "with real time updates!",
                                Size = new Vector2(400, 30),
                            },
                            new TooltipContainer
                            {
                                AutoSizeAxes = Axes.Both,
                                Child        = new TooltipSpriteText("Nested tooltip; uses no cursor in all cases!"),
                            },
                            new TooltipTooltipContainer("This tooltip container has a tooltip itself!")
                            {
                                AutoSizeAxes = Axes.Both,
                                Child        = new Container
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Child        = new TooltipSpriteText("Nested tooltip; uses no cursor in all cases; parent TooltipContainer has a tooltip"),
                                }
                            },
                            new Container
                            {
                                Child = new FillFlowContainer
                                {
                                    Direction = FillDirection.Vertical,
                                    Spacing   = new Vector2(0, 8),
                                    Children  = new[]
                                    {
                                        new Container
                                        {
                                            Child = new Container
                                            {
                                                Child = new TooltipSpriteText("Tooltip within containers with zero size; i.e. parent is never hovered."),
                                            }
                                        },
                                        new Container
                                        {
                                            Child = new TooltipSpriteText("Other tooltip within containers with zero size; different nesting; overlap."),
                                        }
                                    }
                                }
                            }
                        },
                    }
                }
            });

            ttc.Add(makeBox(Anchor.BottomLeft));
            ttc.Add(makeBox(Anchor.TopRight));
            ttc.Add(makeBox(Anchor.BottomRight));
        }