using System.Collections.Generic; using Entitas; using xFrame; namespace CoreGame.Render { [Combat] public class GunDataComponent : IComponent, IReset { public int gunCfgId; public int slotId; public CombatEntity gunEnt; public ElementType elementType; public bool isShowAttackRange; internal float fireCdAcc; // 攻击范围特效 internal List circleVfxHandles = new(); // 重新装弹 public void ReloadAmmo(CombatEntity parent) { if (gunEnt.hasReload || gunEnt.isCannotReload) return; var tbGun = WeaponDescMgr.Instance.GetConfig(gunCfgId); int cd = (int)(ExpressionEvaluator.CalcVal_WithProp(tbGun.ReloadTime, parent.property.container, 1) + PropertyContainer.Epsilon); XLog.LogDebug($"{gunCfgId} Reload Ammo cd {cd}"); parent.animationProxy?.Play(FNameLookup.Reload); parent.DispatchEvent(ClientEvent.OnGunReloadStart, null); GunSrv.PushAmmoBarData(parent, 0f, cd, 0f, false); if (parent.isLocalPlayer) { CoreUIBridge.CoreGamePushGunReload(slotId, true); } gunEnt.AddReload(cd); } public void Reset() { fireCdAcc = 0; } } }