Exemple #1
0
        public async void InitCustomLocalMySQL(string customFolder)
        {
            if (this.Database.CreateIfNotExists())
            {
                List <RessourceProducer> allGoldProducer = JsonManager.Instance.GetAllGoldProducersFromJSon();
                foreach (RessourceProducer item in allGoldProducer)
                {
                    DbSetRessourceProducer.Add(item);
                }
                List <SoldiersProducer> allSoldierProducer = JsonManager.Instance.GetAllSoldierProducersFromJSon(AllPath.Instance.JsonCustomFolder + customFolder + AllPath.Instance.CustomSoldierProducer);
                foreach (SoldiersProducer item in allSoldierProducer)
                {
                    DbSetSoldiersProducer.Add(item);
                }
                List <Hero> allHeros = JsonManager.Instance.GetAllHerosFromJSon(AllPath.Instance.JsonCustomFolder + customFolder + AllPath.Instance.CustomHero);
                foreach (Hero hero in allHeros)
                {
                    DbSetHeros.Add(hero);
                }

                List <Shield> allShield = JsonManager.Instance.GetShieldsFromJSon();
                foreach (Shield shield in allShield)
                {
                    DbSetShield.Add(shield);
                }
                HealerHouse HealerHouse = JsonManager.Instance.GetHealerHouseFromJSon();
                DbSetHealerHouse.Add(HealerHouse);

                Blacksmith Blacksmith = JsonManager.Instance.GetBlacksmithFromJSon();
                DbSetBlacksmith.Add(Blacksmith);
                this.SaveChangesAsync();
            }
        }
 public HealerHouseViewModel(HealerHouseView view, HealerHouse healerHouse)
 {
     this.HealerHouse      = healerHouse;
     this.View             = view;
     this.View.DataContext = HealerHouse;
     PotionStockGenerator();
     EventGenerator();
 }
Exemple #3
0
        public HealerHouse GetHealerHouseFromJSon()
        {
            string      path = "D:\\Workspaces\\Clickers\\Clickers\\JsonConfig\\";
            string      file = "HealerHouse.Json";
            HealerHouse existingHealerHouse = new HealerHouse();

            using (StreamReader fileItem = File.OpenText(path + file))
                using (JsonTextReader reader = new JsonTextReader(fileItem))
                {
                    string jSonContent = fileItem.ReadToEnd();
                    existingHealerHouse = JsonConvert.DeserializeObject <HealerHouse>(jSonContent, new JsonSerializerSettings());
                }
            foreach (Potion potion in existingHealerHouse.PotionList)
            {
                potion.Name        = ConvertToUTF8(potion.Name);
                potion.Description = ConvertToUTF8(potion.Description);
            }
            return(existingHealerHouse);
        }
Exemple #4
0
 public HealerHouseView(HealerHouse healerHouse)
 {
     InitializeComponent();
     HealerHouseViewModel controller = new HealerHouseViewModel(this, healerHouse);
 }