public void Show() { View.transform.DetachChildren(); RowDate = DynamicDataModel.ReadHeroData(); ChuanWuDisPlay(); Debug.Log(JsonMapper.ToJson(RowDate).ToString()); }
//public static PlayerData StrLevelUp(RowEquipment data) //{ // PlayerData player = ReadData(); // if (data.strLevel >= 10) { // Prefabs.Alert("强化已满!", null); // return player; // } // if (player.gold < data.price) { // Prefabs.Alert("金币不足!", null); // return player; // } // for (int i = 0; i < player.equips.Count; i++) // { // if (player.equips[i].equipmentID == data.equipmentID && player.equips[i].strLevel == data.strLevel) // { // player.equips[i].count -= 1; // player.gold -= 200; // if (player.equips[i].count == 0) // { // player.equips.RemoveAt(i); // } // break; // } // } // bool isAdd = false; // for (int i = 0; i < player.equips.Count; i++) // { // if (player.equips[i].equipmentID == data.equipmentID && player.equips[i].strLevel == data.strLevel + 1) // { // player.equips[i].count += 1; // isAdd = true; // break; // } // } // if (!isAdd) // { // Equip equip = new Equip(); // equip.equipmentID = data.equipmentID; // equip.count = 1; // equip.strLevel = data.strLevel + 1; // player.equips.Add(equip); // } // Prefabs.Alert("强化成功,消耗200物资", null); // PlayerPrefs.SetString(key, JsonMapper.ToJson(player)); // return player; //} public static PlayerData StrLevelUp(RowEquipment data) { PlayerData player = DynamicDataModel.ReadData(); if (data.strLevel >= 10) { Prefabs.Alert("强化已满!", null); return(player); } if (player.gold < data.price) { Prefabs.Alert("金币不足!", null); return(player); } for (int i = 0; i < player.equips.Count; i++) { if (player.equips[i].equipmentID == data.equipmentID) { player.gold -= 200; player.equips[i].strLevel += 1; break; } } Prefabs.Alert("强化成功,消耗200物资", null); PlayerPrefs.SetString(key, JsonMapper.ToJson(player)); return(player); }
public void ShowPlayerInfo() { PlayerData pd = DynamicDataModel.ReadData(); gold.text = pd.gold.ToString(); oil.text = pd.oil.ToString(); diamond.text = pd.diamond.ToString(); }
void Start() { DynamicDataModel.Init(); PlayerData data = DynamicDataModel.ReadData(); oil.text = data.oil.ToString(); gold.text = data.gold.ToString(); diamond.text = data.diamond.ToString(); Debug.Log("钻石" + data.diamond); //GameObject.Find("Canvas").GetComponent<BootStart>().enabled=false; }
public void ShowPackage() { DynamicDataModel.Init(); data = DynamicDataModel.ReadData(); //Debug.Log("玩家数据" + JsonMapper.ToJson(data)); Num.text = data.equips.Count + "/" + kucun; finalData = StaticDataModel.ReadEquipMerge(data.equips); equiplistView.DisPlay_Choice(finalData, this, Choice); }
/// <summary> /// 装备强化后队伍改变 /// </summary> public static void EquioStrChange() { List <RowHeroDate> heroList = DynamicDataModel.ReadHeroData(); for (int i = 0; i < heroList.Count; i++) { if (CheckIsOnTeamByPID(heroList[i])) { ChangeHeroSelf(heroList[i]); } } }
public static PlayerData SellPlayerEquip(RowEquipment data) { PlayerData player = DynamicDataModel.ReadData(); for (int i = 0; i < player.equips.Count; i++) { Equip ep = player.equips[i]; if (ep.equipmentID == data.equipmentID && ep.strLevel == data.strLevel) { ep.count -= 1; player.gold += data.price; if (ep.count == 0) { player.equips.RemoveAt(i); } break; } } Prefabs.Alert("卖出" + data.name + "成功,获得金币" + data.price, null); PlayerPrefs.SetString(key, JsonMapper.ToJson(player)); return(player); }
void Awake() { RowDate = DynamicDataModel.ReadHeroData(); }
void Awake() { Clean(); DynamicDataModel.Init(); }
void Start() { RowDate = DynamicDataModel.ReadHeroData(); RowDate = StaticDataModel.ReadHeroDateAddEquip(RowDate); }
public void WearEquip(RowEquipment date) { string json = PlayerPrefs.GetString("HeroData"); List <DynamicDate> HeroD = JsonMapper.ToObject <List <DynamicDate> >(json); switch (EquipPos) { case "W": for (int i = 0; i < HeroD.Count; i++) { if (HeroD[i].HeroID == EquipHero.HeroID) { HeroD[i].WID = date.equipmentID; } } break; case "E1": for (int i = 0; i < HeroD.Count; i++) { if (HeroD[i].HeroID == EquipHero.HeroID) { HeroD[i].EID_1 = date.equipmentID; } } break; case "E2": for (int i = 0; i < HeroD.Count; i++) { if (HeroD[i].HeroID == EquipHero.HeroID) { HeroD[i].EID_2 = date.equipmentID; } } break; } string newJosn = JsonMapper.ToJson(HeroD); PlayerPrefs.SetString("HeroData", newJosn); List <RowHeroDate> newList = DynamicDataModel.ReadHeroData(); for (int i = 0; i < newList.Count; i++) { if (EquipHero.PackageID == newList[i].PackageID) { EquipHero = newList[i]; TeamModel.ChangeHeroSelf(EquipHero); } } GameObject go = Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/PlayerInfo")); go.transform.SetParent(GameObject.Find("UI/Canvas").transform); (go.transform as RectTransform).localScale = Vector3.one; (go.transform as RectTransform).localPosition = Vector3.zero; (go.transform as RectTransform).offsetMax = Vector2.zero; (go.transform as RectTransform).offsetMin = Vector2.zero; go.GetComponent <PlayerInfoView>().Str_DisPlay(EquipHero); //GameObject.Find("UI/Canvas/chuanwu").GetComponent<ChuanwuListView>().Show(); Destroy(gameObject); }