public void ButtonClick(int sel) { int clicked = sel - 1; Debug.Log("Sel: " + sel.ToString()); GameInfo game = BaseSaver.getGame(); if (clicked < mainButtons.Length && thisLoc == QLocType.Main) { thisLoc = (QLocType)System.Enum.Parse(typeof(QLocType), mainButtons[clicked]); } else if (thisLoc == QLocType.Quests && thisSel == -1 && clicked < game.quests.Length) { thisSel = clicked; } else { if (thisSel > -1) { thisSel = -1; } else if (thisLoc != QLocType.Main) { thisLoc = QLocType.Main; } else { SceneManager.LoadScene("AdventureScene"); } } PopulateInfo(thisLoc, thisSel); }
void PopulateInfo(QLocType screen, int selection) { Debug.Log("thisLoc"); Debug.Log(thisLoc); GameInfo game = BaseSaver.getGame(); switch (screen) { case QLocType.Main: Debug.Log("Main"); populateInfo("Player Menu", "Click on the buttons on the side to see the current information about your character."); PopulateButtons(mainButtons); break; case QLocType.Quests: Debug.Log("Quests"); if (selection > -1) { string msg = game.quests [selection].startMsg + "\n\n"; msg += "Proximity: " + game.quests [selection].distance.ToString() + "\n"; msg += "Status: " + (game.quests [selection].completed ? "Completed" : "Active") + "\n"; msg += "Quest Type: " + game.quests [selection].type.ToString() + "\n"; msg += "Rewards:\n"; foreach (ResInfo res in game.quests[selection].rewards) { msg += "\t" + res.type.ToString() + "\n"; } populateInfo(game.quests[selection].title, msg); PopulateButtons(new string[] {}); } else { populateInfo("Quests", "Here are your character's active quests. Click on one to see more information and make it active."); string[] qsts = new string[game.quests.Length]; for (int i = 0; i < game.quests.Length; i++) { qsts [i] = game.quests [i].title; } PopulateButtons(qsts); } break; case QLocType.Stats: populateInfo("Stats", BaseSaver.getGame().RetInfo()); PopulateButtons(new string[0]); Debug.Log("Stats"); break; case QLocType.Squad: Debug.Log("Squad"); break; case QLocType.Enemies: Debug.Log("Enemies"); break; } }
void Start() { Debug.Log("Start"); header = GameObject.Find("InfoHeader"); description = GameObject.Find("InfoDescription"); image = GameObject.Find("InfoImage"); character = GameObject.Find("InfoCharacter"); infoBtns = new GameObject[BTNLENGTH]; for (int i = 0; i < BTNLENGTH; i++) { infoBtns [i] = GameObject.Find("Button_0" + (i + 1).ToString()); infoBtns [i].SetActive(false); } thisLoc = QLocType.Main; mainButtons = new string[] { "Stats", "Quests" }; thisSel = -1; PopulateInfo(thisLoc, thisSel); }