public void SetUI(DataTransfer data)
 {
     StartCoroutine(SetUIIE(data));
 }
        public void SetUI(DataTransfer data)
        {
            m_RoleId = data.GetData <long>(ConstDefine.UI_HeroInfo_RoleId);
            string heroName = data.GetData <string>(ConstDefine.UI_HeroInfo_HeroName);

            m_HName.text = heroName;

            int heroStar = data.GetData <int>(ConstDefine.UI_HeroInfo_HeroStar);

            RefreshStar(heroStar);

            int heroQuality = data.GetData <int>(ConstDefine.UI_HeroInfo_HeroQuality);

            if (heroQuality == 0)
            {
                m_Quality.text = "普通";
            }
            else if (heroQuality == 1)
            {
                m_Quality.text = "精英";
            }
            else if (heroQuality == 2)
            {
                m_Quality.text = "传奇";
            }

            int heroLevel = data.GetData <int>(ConstDefine.UI_HeroInfo_HeroLevel);

            m_Level.text = heroLevel.ToString();

            int   hp       = data.GetData <int>(ConstDefine.UI_HeroInfo_HeroHp);
            int   mgicAtk  = data.GetData <int>(ConstDefine.UI_HeroInfo_MgicAtk);
            int   phyAtk   = data.GetData <int>(ConstDefine.UI_HeroInfo_PhyAtk);
            int   cri      = data.GetData <int>(ConstDefine.UI_HeroInfo_Cri);
            float criValue = data.GetData <float>(ConstDefine.UI_HeroInfo_CriValue);
            int   mgicDef  = data.GetData <int>(ConstDefine.UI_HeroInfo_MgicDef);
            int   phyDef   = data.GetData <int>(ConstDefine.UI_HeroInfo_PhyDef);

            m_Hp.text       = hp.ToString();
            m_MgicAtk.text  = mgicAtk.ToString();
            m_PhyAtk.text   = phyAtk.ToString();
            m_Cri.text      = cri.ToString();
            m_CriValue.text = criValue.ToString();
            m_PhyDef.text   = phyDef.ToString();
            m_MgicDef.text  = phyDef.ToString();

            List <DataTransfer> skillDatas = data.GetData <List <DataTransfer> >(ConstDefine.UI_HeroInfo_SkillContent);

            for (int i = 0; i < skillDatas.Count; i++)
            {
                string skillName = skillDatas[i].GetData <string>(ConstDefine.UI_HeroInfo_SkillName);
                string skillIcon = skillDatas[i].GetData <string>(ConstDefine.UI_HeroInfo_SkillIcon);
                string skillDesc = skillDatas[i].GetData <string>(ConstDefine.UI_HeroInfo_SkillDesc);
            }

            int needDebris  = data.GetData <int>(ConstDefine.UI_HeroInfo_NeedDebris);
            int ownedDebris = data.GetData <int>(ConstDefine.UI_HeroInfo_OwnedDebris);

            m_NeedDebris.text  = needDebris.ToString();
            m_OwnedDebris.text = ownedDebris.ToString();
        }
 public void RefreshAfterUpgradeStar(DataTransfer data)
 {
     SetUI(data);
     //特效动画啥的
     //TODO
 }
