Example #1
0
 public ItemTab(Item item, LinkType type, ProductionGraphViewer parent)
     : base(parent)
 {
     this.Item = item;
     this.Type = type;
     centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
 }
Example #2
0
 public AssemblerIconElement(MachinePermutation assembler, int number, ProductionGraphViewer parent)
     : base(parent)
 {
     DisplayedMachine       = assembler;
     DisplayedNumber        = number;
     centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
 }
Example #3
0
		public ItemTab(Item item, LinkType type, ProductionGraphViewer parent)
			: base(parent)
		{
			this.Item = item;
			this.Type = type;
			centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
		}
Example #4
0
        public RateOptionsPanel(ProductionNode baseNode, ProductionGraphViewer graphViewer)
        {
            InitializeComponent();

            BaseNode    = baseNode;
            GraphViewer = graphViewer;

            if (baseNode.rateType == RateType.Auto)
            {
                autoOption.Checked   = true;
                fixedTextBox.Enabled = false;
            }
            else
            {
                fixedOption.Checked  = true;
                fixedTextBox.Enabled = true;
            }

            float amountToShow = baseNode.desiredRate;

            if (GraphViewer.Graph.SelectedAmountType == AmountType.Rate)
            {
                fixedTextBox.Width = 65;
                unitLabel.Visible  = true;

                if (GraphViewer.Graph.SelectedUnit == RateUnit.PerMinute)
                {
                    amountToShow  *= 60;
                    unitLabel.Text = "/m";
                }
                else
                {
                    unitLabel.Text = "/s";
                }
            }
            else
            {
                unitLabel.Visible  = false;
                fixedTextBox.Width = 85;
            }
            fixedTextBox.Text = Convert.ToString(amountToShow);

            this.productivityBonusTextBox.Text = Convert.ToString(baseNode.ProductivityBonus);
            this.speedBonusTextBox.Text        = Convert.ToString(baseNode.SpeedBonus);

            if (GraphViewer.ShowAssemblers && baseNode is RecipeNode)
            {
                this.assemblerPanel.Visible = true;
                updateAssemblerButtons();
            }
            else
            {
                this.assemblerPanel.Visible = false;
            }
        }
Example #5
0
        public ChooserPanel(IEnumerable <ChooserControl> controls, ProductionGraphViewer parent)
            : base()
        {
            InitializeComponent();
            this.controls = controls.ToList();

            parent.Controls.Add(this);
            this.Location = new Point(parent.Width / 2 - Width / 2, parent.Height / 2 - Height / 2);
            this.Anchor   = AnchorStyles.None;
            this.BringToFront();
            parent.PerformLayout();

            FilterTextBox.Focus();
        }
Example #6
0
        public FloatingTooltipControl(Control control, Direction direction, Point graphLocation, ProductionGraphViewer parent)
        {
            Control       = control;
            Direction     = direction;
            GraphLocation = graphLocation;
            GraphViewer   = parent;

            parent.floatingTooltipControls.Add(this);
            parent.Controls.Add(control);
            Rectangle ttRect = parent.getTooltipScreenBounds(parent.GraphToScreen(graphLocation), new Point(control.Size), direction);

            control.Location = ttRect.Location;
            control.Focus();
        }
Example #7
0
		public NodeElement(ProductionNode node, ProductionGraphViewer parent) : base(parent)
		{
			Width = 100;
			Height = 90;

			DisplayedNode = node;

			if (DisplayedNode.GetType() == typeof(ConsumerNode))
			{
				backgroundColour = supplyColour;
			}
			else if (DisplayedNode.GetType() == typeof(SupplyNode))
			{
				backgroundColour = consumerColour;
			}
			else
			{
				backgroundColour = recipeColour;
			}
			backgroundBrush = new SolidBrush(backgroundColour);

			foreach (Item item in node.Inputs)
			{
				ItemTab newTab = new ItemTab(item, LinkType.Input, Parent);
				SubElements.Add(newTab);
				inputTabs.Add(newTab);
			}
			foreach (Item item in node.Outputs)
			{
				ItemTab newTab = new ItemTab(item, LinkType.Output, Parent);
				SubElements.Add(newTab);
				outputTabs.Add(newTab);
			}

			if (DisplayedNode is RecipeNode || DisplayedNode is SupplyNode)
			{
				assemblerBox = new AssemblerBox(Parent);
				SubElements.Add(assemblerBox); 
				assemblerBox.Height = assemblerBox.Width = 50;
			}

			centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
		}
Example #8
0
        public NodeElement(ProductionNode node, ProductionGraphViewer parent) : base(parent)
        {
            Width  = 100;
            Height = 90;

            DisplayedNode = node;

            if (DisplayedNode.GetType() == typeof(ConsumerNode))
            {
                backgroundColour = supplyColour;
            }
            else if (DisplayedNode.GetType() == typeof(SupplyNode))
            {
                backgroundColour = consumerColour;
            }
            else
            {
                backgroundColour = recipeColour;
            }
            backgroundBrush = new SolidBrush(backgroundColour);

            foreach (Item item in node.Inputs)
            {
                ItemTab newTab = new ItemTab(item, LinkType.Input, Parent);
                SubElements.Add(newTab);
                inputTabs.Add(newTab);
            }
            foreach (Item item in node.Outputs)
            {
                ItemTab newTab = new ItemTab(item, LinkType.Output, Parent);
                SubElements.Add(newTab);
                outputTabs.Add(newTab);
            }

            if (DisplayedNode is RecipeNode || DisplayedNode is SupplyNode)
            {
                assemblerBox = new AssemblerBox(Parent);
                SubElements.Add(assemblerBox);
                assemblerBox.Height = assemblerBox.Width = 50;
            }

            centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
        }
