Esempio n. 1
0
    public void UpdatePreview(string type, int index)
    {
        if (characterReader == null)
        {
            return;
        }

        skillname.text        = characterReader.GetMonsterSkillUI(type, index).name;
        skilldescription.text = characterReader.GetMonsterSkillUI(type, index).description;
    }
    public void UpdateGeneral()
    {
        if (characterReader == null)
        {
            characterReader = FindObjectOfType <GameManager>().GetComponent <GameManager>().characterReader;
        }

        currentMonster = menu.currentMonster;
        nameText.text  = currentMonster.Name;
        lifeText.text  = currentMonster.currentHP + "/" + currentMonster.GetMaxHP();

        if ((sprite = Resources.Load("Image/character/" + currentMonster.Name, typeof(Sprite)) as Sprite) != null)
        {
            characterImg.sprite = sprite;
        }
        else
        {
            int lv = currentMonster.GetLevel();
            while ((sprite = Resources.Load("Image/character/" + currentMonster.Name + lv, typeof(Sprite)) as Sprite) == null && lv > 1)
            {
                lv--;
            }
            if ((sprite = Resources.Load("Image/character/" + currentMonster.Name + lv, typeof(Sprite)) as Sprite) != null)
            {
                characterImg.sprite = sprite;
            }
        }

        skill = characterReader.GetMonsterSkillUI(currentMonster.monsterType.ToString(), 1);
        if (skill != null)
        {
            skillIcon1.sprite = skill.sprite;
        }

        skill = characterReader.GetMonsterSkillUI(currentMonster.monsterType.ToString(), currentMonster.GetEquippedSkill());
        if (skill != null)
        {
            if (currentMonster.GetLevel() >= 3)
            {
                skillIcon2.sprite = skill.sprite;
            }
            else
            {
                skillIcon2.sprite = Resources.Load("UI/skill/NoSkill", typeof(Sprite)) as Sprite;
            }
        }
        if (currentMonster.monsterType == MonsterType.boss)
        {
            dismissBtn.gameObject.SetActive(false);
        }
        else
        {
            dismissBtn.gameObject.SetActive(true);
        }
    }
    public void UpdateAttackPanel()
    {
        if (monster == null)
        {
            return;
        }

        if (monster.actionType == ActionType.AttackEnds || monster.actionType == ActionType.Nonactionable)
        {
            SetAttackPanelDisabled();
            return;
        }

        skill = characterReader.GetMonsterSkillUI(monster.monsterType.ToString(), 1);
        if (skill != null)
        {
            skill1.text = skill.name;
            buttonskill1.interactable = true;
            icon1.sprite = skill.sprite;
        }

        skill = characterReader.GetMonsterSkillUI(monster.monsterType.ToString(), monster.GetEquippedSkill());
        if (skill != null)
        {
            if (monster.GetLevel() >= 3)
            {
                skill2.text = skill.name;
                buttonskill2.interactable = true;
                icon2.sprite = skill.sprite;
            }
            else
            {
                skill2.text = "Locked";
                buttonskill2.interactable = false;
                icon2.sprite = Resources.Load("UI/skill/NoSkill", typeof(Sprite)) as Sprite;
            }
        }

        if (monster.GetLevel() < 5)
        {
            buttonswitch.interactable = false;
            textswitch.text           = "Locked";
        }
        else
        {
            buttonswitch.interactable = true;
            textswitch.text           = "Switch";
        }
        skill1.gameObject.SetActive(false);
        skill2.gameObject.SetActive(false);
        textswitch.gameObject.SetActive(false);
    }
    public void OnEnable()
    {
        string name = "boss";

        if (characterReader == null)
        {
            characterReader = GameObject.FindObjectOfType <GameManager>().GetComponent <GameManager>().characterReader;
        }
        skilldata   = characterReader.GetMonsterSkillUI(name);
        description = characterReader.GetCharacterDescription(PawnType.Monster, name);

        //txtname.text="Andre";
        string skilltext = "";

        for (int i = 0; i < 5; i++)
        {
            var strb = new System.Text.StringBuilder(skilldata[i].description);
            for (int j = 0; skilldata[i].description.Length - 18 * j > 18; j++)
            {
                strb.Insert(25 * j + 18, "\n\u3000\u3000\u3000\u3000\u3000\u3000");
            }
            skilldata[i].description = strb.ToString();
            skilltext += skilldata[i].name.PadRight(6, '\u3000') + skilldata[i].description + "\n";
        }
        skill.text = "<size=22>" + skilltext + "</size>";
        story.text = "<size=22>" + description.story + "</size>";
        race.text  = description.race;
        story.text = description.story;
        desc.text  = description.description;
        index      = 0;
        UpdateImage();
    }
    public void UpdateUnlockPanel(Monster monster)
    {
        if (characterReader == null)
        {
            return;
        }
        if (monster.GetLevel() < index)
        {
            SetIsLocked(true);
        }
        else
        {
            SetIsLocked(false);
            if (index == 1 || index == monster.equippedSkill)
            {
                equipped.gameObject.SetActive(true);
            }
            else
            {
                equipped.gameObject.SetActive(monster.equippedSkill == index?true:false);
            }

            skill            = characterReader.GetMonsterSkillUI(monster.monsterType.ToString(), index);
            skillname.text   = skill.name;
            skillicon.sprite = skill.sprite;
        }
    }
    public void ReadSkillNames(Monster monster)
    {
        List <CharacterReader.CharacterSkillUI> skills = characterReader.GetMonsterSkillUI(monster.Name);
        List <string> names = new List <string>();

        foreach (var skill in skills)
        {
            names.Add(skill.name);
        }
        monster.skillnames = names;
        //if(monster.skillnames!=null)
        //	Debug.Log("read skillnames");
    }
