Ejemplo n.º 1
0
        public Game(Login parentForm, string usernameArg)
        {
            InitializeComponent();
            loginForm = parentForm;
            username = usernameArg;
            questionEntryBox1.SetUsername(usernameArg);
            dropGrid.SetGridRange(7, 21, 21, 0);
            dropGrid.AllowDrop = true;
            dropGrid.SetGridVisibility(false);
            dropGrid.AddOccupyingPB(pictureBox2);
            dropGrid.DragDrop += new DragEventHandler(objectPlaced);
            BeginPanel.BringToFront();
            flowLayoutPanel1.HorizontalScroll.Visible = false;
            FormClosed += new FormClosedEventHandler(formClosed);
            PointsLabel.Text = "Points: " + points;

            UserDatabase userDB = new UserDatabase();
            QuestionButtonState buttonState = userDB.getQuestionButtonState(username);
            SetBiologyButtonsState(buttonState.biologyButtonEnabled);
            OtherSubjectTextBox.Text = buttonState.otherButtonLabel;
            SetOtherButtonState(buttonState.otherButtonEnabled);

            PlantDispenser.stock = 3;
            TapDispenser.stock = 4;
            FoodMachineDispenser.stock = 1;
            TorchDispenser.stock = 1;
        }
Ejemplo n.º 2
0
        private void LoadTimer_Tick(object sender, EventArgs e)
        {
            loadCounter += 50;

            LoadingBar.Increment((int)((4500000 / loadingBarTime) * Math.Abs(Math.Sin(loadCounter * oneRadian))));
            if (loadCounter - oneRadian == ((loadingBarTime / 500) * 50) - 50) // 500 ms before the loadingBarTime is up begin animation to finish loading bar progress
            {
                LoadingBar.Value = LoadingBar.Maximum;
                LoadingLabel.Text = "Loading Completed";
            }
            else if (loadCounter - oneRadian == 100 + ((loadingBarTime / 500) * 50)) // 1 second after the loadingBarTime is up switch to the new form
            {
                LoadTimer.Stop();
                Login loginForm = new Login();
                loginForm.FormClosed += new FormClosedEventHandler(loginFormClosed);
                loginForm.Show();
                this.Hide();
            }
            else if ((loadCounter - oneRadian) % 400 == 0 && LoadingLabel.Text != "Loading Completed")
            {
                ChangeLoadingLabel();
            }
        }