public void OnMouseDown() { Reaction_Text.Reaction_Text.setFormula(reactants, products, reactantCount, productCount); CosmicRanch.setFormula(reactants, products, reactantCount, productCount); }
// Other global variables go here public static void onStart() { // Initialize Backpack if (player == null) { initBackpack(); } // Initialize Wormhole if (wormhole == null) { wormhole = new GameObject("wormhole"); } //testHole th = new testHole(player); //wormhole.AddComponent(th.GetType()); // Initialize Glossary //glossary = new Glossary(player); // Initialize CosmicRanch if (ranch == null) { ranch = new CosmicRanch(); } if (buddyList == null) { buddyList = new List <Buddy>(); } if (sh == null) { sh = new StateHandler(); sh.setCurrentState("MainGameScene", true, true); } /* * if (quizzer == null) * { * //Debug.Log ("buttonA:" + Initialize.quizzer.buttonA.name); * quizzer = new Quiz(); * //Debug.Log ("buttonA:" + Initialize.quizzer.buttonA.name); * } */ if (eFormulas == null || eNames == null) { eFormulas = new List <string>(); eNames = new List <string>(); string sqlQuery = "SELECT Name, Formula " + "FROM Trium " + "WHERE ElementID not null"; string connectionPath = "URI=file:" + Application.dataPath + "/Elementrium.db"; IDbConnection dbconn; dbconn = (IDbConnection) new SqliteConnection(connectionPath); dbconn.Open(); IDbCommand dbcmd = dbconn.CreateCommand(); dbcmd.CommandText = sqlQuery; IDataReader reader = dbcmd.ExecuteReader(); int counter = 0; while (reader.Read()) { eNames.Add(reader.GetString(0)); eFormulas.Add(reader.GetString(1)); counter++; } reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; dbconn.Close(); dbconn = null; } quizID = -1; // Initialize ANY other global variables }
public void OnClick() { Reaction_Text.Reaction_Text.setFormula(reactants, products, reactantCount, productCount); CosmicRanch.setFormula(reactants, products, reactantCount, productCount); //Debug.Log("TESTWETF"); if (Initialize.sh.getCurrentState().name == "MainGameScene") { //Debug.Log("BUTTON CLICKED"); Initialize.sh.setCurrentState("Group", true, true); GameObject rightMenu = GameObject.Find("RightActivation"); rightMenu.GetComponent <RightMenu1>().Play(); } else if (Initialize.sh.getCurrentState().name == "Glossary") { if (!Glossary.displayOpen) { if (name != "" && name != null) { Camera.main.GetComponent <Glossary> ().setnames(name); } else { Camera.main.GetComponent <Glossary> ().setnames(myText.text); } if (tab == 1) //atom { Camera.main.GetComponent <Glossary> ().setinfo(myId, myMass, myFormula); } else if (tab == 2) //molecule { Camera.main.GetComponent <Glossary> ().setinfo2(myCommonName, myMass, myFormula); } int tier = Initialize.player.getTrium(myId2).getTier(); if (tier >= 1) { Camera.main.GetComponent <Glossary> ().setfact1(myFact1); } else { Camera.main.GetComponent <Glossary>().setfact1("FACT LOCKED"); } if (tier >= 2) { Camera.main.GetComponent <Glossary> ().setfact2(myFact2); } else { Camera.main.GetComponent <Glossary>().setfact2("FACT LOCKED"); } if (tier >= 3) { Camera.main.GetComponent <Glossary> ().setfact3(myFact3); } else { Camera.main.GetComponent <Glossary>().setfact3("FACT LOCKED"); } Camera.main.GetComponent <Glossary>().myimg.sprite = mysprite; GlossaryAnim.Play("GlossaryInfoDisplayPopUp"); //Debug.Log ("Played popup"); //Glossary.popupInfo (EventSystem.current.currentSelectedGameObject.name); } } }