コード例 #1
0
        public Customer(int customerID, int customerAmount, Hall hallChosen)
        {
            // Customer ID & Customer Amount
            this.customerID     = customerID;
            this.customerAmount = customerAmount;

            // instantiate hall object to access the Seats and Doors
            hall = hallChosen;
            hall.ConfigHall();
            seats = hall.Seats();
            doors = hall.Doors();

            // get the column and Row of the seats[,]
            seatRowCust = seats.GetLength(0); // get length from the first column [*,]
            seatColCust = seats.GetLength(1); // get length from the second column [,*]

            rand = new Random();
        }
コード例 #2
0
        public void StartSim(FormSimulationScreen fss)
        {
            this.fss = fss;
            hall1.ConfigHall();
            seatList2 = hall1.Seats();
            doors     = hall1.Doors();
            amount    = Convert.ToInt32(customerCount * seatList2.GetLength(1) * seatList2.GetLength(0));
            AssignCustomers(amount);
            AssignCustSeats();

            for (int i = 0; i < hall1.GetRow(); i++)
            {
                for (int j = 0; j < hall1.GetColumn(); j++)
                {
                    System.Windows.Forms.Panel p = new System.Windows.Forms.Panel();
                    p.Location  = new System.Drawing.Point(seatList2[i, j].PosX, seatList2[i, j].PosY);
                    p.Size      = new System.Drawing.Size(seatList2[i, j].SHeight, seatList2[i, j].SWidth);
                    p.BackColor = seatList2[i, j].SeatColor;

                    //System.Windows.Forms.Label l = new System.Windows.Forms.Label();
                    //l.Text = seatList2[i, j].SeatId;
                    //l.Font = new System.Drawing.Font("Arial", 4);
                    //l.TextAlign = System.Drawing.ContentAlignment.TopLeft;
#if DEBUG
                    p.Controls.Add(addlabel("Seats", i, j));
#endif
                    //Console.WriteLine(seatList2[i, j]);
                    fss.Controls.Add(p);
                }
            }

            for (int i = 0; i < hall1.GetDoorAmount(); i++)
            {
                System.Windows.Forms.Panel p = new System.Windows.Forms.Panel();
                p.Location  = new System.Drawing.Point(doors[i].PosX, doors[i].PosY);
                p.Size      = new System.Drawing.Size(doors[i].DWidth, doors[i].DHeight);
                p.BackColor = System.Drawing.Color.Purple;
                fss.Controls.Add(p);
            }
            GenerateCust();
        }