Beispiel #1
0
 void ReleaseDesignerOutlets()
 {
     if (ButtonContinue != null)
     {
         ButtonContinue.Dispose();
         ButtonContinue = null;
     }
     if (LabelQuestNumber != null)
     {
         LabelQuestNumber.Dispose();
         LabelQuestNumber = null;
     }
 }
Beispiel #2
0
        public void BattleUpdate(GameTime gameTime)
        {
            if (!GameIsEnd)
            {
                Level.Text = "Уровень " + (CurrentLevel + 1).ToString();
            }

            if (CurrentLevel == 2 && TimeIsRemind && !LevelIsEnd)
            {
                TimeRemind   = 20;
                TimerRemind  = new ProgramTimer(20);
                TimeIsRemind = false;
            }
            if (TimerRemind != null && !LevelIsEnd)
            {
                TimerRemind.Update(gameTime);
                TimeRemindLabel.Text = Convert.ToString(TimeRemind - TimerRemind.GetSS());

                if (TimerRemind.isEnd)
                {
                    Hero.HP = 0;
                }
            }


            ButtonContinue.Update(gameTime);
            ButtonSaveAndExit.Update(gameTime);

            if (!LevelIsEnd)
            {
                ButtonContinue.Visible    = false;
                ButtonSaveAndExit.Visible = false;

                if (Hero.isDeath)
                {
                    //Поражение

                    ButtonSaveAndExit.Visible = true;

                    if (ButtonSaveAndExit.ButtonUp)
                    {
                        SaveResult();
                        RestartGame();
                    }

                    Enemy.CurrentFrame = 0;
                    GameIsEnd          = true;
                }
                else
                {
                    //Обновление состояния Бафов
                    for (int i = 0; i < Skill.Length; i++)
                    {
                        BuffUpdate(Skill[i], gameTime);
                    }

                    GameTimer.Update(gameTime);
                    Hero.Update(Window, gameTime);

                    if (Hero.State == 3)
                    {
                        if (SoundOnes)
                        {
                            MediaPlayer.Pause();
                            HeroDeath.Play();
                            SoundOnes = false;
                        }
                    }

                    if (Hero.onJump)
                    {
                        Hero.State = 4;
                        Hero.Jump();
                    }

                    if (Hero.State == 2)
                    {
                        Hero.Animate(gameTime);
                    }

                    //протиуник может умереть от шота
                    if (Enemy.HP <= 0 && Enemy.State != 3)
                    {
                        GoldCount.Text     = (Convert.ToInt32(GoldCount.Text) + 1).ToString();
                        Enemy.State        = 3;
                        Enemy.CurrentFrame = 0;
                        Enemy.CurrentTime  = 0;
                    }

                    if (Enemy.State != 3)
                    {
                        CanRunLeft = CanRunRight = true;

                        // Взаимодействие персонажа и противника
                        if (Enemy.Rectangle.Intersects(Hero.Rectangle))
                        {
                            CheckRun();
                            Enemy.DoAttack(Window, gameTime);
                            if (Enemy.CurrentFrame == 11 && Enemy.State == 2) //При завершении анимации заверщаем удар
                            {
                                EnemyAttack.Play();
                                if (Enemy.Attack > Hero.Def)
                                {
                                    Hero.HP -= Enemy.Attack - Hero.Def;
                                }
                                else
                                {
                                    Hero.HP--;
                                }

                                StatHero.Stats.Text = Hero.HP + "    " + Hero.MP + "       " + Hero.Attack + "            " + Hero.Def + "               " + Hero.Speed + "                 " + Hero.AttackSpeed;
                                Enemy.CurrentFrame  = 0;
                            }
                            if (Hero.CurrentFrame == 11 && Hero.State == 2) //При завершении анимации заверщаем удар
                            {
                                HeroAttack.Play();
                                if (Hero.Attack > Enemy.Def)
                                {
                                    Enemy.HP -= Hero.Attack - Enemy.Def;
                                }
                                else
                                {
                                    Enemy.HP--;
                                }
                                Hero.CurrentFrame = 0;
                                if (Enemy.HP <= 0)
                                {
                                    GoldCount.Text = (Convert.ToInt32(GoldCount.Text) + 1).ToString();
                                    Enemy.State    = 3;
                                }
                            }
                        }
                        else
                        {
                            CheckRotate();
                            Enemy.DoMove(Window, gameTime);
                        }
                    }
                    else
                    {
                        Enemy.Animate(gameTime);
                    }
                }
            }
            else
            {
                //Уровень завершен
                if (SoundOnes)
                {
                    MediaPlayer.Play(SoundWin);

                    if (!GameIsEnd)
                    {
                        ButtonContinue.Visible = true;
                    }
                    ButtonSaveAndExit.Visible = true;

                    SoundOnes = false;
                }

                if (ButtonContinue.ButtonUp)
                {
                    MediaPlayer.Play(MainTheme);
                    WindowState = WindowState.Skill;
                    SkillWindow.SkillPoint++;
                    LevelIsEnd = false;
                    SoundOnes  = true;
                }

                if (ButtonSaveAndExit.ButtonUp)
                {
                    SaveResult();
                    RestartGame();
                }
            }

            //Обновлняем статы персонажекй
            StatTextUpdate();

            base.Update(gameTime);

            //Если противник умер и произошла анимация падения
            if (Enemy.State == 3 && Enemy.CurrentFrame == 11)
            {
                NextEnemy(gameTime);
            }
        }
