public virtual void SetItem(JSONWeapon w) { titleText.text = w.item_name; descText.text = "Damage: " + w.damage + "\n" + "Speed: " + w.speed + "\n" + "Price: " + w.price + "\n" + "Equipped: " + w.is_equipped + "\n" + "Level: " + w.req_level; image.sprite = Resources.Load <Sprite>("IMG/" + w.img); }
public static void WriteWeapon(JSONWeapon w) { JSONWeapon[] weaps = GetAllWeapons(); for (int i = 0; i < weaps.Length; i++) { if (weaps[i].item_name.Equals(w.item_name)) { weaps[i] = w; string j = JsonUtility.ToJson(weaps, true); File.WriteAllText(Application.streamingAssetsPath + JSON_PATH, j); break; } } }
public static JSONWeapon GetWeapon(string weap_name) { JSONWeapon[] json = GetAllWeapons(); if (json == null) { json = new JSONWeapon[0]; } for (int i = 0; i < json.Length; i++) { if (json[i].item_name.Equals(weap_name)) { return(json[i]); } } return(null); }
private void LoadItem(JSONWeapon weapon, string prefab, GameObject spawn) { UIItem w = Instantiate <UIItem>(Resources.Load <UIItem>("UI/" + prefab), spawn.transform); w.SetItem(weapon); }
public override void SetItem(JSONWeapon w) { base.SetItem(w); item_name = w.item_name; slot = w.slot; }
public override void SetItem(JSONWeapon w) { base.SetItem(w); price = w.price; item_name = w.item_name; }