/// <summary> /// Loads the specified json. /// </summary> /// <param name="Json">The json.</param> public void Load(JObject Json) { if (Json.ContainsKey("Items")) { foreach (var ItemJson in Json.GetValue("Items")) { var Item = new Item(); Item.Load(ItemJson.ToObject <JObject>()); this.Items.Add(Item); } } if (Json.ContainsKey("Equips")) { // TODO : Equips. } if (Json.ContainsKey("Currencies")) { foreach (var CurrencyJson in Json.GetValue("Currencies")) { var Currency = new Currency(); Currency.Load(CurrencyJson.ToObject <JObject>()); this.Currencies.Add(Currency); } } if (Json.ContainsKey("History")) { // TODO : History. } }
public void InitData(int id) { item = ItemsModel.GetItemById(id); SetToggle(); item.view = this; FreshView(); }
/// <summary> /// 添加系统道具 /// </summary> static ItemJson AddItemJson(string id) { JsonData itemList = Get(DataType.ItemList); ItemJson item = JsonMapper.ToObject <ItemJson>(itemList[id].ToJson()); itemMap.Add(item.id, item); return(item); }
public void OnExit() { confirmPanel.gameObject.SetActive(false); OnHoverDetailPanel.gameObject.SetActive(false); shopCanvas.gameObject.SetActive(false); isItemClicked = false; itemJson = null; }
/// <summary> /// 向用户数据中添加道具 /// </summary> public static void AddItems(int[] items) { for (int i = 0; i < items.Length; i++) { ItemJson newItem = itemMap.ContainsKey(items[i]) ? itemMap[items[i]] : AddItemJson(items[i].ToString()); if (userItemMap.ContainsKey(items[i])) //已经有道具了 { //1.替换 userItemMap[items[i]] = newItem; //2叠加耐久 userItemMap[items[i]].durable += newItem.durable; //3.舍弃 } else { userItemMap.Add(items[i], newItem); //还没有道具 } } NotiCenter.DispatchEvent(KCEvent.KCItemsChange, (object)items); }
public static ItemV2 CreateV3(string email, string id, ItemJson item) { return(new ItemV2 { PartitionKey = email, RowKey = id, BaseRecord = item.BaseRecord, EnchantmentRecord = item.EnchantmentRecord, EnchantmentSeed = item.EnchantmentSeed, IsHardcore = item.IsHardcore, MateriaCombines = item.MateriaCombines, MateriaRecord = item.MateriaRecord, Mod = item.Mod, ModifierRecord = item.ModifierRecord, PrefixRecord = item.PrefixRecord, RelicCompletionBonusRecord = item.RelicCompletionBonusRecord, RelicSeed = item.RelicSeed, Seed = item.Seed, StackCount = item.StackCount, SuffixRecord = item.SuffixRecord, TransmuteRecord = item.TransmuteRecord, IsActive = true }); }
public static ItemV1 CreateV1(string email, ItemJson pi) { return(new ItemV1 { PartitionKey = email, RowKey = Guid.NewGuid().ToString().Replace("-", ""), BaseRecord = pi.BaseRecord, EnchantmentRecord = pi.EnchantmentRecord, EnchantmentSeed = pi.EnchantmentSeed, IsHardcore = pi.IsHardcore, MateriaCombines = pi.MateriaCombines, MateriaRecord = pi.MateriaRecord, Mod = pi.Mod, ModifierRecord = pi.ModifierRecord, PrefixRecord = pi.PrefixRecord, RelicCompletionBonusRecord = pi.RelicCompletionBonusRecord, RelicSeed = pi.RelicSeed, Seed = pi.Seed, StackCount = pi.StackCount, SuffixRecord = pi.SuffixRecord, TransmuteRecord = pi.TransmuteRecord, IsActive = true }); }
private List <ItemJson> ParseXML(Rss rss) { List <ItemJson> tmp = new List <ItemJson>(); foreach (var i in rss.Channel.Item) { var branch = ParseChannel(i.Category); if (branch != BranchChannel.Unknown) { ItemJson tmpItem = new ItemJson(); tmpItem.Branch = branch; tmpItem.Version = ParseVersion(i.Description); // If null or error log in Logger class tmpItem.Changelog = i.Description; tmpItem.URL = i.Link2; tmp.Add(tmpItem); } else { // Log to Logger class and handle accordingly } } return(tmp); // If null or error log in Logger class }
public void OnHoverItem(string itemid) { if (!isItemClicked) { OnHoverDetailPanel.SetActive(true); ItemJson item; if (itemid.ToLower().Contains("iw")) { WeaponJson weapon = DataManager.Instance.SearchWeaponID(itemid); item = weapon; itemStat.text = "Require level: " + item.lvlRequirement + "\n" + "Type: " + item.type.ToString() + "\n" + "PATK: " + weapon.patk + "\n" + "MATK: " + weapon.matk; } else if (itemid.ToLower().Contains("ia")) { ArmorJson armor = DataManager.Instance.SearchArmorID(itemid); item = armor; itemStat.text = "Require level: " + item.lvlRequirement + "\n" + "Type: " + item.type.ToString() + "\n" + "PATK: " + armor.pdef + "\n" + "MATK: " + armor.mdef; } else { item = DataManager.Instance.SearchUsableID(itemid); itemStat.text = ""; } itemDescription.text = item.tooltips; itemName.text = item.name; itemPrice.text = item.gold + " Gold"; itemJson = item; } itemId = itemid; }
public static ItemV2 CreateV2(string email, ItemJson pi) { return(CreateV3(email, Guid.NewGuid().ToString().Replace("-", ""), pi)); }
public override void Write(Utf8JsonWriter writer, Item value, JsonSerializerOptions options) { JsonSerializer.Serialize(writer, ItemJson.From(value), options); }