コード例 #1
0
ファイル: ItemTab.cs プロジェクト: Stonemuzzle/Foreman
 public ItemTab(Item item, LinkType type, ProductionGraphViewer parent)
     : base(parent)
 {
     this.Item = item;
     this.Type = type;
     centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
 }
コード例 #2
0
 public AssemblerIconElement(MachinePermutation assembler, int number, ProductionGraphViewer parent)
     : base(parent)
 {
     DisplayedMachine       = assembler;
     DisplayedNumber        = number;
     centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
 }
コード例 #3
0
ファイル: ItemTab.cs プロジェクト: w-flo/foreman-pkg
		public ItemTab(Item item, LinkType type, ProductionGraphViewer parent)
			: base(parent)
		{
			this.Item = item;
			this.Type = type;
			centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
		}
コード例 #4
0
ファイル: RateOptionsPanel.cs プロジェクト: Rybadour/Foreman
        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;
            }
        }
コード例 #5
0
ファイル: ChooserPanel.cs プロジェクト: Rybadour/Foreman
        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();
        }
コード例 #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();
        }
コード例 #7
0
ファイル: NodeElement.cs プロジェクト: w-flo/foreman-pkg
		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;
		}
コード例 #8
0
ファイル: NodeElement.cs プロジェクト: Stonemuzzle/Foreman
        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;
        }
コード例 #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;
			}
		}
コード例 #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;
     }
 }
コード例 #11
0
ファイル: GraphElement.cs プロジェクト: Rybadour/Foreman
 public GraphElement(ProductionGraphViewer parent)
 {
     Parent = parent;
     Parent.Elements.Add(this);
     SubElements = new HashSet <GraphElement>();
 }
コード例 #12
0
 public AssemblerBox(ProductionGraphViewer parent)
     : base(parent)
 {
     AssemblerList = new Dictionary <MachinePermutation, int>();
 }
コード例 #13
0
ファイル: AssemblerBox.cs プロジェクト: w-flo/foreman-pkg
		public AssemblerBox(ProductionGraphViewer parent)
			: base(parent)
		{
			AssemblerList = new Dictionary<MachinePermutation, int>();
		}
コード例 #14
0
ファイル: LinkElement.cs プロジェクト: w-flo/foreman-pkg
		public LinkElement(ProductionGraphViewer parent, NodeLink displayedLink)
			: base(parent)
		{
			DisplayedLink = displayedLink;
		}
コード例 #15
0
ファイル: GraphElement.cs プロジェクト: w-flo/foreman-pkg
		public GraphElement(ProductionGraphViewer parent)
		{
			Parent = parent;
			Parent.Elements.Add(this);
			SubElements = new HashSet<GraphElement>();
		}
コード例 #16
0
ファイル: GhostNodeElement.cs プロジェクト: Rybadour/Foreman
 public GhostNodeElement(ProductionGraphViewer parent) : base(parent)
 {
     Width  = 96;
     Height = 96;
 }
コード例 #17
0
ファイル: AssemblerBox.cs プロジェクト: w-flo/foreman-pkg
		public AssemblerIconElement(MachinePermutation assembler, int number, ProductionGraphViewer parent)
			: base(parent)
		{
			DisplayedMachine = assembler;
			DisplayedNumber = number;
			centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center;
		}
コード例 #18
0
ファイル: ImageExportForm.cs プロジェクト: w-flo/foreman-pkg
		public ImageExportForm(ProductionGraphViewer graphViewer)
		{
			InitializeComponent();
			this.graphViewer = graphViewer;
		}
コード例 #19
0
 public LinkElement(ProductionGraphViewer parent, NodeLink displayedLink)
     : base(parent)
 {
     DisplayedLink = displayedLink;
 }
コード例 #20
0
 public ImageExportForm(ProductionGraphViewer graphViewer)
 {
     InitializeComponent();
     this.graphViewer = graphViewer;
 }
コード例 #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;
        }