private void CreateFightBtn(Pokemon.Moveslot moveslot, BTLUI_ButtonFight btn) { btn.moveslot = moveslot; btn.moveTxt.text = MoveDatabase.instance.GetMoveData(moveslot.moveID).moveName; btn.colorSel = colorSel; btn.colorUnsel = colorUnsel; }
private void SelectFightBtn( Pokemon pokemon, BTLUI_ButtonFight btn, bool select, bool ZMove = false, bool maxMove = false) { btn.image.color = select ? btn.colorSel : btn.colorUnsel; btn.moveTxt.color = select ? colorTxtSel : colorTxtUnsel; MoveData moveData = (btn.moveslot == null) ? null : MoveDatabase.instance.GetMoveData(btn.moveslot.moveID); if (moveData != null) { if (ZMove) { moveData = battleModel.GetPokemonZMoveData(pokemon, btn.moveslot.moveID); } if (maxMove) { moveData = battleModel.GetPokemonMaxMoveData(pokemon, moveData); } if (moveData != null) { btn.moveTxt.text = moveData.moveName; } else { btn.moveTxt.text = ""; } } if (select) { string promptString = ""; if (btn.moveslot == null) { promptString = "Go back to\nCommands"; } else { if (moveData != null) { TypeData typeData = TypeDatabase.instance.GetTypeData(moveData.moveType); promptString += "\\c" + typeData.typeColor + "\\" + typeData.typeName + "\\c.\\"; promptString += "\nPP: " + btn.moveslot.PP + " / " + btn.moveslot.maxPP; } else { if (ZMove) { promptString = "Cannot use Z-Power"; } } } StartCoroutine(DrawTextInstant(text: promptString, textBox: fightTxt)); } }
public void SetMoveButton( Battle battle, Pokemon pokemon, Pokemon.Moveslot moveslot, BTLUI_ButtonFight moveBtn, bool choosingZMove = false, bool choosingMaxMove = false) { MoveData moveData = battle.GetPokemonMoveData(userPokemon: pokemon, moveID: moveslot.moveID); if (choosingZMove) { moveData = battle.GetPokemonZMoveData(pokemon, moveslot.moveID); } if (choosingMaxMove) { moveData = battle.GetPokemonMaxMoveData(pokemon, moveData); } if (moveData != null) { TypeData typeData = TypeDatabase.instance.GetTypeData(moveData.moveType); Color typeColor = Color.clear; ColorUtility.TryParseHtmlString(typeData.typeColor, out typeColor); moveBtn.moveTxt.text = moveData.moveName; moveBtn.ppTxt.text = moveslot.PP + "/" + moveslot.maxPP; moveBtn.typeTxt.text = typeData.typeName; moveBtn.typeTxt.color = typeColor; moveBtn.moveData = moveData; moveBtn.moveslot = moveslot; moveBtn.hiddenByZMove = false; moveBtn.colorSel = new Color(typeColor.r, typeColor.g, typeColor.b, 0.75f); } else { moveBtn.moveTxt.text = ""; moveBtn.ppTxt.text = ""; moveBtn.typeTxt.text = ""; moveBtn.moveData = null; moveBtn.moveslot = null; moveBtn.hiddenByZMove = true; } moveBtn.UnselectSelf(); }
// FIGHT public void SetMoves( List <Pokemon.Moveslot> choices, bool canMegaEvolve = false, bool canZMove = false, bool canDynamax = false) { fightBtns = new List <BTLUI_ButtonFight>(); fightList = new List <Pokemon.Moveslot>(choices); int realBtns = 0; for (int i = 0; i < fightList.Count; i++) { BTLUI_ButtonFight newBtn = Instantiate(fightBtnPrefab, fightOptionObj.transform); newBtn.InitializeSelf(); fightBtns.Add(newBtn); // Back if (fightList[i] == null) { newBtn.moveTxt.text = "Back"; newBtn.colorSel = colorSel; newBtn.colorUnsel = colorUnsel; newBtn.transform.localPosition += new Vector3(-32, 20); newBtn.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 48f); } else { int xPos = (realBtns % 2) * 116; int yPos = (realBtns < 2) ? 0 : -20; CreateFightBtn(fightList[i], newBtn); newBtn.transform.localPosition += new Vector3(xPos, yPos); realBtns++; } } // Enable Special Button if (canMegaEvolve || canZMove || canDynamax) { fightSpecialBtn.gameObject.SetActive(true); fightSpecialIcon.gameObject.SetActive(true); if (canMegaEvolve) { fightSpecialBtn.colorSel = new Color(0.5f, 1f, 1f, 0.75f); fightSpecialBtn.txt.text = "Z - Mega Evolution"; fightSpecialIcon.sprite = fightMegaIcon; } else if (canZMove) { fightSpecialBtn.colorSel = new Color(0.75f, 1f, 0.5f, 0.75f); fightSpecialBtn.txt.text = "Z - Z-Move"; fightSpecialIcon.sprite = fightZMoveIcon; } else if (canDynamax) { fightSpecialBtn.colorSel = new Color(1f, 0.5f, 0.5f, 0.75f); fightSpecialBtn.txt.text = "Z - Dynamax"; fightSpecialIcon.sprite = fightDynamaxIcon; } } else { fightSpecialBtn.gameObject.SetActive(false); fightSpecialIcon.gameObject.SetActive(false); } }
public void SetMoves( Battle battle, Pokemon pokemon, List <Pokemon.Moveslot> moveList, bool canMegaEvolve, bool canZMove = false, bool canDynamax = false, bool choosingZMove = false, bool choosingMaxMove = false) { // Set each move button for (int i = 0; i < moveList.Count; i++) { Pokemon.Moveslot moveslot = moveList[i]; BTLUI_ButtonFight curBtn = (i == 0) ? move1Btn : (i == 1) ? move2Btn : (i == 2) ? move3Btn : (i == 3) ? move4Btn : null; if (curBtn != null) { SetMoveButton( battle: battle, pokemon: pokemon, moveslot: moveslot, choosingZMove: choosingZMove, choosingMaxMove: choosingMaxMove, moveBtn: curBtn); } } // Remove unnecessary buttons if (moveList.Count < 4) { move4Btn.gameObject.SetActive(false); } if (moveList.Count < 3) { move3Btn.gameObject.SetActive(false); } if (moveList.Count < 2) { move2Btn.gameObject.SetActive(false); } if (moveList.Count < 1) { move1Btn.gameObject.SetActive(false); } // Enable Special Button if (canMegaEvolve || canZMove || canDynamax) { specialBtn.gameObject.SetActive(true); specialIcon.gameObject.SetActive(true); if (canMegaEvolve) { specialBtn.colorSel = new Color(0.5f, 1f, 1f, 0.75f); specialBtn.txt.text = "Z - Mega Evolution"; specialIcon.sprite = fightMegaIcon; } else if (canZMove) { specialBtn.colorSel = new Color(0.75f, 1f, 0.5f, 0.75f); specialBtn.txt.text = "Z - Z-Move"; specialIcon.sprite = fightZMoveIcon; } else if (canDynamax) { specialBtn.colorSel = new Color(1f, 0.5f, 0.5f, 0.75f); specialBtn.txt.text = "Z - Dynamax"; specialIcon.sprite = fightDynamaxIcon; } } else { specialBtn.gameObject.SetActive(false); specialIcon.gameObject.SetActive(false); } }
public void HighlightMove(Pokemon.Moveslot moveslot) { BTLUI_ButtonFight selectedBtn = null; if (move1Btn.moveslot != null) { if (move1Btn.moveslot == moveslot) { selectedBtn = move1Btn; } else { move1Btn.UnselectSelf(); } } if (move2Btn.moveslot != null) { if (move2Btn.moveslot == moveslot) { selectedBtn = move2Btn; } else { move2Btn.UnselectSelf(); } } if (move3Btn.moveslot != null) { if (move3Btn.moveslot == moveslot) { selectedBtn = move3Btn; } else { move3Btn.UnselectSelf(); } } if (move4Btn.moveslot != null) { if (move4Btn.moveslot == moveslot) { selectedBtn = move4Btn; } else { move4Btn.UnselectSelf(); } } if (selectedBtn != null) { selectedBtn.SelectSelf(); backBtn.UnselectSelf(); MoveData moveData = selectedBtn.moveData; TypeData typeData = TypeDatabase.instance.GetTypeData(moveData.moveType); Color typeColor = Color.clear; ColorUtility.TryParseHtmlString(typeData.typeColor, out typeColor); string moveText = "<color=" + typeData.typeColor + ">" + typeData.typeName + "</color>\n"; moveText += moveData.category.ToString() + " / "; moveText += (moveData.basePower > 0) ? moveData.basePower + " BP / " : ""; moveText += (moveData.accuracy > 0) ? (Mathf.FloorToInt(moveData.accuracy * 100)) + "% ACC" : "Never Misses"; promptText.text = moveText; } }