Beispiel #3
0
        protected override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();

            if (WindowState == WindowState.Start)
            {
                StartWindow.Draw(spriteBatch, Window);
            }

            if (WindowState == WindowState.Skill)
            {
                SkillWindow.Draw(spriteBatch, Window);
            }

            if (WindowState == WindowState.Battle)
            {
                spriteBatch.Draw(Bg.Texture, Bg.Rectangle, Color.White);
                spriteBatch.Draw(GoldPanel.Texture, GoldPanel.Rectangle, Color.White);
                spriteBatch.Draw(TimePanel.Texture, TimePanel.Rectangle, Color.White);
                if (CurrentLevel == 2)
                {
                    spriteBatch.Draw(RemindPanel.Texture, RemindPanel.Rectangle, Color.White);
                    TimeRemindLabel.Draw(spriteBatch, Color.White);
                }

                for (int i = 0; i < Skill.Length; i++)
                {
                    Skill[i].Draw(spriteBatch, Window);
                }

                Hero.Draw(spriteBatch);
                if (!LevelIsEnd)
                {
                    Enemy.Draw(spriteBatch);
                }

                GameTimer.Draw(spriteBatch, Color.White);
                GoldCount.Draw(spriteBatch, Color.White);
                Level.Draw(spriteBatch, Color.White);

                if (LevelIsEnd || GameIsEnd)
                {
                    if (Hero.isDeath)
                    {
                        spriteBatch.Draw(DeathMessage.Texture, DeathMessage.Rectangle, Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(WinMessage.Texture, WinMessage.Rectangle, Color.White);
                    }
                }

                StatHero.Title.Draw(spriteBatch);
                StatHero.Stats.Draw(spriteBatch);

                StatEnemy.Title.Draw(spriteBatch);
                StatEnemy.Stats.Draw(spriteBatch);

                ButtonContinue.Draw(spriteBatch, Window);
                ButtonSaveAndExit.Draw(spriteBatch, Window);
            }

            if (WindowState == WindowState.Record)
            {
                RecordWindow.Draw(spriteBatch, Window);
            }

            base.Draw(gameTime);

            spriteBatch.End();
        }
