Пример #1
0
        public new void Paint(Graphics graphics)
        {
            foreach (GraphElement element in GetPaintingOrder())
            {
                graphics.TranslateTransform(element.X, element.Y);
                element.Paint(graphics);
                graphics.TranslateTransform(-element.X, -element.Y);
            }

            foreach (var fttp in floatingTooltipControls)
            {
                TooltipInfo ttinfo = new TooltipInfo();
                ttinfo.ScreenLocation = GraphToScreen(fttp.GraphLocation);
                ttinfo.Direction      = fttp.Direction;
                ttinfo.ScreenSize     = new Point(fttp.Control.Size);
                AddTooltip(ttinfo);
            }

            graphics.ResetTransform();
            while (toolTipsToDraw.Any())
            {
                var tt = toolTipsToDraw.Dequeue();

                if (tt.Text != null)
                {
                    DrawTooltip(tt.ScreenLocation, tt.Text, tt.Direction, graphics);
                }
                else
                {
                    DrawTooltip(tt.ScreenLocation, tt.ScreenSize, tt.Direction, graphics);
                }
            }
        }
Пример #2
0
        public override void Paint(Graphics graphics)
        {
            GraphicsStuff.FillRoundRect(0, 0, Width, Height, 8, graphics, backgroundBrush);
            graphics.DrawString(text, size10Font, Brushes.White, Width / 2, Height / 2, centreFormat);

            if (editorBox != null)
            {
                TooltipInfo ttinfo = new TooltipInfo();
                ttinfo.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(editedItem));
                ttinfo.Direction      = Direction.Up;
                ttinfo.ScreenSize     = new Point(editorBox.Size);
                Parent.AddTooltip(ttinfo);
            }

            base.Paint(graphics);
        }
Пример #3
0
        public override void MouseMoved(Point location)
        {
            if (editorBox == null)
            {
                ItemTab mousedTab = null;
                foreach (ItemTab tab in SubElements.OfType <ItemTab>())
                {
                    if (tab.bounds.Contains(location))
                    {
                        mousedTab = tab;
                    }
                }

                TooltipInfo tti = new TooltipInfo();
                if (mousedTab != null)
                {
                    tti.Text = mousedTab.Item.FriendlyName;
                    if (mousedTab.Type == LinkType.Input)
                    {
                        if (DisplayedNode is ConsumerNode)
                        {
                            tti.Text += "\nClick to edit desired amount";
                        }
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Up;
                        tti.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(mousedTab.Item));
                    }
                    else
                    {
                        tti.Text           = mousedTab.Item.FriendlyName;
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Down;
                        tti.ScreenLocation = Parent.GraphToScreen(GetOutputLineConnectionPoint(mousedTab.Item));
                    }
                    Parent.AddTooltip(tti);
                }
                else if (DisplayedNode is RecipeNode)
                {
                    tti.Direction      = Direction.Left;
                    tti.ScreenLocation = Parent.GraphToScreen(Point.Add(Location, new Size(Width, Height / 2)));
                    tti.Text           = String.Format("Recipe: {0}", (DisplayedNode as RecipeNode).BaseRecipe.FriendlyName);
                    tti.Text          += String.Format("\n--Base Time: {0}s", (DisplayedNode as RecipeNode).BaseRecipe.Time);
                    tti.Text          += String.Format("\n--Base Ingredients:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Ingredients)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    tti.Text += String.Format("\n--Base Results:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Results)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    if (Parent.ShowAssemblers)
                    {
                        tti.Text += String.Format("\n\nAssemblers:");
                        foreach (var kvp in assemblerBox.AssemblerList)
                        {
                            tti.Text += String.Format("\n----{0} ({1})", kvp.Key.assembler.FriendlyName, kvp.Value.ToString());
                            foreach (var Module in kvp.Key.modules)
                            {
                                tti.Text += String.Format("\n------{0}", Module.FriendlyName);
                            }
                        }
                    }
                    Parent.AddTooltip(tti);
                }
            }
        }
Пример #4
0
 //Tooltips added with this method will be drawn the next time the graph is repainted.
 public void AddTooltip(TooltipInfo info)
 {
     toolTipsToDraw.Enqueue(info);
 }
