예제 #1
0
파일: Elevator.cs 프로젝트: Brares/Projects
 public void Closing()
 {
     if (++imagePnt <= (images.Count) - 1)
     {
         mainImage.Image = images[imagePnt].Image;
     }
     else
     {
         EVState = ElevState.prep_moving;
     }
 }
예제 #2
0
파일: Elevator.cs 프로젝트: Brares/Projects
 public void Opening()
 {
     if (++imagePnt <= ((images.Count) - 1) / 2)
     {
         mainImage.Image = images[imagePnt].Image;
     }
     else
     {
         EV_Floor = EV_New_Floor;
         EVState  = ElevState.waiting;
     }
 }
예제 #3
0
파일: Elevator.cs 프로젝트: Brares/Projects
        public Elevator(int x, int y)
        {
            mainImage.Image    = images[40].Image;
            mainImage.SizeMode = PictureBoxSizeMode.AutoSize;
            mainImage.Left     = x;
            mainImage.Top      = y;

            floor           = new ComboBox();
            floor.Left      = x;
            floor.Top       = y + mainImage.Height;
            floor.Width     = mainImage.Width + 10;
            floor.Height    = mainImage.Height;
            floor.BackColor = System.Drawing.Color.Orange;
            floor.ForeColor = System.Drawing.Color.Black;

            lblfloor           = new Label();
            lblfloor.Text      = "Lobby";
            lblfloor.BackColor = Color.White;
            lblfloor.Width     = mainImage.Width + 8;
            lblfloor.Left      = x;
            lblfloor.Top       = y - lblfloor.Height;


            floor.Items.Add("Lobby");
            floor.Items.Add("Floor 2");
            floor.Items.Add("Floor 3");
            floor.Items.Add("Floor 4");
            floor.Items.Add("Floor 5");
            floor.Items.Add("Floor 6");
            floor.Items.Add("Floor 7");
            floor.Items.Add("Floor 8");
            floor.Items.Add("Floor 9");
            floor.Items.Add("Floor 10");

            pForm.Controls.Add(floor);
            pForm.Controls.Add(lblfloor);

            player = new SoundPlayer();
            player.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "\\Elevator-music.wav";

            EVState = ElevState.waiting;

            myTimer.Tick += MyTimer_Tick;
        }
예제 #4
0
파일: Elevator.cs 프로젝트: Brares/Projects
 public void Moving()
 {
     if (mainImage.Top > EV_New_Y)
     {
         EV_Y--;
         mainImage.Top--;
         lblfloor.Text = ReturnFloor();
     }
     else if (mainImage.Top < EV_New_Y)
     {
         EV_Y++;
         mainImage.Top++;
         lblfloor.Text = ReturnFloor();
     }
     else
     {
         player.Stop();
         EVState = ElevState.prep_opening;
     }
 }
예제 #5
0
파일: Elevator.cs 프로젝트: Brares/Projects
 private void floor_SelectedIndexChanged(object sender, EventArgs e)
 {
     EVState = ElevState.prep_closing;
 }
예제 #6
0
파일: Elevator.cs 프로젝트: Brares/Projects
        private void MyTimer_Tick(object sender, EventArgs e)
        {
            switch (EVState)
            {
            case ElevState.waiting:
                imagePnt = 40;
                floor.SelectedIndexChanged += new System.EventHandler(floor_SelectedIndexChanged);

                break;

            case ElevState.prep_closing:
                imagePnt = 40;

                EVState = ElevState.closing;

                break;

            case ElevState.closing:

                Closing();

                break;

            case ElevState.prep_moving:
                EV_New_Floor = floor.SelectedIndex;
                imagePnt     = 0;

                if (EV_New_Floor != EV_Floor)
                {
                    EV_New_Y = (int)replaceValues[EV_New_Floor.ToString()];
                    player.PlayLooping();
                    EVState = ElevState.moving;
                }
                else
                {
                    EVState = ElevState.prep_opening;
                }


                break;

            case ElevState.moving:


                Moving();

                break;

            case ElevState.prep_opening:

                imagePnt = 0;
                EVState  = ElevState.opening;

                break;

            case ElevState.opening:

                Opening();

                break;
            }
        }