Exemplo n.º 1
0
    private void CreatePartyBtn(Pokemon pokemon, BTLUI_ButtonParty btn)
    {
        btn.pokemon = pokemon;

        btn.nameTxt.text = pokemon.nickname;
        PokemonGender gender = pokemon.gender;

        if (gender != PokemonGender.Genderless)
        {
            btn.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                : " <color=#FF8080>♀</color>";
        }

        btn.lvlTxt.text = "Lv" + pokemon.level;
        btn.hpTxt.text  = pokemon.currentHP + " / " + pokemon.maxHP;

        StatusCondition condition = pokemon.nonVolatileStatus;

        if (condition.statusID == "healthy")
        {
            btn.statusTxt.text = "";
        }
        else
        {
            btn.statusTxt.text = condition.data.shortName;
        }

        float hpPercent = pokemon.HPPercent;

        btn.hpBar.fillAmount = hpPercent;

        btn.hpBar.color = (hpPercent > 0.5f) ? btn.hpHigh
            : (hpPercent > 0.25f) ? btn.hpMed
            : btn.hpLow;

        // draw icon
        string drawPath = "pokemonSprites/icon/" + pokemon.data.displayID;

        btn.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
        if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
        {
            btn.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
        }
        else
        {
            StartCoroutine(BattleAssetLoader.instance.LegacyLoadPokemon(
                               pokemon: pokemon,
                               useicon: true,
                               imagePokemon: btn.icon
                               ));
        }
    }
Exemplo n.º 2
0
    public void SetPartyButton(Pokemon pokemon, BTLUI_ButtonParty button)
    {
        button.nameTxt.text = pokemon.nickname;

        PokemonGender gender = pokemon.gender;

        if (gender != PokemonGender.Genderless)
        {
            button.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                : (gender == PokemonGender.Female)? " <color=#FF8080>♀</color>"
                : "";
        }

        button.lvlTxt.text    = "Lv." + pokemon.level;
        button.hpTxt.text     = pokemon.currentHP + "/" + pokemon.maxHP;
        button.statusTxt.text = (pokemon.nonVolatileStatus == null) ? ""
            : pokemon.nonVolatileStatus.data.shortName;

        // draw icon
        string drawPath = "pokemonSprites/icon/" + pokemon.data.displayID;

        button.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
        if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
        {
            button.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
        }
        else
        {
            StartCoroutine(BattleAssetLoader.instance.LegacyLoadPokemon(
                               pokemon: pokemon,
                               useicon: true,
                               imagePokemon: button.icon
                               ));
        }

        // HP Bar
        float hpPercent = pokemon.HPPercent;

        button.hpBar.fillAmount = hpPercent;
        button.hpBar.color      = (hpPercent > 0.5f) ? button.hpHigh
            : (hpPercent > 0.25f) ? button.hpMed
            : button.hpLow;

        button.pokemon = pokemon;
        button.UnselectSelf();
    }
Exemplo n.º 3
0
 // Party Screen
 public void SetParty(List <Pokemon> party, Item item = null)
 {
     for (int i = 0; i < party.Count; i++)
     {
         Pokemon           pokemon = party[i];
         BTLUI_ButtonParty curBtn  = (i == 0) ? party1Btn
             : (i == 1) ? party2Btn
             : (i == 2) ? party3Btn
             : (i == 3) ? party4Btn
             : (i == 4) ? party5Btn
             : (i == 5) ? party6Btn
             : null;
         if (curBtn != null)
         {
             SetPartyButton(pokemon, curBtn);
         }
     }
     if (party.Count < 6)
     {
         party6Btn.gameObject.SetActive(false);
     }
     if (party.Count < 5)
     {
         party5Btn.gameObject.SetActive(false);
     }
     if (party.Count < 4)
     {
         party4Btn.gameObject.SetActive(false);
     }
     if (party.Count < 3)
     {
         party3Btn.gameObject.SetActive(false);
     }
     if (party.Count < 2)
     {
         party2Btn.gameObject.SetActive(false);
     }
     if (party.Count < 1)
     {
         party1Btn.gameObject.SetActive(false);
     }
 }
