예제 #1
0
        GroupBox AgentBox(Agent agent, int yPoint)
        {
            GroupBox agentBox = new GroupBox();

            agentBox.Location = new Point(6, yPoint);
            agentBox.Size     = new Size(200, 55);

            PictureBox icon = new PictureBox();

            agentBox.Controls.Add(icon);
            icon.Location = new Point(4, 10);
            icon.SizeMode = PictureBoxSizeMode.Zoom;
            icon.Image    = IconPath.GetIcon(agent.currentJob.job);
            icon.Size     = new Size(40, 40);

            Label name = new Label();

            agentBox.Controls.Add(name);
            name.Location = new Point(50, 10);
            name.Text     = agent.name;

            ProgressBar bar = new ProgressBar();

            agentBox.Controls.Add(bar);
            bar.Location          = new Point(50, 32);
            bar.Size              = new Size(144, 12);
            agent.siteProgressBar = bar;

            return(agentBox);
        }
예제 #2
0
        public void UpdateAgent(Agent agent)
        {
            int index = agentList.IndexOf(agent);

            agentList[index] = agent;
            agentList[index].listBox.mainJob.Image   = IconPath.GetIcon(agent.mainJob.jobType);
            agentList[index].listBox.agentLabel.Text = agent.name;
        }
예제 #3
0
 private void OpenEdgeBox(Edge edge, Label label, Point point)
 {
     currentEdgeToEdit         = edge;
     groupBox_EdgeBox.Location = new Point(label.Location.X + point.X, label.Location.Y + point.Y);
     groupBox_EdgeBox.Show();
     numeric_Edge.Value            = edge.cost;
     pictureBox_EdgePointOne.Image = IconPath.GetIcon(edge.pointOne.nodeType);
     pictureBox_EdgePointTwo.Image = IconPath.GetIcon(edge.pointTwo.nodeType);
 }
예제 #4
0
        GroupBox SitePanel(Site site, int i)
        {
            GroupBox siteBox = new GroupBox();
            int      yPoint  = i > 0 ? (i * 75) + 3 : 3;

            siteBox.Location = new Point(3, yPoint);
            siteBox.Size     = new Size(235, 75);
            siteBox.Click   += new EventHandler(site.DisplaySiteInformation);

            PictureBox siteIcon = new PictureBox();

            siteBox.Controls.Add(siteIcon);
            siteIcon.Location = new Point(6, 11);
            siteIcon.Size     = new Size(30, 30);
            siteIcon.SizeMode = PictureBoxSizeMode.Zoom;
            siteIcon.Image    = IconPath.GetIcon(site.nodeType);

            Label siteName = new Label();

            siteBox.Controls.Add(siteName);
            siteName.Location = new Point(42, 11);
            siteName.Text     = site.name;

            Label workers = new Label();

            siteBox.Controls.Add(workers);
            workers.Location = new Point(42, 28);
            workers.BringToFront();
            workers.Size = new Size(70, 13);
            workers.Text = $"{site.currentAgents.Count}/{site.maxAgents}";

            int xPoint = 6;

            if (SiteHoldsOre(site.nodeType))
            {
                siteBox.Controls.Add(CreateMaterialBox(site, MaterialType.Ore, xPoint));
                xPoint += 57;
            }
            if (SiteHoldsIngot(site.nodeType))
            {
                siteBox.Controls.Add(CreateMaterialBox(site, MaterialType.Ingot, xPoint));
                xPoint += 57;
            }
            if (SiteHoldsWood(site.nodeType))
            {
                siteBox.Controls.Add(CreateMaterialBox(site, MaterialType.Wood, xPoint));
                xPoint += 57;
            }
            if (SiteHoldsPlank(site.nodeType))
            {
                siteBox.Controls.Add(CreateMaterialBox(site, MaterialType.Plank, xPoint));
            }

            return(siteBox);
        }
