示例#1
0
        public virtual void Release()
        {
            if (buffIdentifyId != SkillDefine.NONE)
            {
                GetOwner().RemoveBuffParam(buffIdentifyId);
            }

            this.mOwner         = null;
            this.mTarget        = null;
            this.data           = null;
            this.buffIdentifyId = SkillDefine.NONE;
        }
示例#2
0
        /// <summary>
        /// 尝试启动循环定时器
        /// </summary>
        private bool TryAddLoopTimer(int buffId)
        {
            if (!IsBuffActionType(buffId, EBuffActionType.LoopTimer, out int actionId))
            {
                return(false);
            }
            SkillBuffData data = SkillUtil.GetSkillBuffData(buffId);

            if (data == null)
            {
                return(false);
            }
            SkillUtil.LogWarning($"[BUFFMANAGER] LoopTimer is Start [BUffId]->[{buffId}] ActionID->[{actionId}])");
            CreateLoopTimer(buffId, actionId, data);
            return(true);
        }
示例#3
0
        /// <summary>
        /// 尝试启动循环定时器
        /// </summary>
        private bool TryAddLoopTimer(int buffId)
        {
            if (IsBuffActionType(buffId, BuffActionType.LoopTimer, out int actionId))
            {
                SkillBuffData data = SkillUtil.GetSkillBuffData(buffId);
                if (data != null)
                {
                    SkillUtil.LogWarning(string.Format(
                                             "[BUFFMANAGER] LoopTimer is Start [BUffId]->[{0}] ActionID->[{1}])"
                                             , buffId, actionId));
                    CreateLoopTimer(buffId, actionId, data);
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
 private void AddActorState(IBuff buff, SkillBuffData buffData)
 {
     if (buffData.State != (int)ActorSkillState.None)
     {
         var stateData = SkillUtil.GetSkillStateData(buffData.State);
         int key       = stateData.StateType;
         if (this.stateMap.ContainsKey(key))
         {
             var number = this.stateMap[key];
             this.stateMap[key] = number + 1;
         }
         else
         {
             this.stateMap.Add(key, 1);
             buff.GetTarget()?.AddState((ActorSkillState)key);
         }
     }
 }
示例#5
0
    public void ClientDelBuff(int id)
    {
        if (clientBuffs.ContainsKey(id))
        {
            clientBuffs.Remove(id);
        }
        SkillBuffData sdb = SkillBuffData.dataMap[id];

        if (sdb.appendState != null)
        {
            ulong st = m_theOwner.stateFlag;
            foreach (var p in sdb.appendState)
            {
                st = Mogo.Util.Utils.BitReset(st, p);
            }
            m_theOwner.stateFlag = st;
        }
    }
示例#6
0
    public void ClientAddBuff(int buffId)
    {
        if (!SkillBuffData.dataMap.ContainsKey(buffId))
        {
            return;
        }
        SkillBuffData sbd = SkillBuffData.dataMap[buffId];

        if (clientBuffs.ContainsKey(buffId))
        {//累加时间
            clientBuffs[buffId].totalTime += sbd.totalTime;
            return;
        }
        if (sbd.excludeBuff != null)
        {
            for (int i = 0; i < sbd.excludeBuff.Count; i++)
            {
                if (clientBuffs.ContainsKey(sbd.excludeBuff[i]))
                {
                    return;
                }
            }
        }
        if (sbd.replaceBuff != null)
        {
            for (int j = 0; j < sbd.replaceBuff.Count; j++)
            {
                ClientDelBuff(sbd.replaceBuff[j]);
            }
        }
        if (sbd.activeSkill != null && sbd.activeSkill.Count > 0)
        {
            foreach (var item in sbd.activeSkill)
            {
                TimerHeap.AddTimer <int>((uint)item.Key, 0, (id) => { m_theOwner.skillManager.BuffUseSkill(id); }, item.Value);
            }
        }
        ClientBuff b = new ClientBuff(sbd);

        clientBuffs.Add(buffId, b);
        UpdateState();
    }
示例#7
0
 private void RemoveActorState(IBuff buff, SkillBuffData buffData)
 {
     if (buffData.State != (int)ActorSkillState.None)
     {
         var stateData = SkillUtil.GetSkillStateData(buffData.State);
         int key       = stateData.StateType;
         if (this.stateMap.ContainsKey(key))
         {
             var number   = this.stateMap[key];
             var newValue = number - 1;
             if (newValue <= 0)
             {
                 this.stateMap.Remove(key);
                 buff.GetTarget()?.RemoveState((ActorSkillState)key);
             }
             else
             {
                 this.stateMap[key] = newValue;
             }
         }
     }
 }
示例#8
0
    private void UpdateState()
    {
        ulong state = m_theOwner.stateFlag;

        foreach (var item in clientBuffs)
        {
            SkillBuffData buffData = null;
            if (!SkillBuffData.dataMap.TryGetValue(item.Value.id, out buffData))
            {
                continue;
            }
            if (buffData.appendState == null)
            {
                continue;
            }
            foreach (var st in buffData.appendState)
            {
                state = Mogo.Util.Utils.BitSet(state, st);
            }
        }
        m_theOwner.stateFlag = state;
    }
示例#9
0
    /// <summary>
    /// 获取需要显示的VIPBuff的ID
    /// </summary>
    /// <returns></returns>
    private int GetShowVIPBuffId()
    {
        int buffId = 0;

        for (int i = 0; i < m_skillBuffDataList.Count; i++)
        {
            SkillBuffData buff = SkillBuffData.dataMap[m_skillBuffDataList[i].buffId];
            if (buff.notifyEvent == 1)
            {
                if (buffId == 0)
                {
                    buffId = buff.id;
                }
                else if (buff.vipLevel > SkillBuffData.dataMap[buffId].vipLevel)
                {
                    buffId = buff.id;
                }
            }
        }

        return(buffId);
    }
示例#10
0
 public virtual void Create(ISkill skill, ISkillActor target, int buffId)
 {
     this.mOwner  = skill;
     this.mTarget = target;
     this.data    = SkillUtil.GetSkillBuffData(buffId);
 }
示例#11
0
 public ClientBuff(SkillBuffData cfg)
 {
     id = cfg.id;
     totalTime = cfg.totalTime;
     startTime = (int)(Time.realtimeSinceStartup * 1000);
 }
示例#12
0
 private void CreateLoopTimer(int buffId, int actionId, SkillBuffData data)
 {
     object[] @params = { buffId, actionId, buffId };
     BaseCreateTimer(buffId, LoopTimerEndCallBack, data.ThinkInterval,
                     buffMap[buffId].GetDuringTime(), @params);
 }
示例#13
0
 public ClientBuff(SkillBuffData cfg)
 {
     id        = cfg.id;
     totalTime = cfg.totalTime;
     startTime = (int)(Time.realtimeSinceStartup * 1000);
 }
示例#14
0
    public void HandleBuff(ushort buffId, byte isAdd, uint time)
    {
        Mogo.Util.LoggerHelper.Debug("buffID:" + buffId);
        if (!SkillBuffData.dataMap.ContainsKey(buffId))
        {
            Mogo.Util.LoggerHelper.Debug("can find the buffId:" + buffId);
            LoggerHelper.Error("can find the buffId:" + buffId);
            return;
        }
        SkillBuffData buff = SkillBuffData.dataMap[buffId];

        if (isAdd == 1) // 添加Buff
        {
            Mogo.Util.LoggerHelper.Debug("add buff fx:" + buff.sfx + ",time:" + time);

            // VIPBuff
            if (buff.notifyEvent == 1)
            {
                // 玩家
                if (m_theOwner == MogoWorld.thePlayer)
                {
                    AddSkillBuff(buff.id, time);
                    int showBuffId = GetShowVIPBuffId();
                    if (showBuffId > 0)
                    {
                        NormalMainUIViewManager.Instance.ShowVIPBuffBtn(true, showBuffId, GetBuffLastTime(buffId));
                    }
                }
            }
            else
            {
                if (m_theOwner.sfxHandler)
                {
                    m_theOwner.sfxHandler.HandleFx(buff.sfx);
                    TimerHeap.AddTimer(time, 0,
                                       (owner) =>
                    {
                        if (owner != null && owner.sfxHandler != null)
                        {
                            owner.sfxHandler.RemoveFXs(buff.sfx);
                        }
                    },
                                       m_theOwner);
                }

                if (m_theOwner == MogoWorld.thePlayer && buff.tips != 0)
                {
                    MogoMsgBox.Instance.ShowFloatingTextQueue(LanguageData.GetContent(buff.tips));
                }
            }
        }
        else // 删除Buff
        {
            // VIPBuff
            if (buff.notifyEvent == 1)
            {
                // 玩家
                if (m_theOwner == MogoWorld.thePlayer)
                {
                    LoggerHelper.Debug("Remove Buff : id =" + buff.id);
                    RemoveSkillBuff(buff.id);

                    int showBuffId = GetShowVIPBuffId();
                    if (showBuffId > 0)
                    {
                        NormalMainUIViewManager.Instance.ShowVIPBuffBtn(true, showBuffId, GetBuffLastTime(showBuffId));
                    }
                    else
                    {
                        NormalMainUIViewManager.Instance.ShowVIPBuffBtn(false);
                    }
                }
            }
            else
            {
                Mogo.Util.LoggerHelper.Debug("delete buff fx:" + buff.sfx);
                if (m_theOwner.sfxHandler)
                {
                    m_theOwner.sfxHandler.RemoveFXs(buff.sfx);
                }
            }
        }
        //UpdateState();
    }