Exemple #1
0
        //初始化怪物卡牌
        public void InitMonsterCard(MonsterTemplate _monster)
        {
            Parent = selfTransform.FindChild("Parent");
            Image Boss_Image = Parent.FindChild("Boss_Image").GetComponent <Image>();

            CardNameText      = Parent.FindChild("Name_txt").GetComponent <Text>();
            _CardLevelText    = Parent.FindChild("Level_txt");
            CardImage         = Parent.FindChild("Icon_Img").GetComponent <Image>();
            CardStar          = _monster.getMonsterstar();
            maxStar           = _monster.getMonstermaxstar();
            CardLevel         = _monster.getMonsterlevel();
            CardName          = GameUtils.getString(_monster.getMonstername());
            CardNameText.text = CardName;//名称
            InterfaceControler.GetInst().AddLevelNum(CardLevel.ToString(), _CardLevelText, url);
            _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_monster.getArtresources());
            Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + _Artresourcedata.getHeadiconresource());

            CardImage.sprite = _img;//图片

            for (int i = 0; i < 5; i++)
            {
                Image temp = Parent.FindChild("Star_Image").GetChild(i).GetComponent <Image>();
                temp.enabled = i < maxStar;

                temp         = Parent.FindChild("Star_Image").GetChild(i + 5).GetComponent <Image>();
                temp.enabled = i < CardStar;
            }

            Boss_Image.enabled = _monster.getMonstertype() == 2 ? true : false;
        }