public void GenButtons() { int[] tempStats; AvailableHeros.Clear(); HeroesChosen.Clear(); //populate available heros who match the tier requirements AvailableHeros = CharectorStats.heroesThatCanBeSacrificed(heroRequirements.heroType, heroRequirements.stars); if (gridButtons.Count > 0) { foreach (GameObject button in gridButtons) { Destroy(button.gameObject); } gridButtons.Clear(); } for (int i = 0; i < AvailableHeros.Count; i++) { tempStats = CharectorStats.UnlockedCharector(AvailableHeros[i]); GameObject button = Instantiate(buttonTemplate) as GameObject; gridButtons.Add(button); button.SetActive(true); button.GetComponent <TileListButton>().SetText(CharectorStats.HeroName(tempStats[1])); button.GetComponent <TileListButton>().SetSacrificeIndex(i, tempStats[0]);//also sets toggle functionality and backpackindex to the button button.transform.SetParent(buttonTemplate.transform.parent, false); } }
public void GenButtons() { AllHeros.Clear(); for (int i = 0; i < CharectorStats.numOfHeroes(); i++) { AllHeros.Add(CharectorStats.UnlockedCharector(i)); } if (buttons.Count > 0) { foreach (GameObject button in buttons) { Destroy(button.gameObject); } buttons.Clear(); } for (int i = 0; i < AllHeros.Count; i++) { GameObject button = Instantiate(buttonTemplate) as GameObject; buttons.Add(button); button.SetActive(true); button.GetComponent <TileListButton>().SetText(CharectorStats.HeroName(AllHeros[i][1])); button.GetComponent <TileListButton>().SetIndex(i); button.transform.SetParent(buttonTemplate.transform.parent, false); } }
public void InitializeMeltGrid() { int[] tempStats; MeltableList.Clear(); SelectedToMeltList.Clear(); MeltableList = CharectorStats.heroesThatCanMelt(CharectorStats.getTempHero(), xpToBeAdded, SelectedToMeltList); if (GridButtonGameObjs.Count > 0) { foreach (GameObject button in GridButtonGameObjs) { Destroy(button.gameObject); } GridButtonGameObjs.Clear(); } for (int i = 0; i < MeltableList.Count; i++) { tempStats = CharectorStats.UnlockedCharector(MeltableList[i]); GameObject button = Instantiate(buttonTemplate) as GameObject; GridButtonGameObjs.Add(button); button.SetActive(true); button.GetComponent <EnhanceListButton>().SetText(CharectorStats.HeroName(tempStats[1])); button.GetComponent <EnhanceListButton>().SetHeroNum(tempStats[0]); button.GetComponent <EnhanceListButton>().SetIndex(i); button.transform.SetParent(buttonTemplate.transform.parent, false); } }
public void TestAddHeroClicked() { InvManager.GoldAdd(30); InvManager.T1ShardAdd(10); InvManager.T2ShardAdd(10); Debug.Log("current Inv:" + InvManager.GoldReturn().ToString() + " gold, " + InvManager.T1ShardAmount().ToString() + " T1s, " + InvManager.T2ShardAmount().ToString() + " T2s"); for (int i = 0; i < CharectorStats.numOfHeroes(); i++) { var character = CharectorStats.UnlockedCharector(i); CharectorStats.testAddExp(i, 10); } SaveManager.SaveParse(); //GameMaster.CallSave(); }
public void TransferToSelected() { int[] tempStats; int tempxp = 0; //Insert function to gray out tile on grid ClearSelectedGameObjs(); for (int i = 0; i < SelectedToMeltList.Count; i++) { tempStats = CharectorStats.UnlockedCharector(SelectedToMeltList[i]); tempxp = tempStats[4]; GameObject button = Instantiate(selectedBtnTemplate) as GameObject; MeltingButtonGameObjs.Add(button); button.SetActive(true); button.GetComponent <SelectedToMeltBtn>().SetText(CharectorStats.HeroName(tempStats[1])); button.GetComponent <SelectedToMeltBtn>().SetIndex(i); button.GetComponent <SelectedToMeltBtn>().SetHeroNum(tempStats[0]); button.transform.SetParent(selectedBtnTemplate.transform.parent, false); } xpToBeAdded += tempxp; }
public bool MeltableButtonClicked(int buttonIdx, bool clicked, int BPIndex) { indexJustClicked = buttonIdx; if (clicked == false) { SelectedToMeltList.Add(BPIndex); TransferToSelected(); int[] tempStats = CharectorStats.UnlockedCharector(BPIndex); xpslide.UpdateSlider(tempStats[4]); xpslide.SetCurrentAndBoundText(); clicked = true; return(clicked); } else { clicked = false; int[] tempStats = CharectorStats.UnlockedCharector(BPIndex); xpToBeAdded -= tempStats[4]; GameObject temp = new GameObject(); for (int i = 0; i < GridButtonGameObjs.Count; i++) { if (GridButtonGameObjs[i].GetComponent <EnhanceListButton>().heroNum == BPIndex) { temp = GridButtonGameObjs[i]; break; } } temp.GetComponent <EnhanceListButton>().clicked = false; SelectedToMeltList.RemoveAt(buttonIdx); RemoveFromSelectedRow(buttonIdx); xpslide.UpdateSlider(-tempStats[4]); xpslide.SetCurrentAndBoundText(); return(clicked); } }