Exemplo n.º 1
0
        public void SetUI(DataTransfer data)
        {
            m_LevelList = new List <Transform>();
            int maxPassLevel = data.GetData <int>(ConstDefine.MaxPassLevel);
            int maxLevel     = data.GetData <int>(ConstDefine.MaxLevel);

            for (int i = 0; i < maxLevel; i++)
            {
                //item
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "GameLevelItem", isCache: true);
                go.transform.SetParent(m_Grid);
                DataTransfer d = new DataTransfer();
                d.SetData(ConstDefine.GameLevelItem_Level, i + 1);
                if (i + 1 <= maxPassLevel)
                {
                    d.SetData(ConstDefine.GameLevelItem_IsLock, false);
                }
                else
                {
                    d.SetData(ConstDefine.GameLevelItem_IsLock, true);
                }
                UIGameLevelItemView itemView = go.GetComponent <UIGameLevelItemView>();
                itemView.OnClickBtn     = OnClickGameLevelItemBtn;
                go.transform.localScale = Vector3.one;
                itemView.SetUI(d);
                m_LevelList.Add(go.transform);


                m_LastLevel = go.transform;
            }

            StartCoroutine("CreateLine", maxLevel);
        }
        public void SetUI(DataTransfer data)
        {
            m_LevelText.transform.parent.localScale = Vector3.one;
            isInit = true;
            int gamLevel = data.GetData <int>(ConstDefine.Item_Level);

            m_GameLevel = gamLevel;
            m_IsLock    = data.GetData <bool>(ConstDefine.Item_IsLock);
            int hasStar = data.GetData <int>(ConstDefine.Item_HasStar);

            if (hasStar > 0)
            {
                m_StarImagge.sprite = m_Star1Sprite;
            }
            else
            {
                m_StarImagge.sprite = m_Star2Sprite;
            }
            if (m_IsLock)
            {
                m_LockImage.sprite = m_LockSprite;
                m_LevelText.font   = m_Font1;
            }
            else
            {
                m_LockImage.sprite = m_UnLockSprite;
                m_LevelText.font   = m_Font2;
            }
            m_LevelText.text = m_GameLevel.ToString();
        }
Exemplo n.º 3
0
        public void SetUI(DataTransfer data)
        {
            //拥有的英雄
            List <int> jobList = data.GetData <List <int> >(ConstDefine.Has_Job);
            //当前的英雄
            int curJob = data.GetData <int>(ConstDefine.Cur_Job);
            //拥有的金币
            int coin = data.GetData <int>(ConstDefine.Has_Coin);

            for (int i = 0; i < jobList.Count; i++)
            {
                for (int j = 0; j < m_JobList.Count; j++)
                {
                    if (jobList[i] == m_JobList[i].Index)
                    {
                        m_JobList[i].HasJob();
                    }
                }
            }
            for (int i = 0; i < m_JobList.Count; i++)
            {
                if (m_JobList[i].Index == curJob)
                {
                    m_JobItem = m_JobList[i];
                    m_JobList[i].IsCurJob();
                }
            }
            m_Coin.text = coin.ToString();
        }
        public void SetWorldMap(DataTransfer data)
        {
            m_LevelMapRect = m_LevelMap.GetComponent <RectTransform>();
            m_LevelMapRect.anchoredPosition = Vector2.zero;
            Vector2 screenRect            = new Vector2(Screen.width, Screen.height);
            Vector2 uiRect                = new Vector2(Screen.width, 1136f * Screen.height / (float)Screen.width);
            Vector2 uiLeftAndTopPos       = new Vector2(uiRect.x / 2f, uiRect.y / 2f);
            Vector2 LevelMapLeftAndTopPos = m_LevelMapRect.anchoredPosition + new Vector2(m_LevelMapRect.rect.width / 2f, m_LevelMapRect.rect.height / 2f);
            Vector2 relativePos           = LevelMapLeftAndTopPos - uiLeftAndTopPos;

            m_LevelMapMin = m_LevelMapRect.anchoredPosition - relativePos;
            m_LevelMapMax = m_LevelMapRect.anchoredPosition + relativePos;

            m_LevelItemList = new List <UILevelItemView>();
            List <DataTransfer> levelList = data.GetData <List <DataTransfer> >(ConstDefine.UI_WorldMap_Content);
            bool isMatch           = false;
            int  maxCanPlayLevelId = data.GetData <int>(ConstDefine.UI_WorldMap_MaxCanPlayGameLevelId);

            for (int i = 0; i < levelList.Count; i++)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "LevelItem", isCache: true);
                if (go != null)
                {
                    go.transform.SetParent(m_LevelMap);
                    go.transform.localPosition = Vector2.zero;
                    go.transform.localScale    = Vector3.one;
                    UILevelItemView view = go.GetComponent <UILevelItemView>();
                    if (view != null)
                    {
                        int     levelId   = levelList[i].GetData <int>(ConstDefine.UI_WorldMap_LevelId);
                        int     grade     = levelList[i].GetData <int>(ConstDefine.UI_WorldMap_LevelGrade);
                        string  levelName = levelList[i].GetData <string>(ConstDefine.UI_WorldMap_LevelName);
                        string  levelIcon = levelList[i].GetData <string>(ConstDefine.UI_WorldMap_LevelIcon);
                        Vector2 levelPos  = levelList[i].GetData <Vector2>(ConstDefine.UI_WorldMap_LevelPos);
                        bool    canPlay   = levelList[i].GetData <bool>(ConstDefine.UI_WorldMap_CanPlay);
                        view.SetUI(levelId, grade, canPlay, levelName, levelIcon, levelPos);
                        view.OnClick += OnClickGameLevelItemCallBack;
                        if (maxCanPlayLevelId == -1001 && !isMatch)//未通关上一难度,从第一关开始
                        {
                            MatchPassGameLevel(levelPos);
                            isMatch = true;
                        }
                        else if (!isMatch)
                        {
                            if (maxCanPlayLevelId == levelId)
                            {
                                MatchPassGameLevel(levelPos);
                                isMatch = true;
                            }
                        }
                    }
                }
            }
            if (!isMatch)
            {
                Debug.LogError("错误:没有找到匹配的关卡");
            }
        }
