Пример #1
0
 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);
 }
Пример #2
0
 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;
         }
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
    private void LoadItem(JSONWeapon weapon, string prefab, GameObject spawn)
    {
        UIItem w = Instantiate <UIItem>(Resources.Load <UIItem>("UI/" + prefab), spawn.transform);

        w.SetItem(weapon);
    }
Пример #5
0
 public override void SetItem(JSONWeapon w)
 {
     base.SetItem(w);
     item_name = w.item_name;
     slot      = w.slot;
 }
Пример #6
0
 public override void SetItem(JSONWeapon w)
 {
     base.SetItem(w);
     price     = w.price;
     item_name = w.item_name;
 }