Beispiel #4
0
        public void TaoBussiness(string mail)
        {
            driver.Navigate().GoToUrl("https://business.facebook.com/overview");
            if (library.IsAjaxLoaded() && library.IsLoadingComplete())
            {
                try
                {
                    if (library.ElementIsVisible(ButtonTaoTaiKhoan))
                    {
                        ButtonTaoTaiKhoan.Click();
                    }
                    else if (library.ElementIsVisible(ButtonTaoTaiKhoanDaCo))
                    {
                        ButtonTaoTaiKhoanDaCo.Click();
                    }
                }
                catch (Exception ex)
                {
                    Email = "Lỗi tạo tài khoản!!";
                    driver.Close();
                    return;
                }
                if (library.ElementsIsVisible(By.XPath("//input[@class='_4b7k _4b7k_big _53rs']")))
                {
                    string[] str = CompanyInfo[1].GetAttribute("value").ToString().Split('0');
                    try
                    {
                        string strName = str.Length > 1 ? str[0] + " 0" + int.Parse(str[1]).ToString() + 1 : str[0] + " 01";
                        if (library.ElementIsVisible(CompanyForm[0]))
                        {
                            CompanyInfo[0].SendKeys(strName);
                        }
                        if (library.ElementIsVisible(CompanyForm[2]))
                        {
                            CompanyInfo[2].SendKeys(mail);
                        }
                    }
                    catch
                    {
                        CompanyInfo[0].SendKeys(CompanyInfo[1].GetAttribute("value").ToString());
                        CompanyInfo[2].SendKeys(mail);
                    }
                    if (library.ElementIsVisible(ButtonContinue))
                    {
                        ButtonContinue.Click();
                        if (
                            library.IsAjaxLoaded() && library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//div//div//div//div//label//input[@class='_4b7k _4b7k_big _53rs']")))
                        {
                            // Input form

                            if (library.ElementIsVisible(CompanyForm[1]))
                            {
                                CompanyForm[1].SendKeys(RandomString(20));
                            }
                            if (library.ElementIsVisible(CompanyForm[2]))
                            {
                                CompanyForm[2].SendKeys(RandomString(20));
                            }
                            if (library.ElementIsVisible(CompanyForm[3]))
                            {
                                CompanyForm[3].SendKeys(RandomString(20));
                            }
                            if (library.ElementIsVisible(CompanyForm[4]))
                            {
                                CompanyForm[4].SendKeys(RandomString(20));
                            }
                            if (library.ElementIsVisible(CompanyForm[5]))
                            {
                                CompanyForm[5].SendKeys("0385102879");
                            }
                            if (library.ElementIsVisible(CompanyForm[6]))
                            {
                                CompanyForm[6].SendKeys("https://www.24h.com.vn/");
                            }
                            if (library.ElementIsVisible(CompanyForm[0]))
                            {
                                CompanyForm[0].SendKeys(RandomString(20));
                            }
                            if (library.ElementIsVisible(ButtomCombobox))
                            {
                                ButtomCombobox.Click();

                                if (library.ElementIsVisible(CountryText))
                                {
                                    CountryText.SendKeys("Vi");
                                    if (library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//span//div//div//div//div//div//div")))
                                    {
                                        if (library.IsAjaxLoaded() && library.ElementIsVisible(ListCountry[0]))
                                        {
                                            ListCountry[0].Click();
                                        }
                                    }
                                    else
                                    {
                                        Email = "Chọn quốc gia thất bại";
                                        driver.Close();
                                        return;
                                    }
                                }
                                else
                                {
                                    Email = "Chọn quốc gia thất bại";
                                    driver.Close();
                                    return;
                                }
                            }
                            else
                            {
                                Email = "Chọn quốc gia thất bại";
                                driver.Close();
                                return;
                            }
                            if (library.ElementsIsVisible(By.XPath("//div//span//div//div//button")))
                            {
                                if (library.ElementIsVisible(ButtonSubmit[1]))
                                {
                                    ButtonSubmit[1].Click();
                                    if (library.IsAjaxLoaded() && library.IsLoadingComplete() && library.IsLoadingComplete())
                                    {
                                        if (library.ElementIsVisible(ButtonFinish))
                                        {
                                            ButtonFinish.Click();
                                        }
                                        if (library.IsAjaxLoaded() && library.IsLoadingComplete())
                                        {
                                            Email = "Thành công!!";
                                            // driver.Close();
                                            // Console.WriteLine("12312");
                                            // TO BE CONTINUE.
                                        }
                                    }
                                }
                                else
                                {
                                    Email = "Gửi submit thất bại!!";
                                    driver.Close();
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        Email = "Click tiếp tục thất bại";
                        driver.Close();
                        return;
                    }
                }
                else
                {
                    Email = "Nhập thông tin BM thất bại";
                    driver.Close();
                    return;
                }
            }
            else
            {
                Email = "Tài khoản đã được tạo";
                driver.Close();
                return;
            }
        }
Beispiel #5
0
 public HomePage ClickButtonContinue()
 {
     ButtonContinue.Click();
     return(new HomePage());
 }
Beispiel #6
0
 public void ClickButtonContinue()
 {
     ButtonContinue.Click();
 }