Ejemplo n.º 1
0
    private void ResetUIBattle()
    {
        // Restore board state UI
        if (endTurnButton == null)
        {
            Debug.LogWarning("End turn button reference not set in UIBattleHandler.");
        }
        else
        {
            endTurnButton.SetActive(true);
        }

        if (shortcutButton == null)
        {
            Debug.LogWarning("Shortcut button reference not set in UIBattleHandler (top left button).");
        }
        else
        {
            shortcutButton.SetActive(true);
        }

        BattleHandler.DisableMonstersLifeBars();

        // Clear association tables and characters panel
        associatedSkillsPanel.Clear();
        foreach (Transform characterPan in associatedCharacterPanel.Values)
        {
            characterPan.gameObject.SetActive(false);
        }
        for (int i = 0; i < charactersPanel.transform.childCount; i++)
        {
            charactersPanel.transform.GetChild(i).GetChild(0).gameObject.SetActive(false);
        }

        ResetAttributesGauges();

        associatedCharacterPanel.Clear();
        associatedCharacterPanelReversed.Clear();

        // Reset skills panel
        for (int i = 0; i < skillsPanels.transform.childCount; i++)
        {
            Transform currentSkillsPanel = skillsPanels.transform.GetChild(i);

            for (int j = 0; j < 4; j++)
            {
                Transform currentSkill = currentSkillsPanel.GetChild(j);
                currentSkill.GetChild((int)SkillButtonChildren.SkillName).GetComponent <SkillContainer>().SkillData = null;
                currentSkill.GetChild((int)SkillButtonChildren.SkillName).GetComponentInChildren <Text>().text      = "";
                currentSkill.GetComponent <SkillDescriptionUI>().SkillData = null;

                currentSkill.GetChild((int)SkillButtonChildren.Atk).GetComponentInChildren <Text>().text = "0";
                currentSkill.GetChild((int)SkillButtonChildren.Def).GetComponentInChildren <Text>().text = "0";
                currentSkill.GetChild((int)SkillButtonChildren.Mag).GetComponentInChildren <Text>().text = "0";

                currentSkill.GetChild((int)SkillButtonChildren.Atk).GetComponentInChildren <Text>().color = customGrey;
                currentSkill.GetChild((int)SkillButtonChildren.Def).GetComponentInChildren <Text>().color = customGrey;
                currentSkill.GetChild((int)SkillButtonChildren.Mag).GetComponentInChildren <Text>().color = customGrey;

                currentSkill.gameObject.SetActive(false);
            }
        }

        // Disable UI battle
        ChangeState(UIBattleState.Disabled);
    }