예제 #5
0
        //Creating the groupbox that will hold a summary of the agent's data
        GroupBox AgentPanel(Agent agent)
        {
            GroupBox agentBox = new GroupBox();
            int      yPoint   = agentList.Count > 1 ? ((agentList.Count - 1) * 70) + 3 : 3;

            agentBox.Location     = new Point(3, yPoint);
            agentBox.Size         = new Size(254, 70);
            agentBox.DoubleClick += agent.DisplayAgentInformation;
            agentBox.Click       += agent.AgentSelect;

            PictureBox mainJob = new PictureBox();

            agentBox.Controls.Add(mainJob);
            mainJob.Location = new Point(6, 13);
            mainJob.Size     = new Size(50, 50);
            mainJob.SizeMode = PictureBoxSizeMode.Zoom;
            mainJob.Image    = IconPath.GetIcon(agent.mainJob.jobType);

            Label agentLabel = new Label();

            agentBox.Controls.Add(agentLabel);
            agentLabel.Location = new Point(62, 16);
            agentLabel.Text     = agent.name;

            GroupBox progressBox = new GroupBox();

            agentBox.Controls.Add(progressBox);
            progressBox.Location = new Point(62, 31);
            progressBox.Size     = new Size(188, 32);
            progressBox.Hide();

            ProgressBar progressBar = new ProgressBar();

            progressBox.Controls.Add(progressBar);
            progressBar.Location = new Point(3, 10);
            progressBar.Size     = new Size(158, 17);

            PictureBox progressJob = new PictureBox();

            progressBox.Controls.Add(progressJob);
            progressJob.Location = new Point(165, 8);
            progressJob.Size     = new Size(20, 20);
            progressJob.SizeMode = PictureBoxSizeMode.Zoom;

            agent.listBox.agentBox    = agentBox;
            agent.listBox.mainJob     = mainJob;
            agent.listBox.agentLabel  = agentLabel;
            agent.listBox.progressBox = progressBox;
            agent.listBox.progressBar = progressBar;
            agent.listBox.progressJob = progressJob;

            return(agentBox);
        }
예제 #6
0
        public Form3(Site site)
        {
            InitializeComponent();

            this.site = site;
            ShowMaterialBoxes();

            pictureBox_Site.Image = IconPath.GetIcon(site.nodeType);
            label_SiteName.Text   = site.name;

            for (int i = 0; i < site.currentAgents.Count; i++)
            {
                int yPoint = i > 1 ? i * 56 : 19;
                groupBox_Agents.Controls.Add(AgentBox(site.currentAgents[i], yPoint));
            }
        }
예제 #7
0
        GroupBox CreateMaterialBox(Site site, MaterialType matType, int xPoint)
        {
            GroupBox materialBox = new GroupBox();

            materialBox.Location = new Point(xPoint, 42);
            materialBox.Size     = new Size(51, 27);

            PictureBox icon = new PictureBox();

            materialBox.Controls.Add(icon);
            icon.Location = new Point(1, 7);
            icon.Size     = new Size(20, 20);
            icon.SizeMode = PictureBoxSizeMode.Zoom;
            icon.Image    = IconPath.GetIcon(matType);

            Label count = new Label();

            materialBox.Controls.Add(count);
            count.Location = new Point(23, 10);
            count.Text     = "00";
            count.Font     = new Font(count.Font.FontFamily, 7);

            //Assigning material box so that it can be updated at runtime
            switch (matType)
            {
            case MaterialType.Wood:
                site.inventory.wood = new MaterialBox(materialBox, icon, count);
                break;

            case MaterialType.Plank:
                site.inventory.plank = new MaterialBox(materialBox, icon, count);
                break;

            case MaterialType.Ore:
                site.inventory.ore = new MaterialBox(materialBox, icon, count);
                break;

            case MaterialType.Ingot:
                site.inventory.ingot = new MaterialBox(materialBox, icon, count);
                break;
            }
            return(materialBox);
        }