Beispiel #1
0
        private void BroadcastHeroInfo()
        {
            int maxExp = GameEntry.DataTable.GetDataTable <DRHeroLevel>().GetDataRow(m_PlayerData.Level).RequireExp;
            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().Fill(m_PlayerData.Name, m_PlayerData.Level, m_PlayerData.Exp, maxExp, m_CurAttribute);

            GameEntry.Event.Fire(this, args);
        }
Beispiel #2
0
        private void OnUpgradeLevel()
        {
            this.ActorCard.SetLevel();

            RefreshBoardEventArgs eventArgs = ReferencePool.Acquire <RefreshBoardEventArgs>();
            int maxHp = Attrbute.GetValue(AttributeType.MaxHp);
            int curHp = Attrbute.GetValue(AttributeType.Hp);

            eventArgs.Fill(EntityId, maxHp, curHp, ActorCard.Level);
            GameEntry.Event.Fire(this, eventArgs);

            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillLevel(ActorCard.Level);

            GameEntry.Event.Fire(this, args);

            int        id   = GameEntry.Entity.GenerateTempSerialId();
            EffectData data = new EffectData(id, Constant.Define.LevelUpEffect);

            data.Owner     = this;
            data.KeepTime  = 3;
            data.BindType  = EffectBindType.OwnFoot;
            data.DeadType  = FlyObjDeadType.UntilLifeTimeEnd;
            data.Parent    = CachedTransform;
            data.SetParent = true;
            GameEntry.Entity.ShowEffect(data);
        }
Beispiel #3
0
        protected override void UpdateHealth()
        {
            int maxHp = Attrbute.GetValue(AttributeType.MaxHp);
            int curHp = Attrbute.GetValue(AttributeType.Hp);
            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillHp(curHp, maxHp);

            GameEntry.Event.Fire(this, args);
        }
Beispiel #4
0
        private void RefreshHeroInfo(object sender, GameEventArgs e)
        {
            RefreshHeroInfoEventArgs ne = e as RefreshHeroInfoEventArgs;

            switch (ne.Type)
            {
            case RefreshType.Name:
                m_Name.text = ne.Name;
                break;

            case RefreshType.Level:
                m_Level.text = GlobalTools.Format("LV.{0}", ne.Level);
                break;

            case RefreshType.Hp:
                if (ne.MaxHp != 0)
                {
                    m_Hp.value = 100 * (float)ne.CurHp / ne.MaxHp;
                    m_Hp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.CurHp, ne.MaxHp);
                }
                break;

            case RefreshType.Mp:
                if (ne.MaxMp != 0)
                {
                    m_Mp.value = 100 * (float)ne.CurMp / ne.MaxMp;
                    m_Mp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.CurMp, ne.MaxMp);
                }
                break;

            case RefreshType.Exp:
                if (ne.MaxExp != 0)
                {
                    m_Exp.fillAmount = (float)ne.CurExp / ne.MaxExp;
                }
                break;

            case RefreshType.All:
                m_Name.text  = ne.Name;
                m_Level.text = GlobalTools.Format("LV.{0}", ne.Level);
                if (ne.MaxHp != 0)
                {
                    m_Hp.value = 100 * (float)ne.Attribute.Hp / ne.Attribute.MaxHp;
                    m_Hp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.Attribute.Hp, ne.Attribute.MaxHp);
                }
                if (ne.MaxMp != 0)
                {
                    m_Mp.value = 100 * (float)ne.Attribute.Mp / ne.Attribute.MaxMp;
                    m_Mp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.Attribute.Mp, ne.Attribute.MaxMp);
                }
                if (ne.MaxExp != 0)
                {
                    m_Exp.fillAmount = (float)ne.CurExp / ne.MaxExp;
                }
                break;
            }
        }
Beispiel #5
0
        protected override void UpdatePower()
        {
            base.UpdatePower();
            int maxMp = Attrbute.GetValue(AttributeType.MaxMp);
            int curMp = Attrbute.GetValue(AttributeType.Mp);
            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillMp(curMp, maxMp);

            GameEntry.Event.Fire(this, args);
        }
Beispiel #6
0
        private void TryAddExp(int exp)
        {
            if (exp <= 0)
            {
                return;
            }

            var dt = GameEntry.DataTable.GetDataTable <DRHeroLevel>();

            int maxLevel = dt.Count;

            if (m_PlayerData.Level == maxLevel)
            {
                ShowWarning("100005");
                return;
            }

            DRHeroLevel curLevelData = dt.GetDataRow(m_PlayerData.Level);

            if (curLevelData == null)
            {
                Log.Error("Can no get level{0} data.", m_PlayerData.Level);
                return;
            }

            int maxExp = curLevelData.RequireExp;

            m_PlayerData.Exp += exp;
            int offsetExp = m_PlayerData.Exp - maxExp;

            if (offsetExp > 0)
            {
                m_PlayerData.Exp = offsetExp;
                m_PlayerData.Level++;
                OnUpgradeLevel();
            }

            int curExp = m_PlayerData.Exp;

            RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillExp(curExp, maxExp);

            GameEntry.Event.Fire(this, args);
        }