예제 #1
0
파일: Army.cs 프로젝트: Edrenn/Clickers
        public void GenerateHero()
        {
            Random random = new Random();
            MySQLManager <Hero> MyHeroSQLManager = new MySQLManager <Hero>();
            Hero      newHero      = null;
            MySQLHero heroSQL      = new MySQLHero();
            int       testTypeHero = random.Next(0, 40);

            if (testTypeHero <= 10)
            {
                Task <Hero> TaskHero = MyHeroSQLManager.Get(1);
                newHero = TaskHero.Result;
                newHero = heroSQL.GetSkills(newHero);
            }
            else if (testTypeHero >= 20 && testTypeHero < 30)
            {
                Task <Hero> TaskHero = MyHeroSQLManager.Get(2);
                newHero = TaskHero.Result;
                newHero = heroSQL.GetSkills(newHero);
            }
            else if (testTypeHero > 40)
            {
            }
            else
            {
                Task <Hero> TaskHero = MyHeroSQLManager.Get(3);
                newHero = TaskHero.Result;
                newHero = heroSQL.GetSkills(newHero);
            }
            GameViewModel.Instance.EnnemyCastle.Army.Hero = newHero;
        }
예제 #2
0
 private async void InitLUC()
 {
     this.optionsAdmin.ListMapUC.LoadItems((await mapManager.Get()).ToList());
     this.optionsAdmin.ListMapUC.IsEnabled = false;
     this.optionsAdmin.ListThemeP1UC.LoadItems((await themeManager.Get()).ToList());
     this.optionsAdmin.ListThemeP2UC.LoadItems((await themeManager.Get()).ToList());
 }
예제 #3
0
        private async void DuplicateAddressContextMenu_OnClick(object sender, RoutedEventArgs e)
        {
            if (this.addressAdmin.UCAddressList.ItemsList.SelectedIndex > -1)
            {
                var address = new Address();
                address = (Address)this.addressAdmin.UCAddressList.ItemsList.SelectedItem; // casting the list view
                await addressManager.Insert(address);

                this.addressAdmin.UCAddressList.LoadItems((await addressManager.Get()).ToList());
            }
        }
예제 #4
0
        private GameViewModel()
        {
            MySQLManager <Castle> MySQLCastle = new MySQLManager <Castle>();

            this.MainCastle = MySQLCastle.Get(1).Result;
            this.MainCastle.GoldProducers     = new List <RessourceProducer>();
            this.MainCastle.SoldiersProducers = new Dictionary <string, SoldiersProducer>();
            this.MainCastle.ShieldStock       = new List <Models.Items.Shield>();
            this.MainCastle.WeaponStock       = new List <Models.Items.Weapon>();
            this.MainCastle.PotionStock       = new List <Models.Items.Potion>();
            this.MainCastle.Heroes            = new List <Hero>();
            this.MainCastle.Army = new Army();
            MySQLManager <HealerHouse> MyHealerHouseSQLManager = new MySQLManager <HealerHouse>();

            MainCastle.Healer = MyHealerHouseSQLManager.Get(1).Result;
            MySQLHealerHouse mySQLHealerHouse = new MySQLHealerHouse();

            mySQLHealerHouse.GetHealerHouse(MainCastle.Healer);


            MySQLManager <Blacksmith> MyBlacksmithSQLManager = new MySQLManager <Blacksmith>();

            MainCastle.Blacksmith = MyBlacksmithSQLManager.Get(1).Result;
            MySQLBlacksmith toto = new MySQLBlacksmith();

            toto.SetItems(MainCastle.Blacksmith);

            getAllHero();
            GetAllSoldierProducer();
            GetAllGoldProducer();
            ennemyCastle     = new Castle("Méchant Chato");
            this.goldCounter = this.MainCastle.Golds;
        }
예제 #5
0
        // GET: User
        private static async Task <List <User> > GetAllUsers()
        {
            MySQLManager <User> manager;

            manager = new MySQLManager <User>(DataConnectionResource.LOCALMYSQL);
            return(await manager.Get() as List <User>);
        }
