//: base (id, null, null, null, null, null, null, null, null, null, null)
 public Resources_InventoryShop(string id, Item_Root item1, Item_Root item2, Item_Root item3, Item_Root item4)
 {
     _id = id;
     _shopItem1 = item1;
     _shopItem2 = item2;
     _shopItem3 = item3;
     _shopItem4 = item4;
     _inventories.Add (this);
 }
Exemple #2
0
 public Resources_InventoryShop(string id, Item_Root item1, Item_Root item2, Item_Root item3, Item_Root item4)
 //: base (id, null, null, null, null, null, null, null, null, null, null)
 {
     _id        = id;
     _shopItem1 = item1;
     _shopItem2 = item2;
     _shopItem3 = item3;
     _shopItem4 = item4;
     _inventories.Add(this);
 }
Exemple #3
0
 public Item_Root CreateInstanceOfItem(string id)
 {
     if (Item_Root.GetItemByID(id) != null)
     {
         return((Item_Root)Item_Root.GetItemByID(id).MemberwiseClone());
     }
     else
     {
         Debug.LogError("Could not find a definition for '" + id + "' to create an instance of.");
         return(null);
     }
 }
 public static Dialogue_Prompt ConfirmPurchase(int playerCash, Item_Root item)
 {
     if (playerCash >= item.price) {
         Resources_Player.instance.inventory.GetItem(item);
         Resources_Player.instance.money -= item.price;
         DialogueInterface.Instance.shopkeeperRef.home.money += item.price;
         Dialogue_Prompt_Logic.PurchaseSuccessful();
         DialogueInterface.Instance.shopkeeperRef.respect += 5;
         return Dialogue_Prompt.GetPromptByName("dialogue_prompt_purchaseSuccessful");
     } else {
         Dialogue_Prompt_Logic.PurchaseFailed();
         return Dialogue_Prompt.GetPromptByName("dialogue_prompt_purchaseFailed"); }
 }
 static public Dialogue_Prompt ConfirmPurchase(int playerCash, Item_Root item)
 {
     if (playerCash >= item.price)
     {
         Resources_Player.instance.inventory.GetItem(item);
         Resources_Player.instance.money -= item.price;
         DialogueInterface.Instance.shopkeeperRef.home.money += item.price;
         Dialogue_Prompt_Logic.PurchaseSuccessful();
         DialogueInterface.Instance.shopkeeperRef.respect += 5;
         return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_purchaseSuccessful"));
     }
     else
     {
         Dialogue_Prompt_Logic.PurchaseFailed();
         return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_purchaseFailed"));
     }
 }
    private void GenerateShopInventoriesFromJSON()
    {
        for (int i = 0; i < _worldData["ShopInventories"].Count; i++)
        {
            JSONObject entry = _worldData["ShopInventories"][i];

            JSONObject item1o = entry["item1"];
            JSONObject item2o = entry["item2"];
            JSONObject item3o = entry["item3"];
            JSONObject item4o = entry["item4"];

            Item_Root item1 = null;
            Item_Root item2 = null;
            Item_Root item3 = null;
            Item_Root item4 = null;

            if (item1o != null)
            {
                item1 = Item_Root.GetItemByID(item1o.str);
            }
            if (item2o != null)
            {
                item2 = Item_Root.GetItemByID(item2o.str);
            }
            if (item3o != null)
            {
                item3 = Item_Root.GetItemByID(item3o.str);
            }
            if (item4o != null)
            {
                item4 = Item_Root.GetItemByID(item4o.str);
            }

            new Resources_InventoryShop(entry["id"].str, item1, item2, item3, item4);
        }
    }
    private void GenerateStartingInventoriesFromJSON()
    {
        for (int i = 0; i < _worldData["StartingInventories"].Count; i++)
        {
            JSONObject entry = _worldData["StartingInventories"][i];

            JSONObject gunInfo     = entry["gun"];
            JSONObject meleeInfo   = entry["melee"];
            JSONObject clothesInfo = entry["clothes"];
            JSONObject shoesInfo   = entry["shoes"];
            JSONObject pinInfo     = entry["pin"];
            JSONObject neckInfo    = entry["neck"];
            JSONObject ringInfo    = entry["ring"];
            JSONObject wristInfo   = entry["wrist"];
            JSONObject hairInfo    = entry["hair"];
            JSONObject flowerInfo  = entry["flower"];

            Item_Weapon_Gun   gun     = null;
            Item_Weapon_Melee melee   = null;
            Item_Gear_Clothes clothes = null;
            Item_Gear_Shoes   shoes   = null;
            Item_Gear_Pin     pin     = null;
            Item_Gear_Neck    neck    = null;
            Item_Gear_Ring    ring    = null;
            Item_Gear_Wrist   wrist   = null;
            Item_Decay_Hair   hair    = null;
            Item_Decay_Flower flower  = null;

            if (gunInfo != null)
            {
                gun = (Item_Weapon_Gun)Item_Root.GetItemByID(gunInfo.str);
            }
            if (meleeInfo != null)
            {
                melee = (Item_Weapon_Melee)Item_Root.GetItemByID(meleeInfo.str);
            }
            if (clothesInfo != null)
            {
                clothes = (Item_Gear_Clothes)Item_Root.GetItemByID(clothesInfo.str);
            }
            if (shoesInfo != null)
            {
                shoes = (Item_Gear_Shoes)Item_Root.GetItemByID(shoesInfo.str);
            }
            if (pinInfo != null)
            {
                pin = (Item_Gear_Pin)Item_Root.GetItemByID(pinInfo.str);
            }
            if (neckInfo != null)
            {
                neck = (Item_Gear_Neck)Item_Root.GetItemByID(neckInfo.str);
            }
            if (ringInfo != null)
            {
                ring = (Item_Gear_Ring)Item_Root.GetItemByID(ringInfo.str);
            }
            if (wristInfo != null)
            {
                wrist = (Item_Gear_Wrist)Item_Root.GetItemByID(wristInfo.str);
            }
            if (hairInfo != null)
            {
                hair = (Item_Decay_Hair)Item_Root.GetItemByID(hairInfo.str);
            }
            if (flowerInfo != null)
            {
                flower = (Item_Decay_Flower)Item_Root.GetItemByID(flowerInfo.str);
            }

            Resources_Inventory inventory = new Resources_Inventory(entry["id"].str, gun, melee, clothes, shoes, pin, neck, ring, wrist, hair, flower);
        }
    }
    public void GetItem(Item_Root item)
    {
        _inventory.Add(item);
        switch (item.GetType().ToString())
        {
        case "Item_Weapon_Gun": {
            _gun = (Item_Weapon_Gun)item;
            break;
        }

        case "Item_Weapon_Melee": {
            _melee = (Item_Weapon_Melee)item;
            break;
        }

        case "Item_Gear_Clothes": {
            _clothes = (Item_Gear_Clothes)item;
            break;
        }

        case "Item_Gear_Shoes": {
            _shoes = (Item_Gear_Shoes)item;
            break;
        }

        case "Item_Gear_Pin": {
            _pin = (Item_Gear_Pin)item;
            break;
        }

        case "Item_Gear_Neck": {
            _neck = (Item_Gear_Neck)item;
            break;
        }

        case "Item_Gear_Ring": {
            _ring = (Item_Gear_Ring)item;
            break;
        }

        case "Item_Gear_Wrist": {
            _wrist = (Item_Gear_Wrist)item;
            break;
        }

        case "Item_Decay_Hair": {
            _hair = (Item_Decay_Hair)item;
            break;
        }

        case "Item_Decay_Flower": {
            _flower = (Item_Decay_Flower)item;
            break;
        }

        case "Item_Consumable": {
            _consumables.Add((Item_Consumable)item);
            break;
        }
        }
    }
 private void Test4()
 {
     item = shopkeeperRef.home.inventory.shopItem4;
 }
 public void GetItem(Item_Root item)
 {
     _inventory.Add (item);
     switch (item.GetType().ToString())
     {
     case "Item_Weapon_Gun": {
         _gun = (Item_Weapon_Gun)item;
         break; }
     case "Item_Weapon_Melee": {
         _melee = (Item_Weapon_Melee)item;
         break; }
     case "Item_Gear_Clothes": {
         _clothes = (Item_Gear_Clothes)item;
         break; }
     case "Item_Gear_Shoes": {
         _shoes = (Item_Gear_Shoes)item;
         break; }
     case "Item_Gear_Pin": {
         _pin = (Item_Gear_Pin)item;
         break; }
     case "Item_Gear_Neck": {
         _neck = (Item_Gear_Neck)item;
         break; }
     case "Item_Gear_Ring": {
         _ring = (Item_Gear_Ring)item;
         break; }
     case "Item_Gear_Wrist": {
         _wrist = (Item_Gear_Wrist)item;
         break; }
     case "Item_Decay_Hair": {
         _hair = (Item_Decay_Hair)item;
         break; }
     case "Item_Decay_Flower": {
         _flower = (Item_Decay_Flower)item;
         break; }
     case "Item_Consumable": {
         _consumables.Add((Item_Consumable)item);
         break; }
     }
 }