125 战斗 修复 combine skill第一个为非skill包的问题 增加技能配置错误容错(技能帧配置太长导致动作结束 事件没结束) 调整技能代码 删除多余字段
6个文件已修改
2个文件已添加
171 ■■■■■ 已修改文件
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Motion/MotionBase.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/RecordPlayer/RecordPlayer.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/MountBuffSkill.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/MountBuffSkill.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/SkillBase.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/SkillFactory.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -116,6 +116,7 @@
            }
        }
        //  嵌套包内的包合并
        foreach (var combinePack in combineDict.Values)
        {
@@ -123,16 +124,12 @@
            {
                if (indexDict.TryGetValue(i, out var pack))
                {
                    indexDict.Remove(i);
                    combinePack.AddPack(pack);
                    if (pack is CustomHB426CombinePack)
                    {
                        //  如果是嵌套的包 加入之后 调整i
                        combinePack.AddPack(pack);
                        i = (pack as CustomHB426CombinePack).toIndex;
                    }
                    else
                    {
                        combinePack.AddPack(pack);
                        indexDict.Remove(i);
                    }
                }
            }
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -7,6 +7,8 @@
    private bool isCast = false;
    public int fromSkillId = 0;
    public SkillRecordAction(BattleField _battleField, BattleObject _caster, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> packList)
        : base(RecordActionType.Skill, _battleField, _caster)
    {
@@ -43,7 +45,7 @@
            return;
        }
        if (!skillBase.IsFinished())
        if (isCast && !skillBase.IsFinished())
        {
            skillBase.Run();
        }
@@ -51,6 +53,14 @@
        if (isCast)
            return;
        if (fromSkillId > 0)
        {
            BattleDebug.LogError("cast skill from skill : " + fromSkillId);
        }
        skillBase.fromSkillId = fromSkillId;
        skillBase.Cast();
        isCast = true;
Main/System/Battle/Motion/MotionBase.cs
@@ -210,11 +210,28 @@
        // 动画帧更新处理
        int triggerMFEndCount = 0;
        Action updateLocalHandler = null;
        int failCallbackTimes = 0;
        updateLocalHandler = () =>
        {
            if (isFinish) return;
            float frame = (skillTrackEntry.TrackTime * (float)BattleConst.skillMotionFps);
            float frame = (skillTrackEntry.TrackTime * skillTrackEntry.TimeScale * (float)BattleConst.skillMotionFps);
            if (skillTrackEntry.TrackTime == 0)
            {
                failCallbackTimes++;
            }
            if (failCallbackTimes > 100)
            {
                Debug.LogError("技能动画播放失败,回调异常,强制结束 " + skillConfig.SkillID + " 导致错误的原因是技能帧配置得太久导致技能动作结束了事件还没结束");
                skillBase.ForceFinished();
                RemoveRunAction(updateLocalHandler);
                isFinish = true;
                return;
            }
            // 前摇结束(只触发一次)
            if (!beginPhaseTriggered && frame >= skillConfig.StartupFrames && curLoop == 0)
Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -30,7 +30,7 @@
    public void PlayRecord(RecordAction recordAction)
    {
        // BattleDebug.LogError("Enqueue record action " + recordAction.GetType());
        BattleDebug.LogError("Enqueue record action " + recordAction.GetType());
        recordActionQueue.Enqueue(recordAction);
    }
@@ -44,7 +44,7 @@
    public void InsertRecord(RecordAction recordAction)
    {
        // BattleDebug.LogError("Insert record action " + recordAction.GetType());
        BattleDebug.LogError("Insert record action " + recordAction.GetType());
        if (currentRecordAction != null)
        {
            Queue<RecordAction> tempQueue = new Queue<RecordAction>();
@@ -126,7 +126,7 @@
        if (currentRecordAction != null && currentRecordAction.IsFinished())
        {
            // BattleDebug.LogError("record action " + currentRecordAction.GetType() + " play finished");
            BattleDebug.LogError("record action " + currentRecordAction.GetType() + " play finished");
            currentRecordAction = null;
            isWaitingNextAction = true;
            waitTimer = 0f;
@@ -138,7 +138,7 @@
            if (recordActionQueue.Count > 0)
            {
                currentRecordAction = recordActionQueue.Dequeue();
                // BattleDebug.LogError("play record action " + currentRecordAction.GetType());
                BattleDebug.LogError("play record action " + currentRecordAction.GetType());
            }
        }
    }
Main/System/Battle/Skill/MountBuffSkill.cs
New file
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Linq;
public class MountBuffSkill : SkillBase
{
    public MountBuffSkill(BattleObject _caster, SkillConfig _skillCfg,
            HB427_tagSCUseSkill _vNetData, List<GameNetPackBasic> _packList, BattleField _battleField)
            : base(_caster, _skillCfg, _vNetData, _packList, _battleField)
    {
    }
    protected override void OnHitTargets(int _hitIndex, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> hitList)
    {
        base.OnHitTargets(_hitIndex, hitList);
    }
    protected override void OnAllAttackMoveFinished()
    {
        base.OnAllAttackMoveFinished();
        OnSkillFinished();
    }
    protected override void OnHitEachTarget(int _hitIndex, BattleObject target, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt)
    {
        //    什么都不做 只等buff
    }
}
Main/System/Battle/Skill/MountBuffSkill.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82b8f2f1107f8cc43957452aaa48844a
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/Battle/Skill/SkillBase.cs
@@ -24,12 +24,6 @@
    protected BattleObject caster = null; // 施法者
    protected bool startCounting = false;
    protected bool pauseState = false;
    protected int curFrame = 0;
    protected List<GameNetPackBasic> packList;
    protected SkillRecordAction otherSkillAction;
@@ -40,7 +34,9 @@
    protected bool moveFinished = false;
    public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
    public int fromSkillId;
    public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
    {
        caster = _caster;
        skillConfig = _skillCfg;
@@ -54,14 +50,18 @@
    public virtual void Run()
    {
        if (startCounting)
        {
            curFrame++;
        }
        if (null != skillEffect)
        {
            skillEffect.Run();
            if (skillEffect.IsFinished())
            {
                skillEffect = null;
                OnSkillFinished();
            }
            else
            {
                skillEffect.Run();
            }
        }
        if (otherSkillAction != null)
@@ -77,20 +77,6 @@
            }
        }
    }
    public void Pause()
    {
        pauseState = startCounting;
        startCounting = false;
    }
    public void Resume()
    {
        startCounting = pauseState;
    }
    // 0·移动到距离目标n码,的距离释放(可配置,9999即原地释放,负数则是移动到人物背面,人物要转身)
    // 1·移动到距离阵容位置n码的距离(如2号位,5号位)释放(即战场中央此类)
@@ -320,7 +306,7 @@
    //    技能前摇帧结束
    public virtual void OnStartSkillFrameEnd()
    {
    }
    /// <summary>
@@ -329,6 +315,7 @@
    /// <param name="times"></param>
    public virtual void OnMiddleFrameStart(int times)
    {
        // if (skillEffect != null)
        {
            skillEffect.OnMiddleFrameStart(times);
@@ -337,6 +324,7 @@
    public virtual void OnMiddleFrameEnd(int times, int hitIndex)
    {
        // if (skillEffect != null)
        {
            skillEffect.OnMiddleFrameEnd(times, hitIndex);
@@ -348,6 +336,7 @@
    /// </summary>
    public virtual void OnFinalFrameStart()
    {
        // if (skillEffect != null)
        {
            skillEffect.OnFinalFrameStart();
@@ -358,7 +347,7 @@
    /// 后摇结束
    /// </summary>
    public virtual void OnFinalFrameEnd()
    {
    {
        // if (skillEffect != null)
        {
            skillEffect.OnFinalFrameEnd();
@@ -635,10 +624,13 @@
            {
                return false;
            }
            else
        }
        if (otherSkillAction != null)
        {
            if (!otherSkillAction.IsFinished())
            {
                OnSkillFinished();
                skillEffect = null;
                return false;
            }
        }
@@ -653,9 +645,6 @@
                bo.heroInfoBar.SetActive(true);
            }
            battleField.battleRootNode.skillMaskNode.SetActive(false);
            return true;
        }
@@ -715,6 +704,7 @@
                {
                    BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
                    otherSkillAction = combinePack.CreateSkillAction();
                    otherSkillAction.fromSkillId = skillConfig.SkillID;
                    return;
                }
            }
Main/System/Battle/Skill/SkillFactory.cs
@@ -63,18 +63,22 @@
            case 2:
                skill = new DirectlyHealSkill(_caster, skillConfig, vNetData, packList, battleField);
                break;
            // case 3:
            // case 4:
            // case 5:
            // case 6:
            // case 14:
                // // skill = new MountBuffSkill(_caster, skillConfig, vNetData, packList, battleField);
                // break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 14:
                skill = new MountBuffSkill(_caster, skillConfig, vNetData, packList, battleField);
                break;
            default:
                Debug.LogError("超出了技能类型范围 请检查配置, 目前暂时只支持攻击类型的技能");
                break;
        }
        // skill 挂载buff
        // skill  1 2 3 4技能
        // skill头 B428 尾
        return skill;
    }
}