예제 #6
0
        private async void InitLUCJobAdmin()
        {
            List <Job> allJobs = (await jobManager.Get()).ToList();

            employeeManager.GetJobs(this.currentEmployee);
            Boolean flag = true;

            foreach (var item in allJobs)
            {
                foreach (var item1 in this.currentEmployee.Jobs)
                {
                    if (item.Id == item1.Id)
                    {
                        flag = false;
                    }
                }
                if (flag)
                {
                    allJobsInsert.Add(item);
                }
            }

            newListControl.LoadItem(this.currentEmployee.Jobs);
            this.jobAdmin.UCJobList.LoadItem(allJobsInsert);
        }
예제 #7
0
        private async void BtnValidate_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                String json = this.dataInsertView.txtBoxJson.Text;
                json = json.Replace("\r\n", " ");
                json = json.Replace("\n", " ");
                json = json.Replace("\\", " ");
                JsonConvert.DeserializeObject <Object>(json);

                MySQLManager <User> userManager = new MySQLManager <User>(DataConnectionResource.LOCALMYSQL);
                User currentUser = await userManager.Get(LoggedUser.UserId);

                MySQLManager <Data> dataManager = new MySQLManager <Data>(DataConnectionResource.LOCALMYSQL);
                Data data = new Data();
                data.JsonData = this.dataInsertView.txtBoxJson.Text;
                data.User     = currentUser;
                await dataManager.Insert(data);

                MessageBox.Show("Data Inserted");

                DataInsertViewModel viewModel = new DataInsertViewModel(currentUser);
            }
            catch (Exception ex)
            {
                this.dataInsertView.txtBoxJson.Text = ex.Message;
            }
        }
예제 #8
0
 private async void LoadUsers()
 {
     foreach (var item in (await userManager.Get()).ToList())
     {
         this.userCollection.Add(item);
     }
 }
        private async void LoadItems()
        {
            Student s1 = new Student();

            s1.Name     = "John";
            s1.Surname  = "Doe";
            s1.Age      = 15;
            s1.Mail     = "*****@*****.**";
            s1.Password = "******";
            s1.Username = "******";
            await student1.Insert(s1);


            Student s2 = new Student();

            s2.Name     = "Pierre";
            s2.Surname  = "Paul";
            s2.Age      = 21;
            s2.Mail     = "*****@*****.**";
            s2.Password = "******";
            s2.Username = "******";
            await student1.Insert(s2);

            var result = this.pageStudent.ucStudentUserControl.Student = await student1.Get(1);
        }
예제 #10
0
        public TaverneViewModel()
        {
            MySQLManager <Hero> mySQLHeroManager = new MySQLManager <Hero>();

            Heros     = new Dictionary <string, Hero>();
            this.View = new TaverneView();
            int         heroNumber = 1;
            bool        isOk       = true;
            List <Hero> herosList  = new List <Hero>();

            while (isOk)
            {
                Task <Hero> allHeros = mySQLHeroManager.Get(heroNumber);
                if (allHeros.Result != null)
                {
                    herosList.Add(allHeros.Result);
                    Hero      test          = allHeros.Result;
                    MySQLHero testReference = new MySQLHero();
                    test        = testReference.GetSkills(test);
                    heroNumber += 1;
                }
                else
                {
                    isOk = false;
                }
            }

            foreach (Hero hero in herosList)
            {
                Heros.Add(hero.Name, hero);
                NewHeroView(hero);
            }

            EventGenerator();
        }
예제 #11
0
        private async void MysqlTest()
        {
            MySQLManager <Class1>    managerC1 = new MySQLManager <Class1>(DataConnectionResource.LOCALMYSQL);
            EntityGenerator <Class1> gen       = new EntityGenerator <Class1>();
            EntityGenerator <Class2> gen1      = new EntityGenerator <Class2>();
            Class1 c1 = gen.GenerateItem();

            c1.Addresses = gen1.GenerateListItems() as List <Class2>;
            await managerC1.Insert(c1);

            var result = await managerC1.Get() as List <Class1>;

            c1.Addresses.Add(gen1.GenerateItem());
            await managerC1.Update(c1);

            var result1 = await managerC1.Get() as List <Class1>;
        }
