コード例 #1
0
        private void PopSummonResult()
        {
            if (m_SummonInfoStack == null)
            {
                return;
            }
            if (m_SummonInfoStack.Count <= 0)
            {
                m_SummonResultView.Hide();
                return;
            }
            SummonInfoTransfer temp = m_SummonInfoStack.Pop();

            m_SummonResultView.Show(temp);
        }
コード例 #2
0
 public void Show(SummonInfoTransfer summonInfo)
 {
     m_NickName.text = summonInfo.NickName;
     if (summonInfo.IsDebris)
     {
         m_NewHero.gameObject.SetActive(false);
         m_OwerHero.gameObject.SetActive(true);
         m_DebrisCount.text = summonInfo.DebrisCount.ToString();
     }
     else
     {
         m_NewHero.gameObject.SetActive(true);
         m_OwerHero.gameObject.SetActive(false);
     }
     ShowAni();
 }
コード例 #3
0
        private SummonInfoTransfer Summon()
        {
            ConfigEntity      configEntity = ConfigDBModel.Instance.GetList()[0];
            float             randomRange  = UnityEngine.Random.Range(0, 1f);
            List <HeroEntity> heroList     = null;
            HeroInfo          info         = null;
            HeroEntity        heroEntity   = null;
            int heroStar = 1;

            if (randomRange <= configEntity.TheProbabilityOfLegendHero)
            {
                //抽取传奇英雄
                heroStar = 3;
                heroList = HeroDBModel.Instance.GetList().FindAll(x => x.Quality == 2);
            }
            else if (randomRange <= configEntity.TheProbabilityOfLegendHero + configEntity.TheProbabilityOfeliteHero)
            {
                //抽取精英英雄
                heroStar = 2;
                heroList = HeroDBModel.Instance.GetList().FindAll(x => x.Quality == 1);
            }
            else if (randomRange <= configEntity.TheProbabilityOfLegendHero + configEntity.TheProbabilityOfeliteHero + configEntity.TheProbabilityOfNormalHero)
            {
                //抽取普通英雄
                heroList = HeroDBModel.Instance.GetList().FindAll(x => x.Quality == 0);
            }
            else
            {
                Debug.LogError("错误:配置表填错了");
                return(SummonInfoTransfer.Empty());
            }
            if (heroList.Count > 0)
            {
                heroEntity = heroList[UnityEngine.Random.Range(0, heroList.Count)];
            }
            else
            {
                Debug.Log("没有英雄哦");
                return(SummonInfoTransfer.Empty());
            }

            SummonInfoTransfer transfer = new SummonInfoTransfer();

            //有没有这个英雄
            if (Global.HeroInfoList.Find(x => x.HeroID == heroEntity.Id) != null)
            {
                transfer.IsDebris = true;
                if (heroEntity.Quality == 0)
                {
                    transfer.DebrisCount = configEntity.TheDebrisOfNormalHero;
                }
                else if (heroEntity.Quality == 1)
                {
                    transfer.DebrisCount = configEntity.TheDebrisOfEliteHero;
                }
                else if (heroEntity.Quality == 2)
                {
                    transfer.DebrisCount = configEntity.TheDebrisOfLegendHero;
                }
                SimulatedDatabase.Instance.AddDebris(transfer.DebrisCount);
            }
            else
            {
                info = SimulatedDatabase.Instance.CreateHero(heroEntity.Id, heroStar);
                transfer.IsDebris = false;
            }
            transfer.NickName = heroEntity.Name;
            transfer.Quality  = heroEntity.Quality;
            transfer.HeroPic  = heroEntity.RolePic;
            return(transfer);
        }