void LoadAssetfromJson() { nLevel = new ArrayList(); Hashtable itemTable = (Hashtable)HMJson.objectFromJsonString(textAsset.text); foreach (String itemName in itemTable.Keys) { itemInfoLevel = (ArrayList)itemTable["Level"]; foreach (Hashtable itemInfo in itemInfoLevel) { String levelName = (String)itemInfo["level"]; String rocks = (String)itemInfo["rock"]; String boxs = (String)itemInfo["boxs"]; Level levelValue = new Level(); levelValue.Name = levelName; levelValue.Rock = Int32.Parse(rocks); levelValue.Boxs = Int32.Parse(boxs); nLevel.Add(levelValue); } } }
void LoadAssetfromJson() { StateManager.Instance.potionItems = new ArrayList(); StateManager.Instance.skillScrollItems = new ArrayList(); StateManager.Instance.magicScrollItems = new ArrayList(); StateManager.Instance.buffScrollItems = new ArrayList(); Hashtable itemTable = (Hashtable)HMJson.objectFromJsonString(textAsset.text); foreach (String itemName in itemTable.Keys) { itemInfosP = (ArrayList)itemTable["potion"]; //포션 ArrayList itemInfosS = (ArrayList)itemTable["skillScroll"]; //기술 ArrayList itemInfosM = (ArrayList)itemTable["magicScroll"]; //마법 ArrayList itemInfosB = (ArrayList)itemTable["buffScroll"]; //보조 ArrayList //Debug.Log("[Item " + itemName + "]" + "\n"); foreach (Hashtable itemInfo in itemInfosP) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String upPoint = (String)itemInfo["up"]; String image = (String)itemInfo["potionImage"]; String explain = (String)itemInfo["Explain"]; PotionItem potionItem = new PotionItem(); potionItem.Name = name; potionItem.Price = Int32.Parse(price); potionItem.UpPoint = Int32.Parse(upPoint); potionItem.Image = image; potionItem.Explain = explain; StateManager.Instance.potionItems.Add(potionItem); } foreach (Hashtable itemInfo in itemInfosS) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String atkPoint = (String)itemInfo["atk"]; String specialAbility = (String)itemInfo["specialAbility"]; String image = (String)itemInfo["skillScrollImage"]; String explain = (String)itemInfo["Explain"]; SkillItem skillItem = new SkillItem(); skillItem.Name = name; skillItem.Price = Int32.Parse(price); skillItem.AttackUpPoint = float.Parse(atkPoint); skillItem.SpecialAbility = float.Parse(specialAbility); skillItem.Image = image; skillItem.Explain = explain; StateManager.Instance.skillScrollItems.Add(skillItem); } foreach (Hashtable itemInfo in itemInfosM) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String atkPoint = (String)itemInfo["atk"]; String spdDown = (String)itemInfo["spdDown"]; String atkDown = (String)itemInfo["atkDown"]; String image = (String)itemInfo["magicScrollImage"]; String explain = (String)itemInfo["Explain"]; MagicItem magicItem = new MagicItem(); magicItem.Name = name; magicItem.Price = Int32.Parse(price); magicItem.AttactPoint = float.Parse(atkPoint); magicItem.AtkDownPoint = float.Parse(atkDown); magicItem.SpdDownPoint = float.Parse(spdDown); magicItem.Image = image; magicItem.Explain = explain; StateManager.Instance.magicScrollItems.Add(magicItem); } foreach (Hashtable itemInfo in itemInfosB) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String HpUp_Mul = (String)itemInfo["hpUp_Mul"]; String AtkUp = (String)itemInfo["atkUp"]; String DefUp = (String)itemInfo["defUp"]; String SpdUp = (String)itemInfo["spdUp"]; String DefDown = (String)itemInfo["defDown"]; String Restoration = (String)itemInfo["restoration"]; String image = (String)itemInfo["buffScrollImage"]; String explain = (String)itemInfo["Explain"]; BuffItem buffItem = new BuffItem(); buffItem.Name = name; buffItem.Price = Int32.Parse(price); buffItem.HpUp_Mul = float.Parse(HpUp_Mul); buffItem.AtkUp = float.Parse(AtkUp); buffItem.DefUp = float.Parse(DefUp); buffItem.SpdUp = float.Parse(SpdUp); buffItem.DefDown = float.Parse(DefDown); buffItem.Restoration = Int32.Parse(Restoration); buffItem.Image = image; buffItem.Explain = explain; StateManager.Instance.buffScrollItems.Add(buffItem); } } }
void LoadAssetfromJson() { wItems = new ArrayList(); aItems = new ArrayList(); bItems = new ArrayList(); Hashtable itemTable = (Hashtable)HMJson.objectFromJsonString(textAsset.text); foreach (String itemName in itemTable.Keys) { itemInfos = (ArrayList)itemTable["weapon"]; itemInfosA = (ArrayList)itemTable["armor"]; itemInfosB = (ArrayList)itemTable["boots"]; //Debug.Log("[Item " + itemName + "]" + "\n"); foreach (Hashtable itemInfo in itemInfos) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["weaponPrice"]; String atkPoint = (String)itemInfo["weaponATK"]; String durability = (String)itemInfo["weaponDurability"]; String weaponExplain = (String)itemInfo["weaponExplain"]; String weaponName = (String)itemInfo["weaponName"]; String weaponImage = (String)itemInfo["weaponImage"]; HMWeaponItem weaponItem = new HMWeaponItem(); weaponItem.Name = name; weaponItem.Price = Int32.Parse(price); weaponItem.AttackPoint = Int32.Parse(atkPoint); weaponItem.Durability = Int32.Parse(durability); weaponItem.Explain = weaponExplain; weaponItem.WeaponName = weaponName; weaponItem.Image = weaponImage; wItems.Add(weaponItem); } foreach (Hashtable itemInfo in itemInfosA) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String aromorExplain = (String)itemInfo["armorExplain"]; String defPoint = (String)itemInfo["armorDef"]; String armorName = (String)itemInfo["armorName"]; String armorImage = (String)itemInfo["armorImage"]; HMArmorItem armorItem = new HMArmorItem(); armorItem.Name = name; armorItem.Price = Int32.Parse(price); armorItem.Def = Int32.Parse(defPoint); armorItem.ArmorName = armorName; armorItem.Explain = aromorExplain; armorItem.Image = armorImage; aItems.Add(armorItem); } foreach (Hashtable itemInfo in itemInfosB) { String name = (String)itemInfo["name"]; String price = (String)itemInfo["price"]; String bootsExplain = (String)itemInfo["bootsExplain"]; String bootsSpd = (String)itemInfo["bootsSpd"]; String bootsName = (String)itemInfo["bootsName"]; String bootsImage = (String)itemInfo["bootsImage"]; HMBootsItem bootsItem = new HMBootsItem(); bootsItem.Name = name; bootsItem.Price = Int32.Parse(price); bootsItem.Spd = float.Parse(bootsSpd); bootsItem.Explain = bootsExplain; bootsItem.BootsName = bootsName; bootsItem.Image = bootsImage; bItems.Add(bootsItem); } } }
void LoadAssetfromJson() { nMaps = new ArrayList(); nLevel = new ArrayList(); nMonster = new ArrayList(); Hashtable itemTable = (Hashtable)HMJson.objectFromJsonString(textAsset.text); foreach (String itemName in itemTable.Keys) { itemInfoMaps = (ArrayList)itemTable["map"]; itemInfoLevel = (ArrayList)itemTable["Level"]; itemInfoMonster = (ArrayList)itemTable["Monster"]; foreach (Hashtable itemInfo in itemInfoMaps) { String mapName = (String)itemInfo["mapName"]; String widthRoad = (String)itemInfo["wRoad_"]; String heightRoad = (String)itemInfo["hRoad_"]; String rotationRoad = (String)itemInfo["rRoad_"]; String room = (String)itemInfo["room_"]; String tcrossRoad = (String)itemInfo["tRoad_"]; String crossRoad = (String)itemInfo["cRoad_"]; Maps mapValue = new Maps(); mapValue.Name = mapName; mapValue.WidthRoad = Int32.Parse(widthRoad); mapValue.HeightRoad = Int32.Parse(heightRoad); mapValue.RotationRoad = Int32.Parse(rotationRoad); mapValue.CrossRoad = Int32.Parse(crossRoad); mapValue.TcrossRoad = Int32.Parse(tcrossRoad); mapValue.Room = Int32.Parse(room); nMaps.Add(mapValue); } foreach (Hashtable itemInfo in itemInfoLevel) { String levelName = (String)itemInfo["level"]; String rocks = (String)itemInfo["rock"]; String boxs = (String)itemInfo["boxs"]; String monster = (String)itemInfo["monsterV"]; Level levelValue = new Level(); levelValue.Name = levelName; levelValue.Rock = Int32.Parse(rocks); levelValue.Boxs = Int32.Parse(boxs); levelValue.Monster = Int32.Parse(monster); nLevel.Add(levelValue); } foreach (Hashtable itemInfo in itemInfoMonster) { String name = (String)itemInfo["monsterName"]; String monsterAtt = (String)itemInfo["monsterAtt"]; String monsterDef = (String)itemInfo["monsterDef"]; String monsterMaxSpd = (String)itemInfo["monsterMaxSpd"]; String monsterMinSpd = (String)itemInfo["monsterMinSpd"]; String monsterHp = (String)itemInfo["monsterHp"]; Monster MonsterValue = new Monster(); MonsterValue.Name = name; MonsterValue.MonsterAtt = Int32.Parse(monsterAtt); MonsterValue.MonsterDef = Int32.Parse(monsterDef); MonsterValue.MonsterMaxSpd = Int32.Parse(monsterMaxSpd); MonsterValue.MonsterMinSpd = Int32.Parse(monsterMinSpd); MonsterValue.MonsterHp = Int32.Parse(monsterHp); nMonster.Add(MonsterValue); } } }