예제 #12
0
        private async void InitLists()
        {
            MySQLManager <Address> addressManager = new MySQLManager <Address>();

            this.UCAddressList.LoadItems((await addressManager.Get()).ToList());

            MySQLManager <StreetNumber> streetNumberManager = new MySQLManager <StreetNumber>();

            this.UCStreetNumberList.LoadItem((await streetNumberManager.Get()).ToList());
        }
예제 #13
0
        public async Task <ActionResult> EditAdvance(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User item = await db.Get(id);

            usersManager.GetRoles(item);
            usersManager.GetDatas(item);

            if (item == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Roles = await rolesManager.Get();

            ViewBag.Datas = await datasManager.Get();

            return(View(item));
        }
예제 #14
0
파일: Army.cs 프로젝트: Edrenn/Clickers
        public void GenerateEnnemyArmy()
        {
            GameViewModel.Instance.EnnemyCastle.Army.AllSoldiers.Clear();
            MySQLManager <Soldier> MySoldierSQLManager = new MySQLManager <Soldier>();
            Random random = new Random();
            int    soldierNumber;

            if (GameViewModel.Instance.MainCastle.Army.AllSoldiers.Count <= 5)
            {
                int newVaratiation = GameViewModel.Instance.MainCastle.Army.AllSoldiers.Count - 1;
                soldierNumber = random.Next(2, GameViewModel.Instance.MainCastle.Army.AllSoldiers.Count + newVaratiation);
            }
            else
            {
                soldierNumber = random.Next(GameViewModel.Instance.MainCastle.Army.AllSoldiers.Count - 5, GameViewModel.Instance.MainCastle.Army.AllSoldiers.Count + 5);
            }
            for (int counter = 0; counter < soldierNumber; counter++)
            {
                Soldier newSoldier;
                int     testType = random.Next(0, 30);
                if (testType <= 10)
                {
                    Task <Soldier> TaskSoldier = MySoldierSQLManager.Get(1);
                    newSoldier = TaskSoldier.Result;
                }
                else if (testType > 20)
                {
                    Task <Soldier> TaskSoldier = MySoldierSQLManager.Get(2);
                    newSoldier = TaskSoldier.Result;
                }
                else
                {
                    Task <Soldier> TaskSoldier = MySoldierSQLManager.Get(3);
                    newSoldier = TaskSoldier.Result;
                }
                GameViewModel.Instance.EnnemyCastle.Army.AllSoldiers.Add(newSoldier);
            }
        }
        private async void LoadItems()
        {
            MusicClass mc1 = new MusicClass();

            mc1.ClassAge        = 8;
            mc1.ClassExperience = 1;
            mc1.NumberUser      = 10;

            await musicClass1.Insert(mc1);

            var result = this.pageSchool.ucMusicClassUserControl.MusicClass = await musicClass1.Get(1);

            this.pageSchool.ucMusicClassUserControl.MusicClass = result;
        }
예제 #16
0
 private async void LoadRoles()
 {
     roles = (await roleManager.Get()).ToList();
     foreach (var item in roles)
     {
         StackPanel stp = new StackPanel();
         stp.Orientation = Orientation.Horizontal;
         Label lbl = new Label();
         lbl.Content = item.Name;
         stp.Children.Add(lbl);
         CheckBox checkbox = new CheckBox();
         checkbox.Name = "checkbox" + item.Name;
         stp.Children.Add(checkbox);
         this.userManagerView.stackpanelRoles.Children.Add(stp);
     }
 }
예제 #17
0
        private async void BtnMettreAjour_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.lootAdminV.UCLoot.Loot.Id != 0)
            {
                currentLoot = this.lootAdminV.UCLoot.Loot;
                await lootManager.Update(currentLoot);
            }
            else
            {
                //Recupere la partie par rapport a l'id saisie
                currentParty = await partyManager.Get(Convert.ToInt32(this.lootAdminV.UCLoot.txtParty.Text));

                //affecter au loot la party retrouvé
                currentLoot.Party = currentParty;

                //test si l'id du personnage est renseigner ou pas
                if (this.lootAdminV.UCLoot.txtCharacter.Text != "")
                {
                    //recupere le personnage par rapport a l'id saisie
                    currentCharacter = await characterManager.Get(Convert.ToInt32(this.lootAdminV.UCLoot.txtCharacter.Text));

                    //affecte le personnage retrouvé
                    currentLoot.Character = currentCharacter;
                    //rajouter
                    currentCharacter.Equipement.Add(currentLoot);
                }
                else
                {
                    currentParty.Bag.Add(currentLoot);
                }
                await lootManager.Insert(currentLoot);

                //TODO verifier si l'id de l'item est bien présent ...
                this.lootAdminV.LUCLoot.Obs.Add(currentLoot);
                this.lootAdminV.UCLoot.Loot = currentLoot;
            }
        }
