| | |
| | | } |
| | | // 有特效可能带spine又带unity特效的情况 |
| | | spineComp = gameObject.GetComponentInChildren<SkeletonAnimation>(true); |
| | | |
| | | if (effectConfig.effectPos != null && effectConfig.effectPos.Length >= 2) |
| | | { |
| | | rectTrans.anchoredPosition += new Vector2(effectConfig.effectPos[0], effectConfig.effectPos[1]); |
| | | } |
| | | |
| | | } |
| | | |
| | | protected virtual void Clear() |
| | |
| | | |
| | | public string sortingLayer; |
| | | public int sortingOrder; |
| | | private RectTransform rectTrans; |
| | | |
| | | protected void OnSortingChanged(string _sortingLayer, int _sortingOrder) |
| | | { |
| | |
| | | |
| | | GameObject newGo = new GameObject("BattleEffectPlayer_" + effectId); |
| | | newGo.transform.SetParent(parent, false); |
| | | newGo.AddMissingComponent<RectTransform>(); |
| | | battleEffectPlayer = newGo.AddComponent<BattleEffectPlayer>(); |
| | | battleEffectPlayer.rectTrans = newGo.AddMissingComponent<RectTransform>(); |
| | | |
| | | battleEffectPlayer.effectId = effectId; |
| | | battleEffectPlayer.SetActive(true); |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: Thursday, August 21, 2025
|
| | | // [ Date ]: 2025年8月26日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int isLoop;
|
| | | public int frontBack;
|
| | | public float delayPlay;
|
| | | public int[] effectPos;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | | int.TryParse(tables[11],out frontBack);
|
| | |
|
| | | float.TryParse(tables[12],out delayPlay);
|
| | |
|
| | | if (tables[13].Contains("[")) |
| | | { |
| | | effectPos = JsonMapper.ToObject<int[]>(tables[13]); |
| | | } |
| | | else |
| | | { |
| | | string[] effectPosStringArray = tables[13].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | effectPos = new int[effectPosStringArray.Length]; |
| | | for (int i=0;i<effectPosStringArray.Length;i++) |
| | | { |
| | | int.TryParse(effectPosStringArray[i],out effectPos[i]); |
| | | } |
| | | }
|
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: Monday, August 25, 2025
|
| | | // [ Date ]: 2025年8月26日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int CoolDownTime;
|
| | | public int[] EnhanceSkillList;
|
| | | public int FightPower;
|
| | | public string SkillMotionName;
|
| | | public string IconName;
|
| | | public int EffectType;
|
| | | public int StartupFrames;
|
| | | public int[] ActiveFrames;
|
| | | public int RecoveryFrames;
|
| | |
| | | public float CastDistance;
|
| | | public int[][] DamageDivide;
|
| | | public int BulletEffectId;
|
| | | public int BulletPos;
|
| | | public int BulletPath;
|
| | | public float BulletFlyTime;
|
| | | public int ExplosionEffectId;
|
| | | public int ExplosionPos;
|
| | | public string SkillMotionName;
|
| | | public int EffectId;
|
| | | public int EffectPos;
|
| | | public int EffectType;
|
| | | public string IconName;
|
| | | public int ExplosionEffect2;
|
| | | public int EffectId;
|
| | | public int EffectId2;
|
| | | public int MStartEffectId;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | |
|
| | | int.TryParse(tables[23],out FightPower);
|
| | |
|
| | | int.TryParse(tables[24],out StartupFrames); |
| | | SkillMotionName = tables[24];
|
| | |
|
| | | if (tables[25].Contains("[")) |
| | | IconName = tables[25];
|
| | |
|
| | | int.TryParse(tables[26],out EffectType); |
| | |
|
| | | int.TryParse(tables[27],out StartupFrames); |
| | |
|
| | | if (tables[28].Contains("[")) |
| | | { |
| | | ActiveFrames = JsonMapper.ToObject<int[]>(tables[25]); |
| | | ActiveFrames = JsonMapper.ToObject<int[]>(tables[28]); |
| | | } |
| | | else |
| | | { |
| | | string[] ActiveFramesStringArray = tables[25].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | string[] ActiveFramesStringArray = tables[28].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | ActiveFrames = new int[ActiveFramesStringArray.Length]; |
| | | for (int i=0;i<ActiveFramesStringArray.Length;i++) |
| | | { |
| | |
| | | } |
| | | }
|
| | |
|
| | | int.TryParse(tables[26],out RecoveryFrames); |
| | | int.TryParse(tables[29],out RecoveryFrames); |
| | |
|
| | | int.TryParse(tables[27],out LoopCount); |
| | | int.TryParse(tables[30],out LoopCount); |
| | |
|
| | | int.TryParse(tables[28],out CastPosition); |
| | | int.TryParse(tables[31],out CastPosition); |
| | |
|
| | | int.TryParse(tables[29],out CastIndexNum); |
| | | int.TryParse(tables[32],out CastIndexNum); |
| | |
|
| | | float.TryParse(tables[30],out CastDistance); |
| | | float.TryParse(tables[33],out CastDistance); |
| | |
|
| | | DamageDivide = JsonMapper.ToObject<int[][]>(tables[31].Replace("(", "[").Replace(")", "]")); |
| | | DamageDivide = JsonMapper.ToObject<int[][]>(tables[34].Replace("(", "[").Replace(")", "]")); |
| | |
|
| | | int.TryParse(tables[32],out BulletEffectId); |
| | | int.TryParse(tables[35],out BulletEffectId); |
| | |
|
| | | int.TryParse(tables[33],out BulletPos); |
| | | int.TryParse(tables[36],out BulletPath); |
| | |
|
| | | int.TryParse(tables[34],out BulletPath); |
| | | float.TryParse(tables[37],out BulletFlyTime); |
| | |
|
| | | float.TryParse(tables[35],out BulletFlyTime); |
| | | int.TryParse(tables[38],out ExplosionEffectId); |
| | |
|
| | | int.TryParse(tables[36],out ExplosionEffectId); |
| | | int.TryParse(tables[39],out ExplosionEffect2); |
| | |
|
| | | int.TryParse(tables[37],out ExplosionPos); |
| | | int.TryParse(tables[40],out EffectId); |
| | |
|
| | | SkillMotionName = tables[38];
|
| | | int.TryParse(tables[41],out EffectId2); |
| | |
|
| | | int.TryParse(tables[39],out EffectId); |
| | |
|
| | | int.TryParse(tables[40],out EffectPos); |
| | |
|
| | | int.TryParse(tables[41],out EffectType); |
| | |
|
| | | IconName = tables[42];
|
| | |
|
| | | int.TryParse(tables[43],out ExplosionEffect2); |
| | | int.TryParse(tables[42],out MStartEffectId); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | // B4 28 Buff刷新 #tagSCBuffRefresh |
| | | |
| | | public class DTCB428_tagSCBuffRefresh : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | public override void Done(GameNetPackBasic vNetPack) |
| | | { |
| | | base.Done(vNetPack); |
| | | HB428_tagSCBuffRefresh vNetData = vNetPack as HB428_tagSCBuffRefresh; |
| | | BattleField battleField = BattleManager.Instance.GetBattleField(vNetData.packUID); |
| | | |
| | | if (null != battleField) |
| | | { |
| | | battleField.OnRefreshBuff(vNetData); |
| | | } |
| | | } |
| | | } |
| | |
| | | public uint LastTime; // 剩余时长毫秒/回合数 |
| | | public ushort Layer; // 层数,不需要默认0 |
| | | public uint OwnerID; // buff来源者,即施法方 |
| | | public uint Value1; |
| | | public uint Value2; |
| | | public uint Value3; |
| | | |
| | | public HB428_tagSCBuffRefresh () { |
| | | _cmd = (ushort)0xB428; |
| | |
| | | TransBytes (out LastTime, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Layer, vBytes, NetDataType.WORD); |
| | | TransBytes (out OwnerID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Value1, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Value2, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Value3, vBytes, NetDataType.DWORD); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public BattleEffectPlayer PlayEffect(int ObjID, int effectId, Transform parent) |
| | | public BattleEffectPlayer PlayEffect(int ObjID, int effectId, Transform parent, BattleCamp camp) |
| | | { |
| | | if (effectId <= 0) |
| | | { |
| | | BattleDebug.LogError("effect id <= 0"); |
| | | Debug.LogError("effect id <= 0"); |
| | | return null; |
| | | } |
| | | |
| | | var effectCfg = EffectConfig.Get(effectId); |
| | | if (null == effectCfg) |
| | | { |
| | | BattleDebug.LogError("effect config is null, effectId : " + effectId); |
| | | Debug.LogError("effect config is null, effectId : " + effectId); |
| | | return null; |
| | | } |
| | | |
| | |
| | | effectDict[effectId] = new List<BattleEffectPlayer>(); |
| | | } |
| | | |
| | | BattleDebug.LogError("播放特效 " + effectId); |
| | | |
| | | BattleEffectPlayer effectPlayer = BattleEffectPlayer.Create(effectId, battleField.battleRootNode.transform); |
| | | // 设置特效缩放和方向 |
| | | |
| | | effectPlayer.transform.position = parent.position; |
| | | float effectScale = parent.transform.localScale.x; |
| | | effectPlayer.transform.localScale *= effectScale; |
| | | |
| | | effectPlayer.onDestroy += OnEffectDestroy; |
| | | if (effectPlayer != null) |
| | | { |
| | | effectDict[effectId].Add(effectPlayer); |
| | | } |
| | | effectPlayer.Play(true); |
| | | |
| | | var effectScale = effectPlayer.transform.localScale; |
| | | effectScale.x *= camp == BattleCamp.Red ? 1 : -1; |
| | | effectPlayer.transform.localScale = effectScale; |
| | | |
| | | return effectPlayer; |
| | | } |
| | | |
| | |
| | | |
| | | public void StartBattle(Action onMoveComplete) |
| | | { |
| | | List<BattleObject> redTeam = battleObjMgr.GetBattleObjList(BattleCamp.Red); |
| | | List<BattleObject> blueTeam = battleObjMgr.GetBattleObjList(BattleCamp.Blue); |
| | | |
| | | Tween tween = null; |
| | | |
| | | foreach (var obj in redTeam) |
| | | foreach (var obj in blueTeam) |
| | | { |
| | | obj.heroGo.SetActive(true); |
| | | obj.motionBase.PlayAnimation(MotionName.run, true); |
| | | RectTransform trans = obj.heroRectTrans; |
| | | trans.anchoredPosition = new Vector2(-800, 0); |
| | |
| | | |
| | | tween.onComplete = () => |
| | | { |
| | | foreach (var obj in redTeam) |
| | | foreach (var obj in blueTeam) |
| | | { |
| | | obj.motionBase.PlayAnimation(MotionName.idle, true); |
| | | } |
| | |
| | | { |
| | | |
| | | } |
| | | |
| | | public void OnRefreshBuff(HB428_tagSCBuffRefresh vNetData) |
| | | { |
| | | BattleObject battleObj = battleObjMgr.GetBattleObject((int)vNetData.ObjID); |
| | | if (null != battleObj) |
| | | { |
| | | battleObj.buffMgr.RefreshBuff(vNetData); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError($"BattleObject with ID {vNetData.ObjID} not found for buff refresh."); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | public class BuffMountAction : RecordAction |
| | | { |
| | | protected HB428_tagSCBuffRefresh hB428_TagSCBuffRefresh; |
| | | |
| | | protected Action onComplete; |
| | | |
| | | public BuffMountAction(BattleField _battleField, BattleObject _battleObj, HB428_tagSCBuffRefresh vNetData, Action _onComplete) |
| | | : base(RecordActionType.BuffMount, _battleField, _battleObj) |
| | | { |
| | | isFinish = false; |
| | | hB428_TagSCBuffRefresh = vNetData; |
| | | onComplete = _onComplete; |
| | | } |
| | | |
| | | public override bool IsFinished() |
| | | { |
| | | return isFinish; |
| | | } |
| | | |
| | | |
| | | public override void Run() |
| | | { |
| | | base.Run(); |
| | | |
| | | if (!isRunOnce) |
| | | { |
| | | SkillConfig skillConfig = SkillConfig.Get((int)hB428_TagSCBuffRefresh.SkillID); |
| | | if (null != skillConfig) |
| | | { |
| | | // 飘字 |
| | | battleObject.heroInfoBar.ShowTips(skillConfig.SkillName); |
| | | } |
| | | |
| | | |
| | | // 加buff(onComplete写了) |
| | | onComplete?.Invoke(); |
| | | |
| | | |
| | | isFinish = true; |
| | | return; |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 03f12da82f639b04790f1cff4480e17a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | EventBroadcast.Instance.AddListener<string, BattleObject, List<long>>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken); |
| | | EventBroadcast.Instance.AddListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken); |
| | | EventBroadcast.Instance.AddListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_MOUNTED, OnBuffMounted); |
| | | EventBroadcast.Instance.AddListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_DISAPEAR, OnBuffDisapear); |
| | | damagePrefabPool = GameObjectPoolManager.Instance.RequestPool(UILoader.LoadPrefab("DamageContent")); |
| | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | EventBroadcast.Instance.RemoveListener<string, BattleObject, List<long>>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken); |
| | | EventBroadcast.Instance.RemoveListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken); |
| | | EventBroadcast.Instance.RemoveListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_MOUNTED, OnBuffMounted); |
| | | EventBroadcast.Instance.RemoveListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_DISAPEAR, OnBuffDisapear); |
| | | } |
| | |
| | | damagePrefabPool.Release(content.gameObject); |
| | | } |
| | | |
| | | private void OnDamageTaken(string guid, BattleObject bo, List<long> damageList) |
| | | private void OnDamageTaken(BattleDmgInfo damageInfo) |
| | | { |
| | | GameObject damageContent = damagePrefabPool.Request(); |
| | | DamageContent content = damageContent.GetComponent<DamageContent>(); |
| | | damageContent.transform.SetParent(damageNode, false); |
| | | damageContent.transform.localPosition = new Vector3(damageContent.transform.localPosition.x, damageContent.transform.localPosition.y, 0); |
| | | content.SetDamage(damageList, () => RemoveDamageContent(content)); |
| | | content.SetDamage(damageInfo, () => RemoveDamageContent(content)); |
| | | damageContentList.Add(content); |
| | | |
| | | // heroGo 的 parent 作为参考节点 |
| | | |
| | | var heroRect = bo.heroRectTrans; |
| | | var heroRect = damageInfo.hurtObj.heroRectTrans; |
| | | if (heroRect == null) |
| | | return; |
| | | |
| | |
| | | // 同时只能有一场战斗在进行 guid, battlefield |
| | | protected Dictionary<string, BattleField> battleFields = new Dictionary<string, BattleField>(); |
| | | |
| | | protected LogicUpdate logicUpdate = new LogicUpdate(); |
| | | |
| | | public Action<string, BattleField> onBattleFieldCreate; |
| | | |
| | |
| | | public override void Init() |
| | | { |
| | | base.Init(); |
| | | logicUpdate.Start(Run); |
| | | |
| | | LogicEngine.Instance.OnUpdate += Run; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | base.Release(); |
| | | logicUpdate.Destroy(); |
| | | LogicEngine.Instance.OnUpdate -= Run; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; |
| | | } |
| | | |
| | |
| | | { |
| | | battleField = _battleField; |
| | | ReloadTeam(_redTeam, BattleCamp.Red); |
| | | ReloadTeam(_blueTeam, BattleCamp.Blue); |
| | | ReloadTeam(_blueTeam, BattleCamp.Blue, false); |
| | | } |
| | | |
| | | public void ReloadTeam(TeamBase teamBase, BattleCamp _camp) |
| | | public void ReloadTeam(TeamBase teamBase, BattleCamp _camp, bool active = true) |
| | | { |
| | | var posNodeList = _camp == BattleCamp.Red ? battleField.battleRootNode.redTeamNodeList : battleField.battleRootNode.blueTeamNodeList; |
| | | var campDict = _camp == BattleCamp.Red ? redCampDict : blueCampDict; |
| | | CreateTeam(posNodeList, campDict, teamBase, _camp); |
| | | CreateTeam(posNodeList, campDict, teamBase, _camp, active); |
| | | } |
| | | |
| | | protected void CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp) |
| | | protected void CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp, bool active) |
| | | { |
| | | DestroyTeam(campDict); |
| | | if (teamBase == null) |
| | |
| | | if (teamHero != null) |
| | | { |
| | | BattleObject battleObj = BattleObjectFactory.CreateBattleObject(battleField, posNodeList, teamHero, _Camp); |
| | | battleObj.heroGo.SetActive(active); |
| | | allBattleObjDict.Add(battleObj.ObjID, battleObj); |
| | | campDict.Add(teamHero.positionNum, battleObj); |
| | | } |
| | |
| | | |
| | | private RectTransform m_heroRectTrans; |
| | | |
| | | private BattleHeroInfoBar battleHeroInfoBar; |
| | | |
| | | public RectTransform heroRectTrans |
| | | { |
| | | get |
| | |
| | | |
| | | protected Renderer[] renderers; |
| | | |
| | | public Transform effectNode; |
| | | |
| | | private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>(); |
| | | public BattleHeroInfoBar heroInfoBar; |
| | | |
| | | public BattleObject(BattleField _battleField) |
| | | { |
| | |
| | | buffMgr.Init(this); |
| | | |
| | | renderers = heroGo.GetComponentsInChildren<Renderer>(true); |
| | | } |
| | | |
| | | heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true); |
| | | heroInfoBar.SetBattleObject(this); |
| | | } |
| | | |
| | | |
| | | public virtual void Run() |
| | | { |
| | | motionBase.Run(); |
| | | battleHeroInfoBar.Run(); |
| | | } |
| | | |
| | | public virtual void Pause() |
| | |
| | | switch ((PlayerDataType)_refreshInfo.RefreshType) |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | battleHeroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp); |
| | | teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | |
| | | Debug.Log($"Damage: {damage}"); |
| | | } |
| | | |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, (int)attackType); |
| | | |
| | | // YYL TODO 是否需要挂在在自身的follow点上 |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleField.guid, this, damageValues); |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); |
| | | } |
| | | |
| | | public RectTransform GetAliasTeamNode() |
| | |
| | | tweenList.Remove(tween); |
| | | }; |
| | | |
| | | // tween.Play(); |
| | | tween.Play(); |
| | | } |
| | | |
| | | public void OnKillTween(Tween tween) |
| | | { |
| | | tween.Kill(); |
| | | if (tween != null && tweenList.Contains(tween)) |
| | | { |
| | | tweenList.Remove(tween); |
| | | } |
| | | } |
| | | |
| | | public void HaveRest() |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | | |
| | | public class BattleObjectBuffMgr |
| | | { |
| | | // private Dictionary<BuffBase, EffectPlayer> buffDict = new Dictionary<BuffBase, EffectPlayer>(); |
| | | // buffId, effectId, EffectPlayer |
| | | private Dictionary<uint, Dictionary<int, BattleEffectPlayer>> buffEffectDict = new Dictionary<uint, Dictionary<int, BattleEffectPlayer>>(); |
| | | |
| | | |
| | | // buffId, buffdata |
| | | private Dictionary<uint, HB428_tagSCBuffRefresh> buffDataDict = new Dictionary<uint, HB428_tagSCBuffRefresh>(); |
| | | |
| | | private BattleObject battleObject; |
| | | |
| | |
| | | // 删除buff |
| | | public void RemoveBuff(HB429_tagSCBuffDel vNetData) |
| | | { |
| | | HB428_tagSCBuffRefresh buffData = null; |
| | | |
| | | // buffBase.OnRemove(); |
| | | if (buffDataDict.TryGetValue(vNetData.BuffID, out buffData)) |
| | | { |
| | | buffDataDict.Remove(vNetData.BuffID); |
| | | } |
| | | |
| | | if (buffData != null) |
| | | { |
| | | Dictionary<int, BattleEffectPlayer> effectDict = null; |
| | | |
| | | if (buffEffectDict.TryGetValue(vNetData.BuffID, out effectDict)) |
| | | { |
| | | SkillConfig skillConfig = SkillConfig.Get((int)buffData.SkillID); |
| | | if (null != skillConfig) |
| | | { |
| | | BattleEffectPlayer effectPlayer = null; |
| | | if (effectDict.TryGetValue(skillConfig.EffectId, out effectPlayer)) |
| | | { |
| | | battleObject.battleField.battleEffectMgr.RemoveEffect(skillConfig.EffectId, effectPlayer); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 不做表现 |
| | | battleObject.heroInfoBar.RefreshBuff(buffDataDict.Values.ToList()); |
| | | } |
| | | |
| | | public void RefreshBuff(HB428_tagSCBuffRefresh vNetData) |
| | | { |
| | | bool isNew = false; |
| | | if (buffDataDict.ContainsKey(vNetData.BuffID)) |
| | | { |
| | | buffDataDict[vNetData.BuffID] = vNetData; |
| | | } |
| | | else |
| | | { |
| | | isNew = true; |
| | | buffDataDict.Add(vNetData.BuffID, vNetData); |
| | | } |
| | | |
| | | if (isNew) |
| | | { |
| | | BuffMountAction buffMountAction = new BuffMountAction(battleObject.battleField, battleObject, vNetData, () => |
| | | { |
| | | SkillConfig skillConfig = SkillConfig.Get((int)vNetData.SkillID); |
| | | if (null != skillConfig && skillConfig.EffectId > 0) |
| | | { |
| | | // Dictionary<uint, Dictionary<int, BattleEffectPlayer>> buffEffectDict |
| | | Dictionary<int, BattleEffectPlayer> effectDict = null; |
| | | if (buffEffectDict.TryGetValue(vNetData.BuffID, out effectDict)) |
| | | { |
| | | // 存在这个buffid的特效字典 |
| | | if (effectDict.ContainsKey(skillConfig.EffectId)) |
| | | { |
| | | Debug.LogError("已存在同样的buff特效 " + skillConfig.EffectId); |
| | | } |
| | | else |
| | | { |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject.ObjID, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | effectDict.Add(skillConfig.EffectId, effect); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | effectDict = new Dictionary<int, BattleEffectPlayer>(); |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject.ObjID, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | effectDict.Add(skillConfig.EffectId, effect); |
| | | buffEffectDict.Add(vNetData.BuffID, effectDict); |
| | | } |
| | | } |
| | | }); |
| | | battleObject.battleField.recordPlayer.PlayRecord(buffMountAction); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | |
| | | public class BattleDmgInfo |
| | | { |
| | | public string battleFieldGuid { get; private set; } |
| | | public List<long> damageList { get; private set; } |
| | | public int attackType { get; private set; } |
| | | public BattleObject hurtObj { get; private set; } |
| | | |
| | | public BattleDmgInfo(string battleFieldGuid, List<long> damageList, BattleObject hurtObj, int attackType) |
| | | { |
| | | this.battleFieldGuid = battleFieldGuid; |
| | | this.damageList = damageList; |
| | | this.hurtObj = hurtObj; |
| | | this.attackType = attackType; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 36e9ba972525e3a469d210dd67ac05b3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | Guard,//格挡 |
| | | Skill,//技能 |
| | | Death,//死亡 |
| | | BuffMount,//挂载增益 |
| | | |
| | | BattleStart,//战斗开始 |
| | | } |
| | |
| | | } |
| | | |
| | | elapsed += Time.deltaTime; |
| | | float t = Mathf.Clamp01(elapsed / 0.3f); |
| | | float t = Mathf.Clamp01(elapsed / duration); |
| | | Vector2 pos = Vector2.Lerp(start, end, t); |
| | | bulletTrans.anchoredPosition = pos; |
| | | |
| | | Vector2 dir = end - start; |
| | | float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; |
| | | bulletTrans.localRotation = Quaternion.Euler(0, 0, angle); |
| | | |
| | | bulletTrans.localRotation = Quaternion.Euler(0, bulletTrans.transform.localScale.x < 0f ? 180 : 0, angle); |
| | | // if (bulletTrans.transform.localScale.x < 0f) |
| | | // { |
| | | // bulletTrans.transform.localRotation *= Quaternion.Euler(0, 180, 0); |
| | | // } |
| | | if (t >= 1f) |
| | | { |
| | | finished = true; |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | public override void OnMiddleFrameStart(int times) |
| | | { |
| | | base.OnMiddleFrameStart(times); |
| | | // 弹射 另外的做法了 |
| | | if (skillConfig.effectType == SkillEffectType.Bullet && skillConfig.BulletPath == 4) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public override void Play(Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit) |
| | | { |
| | | base.Play(_onHit); |
| | | |
| | | } |
| | | |
| | | protected void ShotToFormation(RectTransform target, Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit) |
| | | { |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.effectNode); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | |
| | | RectTransform effectTrans = effectPlayer.transform as RectTransform; |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | var effect1 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform); |
| | | var effect2 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform); |
| | | var effect1 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp); |
| | | var effect2 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp); |
| | | if (effect1 != null) |
| | | { |
| | | effect1.transform.localRotation = effectTrans.localRotation; |
| | |
| | | protected void ShotToTarget(BattleObject target) |
| | | { |
| | | BattleDebug.LogError("发射子弹 " + skillConfig.BulletEffectId); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | |
| | | |
| | | var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, (index, hitList) => |
| | |
| | | |
| | | if (skillConfig.ExplosionEffectId > 0) |
| | | { |
| | | var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform); |
| | | var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp); |
| | | eft.transform.localRotation = effectPlayer.transform.localRotation; |
| | | if (eft.transform.localScale.x < 0f) |
| | | { |
| | | eft.transform.localRotation *= Quaternion.Euler(0, 180, 0); |
| | | } |
| | | } |
| | | |
| | | if (skillConfig.ExplosionEffect2 > 0) |
| | | { |
| | | var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform); |
| | | var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp); |
| | | eft.transform.localRotation = effectPlayer.transform.localRotation; |
| | | if (eft.transform.localScale.x < 0f) |
| | | { |
| | | eft.transform.localRotation *= Quaternion.Euler(0, 180, 0); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | // 技能动作第一帧 |
| | | // 不用理会回调 |
| | | public override void Play(Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit) |
| | | { |
| | | // 播放技能特效 |
| | | BattleEffectPlayer battleEffectPlayer = caster.battleField.battleEffectMgr.PlayEffect( |
| | | caster.ObjID, |
| | | skillConfig.EffectId, |
| | | caster.heroGo.transform |
| | | ); |
| | | } |
| | | |
| | | |
| | | public override void Run() |
| | | { |
| | | base.Run(); |
| | | } |
| | | |
| | | public override void OnMiddleFrameEnd(int times, int hitIndex) |
| | | { |
| | |
| | | continue; |
| | | } |
| | | |
| | | /*var effect1 = */ |
| | | caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffectId, target.heroGo.transform); |
| | | /*var effect2 = */ |
| | | caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect2, target.heroGo.transform); |
| | | // if (effect1 != null) |
| | | // { |
| | | // effect1.transform.localRotation = effectTrans.localRotation; |
| | | // } |
| | | // if (effect2 != null) |
| | | // { |
| | | // effect2.transform.localRotation = effectTrans.localRotation; |
| | | // } |
| | | caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffectId, target.heroGo.transform, target.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect2, target.heroGo.transform, target.Camp); |
| | | } |
| | | |
| | | // 为什么没触发 |
| | | onHit?.Invoke(hitIndex, tagUseSkillAttack.HurtList.ToList()); |
| | | isFinish = true; |
| | | } |
| | | |
| | | public override void OnMiddleFrameStart(int times) |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | public virtual void Play(Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit) |
| | | { |
| | | onHit = _onHit; |
| | | if (skillConfig.EffectId > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId, caster.heroRectTrans, caster.Camp); |
| | | } |
| | | if (skillConfig.EffectId2 > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId2, caster.heroRectTrans, caster.Camp); |
| | | } |
| | | } |
| | | |
| | | public virtual void Run() |
| | |
| | | |
| | | public virtual void OnMiddleFrameStart(int times) |
| | | { |
| | | |
| | | if (skillConfig.MStartEffectId <= 0) |
| | | return; |
| | | // 中摇固定特效 |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.MStartEffectId, caster.heroGo.transform, caster.Camp); |
| | | } |
| | | |
| | | public virtual bool IsFinished() |
New file |
| | |
| | | using UnityEngine; |
| | | |
| | | public class BasicHeroInfoContainer : MonoBehaviour |
| | | { |
| | | public void SetHeroInfo(TeamHero teamHero) |
| | | { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 5c3e5adcdb7b8a74bb4a3561c9eb3a14 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class BattleBuffCell : CellView |
| | | { |
| | | public Image imageIcon; |
| | | public Text textLevel; |
| | | |
| | | public void Display(HB428_tagSCBuffRefresh hB428_TagSCBuffRefresh) |
| | | { |
| | | SkillConfig skillConfig = SkillConfig.Get((int)hB428_TagSCBuffRefresh.SkillID); |
| | | |
| | | imageIcon.sprite = ResManager.Instance.LoadAsset<Sprite>("", skillConfig.IconName); |
| | | textLevel.text = hB428_TagSCBuffRefresh.Layer.ToString(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c7e8e099ab9f4874fa6a4bce3cf9b6ab |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | |
| | | public class BattleBuffLineCell : CellView |
| | | { |
| | | [SerializeField] BattleBuffCell[] buffCellList; |
| | | |
| | | public void Display(List<HB428_tagSCBuffRefresh> buffList, int index) |
| | | { |
| | | for (int i = 0; i < buffCellList.Length; i++) |
| | | { |
| | | if (i + index < buffList.Count) |
| | | { |
| | | buffCellList[i].SetActive(true); |
| | | buffCellList[i].Display(buffList[i + index]); |
| | | } |
| | | else |
| | | { |
| | | buffCellList[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ed7bc7d61144495468403b4152a0150f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System; |
| | | using DG.Tweening; |
| | | |
| | | |
| | | public class BattleHeroInfoBar : MonoBehaviour |
| | | { |
| | | protected BattleObject battleObject; |
| | | |
| | | public Slider sliderHp; |
| | | |
| | | public Slider sliderXp; //怒气 |
| | | |
| | | protected float timer = 0f; |
| | | |
| | | public float PopUpInterval = 0.2f; |
| | | |
| | | |
| | | // public List<BattleBuffCell> buffCells = new List<BattleBuffCell>(); |
| | | |
| | | protected List<string> messages = new List<string>(); |
| | | |
| | | public BasicHeroInfoContainer heroInfoContainer; |
| | | |
| | | public BattleTips textTips; |
| | | |
| | | protected Tween hpTween; |
| | | |
| | | protected List<BattleTips> tipsList = new List<BattleTips>(); |
| | | |
| | | protected List<HB428_tagSCBuffRefresh> buffList = new List<HB428_tagSCBuffRefresh>(); |
| | | |
| | | public ScrollerController scroller; |
| | | |
| | | public void SetBattleObject(BattleObject _battleObject) |
| | | { |
| | | battleObject = _battleObject; |
| | | heroInfoContainer.SetHeroInfo(battleObject.teamHero); |
| | | RefreshBuff(buffList); |
| | | } |
| | | |
| | | public void RefreshBuff(List<HB428_tagSCBuffRefresh> datas) |
| | | { |
| | | buffList = datas; |
| | | // 更新buff图标 or 创建新的buff图标 |
| | | scroller.Refresh(); |
| | | for (int i = 0; i < buffList.Count; i++) |
| | | { |
| | | if (i % 5 == 0) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | protected void OnEnable() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | } |
| | | |
| | | protected void OnDisable() |
| | | { |
| | | // TODO YYL 考虑池化 |
| | | messages.Clear(); |
| | | for (int i = 0; i < tipsList.Count; i++) |
| | | { |
| | | var tip = tipsList[i]; |
| | | tip.OnFinish = null; |
| | | GameObject.DestroyImmediate(tip.gameObject); |
| | | } |
| | | tipsList.Clear(); |
| | | } |
| | | |
| | | protected void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as BattleBuffLineCell; |
| | | _cell.Display(buffList, cell.index); |
| | | } |
| | | |
| | | public void ShowTips(string message) |
| | | { |
| | | messages.Add(message); |
| | | } |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void PopUpTipsDirectly(string message) |
| | | { |
| | | GameObject prefab = textTips.gameObject; |
| | | |
| | | GameObject go = GameObject.Instantiate(prefab, transform); |
| | | |
| | | BattleTips tips = go.GetComponent<BattleTips>(); |
| | | |
| | | tips.SetText(message); |
| | | |
| | | tips.OnFinish = () => |
| | | { |
| | | // TODO YYL 考虑池化 |
| | | tipsList.Remove(tips); |
| | | GameObject.DestroyImmediate(tips.gameObject); |
| | | }; |
| | | |
| | | tipsList.Add(tips); |
| | | } |
| | | |
| | | |
| | | public void UpdateHP(long fromHp, long toHp, long maxHp) |
| | | { |
| | | // 做hp增加或者减少的动画 |
| | | // sliderHp.value = ((float)fromHp) / ((float)maxHp); |
| | | if (hpTween != null) |
| | | { |
| | | battleObject.battleField.battleTweenMgr.OnKillTween(hpTween); |
| | | } |
| | | hpTween = sliderHp.DOValue((float)toHp / maxHp, 0.3f); |
| | | battleObject.battleField.battleTweenMgr.OnPlayTween(hpTween); |
| | | } |
| | | |
| | | |
| | | public void Run() |
| | | { |
| | | for (int i = tipsList.Count - 1; i >= 0; i--) |
| | | { |
| | | tipsList[i].Run(); |
| | | } |
| | | |
| | | timer += Time.deltaTime; |
| | | |
| | | if (messages.Count > 0 && timer >= PopUpInterval) |
| | | { |
| | | // 播放飘字 |
| | | string message = messages[0]; |
| | | messages.RemoveAt(0); |
| | | |
| | | PopUpTipsDirectly(message); |
| | | |
| | | timer = 0f; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 91976c75be6daea45993712cce2f2110 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | using UnityEngine; |
| | | using System; |
| | | using UnityEngine.UI; |
| | | |
| | | public class BattleTips : MonoBehaviour |
| | | { |
| | | public Vector2 beginPos = Vector2.zero; |
| | | public Vector2 endPos = new Vector2(0, 100); |
| | | public float showTime = 0.4f; |
| | | public float timer = 0f; |
| | | |
| | | protected RectTransform rectTransform; |
| | | |
| | | void Awake() |
| | | { |
| | | rectTransform = gameObject.AddMissingComponent<RectTransform>(); |
| | | } |
| | | |
| | | public Text tipText; |
| | | |
| | | public Action OnFinish; |
| | | |
| | | public void SetText(string text) |
| | | { |
| | | tipText.text = text; |
| | | rectTransform.anchoredPosition = Vector2.zero; |
| | | timer = 0f; |
| | | gameObject.SetActive(true); |
| | | } |
| | | |
| | | |
| | | // 不要使用update |
| | | public void Run() |
| | | { |
| | | if (timer >= showTime) |
| | | { |
| | | OnFinish?.Invoke(); |
| | | OnFinish = null; |
| | | gameObject.SetActive(false); |
| | | return; |
| | | } |
| | | |
| | | rectTransform.anchoredPosition = Vector2.Lerp(beginPos, endPos, timer / showTime); |
| | | timer += Time.deltaTime; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ca221a28c4019fa439e674596524bc3d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | line.SetActive(false); |
| | | } |
| | | |
| | | public void SetDamage(List<long> damages, Action _onComplete) |
| | | public void SetDamage(BattleDmgInfo damageInfo, Action _onComplete) |
| | | { |
| | | var damages = damageInfo.damageList; |
| | | for (int i = 0; i < damages.Count; i++) |
| | | { |
| | | if (i >= damageLineList.Count) |
| | |
| | | damageLineList.Add(newLine.GetComponent<DamageLine>()); |
| | | } |
| | | damageLineList[i].SetActive(true); |
| | | damageLineList[i].SetDamage(damages[i]); |
| | | damageLineList[i].SetDamage(damageInfo.attackType, damages[i]); |
| | | } |
| | | |
| | | for (int i = damages.Count; i < damageLineList.Count; i++) |
| | |
| | | |
| | | public TextEx damageValueLabel; |
| | | |
| | | public void SetDamage(DamageType damageType, long damage) |
| | | public void SetDamage(int damageType, long damage) |
| | | { |
| | | damageTypeLabel.SetActive(true); |
| | | damageValueLabel.text = damage.ToString(); |
| | | damageTypeLabel.SetActive(false); |
| | | damageValueLabel.text = BattleUtility.DisplayDamageNum(damage, damageType); |
| | | } |
| | | |
| | | public void SetDamage(long damage) |
| | |
| | | |
| | | public float modelScale = 1f; |
| | | |
| | | public int level = 0; |
| | | |
| | | public TeamBase teamBase |
| | | { |
| | |
| | | } |
| | | public int positionNum; //注意服务端的1号位是1,客户端在使用时是0,通信和策划沟通用1 |
| | | |
| | | // 战场数据 |
| | | |
| | | |
| | | // 战场数据 |
| | | public int ObjID = 0;// 战斗单位唯一ID |
| | | |
| | | public int NPCID = 0;// 战斗NPCID,不同的实例ID对应的NPCID可能一样 |
| | |
| | | // 判断一下是npc还是玩家 |
| | | heroId = (int)fightObj.HeroID; |
| | | |
| | | if (fightObj.NPCID > 0) |
| | | // B4 24 回合战斗初始化 #tagSCTurnFightInit |
| | | // 封包中的 HeroID、SkinID 字段不再是玩家阵容独有,NPC阵容也可能有值,一般是关联武将的NPC有值 |
| | | // 如果 HeroID、SkinID 不为空,则可认为是关联武将的NPC,外观相关默认通过HeroID读取武将相关,如名称 |
| | | // 皮肤 SkinID 不为空时,则模型默认使用该皮肤 |
| | | // 如果 HeroID、SkinID 为空, NPCID不为空,则走原NPC默认规则 |
| | | |
| | | // 补充 skinid跟heroid要么同时没有 要么同时有 如果这三个id都没有的话 那就是配置严重错误 无法弥补 |
| | | |
| | | if (fightObj.SkinID > 0 && fightObj.HeroID > 0) |
| | | { |
| | | // 走玩家逻辑 |
| | | var heroConfig = HeroConfig.Get(heroId); |
| | | if (null == heroConfig) |
| | | { |
| | | Debug.LogError("hero config is null, heroId : " + heroId); |
| | | return; |
| | | } |
| | | Country = (HeroCountry)heroConfig.Country; |
| | | SkinID = (int)fightObj.SkinID; |
| | | modelScale = 1f; |
| | | } |
| | | else if (fightObj.NPCID > 0) |
| | | { |
| | | //走NPC的逻辑 |
| | | NPCConfig npcConfig = NPCConfig.Get((int)fightObj.NPCID); |
| | | Country = (HeroCountry)npcConfig.Country; |
| | | SkinID = npcConfig.SkinID; |
| | | BattleDebug.LogError("npc skin id is " + SkinID); |
| | | modelScale = npcConfig.ModelScale; |
| | | } |
| | | else |
| | | { |
| | | //走玩家逻辑 |
| | | var heroConfig = HeroConfig.Get(heroId); |
| | | Country = (HeroCountry)heroConfig.Country; |
| | | SkinID = (int)fightObj.SkinID; |
| | | BattleDebug.LogError("normal hero skin id is " + SkinID); |
| | | modelScale = 1f; |
| | | throw new System.Exception("hero id and skin id are both invalid, npc id is invalid too (all <= 0)"); |
| | | } |
| | | |
| | | level = (int)fightObj.LV; |
| | | |
| | | skinConfig = HeroSkinConfig.Get(SkinID); |
| | | teamBase = _teamBase; |