Example #9
0
		public DraggedLinkElement(ProductionGraphViewer parent, NodeElement startNode, LinkType startConnectionType, Item item)
			: base(parent)
		{
			if (startConnectionType == LinkType.Input)
			{
				ConsumerElement = startNode;
			}
			else
			{
				SupplierElement = startNode;
			}
			StartConnectionType = startConnectionType;
			Item = item;
			if ((Control.MouseButtons & MouseButtons.Left) != 0)
			{
				DragType = DragType.MouseDown;
			}
			else
			{
				DragType = DragType.MouseUp;
			}
		}
Example #10
0
 public DraggedLinkElement(ProductionGraphViewer parent, NodeElement startNode, LinkType startConnectionType, Item item)
     : base(parent)
 {
     if (startConnectionType == LinkType.Input)
     {
         ConsumerElement = startNode;
     }
     else
     {
         SupplierElement = startNode;
     }
     StartConnectionType = startConnectionType;
     Item = item;
     if ((Control.MouseButtons & MouseButtons.Left) != 0)
     {
         DragType = DragType.MouseDown;
     }
     else
     {
         DragType = DragType.MouseUp;
     }
 }
Example #11
0
 public GraphElement(ProductionGraphViewer parent)
 {
     Parent = parent;
     Parent.Elements.Add(this);
     SubElements = new HashSet <GraphElement>();
 }
Example #12
0
 public AssemblerBox(ProductionGraphViewer parent)
     : base(parent)
 {
     AssemblerList = new Dictionary <MachinePermutation, int>();
 }
Example #13
0
		public AssemblerBox(ProductionGraphViewer parent)
			: base(parent)
		{
			AssemblerList = new Dictionary<MachinePermutation, int>();
		}
Example #14
0
		public LinkElement(ProductionGraphViewer parent, NodeLink displayedLink)
			: base(parent)
		{
			DisplayedLink = displayedLink;
		}
Example #15
0
		public GraphElement(ProductionGraphViewer parent)
		{
			Parent = parent;
			Parent.Elements.Add(this);
			SubElements = new HashSet<GraphElement>();
		}
Example #16
0
 public GhostNodeElement(ProductionGraphViewer parent) : base(parent)
 {
     Width  = 96;
     Height = 96;
 }
Example #17
0
		public AssemblerIconElement(MachinePermutation assembler, int number, ProductionGraphViewer parent)
			: base(parent)
		{
			DisplayedMachine = assembler;
			DisplayedNumber = number;
			centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
		}
Example #18
0
		public ImageExportForm(ProductionGraphViewer graphViewer)
		{
			InitializeComponent();
			this.graphViewer = graphViewer;
		}
Example #19
0
 public LinkElement(ProductionGraphViewer parent, NodeLink displayedLink)
     : base(parent)
 {
     DisplayedLink = displayedLink;
 }
Example #20
0
 public ImageExportForm(ProductionGraphViewer graphViewer)
 {
     InitializeComponent();
     this.graphViewer = graphViewer;
 }
Example #21
0
        public NodeElement(ProductionNode node, ProductionGraphViewer parent) : base(parent)
        {
            Width  = 100;
            Height = 90;

            DisplayedNode = node;

            Color backgroundColour = missingColour;
            Color textColour       = darkTextColour;

            if (DisplayedNode is ConsumerNode)
            {
                backgroundColour = outputColour;

                if (((ConsumerNode)DisplayedNode).ConsumedItem.IsMissingItem)
                {
                    backgroundColour = missingColour;
                }
            }
            else if (DisplayedNode is SupplyNode)
            {
                backgroundColour = supplyColour;
                if (((SupplyNode)DisplayedNode).SuppliedItem.IsMissingItem)
                {
                    backgroundColour = missingColour;
                }
            }
            else if (DisplayedNode is RecipeNode)
            {
                backgroundColour = recipeColour;
                if (((RecipeNode)DisplayedNode).BaseRecipe.IsMissingRecipe)
                {
                    backgroundColour = missingColour;
                }
            }
            else if (DisplayedNode is PassthroughNode)
            {
                backgroundColour = passthroughColour;
                if (((PassthroughNode)DisplayedNode).PassedItem.IsMissingItem)
                {
                    backgroundColour = missingColour;
                }
            }
            else
            {
                Trace.Fail("No branch for node: " + DisplayedNode.ToString());
            }
            backgroundBrush = new SolidBrush(backgroundColour);
            textBrush       = new SolidBrush(textColour);

            foreach (Item item in node.Inputs)
            {
                ItemTab newTab = new ItemTab(item, LinkType.Input, Parent);
                SubElements.Add(newTab);
                inputTabs.Add(newTab);
            }
            foreach (Item item in node.Outputs)
            {
                ItemTab newTab = new ItemTab(item, LinkType.Output, Parent);
                SubElements.Add(newTab);
                outputTabs.Add(newTab);
            }

            if (DisplayedNode is RecipeNode || DisplayedNode is SupplyNode)
            {
                assemblerBox = new AssemblerBox(Parent);
                SubElements.Add(assemblerBox);
                assemblerBox.Height = assemblerBox.Width = 50;
            }

            centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
        }