Пример #1
0
        private void ShowFormSimulationScreen()
        {
            formSimulation = new FormSimulationScreen(scenariotest);
            formSimulation.StartPosition = FormStartPosition.Manual;
            formSimulation.Size          = pnlLayout1.Size;
            formSimulation.Location      = new Point(this.Location.X + 20, this.Location.Y + 134);

            formSimulation.Show(this);
        }
Пример #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();
        }
Пример #3
0
        public void goToSeat(int amount, List <System.Windows.Forms.Panel> users, Seat[,] seatList2, List <Customer> custs, FormSimulationScreen fss)
        {
            for (int i = 0; i < amount; i++)
            {
                if (users[i].Top < seatList2[custs[i].SeatRow, custs[i].SeatCol].PosY - seatList2[custs[i].SeatRow, custs[i].SeatCol].SHeight)
                {
                    if (i != 0 && users[i].Bottom >= users[i - 1].Top && users[i].Left >= users[i - 1].Left)
                    {
                        users[i].Top += 0;
                    }
                    else
                    {
                        users[i].Top += custs[i].Speed;
                    }
                }
                else
                {
                    if (users[i].Left < seatList2[custs[i].SeatRow, custs[i].SeatCol].PosX)
                    {
                        users[i].Left += 1;
                    }
                    else if (users[i].Left == seatList2[custs[i].SeatRow, custs[i].SeatCol].PosX)
                    {
                        //fss.timerSimulation.Stop();

                        while (users[i].Top < seatList2[custs[i].SeatRow, custs[i].SeatCol].PosY)
                        {
                            users[i].Top += 1;
                            if (users[i].Top == seatList2[custs[i].SeatRow, custs[i].SeatCol].PosY)
                            {
                                users[i].BringToFront();
                                seatCounter++;
                                System.Windows.Forms.Label test = ((FormSimulation)fss.Owner).lblFilledSeats;
                                test.Text = Convert.ToString(seatCounter);

                                //fss.timerSimulation.Stop();

                                if (i == amount - 1)
                                {
                                    FormSimulation.emergencyEnable = true;
                                    System.Windows.Forms.Timer timerSim = ((FormSimulation)fss.Owner).timer1;
                                    timerSim.Stop();
                                    //flag end timer when customer all seated
                                }
                            }
                        }
                    }
                }
            }
        }