Esempio n. 4
0
 public void SetUI(DataTransfer data)
 {
     m_IsPlayMusic = data.GetData <bool>(ConstDefine.MusicStatus);
     SetMusic();
 }
        private DataTransfer GetHeroInfoData(long roldID)
        {
            long       roleId = roldID;
            GameObject go     = UIViewUtil.Instance.OpenWindow(UIViewType.HeroInfoView);

            m_HeroInfoView = go.GetComponent <UIHeroInfoView>();
            if (m_HeroInfoView == null)
            {
                Debug.LogError("错误:没有这个界面");
                return(null);
            }
            HeroInfo heroInfo = Global.HeroInfoList.Find(x => x.RoleId == roleId);

            if (heroInfo == null)
            {
                Debug.LogError("错误:没有英雄信息");
                return(null);
            }
            HeroEntity heroEntity = HeroDBModel.Instance.Get(heroInfo.HeroID);

            if (heroEntity == null)
            {
                Debug.LogError("错误:找不到英雄实体");
                return(null);
            }
            string heroName    = heroInfo.RoleNickName;
            int    heroStar    = heroInfo.HeroStar;
            int    heroQuality = heroEntity.Quality;
            int    heroLevel   = SimulatedDatabase.Instance.GetLevel();
            int    hp          = heroInfo.MaxHP;
            int    mgicAtk     = heroInfo.MgicAtk;
            int    phyAtk      = heroInfo.PhyAtk;
            int    cri         = heroInfo.Cri;
            float  criValue    = heroInfo.CriValue;
            int    phyDef      = heroInfo.PhyDef;
            int    mgicDef     = heroInfo.MgicDef;

            DataTransfer data = new DataTransfer();

            data.SetData(ConstDefine.UI_HeroInfo_RoleId, roleId);
            data.SetData(ConstDefine.UI_HeroInfo_HeroName, heroName);
            data.SetData(ConstDefine.UI_HeroInfo_HeroStar, heroStar);
            data.SetData(ConstDefine.UI_HeroInfo_HeroQuality, heroQuality);
            data.SetData(ConstDefine.UI_HeroInfo_HeroLevel, heroLevel);

            data.SetData(ConstDefine.UI_HeroInfo_HeroHp, hp);
            data.SetData(ConstDefine.UI_HeroInfo_MgicAtk, mgicAtk);
            data.SetData(ConstDefine.UI_HeroInfo_PhyAtk, phyAtk);
            data.SetData(ConstDefine.UI_HeroInfo_Cri, cri);
            data.SetData(ConstDefine.UI_HeroInfo_CriValue, criValue);
            data.SetData(ConstDefine.UI_HeroInfo_PhyDef, phyDef);
            data.SetData(ConstDefine.UI_HeroInfo_MgicDef, mgicDef);

            List <DataTransfer> skillDatas = new List <DataTransfer>();

            for (int i = 0; i < heroInfo.SkillList.Count; i++)
            {
                DataTransfer skillData   = new DataTransfer();
                SkillEntity  skillEntity = SkillDBModel.Instance.Get(heroInfo.SkillList[i].SkillId);
                skillData.SetData(ConstDefine.UI_HeroInfo_SkillName, skillEntity.SkillName);
                string skillIcno = Global.Instance.GetSkillIconByRanggeAndType(skillEntity.AttackRange, skillEntity.AttackArea);
                skillData.SetData(ConstDefine.UI_HeroInfo_SkillIcon, skillIcno);
                skillData.SetData(ConstDefine.UI_HeroInfo_SkillDesc, skillEntity.SkillDesc);
                skillDatas.Add(skillData);
            }
            data.SetData(ConstDefine.UI_HeroInfo_SkillContent, skillDatas);

            HeroStarEntity heroStarEntity = HeroStarDBModel.Instance.GetList().Find((x) => x.Star == heroStar);

            data.SetData(ConstDefine.UI_HeroInfo_NeedDebris, heroStarEntity.NeedHeroDebris);
            data.SetData(ConstDefine.UI_HeroInfo_OwnedDebris, SimulatedDatabase.Instance.GetDebris());
            return(data);
        }
        //显示英雄简介
        private void ShowHeroIntro(long roleId)
        {
            if (m_HeroIntroView == null)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "HeroIntro");
                m_HeroIntroView = go.GetComponent <UIHeroIntroView>();
                go.transform.SetParent(UISceneCtrl.Instance.CurrentUIScene.MainCanvans.transform);
                go.transform.localScale    = Vector3.one;
                go.transform.localPosition = Vector3.zero;
            }
            m_HeroIntroView.gameObject.SetActive(true);
            DataTransfer data     = new DataTransfer();
            HeroInfo     heroInfo = Global.HeroInfoList.Find(x => x.RoleId == roleId);

            if (heroInfo != null)
            {
                if (heroInfo != null)
                {
                    HeroEntity heroEntity = HeroDBModel.Instance.Get(heroInfo.HeroID);
                    data.SetData <string>("HeroName", heroEntity.Name);
                    data.SetData <string>("HeroDesc", heroEntity.Desc);
                    for (int i = 0; i < heroInfo.SkillList.Count; i++)
                    {
                        SkillEntity skill1Entity = SkillDBModel.Instance.Get(heroInfo.SkillList[i].SkillId);
                        data.SetData <string>("Skill" + (i + 1) + "Name", skill1Entity.SkillName);
                        data.SetData <string>("Skill" + (i + 1) + "Desc", skill1Entity.SkillDesc);
                    }
                }
            }
            else
            {
                //敌人
                RoleInfoBase monsterInfo = GameSceneCtrl.Instance.MonsterList.Find(x => x.CurRoleInfo.RoleId == roleId).CurRoleInfo;
                if (monsterInfo != null)
                {
                    SpriteEntity spriteEntity = SpriteDBModel.Instance.GetList().Find(x => x == ((MonsterInfo)monsterInfo).SpriteEntity);
                    if (spriteEntity == null)
                    {
                        Debug.LogError("错误:找不到精灵实体,请查看是否有没有赋值,或者GameSceneCtrl的MonsterList 移除,添加出错了");
                        return;
                    }
                    else
                    {
                        data.SetData <string>("HeroName", spriteEntity.Name);
                        data.SetData <string>("HeroDesc", "");
                        for (int j = 0; j < ((MonsterInfo)monsterInfo).GetSkillList().Count; j++)
                        {
                            SkillEntity skill1Entity = SkillDBModel.Instance.Get(((MonsterInfo)monsterInfo).GetSkillList()[j]);
                            data.SetData <string>("Skill" + (j + 1) + "Name", skill1Entity.SkillName);
                            data.SetData <string>("Skill" + (j + 1) + "Desc", skill1Entity.SkillDesc);
                        }
                    }
                }
                else
                {
                    Debug.Log("错误:没找到英雄信息");
                    return;
                }
            }
            m_HeroIntroView.SetUI(data);
        }