예제 #18
0
        private async void MysqlTest1()
        {
            MySQLManager <Class1>    manager   = new MySQLManager <Class1>(DataConnectionResource.LOCALMYSQL);
            EntityGenerator <Class1> generator = new EntityGenerator <Class1>();
            //Class1 item = generator.GenerateItem();
            Class1 item = new Class1();

            item            = generator.GenerateItem();
            item.Address    = new Class2();
            item.Id         = 2;
            item.AddressId  = 28;
            item.Address.Id = 28;

            var res = await manager.Update(item);

            var items = await manager.Get() as List <Class1>;

            foreach (var iteme in items)
            {
                iteme.Name = "test";
            }

            await manager.Update(items);
        }
예제 #19
0
 private async void InitLUCLoot()
 {
     this.lootAdminV.LUCLoot.LoadItems((await lootManager.Get()).ToList());
     this.lootAdminV.LUCItems.LoadItems((await itemsManager.Get()).ToList());
 }
예제 #20
0
 private async void InitLists()
 {
     this.streetNumberAdmin.ucStreetNumberList.LoadItem((await streetNumberManager.Get()).ToList());
 }
예제 #21
0
 public async Task <IEnumerable <T> > Get()
 {
     return(await manager.Get());
 }
예제 #22
0
        private async Task <RessourceProducer> RecupProducer(int idToRecup)
        {
            RessourceProducer producerToReturn = await mySQLManager.Get(idToRecup);

            return(producerToReturn);
        }
예제 #23
0
 private async void InitLUC()
 {
     this.jobAdmin.UCJobList.LoadItem((await jobManager.Get()).ToList());
 }
예제 #24
0
        private async Task <Soldier> RecupSoldiers(int idToRecup)
        {
            Soldier soldier = await mySQLSoldierManager.Get(idToRecup);

            return(soldier);
        }
예제 #25
0
        private async void LoadCastle()
        {
            Task <Castle> castleToLoad = myCastleManager.Get(1);

            GameViewModel.Instance.MainCastle = castleToLoad.Result;
        }
예제 #26
0
        private async Task <SoldiersProducer> RecupProducer(int idToRecup)
        {
            SoldiersProducer producerToRdeturn = await mySoldiersProducerSQLManager.Get(idToRecup);

            return(producerToRdeturn);
        }
예제 #27
0
        public async Task <ActionResult> CreateAdvance()
        {
            ViewBag.Roles = await rolesManager.Get();

            return(View());
        }
예제 #28
0
        private async void InitLists()
        {
            MySQLManager <Schedule> scheduleManager = new MySQLManager <Schedule>();

            this.listScheduleUC.LoadItem((await scheduleManager.Get()).ToList());
        }
예제 #29
0
 private async void InitLists()
 {
     this.scheduleAdmin.listScheduleUC.LoadItem((await scheduleManager.Get()).ToList());
 }
예제 #30
0
 /// <summary>
 /// Return List of all items.
 /// </summary>
 /// <returns>IEnumerable items.</returns>
 public IEnumerable <ClassA> GetAll()
 {
     return(manager.Get());
 }