Exemplo n.º 5
0
        private IEnumerator SetUIIE(DataTransfer data)
        {
            m_Count           = (int)(m_RowAnCol.x * m_RowAnCol.y);
            m_LevelViewList   = new List <UILevelItemView>();
            m_TweenList       = new List <Tween>();
            m_GridLayoutGroup = m_Grid.GetComponent <GridLayoutGroup>();
            float heightScale = Screen.height / (Screen.width * (852 / 1136f));

            m_GridLayoutGroup.cellSize    *= heightScale;
            m_GridLayoutGroup.spacing     *= heightScale;
            m_BtnLeft.sizeDelta           *= heightScale;
            m_BtnRight.sizeDelta          *= heightScale;
            m_BtnLeft.anchoredPosition3D  *= heightScale;
            m_BtnRight.anchoredPosition3D *= heightScale;
            for (int i = 0; i < m_Count; i++)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "LevelItem", isCache: true);
                go.transform.SetParent(m_Grid);
                go.transform.localScale    = Vector3.one;
                go.transform.localPosition = Vector3.zero;
                UILevelItemView view = go.GetComponent <UILevelItemView>();
                view.OnClickBtn += OnClickGameLevelItemBtn;
                m_LevelViewList.Add(view);
            }
            m_MaxPassLevel = data.GetData <int>(ConstDefine.MaxCanPlay);
            m_MaxLevel     = data.GetData <int>(ConstDefine.MaxLevel);
            m_StarInfo     = data.GetData <List <int> >(ConstDefine.StarInfo);
            yield return(null);

            bool isRun = true;

            m_Index = 1;
            while (isRun)
            {
                int index = m_Index;
                index += m_Count;
                if (index <= m_MaxPassLevel)
                {
                    m_Index += m_Count;
                }
                else
                {
                    m_Index += m_Count;
                    isRun    = false;
                }
            }
            Refresh(true);
        }
        private IEnumerator SetUIIE(DataTransfer data)
        {
            List <DataTransfer> datas = data.GetData <List <DataTransfer> >(ConstDefine.UI_AllHero_Content);

            m_HeroInfoViewList = new List <UISimpleHeroInfoView>();
            for (int i = 0; i < datas.Count; i++)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "SimpleHeroInfo", isCache: true);
                if (go != null)
                {
                    go.transform.SetParent(m_Grid.transform);
                    go.transform.localPosition = Vector3.zero;
                    go.transform.localScale    = Vector3.one;
                    UISimpleHeroInfoView heroInfo = go.GetComponent <UISimpleHeroInfoView>();
                    if (heroInfo != null)
                    {
                        long   roleId        = datas[i].GetData <long>(ConstDefine.UI_AllHero_RoleId);
                        int    heroStar      = datas[i].GetData <int>(ConstDefine.UI_AllHero_HeroStar);
                        string heroName      = datas[i].GetData <string>(ConstDefine.UI_AllHero_HeroName);
                        string heroIcon      = datas[i].GetData <string>(ConstDefine.UI_AllHero_HeroHead);
                        string heroSkillIcon = datas[i].GetData <string>(ConstDefine.UI_AllHero_HeroSkillICon);
                        heroInfo.SetUI(heroName, heroIcon, heroSkillIcon, heroStar, roleId);
                        m_HeroInfoViewList.Add(heroInfo);
                        heroInfo.OnClick += OnClickSimpleHeroInfoCallBack;
                    }
                    if (i % 9 == 0)
                    {
                        yield return(null);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void SetUI(DataTransfer data)
        {
            isInit = true;
            int gamLevel = data.GetData <int>(ConstDefine.GameLevelItem_Level);

            m_GameLevel = gamLevel;
            m_IsLock    = data.GetData <bool>(ConstDefine.GameLevelItem_IsLock);
            if (m_IsLock)
            {
                m_LockImage.sprite = m_LockSprite;
            }
            else
            {
                m_LockImage.sprite = m_UnLockSprite;
            }
            m_LevelText.text = m_GameLevel.ToString();
        }
Exemplo n.º 8
0
        private IEnumerator SetUIIE(DataTransfer data)
        {
            m_LevelViewList   = new List <UIGameLevelItemView>();
            m_TweenList       = new List <Tween>();
            m_GridLayoutGroup = m_Grid.GetComponent <GridLayoutGroup>();
            float weightScale = (Screen.width * (1136f / Screen.height)) / 852f;

            m_GridLayoutGroup.cellSize    *= weightScale;
            m_BtnLeft.sizeDelta           *= weightScale;
            m_BtnRight.sizeDelta          *= weightScale;
            m_BtnLeft.anchoredPosition3D  *= weightScale;
            m_BtnRight.anchoredPosition3D *= weightScale;
            for (int i = 0; i < 9; i++)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "GameLevelItem", isCache: true);
                go.transform.SetParent(m_Grid);
                go.transform.localScale = Vector3.one;
                go.transform.localScale = Vector3.one;
                UIGameLevelItemView view = go.GetComponent <UIGameLevelItemView>();
                view.OnClickBtn += OnClickGameLevelItemBtn;
                m_LevelViewList.Add(view);
            }
            m_MaxPassLevel = data.GetData <int>(ConstDefine.MaxPassLevel);
            m_MaxLevel     = data.GetData <int>(ConstDefine.MaxLevel);
            yield return(null);

            bool isRun = true;

            m_Index = 1;
            while (isRun)
            {
                int index = m_Index;
                index += 9;
                if (index <= m_MaxPassLevel)
                {
                    m_Index += 9;
                }
                else
                {
                    m_Index += 9;
                    isRun    = false;
                }
            }
            Refresh(true);
        }
