Exemplo n.º 1
0
        /// <summary>
        /// 显示属性改变。
        /// </summary>
        /// <param name="type">属性类型。</param>
        /// <param name="oldvalue">改变前的值。</param>
        /// <param name="newvalue">改变值。</param>
        /// <param name="delay">显示延迟。</param>
        public void ShowAttrChange(BasicAttrEnum type, double oldvalue, double newvalue, float delay)
        {
            var change = newvalue - oldvalue;

            if (type == BasicAttrEnum.Power)
            {
                //同一时间只显示一个战斗变化
                if (CurPowerFlyAttr != null)
                {
                    RemoveFlyAttr(CurPowerFlyAttr);
                }
                CurPowerFlyAttr = GetFlyAttr(change > 0 ? 0 : 1);
                if (newvalue > oldvalue)
                {
                    //CoreEntry.gAudioMgr.PlayUISound(900011);
                }
                CurPowerFlyAttr.Init(type, oldvalue, newvalue, 0, -150, delay);
            }
            else
            {
                ItemFlyAttr item = GetFlyAttr(change > 0 ? 2 : 3);
                item.Init(type, (float)oldvalue, (float)newvalue, 200, 50, delay);
                CurFlyAttr.Add(item);
            }
        }
Exemplo n.º 2
0
        //private int mValue;

        public void Init(BasicAttrEnum type, double oldvalue, double newvalue, float x, float y, float delay)
        {
            mType = type;
            var change = newvalue - oldvalue;

            if (type == BasicAttrEnum.Power)
            {
                //战斗力表现方式不一样
                Scroll.SetValue((long)oldvalue, false);
                Scroll.SetValue((long)newvalue, true);
                ChangeText.text = change > 0 ? ("+" + change.ToString()) : change.ToString();

                PowerToText fun = LuaMgr.Instance.GetLuaEnv().Global.GetInPath <PowerToText>("Common.PowerToText");
                int         len = (oldvalue > newvalue ? oldvalue : newvalue).ToString().Length * 30;
                if (fun != null)
                {
                    len = fun((oldvalue > newvalue ? oldvalue : newvalue)).Length * 30;
                }

                int           clen    = ChangeText.text.Length * 30;
                RectTransform valuert = Scroll.GetComponent <RectTransform>();
                //valuert.anchoredPosition = new Vector2(-len / 2, 0);
                valuert.sizeDelta        = new Vector2(len, valuert.sizeDelta.y);
                PowerBackLeft.sizeDelta  = new Vector2(len / 2 + 100, PowerBackLeft.sizeDelta.y);
                PowerBackRight.sizeDelta = new Vector2(len / 2 + clen + 70, PowerBackRight.sizeDelta.y);
                if (EffectFire != null)
                {
                    EffectFire.Play();
                }
                // if (Effect != null)
                // {
                //     Effect.SetActive(false);
                //     Effect.SetActive(true);
                // }
            }
            else
            {
                NameText.text  = BaseAttr.GetBasicAttrName((int)mType);
                ValueText.text = string.Format("{0}{1}", change > 0 ? "+" : "", change);
            }
            AniCurve.Init(x, y, delay);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新属性。
        /// </summary>
        /// <param name="attrs">属性列表。</param>
        public virtual void OnUpdateAttr(List <MsgData_sClientAttr> attrs)
        {
            //Debug.Log("OnUpdateAttr 0");
            //用于判断血量或战力是否发生变化
            long   oldhp          = mBasicAttr.CurHP;
            long   oldmaxhp       = mBasicAttr.MaxHP;
            long   oldpower       = mBasicAttr.Power;
            double fOldPower      = mBasicAttr.GetBasicAttrValue((int)BasicAttrEnum.Power);
            int    oldlevel       = mBasicAttr.Level;
            long   oldExp         = mBasicAttr.Exp;
            bool   currencychange = false;
            int    oldJingJieLv   = mBasicAttr.JingJieLevel;
            long   oldJingJieExp  = mBasicAttr.JingJieExp;
            int    oldVip         = mBasicAttr.VIPLevel;

            double[] oldattr = mInit ? FlyAttrManager.GetShowAttr(mBasicAttr.Attrs) : null;     //没进场不飘字
            for (int i = 0; i < attrs.Count; ++i)
            {
                MsgData_sClientAttr ca   = attrs[i];
                BasicAttrEnum       type = BaseAttr.GetBasicAttrTypeFromStatType(ca.AttrType);
                if (type != BasicAttrEnum.Unkonw)
                {
                    mBasicAttr.SetBasicAttrValue((int)type, ca.AttrValue);
                    continue;
                }
                int currencytype = CurrencyType.GetCurrencyTypeFromStatType(ca.AttrType);
                if (currencytype != -1)
                {
                    SetCurrency(currencytype, (long)ca.AttrValue);
                    currencychange = true;
                    if (currencytype == CurrencyType.CURRENCY_TYPE_UNBIND_MONEY)
                    {
                        Account.Instance.isRecharging = false; //充值钻石完成
                    }
                    continue;
                }
            }
            if (oldVip != mBasicAttr.VIPLevel)
            {
                if (CoreEntry.gActorMgr.MainPlayer != null)
                {
                    if (CoreEntry.gActorMgr.MainPlayer.mBaseAttr != null)
                    {
                        CoreEntry.gActorMgr.MainPlayer.mBaseAttr.VIPLevel = mBasicAttr.VIPLevel;
                        CoreEntry.gActorMgr.MainPlayer.Health.OnLordChange();
                    }
                }
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_VIP, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 1");
            }
            if (oldhp != mBasicAttr.CurHP || oldmaxhp != mBasicAttr.MaxHP)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_HP, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 2");
            }
            if (oldpower != mBasicAttr.Power)
            {
                long powerDiff    = (long)(mBasicAttr.GetBasicAttrValue((int)BasicAttrEnum.Power) - fOldPower);
                long powerDiffInt = mBasicAttr.Power - oldpower;
                oldpower = oldpower - (powerDiff - powerDiffInt);
                EventParameter ep = EventParameter.Get();
                ep.longParameter  = oldpower;
                ep.longParameter1 = mBasicAttr.Power;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_POWER, ep);
                Debug.Log("OnUpdateAttr 3");
            }
            if (oldlevel != mBasicAttr.Level)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_INFO, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 4");
                if (oldlevel != 0)
                {
                    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_LV, EventParameter.Get(oldlevel));
                    //Debug.Log("OnUpdateAttr 5");
                }
            }
            if (currencychange)
            {
                //注意,大量丢金币变化通知,卡CPU
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_CURRENCY, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 6");
            }
            if (oldlevel != mBasicAttr.Level || oldExp != mBasicAttr.Exp)
            {
                EventParameter parameter = EventParameter.Get();
                parameter.intParameter  = oldlevel;
                parameter.longParameter = oldExp;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_EXP, parameter);
                //Debug.Log("OnUpdateAttr 7");
            }
            if (oldJingJieLv != mBasicAttr.JingJieLevel)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_JINGJIE_LV, EventParameter.Get(oldJingJieLv));
                //Debug.Log("OnUpdateAttr 8");
            }
            if (oldJingJieLv != mBasicAttr.JingJieLevel || oldJingJieExp != mBasicAttr.JingJieExp)
            {
                EventParameter parameter = EventParameter.Get();
                parameter.intParameter  = oldJingJieLv;
                parameter.longParameter = oldJingJieExp;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PALYER_JINGJIE_EXP, parameter);
                //Debug.Log("OnUpdateAttr 9");
            }
            if (oldattr != null)
            {
                double[]       newattr = FlyAttrManager.GetShowAttr(mBasicAttr.Attrs);
                EventParameter ep      = EventParameter.Get();
                ep.objParameter  = oldattr;
                ep.objParameter1 = newattr;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FLY_ATTR, ep);
                //Debug.Log("OnUpdateAttr 10");
            }
        }
Exemplo n.º 4
0
 public FlyAttrInfo(BasicAttrEnum type, int ov, int nv)
 {
     AttrType = type;
     OldValue = ov;
     NewValue = nv;
 }