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); }
void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } AudioListener.volume = Volume; if (MainMenuCanvas == null && SceneManager.GetActiveScene().buildIndex == 1) { MainMenuCanvas = GameObject.Find("MainMenucanvas"); } else if (SceneManager.GetActiveScene().buildIndex == 1) { // for the exit button #if UNITY_STANDALONE MainMenuCanvas.transform.GetChild(2).gameObject.SetActive(true); #else MainMenuCanvas.transform.GetChild(3).gameObject.SetActive(false); #endif } #if UNITY_STANDALONE MainCanvas.transform.GetChild(0).gameObject.SetActive(false); if (Input.GetKeyDown(KeyCode.Escape) && SceneManager.GetActiveScene().buildIndex != 0 && //splashpage SceneManager.GetActiveScene().buildIndex != 1 && //mainmenu SceneManager.GetActiveScene().buildIndex != 2 && //CUTSCENE_1 SceneManager.GetActiveScene().buildIndex != 4 && //CUTSCENE_2 SceneManager.GetActiveScene().buildIndex != 10 //CUTSCENE_3 ) { turnOnInGamePauseMenu(); } // Helps to prevent when player died when In-Game Pause menu is open whil transiting to win screen or lose screen else if (SceneManager.GetActiveScene().buildIndex == 12 || SceneManager.GetActiveScene().buildIndex == 11) { InGamePauseCanvas.SetActive(false); talking = false; isOpeningInPause = false; } #else if (SceneManager.GetActiveScene().buildIndex != 0 && //splashpage SceneManager.GetActiveScene().buildIndex != 1 && //mainmenu SceneManager.GetActiveScene().buildIndex != 2 && //CUTSCENE_1 SceneManager.GetActiveScene().buildIndex != 4 && //CUTSCENE_2 SceneManager.GetActiveScene().buildIndex != 10 && //CUTSCENE_3 SceneManager.GetActiveScene().buildIndex != 11 && //winscreen SceneManager.GetActiveScene().buildIndex != 12) //losescreen { MainCanvas.transform.GetChild(0).gameObject.SetActive(true); MainCanvas.transform.GetChild(3).gameObject.SetActive(true); MainCanvas.transform.GetChild(4).gameObject.SetActive(true); MainCanvas.transform.GetChild(5).gameObject.SetActive(true); MainCanvas.transform.GetChild(6).gameObject.SetActive(true); MainCanvas.GetComponent <AndroidLoadDataScript>().enabled = true; } else { MainCanvas.transform.GetChild(0).gameObject.SetActive(false); MainCanvas.transform.GetChild(3).gameObject.SetActive(false); MainCanvas.transform.GetChild(4).gameObject.SetActive(false); MainCanvas.transform.GetChild(5).gameObject.SetActive(false); MainCanvas.transform.GetChild(6).gameObject.SetActive(false); MainCanvas.GetComponent <AndroidLoadDataScript>().enabled = false; } #endif //if you reach the required number of questitems QuestItemScrpt test = FindObjectOfType <QuestItemScrpt>(); if (test.getCurrenNumOfQuestItems() == test.m_numberOfRelics) { test.resetQuestItemList(); if (talkedToDragon) { talkedToDragon = false; } onWin(); } }