Exemplo n.º 9
0
        public void SetUI(DataTransfer data)
        {
            int gamLevel = data.GetData <int>(ConstDefine.GameLevelItem_Level);

            m_GameLevel = gamLevel;
            m_IsLock    = data.GetData <bool>(ConstDefine.GameLevelItem_IsLock);
            if (m_IsLock)
            {
                m_LockImage.sprite = m_LockSprite;
                m_LevelText.font   = m_Font2;
            }
            else
            {
                m_LockImage.sprite = m_UnLockSprite;
                m_LevelText.font   = m_Font1;
            }
            m_LevelText.text = m_GameLevel.ToString();
            StartCoroutine("SetLevelText");
        }
        public void SetUI(DataTransfer data)
        {
            string heroName   = data.GetData <string>("HeroName");
            string heroDesc   = data.GetData <string>("HeroDesc");
            string skill1Name = data.GetData <string>("Skill1Name");
            string skill1Desc = data.GetData <string>("Skill1Desc");
            string skill2Name = data.GetData <string>("Skill2Name");
            string skill2Desc = data.GetData <string>("Skill2Desc");

            HeroName.text   = heroName;
            HeroDesc.text   = heroDesc;
            Skill1Name.text = skill1Name;
            Skill1Desc.text = skill1Desc;
            Skill2Name.text = skill2Name;
            Skill2Desc.text = skill2Desc;
        }
Exemplo n.º 11
0
        public void SetUI(DataTransfer data)
        {
            m_TaskItemList = new List <UITaskItemView>();
            List <DataTransfer> ds = data.GetData <List <DataTransfer> >(ConstDefine.UI_Task_Content);

            for (int i = 0; i < ds.Count; i++)
            {
                GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "TaskItem");
                go.transform.SetParent(m_Grid.transform);
                go.transform.localPosition = Vector3.zero;
                go.transform.localScale    = Vector3.one;
                UITaskItemView view        = go.GetComponent <UITaskItemView>();
                int            taskId      = ds[i].GetData <int>(ConstDefine.UI_Task_Id);
                string         name        = ds[i].GetData <string>(ConstDefine.UI_TaskItem_Name);
                string         desc        = ds[i].GetData <string>(ConstDefine.UI_TaskItem_Desc);
                int            targetCount = ds[i].GetData <int>(ConstDefine.UI_TaskItem_TargetCount);
                int            curCount    = ds[i].GetData <int>(ConstDefine.UI_TaskItem_CurCount);
                bool           getReward   = ds[i].GetData <bool>(ConstDefine.UI_TaskItem_GetReward);
                view.SetUI(taskId, name, desc, curCount, targetCount, getReward);
                view.GetRewardEvent += OnGetRewardCallBack;
                m_TaskItemList.Add(view);
            }
        }
        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();
        }
Exemplo n.º 13
0
 public void SetUI(DataTransfer data)
 {
     m_IsPlayMusic = data.GetData <bool>(ConstDefine.MusicStatus);
     SetMusic();
 }