Exemplo n.º 4
0
    // PARTY
    public void SetParty(List <Pokemon> choices, bool forceSwitch, Item item = null)
    {
        partyBtns = new List <BTLUI_ButtonParty>();
        partyList = new List <Pokemon>(choices);

        int realBtns = 0;

        for (int i = 0; i < partyList.Count; i++)
        {
            BTLUI_ButtonParty newBtn = Instantiate(
                (partyList[i] == null)? partyBtnBackPrefab : partyBtnPrefab,
                partyOptionObj.transform
                );
            newBtn.InitializeSelf();
            partyBtns.Add(newBtn);

            // Back
            if (partyList[i] == null)
            {
                newBtn.nameTxt.text             = "Back";
                newBtn.transform.localPosition += new Vector3(-48, -124);
            }
            else
            {
                int xPos = (realBtns % 2) * 148;
                int yPos = -((realBtns / 2) * 40) - (realBtns % 2) * 22;
                CreatePartyBtn(partyList[i], newBtn);
                newBtn.transform.localPosition += new Vector3(xPos, yPos);
                realBtns++;
            }
        }

        string promptString = (forceSwitch)?
                              "Who will you\nswitch in?" : "Select a\nparty member.";

        if (item != null)
        {
            promptString = "Use the " + item.data.itemName + "\non which party member?";
        }
        StartCoroutine(DrawTextInstant(text: promptString, textBox: partyTxt));
    }
Exemplo n.º 5
0
    private void SelectPartyBtn(BTLUI_ButtonParty btn, bool select)
    {
        btn.image.color   = select ? colorSel : colorUnsel;
        btn.nameTxt.color = select ? colorTxtSel : colorTxtUnsel;

        if (btn.pokemon != null)
        {
            if (select)
            {
                btn.lvlTxt.color    = colorTxtSel;
                btn.hpTxt.color     = colorTxtSel;
                btn.statusTxt.color = colorTxtSel;
            }
            else
            {
                btn.lvlTxt.color    = colorTxtUnsel;
                btn.hpTxt.color     = colorTxtUnsel;
                btn.statusTxt.color = colorTxtUnsel;
            }
        }
    }
Exemplo n.º 6
0
    public void HighlightPokemon(Pokemon pokemon)
    {
        BTLUI_ButtonParty selectedBtn = null;

        if (party1Btn.pokemon != null)
        {
            if (party1Btn.pokemon == pokemon)
            {
                selectedBtn = party1Btn;
            }
            else
            {
                party1Btn.UnselectSelf();
            }
        }
        if (party2Btn.pokemon != null)
        {
            if (party2Btn.pokemon == pokemon)
            {
                selectedBtn = party2Btn;
            }
            else
            {
                party2Btn.UnselectSelf();
            }
        }
        if (party3Btn.pokemon != null)
        {
            if (party3Btn.pokemon == pokemon)
            {
                selectedBtn = party3Btn;
            }
            else
            {
                party3Btn.UnselectSelf();
            }
        }
        if (party4Btn.pokemon != null)
        {
            if (party4Btn.pokemon == pokemon)
            {
                selectedBtn = party4Btn;
            }
            else
            {
                party4Btn.UnselectSelf();
            }
        }
        if (party5Btn.pokemon != null)
        {
            if (party5Btn.pokemon == pokemon)
            {
                selectedBtn = party5Btn;
            }
            else
            {
                party5Btn.UnselectSelf();
            }
        }
        if (party6Btn.pokemon != null)
        {
            if (party6Btn.pokemon == pokemon)
            {
                selectedBtn = party6Btn;
            }
            else
            {
                party6Btn.UnselectSelf();
            }
        }

        if (selectedBtn != null)
        {
            selectedBtn.SelectSelf();
            backBtn.UnselectSelf();
            promptText.text = "Choose a Pokémon.";
        }
    }