Пример #5
0
		public override void MouseMoved(Point location)
		{
			if (editorBox == null)
			{
				ItemTab mousedTab = null;
				foreach (ItemTab tab in SubElements.OfType<ItemTab>())
				{
					if (tab.bounds.Contains(location))
					{
						mousedTab = tab;
					}
				}

				TooltipInfo tti = new TooltipInfo();
				if (mousedTab != null)
				{
					tti.Text = mousedTab.Item.FriendlyName;
					if (mousedTab.Type == LinkType.Input)
					{
						if (DisplayedNode is ConsumerNode)
						{
							tti.Text += "\nClick to edit desired amount";
						}
						tti.Text += "\nDrag to create a new connection";
						tti.Direction = Direction.Up;
						tti.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(mousedTab.Item));
					}
					else
					{
						tti.Text = mousedTab.Item.FriendlyName;
						tti.Text += "\nDrag to create a new connection";
						tti.Direction = Direction.Down;
						tti.ScreenLocation = Parent.GraphToScreen(GetOutputLineConnectionPoint(mousedTab.Item));
					}
					Parent.AddTooltip(tti);
				}
				else if (DisplayedNode is RecipeNode)
				{
					tti.Direction = Direction.Left;
					tti.ScreenLocation = Parent.GraphToScreen(Point.Add(Location, new Size(Width, Height / 2)));
					tti.Text = String.Format("Recipe: {0}", (DisplayedNode as RecipeNode).BaseRecipe.FriendlyName);
					tti.Text += String.Format("\n--Base Time: {0}s", (DisplayedNode as RecipeNode).BaseRecipe.Time);
					tti.Text += String.Format("\n--Base Ingredients:");
					foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Ingredients)
					{
						tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
					}
					tti.Text += String.Format("\n--Base Results:");
					foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Results)
					{
						tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
					}
					if (Parent.ShowAssemblers)
					{
						tti.Text += String.Format("\n\nAssemblers:");
						foreach(var kvp in assemblerBox.AssemblerList)
						{
							tti.Text += String.Format("\n----{0} ({1})", kvp.Key.assembler.FriendlyName, kvp.Value.ToString());
							foreach (var Module in kvp.Key.modules)
							{
								tti.Text += String.Format("\n------{0}", Module.FriendlyName);
							}
						}
					}
					Parent.AddTooltip(tti);
				}
			}
		}
Пример #6
0
		public override void Paint(Graphics graphics)
		{
			GraphicsStuff.FillRoundRect(0, 0, Width, Height, 8, graphics, backgroundBrush);
			graphics.DrawString(text, size10Font, Brushes.White, Width / 2, Height / 2, centreFormat);

			if (editorBox != null)
			{
				TooltipInfo ttinfo = new TooltipInfo();
				ttinfo.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(editedItem));
				ttinfo.Direction = Direction.Up;
				ttinfo.ScreenSize = new Point(editorBox.Size);
				Parent.AddTooltip(ttinfo);
			}

			base.Paint(graphics);
		}
Пример #7
0
		//Tooltips added with this method will be drawn the next time the graph is repainted.
		public void AddTooltip(TooltipInfo info)
		{
			toolTipsToDraw.Enqueue(info);
		}
Пример #8
0
        public override void MouseMoved(Point location)
        {
            ItemTab mousedTab = null;

            foreach (ItemTab tab in SubElements.OfType <ItemTab>())
            {
                if (tab.bounds.Contains(location))
                {
                    mousedTab = tab;
                }
            }

            if (tooltipsEnabled)
            {
                TooltipInfo tti = new TooltipInfo();
                if (mousedTab != null)
                {
                    tti.Text = mousedTab.Item.FriendlyName;
                    if (mousedTab.Type == LinkType.Input)
                    {
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Up;
                        tti.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(mousedTab.Item));
                    }
                    else
                    {
                        tti.Text           = mousedTab.Item.FriendlyName;
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Down;
                        tti.ScreenLocation = Parent.GraphToScreen(GetOutputLineConnectionPoint(mousedTab.Item));
                    }
                    Parent.AddTooltip(tti);
                }
                else if (DisplayedNode is RecipeNode)
                {
                    tti.Direction      = Direction.Left;
                    tti.ScreenLocation = Parent.GraphToScreen(Point.Add(Location, new Size(Width, Height / 2)));
                    tti.Text           = String.Format("Recipe: {0}", (DisplayedNode as RecipeNode).BaseRecipe.FriendlyName);
                    tti.Text          += String.Format("\n--Base Time: {0}s", (DisplayedNode as RecipeNode).BaseRecipe.Time);
                    tti.Text          += String.Format("\n--Base Ingredients:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Ingredients)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    tti.Text += String.Format("\n--Base Results:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Results)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    if (Parent.ShowAssemblers)
                    {
                        tti.Text += String.Format("\n\nAssemblers:");
                        foreach (var kvp in assemblerBox.AssemblerList)
                        {
                            tti.Text += String.Format("\n----{0} ({1})", kvp.Key.assembler.FriendlyName, kvp.Value.ToString());
                            foreach (var Module in kvp.Key.modules.Where(m => m != null))
                            {
                                tti.Text += String.Format("\n------{0}", Module.FriendlyName);
                            }
                        }
                    }

                    if (Parent.Graph.SelectedAmountType == AmountType.FixedAmount)
                    {
                        tti.Text += String.Format("\n\nCurrent iterations: {0}", DisplayedNode.actualRate);
                    }
                    else
                    {
                        tti.Text += String.Format("\n\nCurrent Rate: {0}/{1}",
                                                  Parent.Graph.SelectedUnit == RateUnit.PerMinute ? DisplayedNode.actualRate / 60 : DisplayedNode.actualRate,
                                                  Parent.Graph.SelectedUnit == RateUnit.PerMinute ? "m" : "s");
                    }
                    Parent.AddTooltip(tti);
                }

                TooltipInfo helpToolTipInfo = new TooltipInfo();
                helpToolTipInfo.Text           = "Left click on this node to edit how fast it runs\nRight click to delete it";
                helpToolTipInfo.Direction      = Direction.None;
                helpToolTipInfo.ScreenLocation = new Point(10, 10);
                Parent.AddTooltip(helpToolTipInfo);
            }
        }