Esempio n. 7
0
    public void UpdateCurrentMonster()
    {
        if (characterReader == null)
        {
            characterReader = GameObject.FindObjectOfType <GameManager>().GetComponent <GameManager>().characterReader;
        }
        string name = type.ToString();

        skilldata   = characterReader.GetMonsterSkillUI(name);
        description = characterReader.GetCharacterDescription(PawnType.Monster, name);

        txtname.text = name;
        string skilltext = "";

        for (int i = 0; i < 5; i++)
        {
            var strb = new System.Text.StringBuilder(skilldata[i].description);
            for (int j = 0; skilldata[i].description.Length - 18 * j > 18; j++)
            {
                strb.Insert(25 * j + 18, "\n\u3000\u3000\u3000\u3000\u3000\u3000");
            }
            skilldata[i].description = strb.ToString();
            skilltext += skilldata[i].name.PadRight(6, '\u3000') + skilldata[i].description + "\n";
        }
        skill.text = skilltext;
        race.text  = description.race;
        story.text = description.story;
        desc.text  = description.description;

        if ((sprite = Resources.Load("Image/character/" + name, typeof(Sprite)) as Sprite) != null)
        {
            image.sprite = sprite;
        }
        else if ((sprite = Resources.Load("Image/character/" + name + "5", typeof(Sprite)) as Sprite) != null)
        {
            image.sprite = sprite;
        }
    }
    public void UpdatePreview(MonsterType type)
    {
        name          = type.ToString();
        skilldata     = characterReader.GetMonsterSkillUI(name);
        characterData = characterReader.GetMonsterData(gameManager.monsterManager.GetMonsterUnlockLevel(type), type.ToString(), 1);

        txtname.text = name;
        string skilltext = "";
        var    strb      = new System.Text.StringBuilder(skilldata[0].description);

        for (int j = 0; skilldata[0].description.Length - letterPerLine * j > letterPerLine; j++)
        {
            strb.Insert((7 + letterPerLine) * j + letterPerLine, "\n\u3000\u3000\u3000\u3000\u3000\u3000");
        }
        skilldata[0].description = strb.ToString();
        skilltext += skilldata[0].name.PadRight(6, '\u3000') + skilldata[0].description + "\n";
        skill.text = "<size=22>" + skilltext + "</size>";

        data1.text = "1\n"
                     + (characterData.HP) + "\n"
                     + (characterData.attack) + "\n"
                     + (characterData.defense) + "\n";
        data2.text = (characterData.dexterity) + "\n"
                     + (characterData.magicAttack) + "\n"
                     + (characterData.magicDefense) + "\n"
                     + (characterData.attackRange) + "\n";

        if ((sprite = Resources.Load("Image/character/" + name, typeof(Sprite)) as Sprite) != null)
        {
            image.sprite = sprite;
        }
        else if ((sprite = Resources.Load("Image/character/" + name + "1", typeof(Sprite)) as Sprite) != null)
        {
            image.sprite = sprite;
        }
    }