public itemInformation(itemInformation zeOther) { item_name = zeOther.item_name; item_effect = zeOther.item_effect; item_type = zeOther.item_type; item_count = zeOther.item_count; }
void Start() { // Need to clear the data inside inventory! itemName_Count_Map.Clear(); //switch (HeroDataScript.m_playerID) //{ // case 0: // // Since it is a new game, don't load anything! // break; // default: // We shall load it from the SQLite since it is from the load save! //Text zeDebugginText = GameObject.Find("DEBUGGINGTEXTUI").GetComponent<Text>(); checkForRelics = GetComponent <QuestItemScrpt>(); checkForRelics.resetQuestItemList(); List <string> myConditions = new List <string>(); myConditions.Add("PlayerID = " + HeroDataScript.m_playerID); List <object> theFieldToTake = new List <object>(); theFieldToTake.Add((int)1); theFieldToTake.Add("LOL"); theFieldToTake.Add((int)1); //Debug.Log("Reading from Table: " + PlayerInventoryTable); //zeDebugginText.text = "Reading from Table: " + PlayerInventoryTable; string[] allZeStuff = MySQLiteHandler.instance.getAllStringFromTable(PlayerInventoryTable, 3, theFieldToTake, myConditions); //zeDebugginText.text = "Successful reading from: " + PlayerInventoryTable; //Debug.Log("Successful reading from: " + PlayerInventoryTable); foreach (string zeStr in allZeStuff) { //Debug.Log(PlayerInventoryTable + ": " + zeStr); string[] allZeItemStr = zeStr.Split(','); // Item Count is int 3rd row, we shall check if that is more than 0. If so, add it to the inventory! int zeItemCount; int.TryParse(allZeItemStr[2], out zeItemCount); if (zeItemCount >= 0) { // Since the string will be in the 2nd row, we will take that! itemInformation zeNewItem = new itemInformation(ItemGeneratorScript.instance.getItemInform(allZeItemStr[1])); zeNewItem.item_count = zeItemCount; //Debug.Log("Item Count: " + zeNewItem.item_count); //Debug.Log("Item Name: " + zeNewItem.item_name); //Debug.Log(zeNewItem.item_effect); passInInventory(zeNewItem); } } // break; //} //Debug.Log("Total Inventory space: " + itemName_Count_Map.Count); }
public void notifyItemCollected(itemInformation zeQuestItem) { //Debug.Log("Notifying quest item: " + zeQuestItem.item_name); if (zeQuestItem.item_name.Contains(m_questItemName)) { if (zeQuestItem.item_count > 0) { theQuestItemName.Add(zeQuestItem.item_name); } //Debug.Log("Successful notify quest item: " + zeQuestItem.item_name); //Debug.Log("Total Quest items: " + theQuestItemName.Count); //List<string> myConditions = new List<string>(); //myConditions.Add("PlayerID = " + HeroDataScript.m_playerID); //myConditions.Add("ItemName = " + MySQLiteHandler.instance.helpToConvertToSQLString(zeQuestItem.item_name)); //MySQLiteHandler.instance.saveSpecificResult(tableString, "ItemCount", zeQuestItem.item_count.ToString(), myConditions); //if (checkQuestItemsCollected()) //{ // // Then we shall proceed to the next level! // LocalDataSingleton.instance.GoNext(); //} } }
public bool passInInventory(itemInformation zeItem) { itemInformation toCheckWhetherItExistInsideInventory; // Add to the stacks of items! //Debug.Log("Item's name: " + zeItem.item_name); if (itemName_Count_Map.TryGetValue(zeItem.item_name, out toCheckWhetherItExistInsideInventory)) { toCheckWhetherItExistInsideInventory.item_count++; //Debug.Log("Stacking item: " + zeItem.item_name); checkForRelics.notifyItemCollected(zeItem); return(true); } // If still can contain more inventory space, then add it in! if (itemName_Count_Map.Count < max_InventorySpace) { //Debug.Log("Adding item: " + zeItem.item_name); checkForRelics.notifyItemCollected(zeItem); itemName_Count_Map.Add(zeItem.item_name, zeItem); return(true); } return(false); }