临时提交

This commit is contained in:
PC-20230316NUNE\Administrator
2024-10-18 17:48:59 +08:00
parent 8cea537319
commit 31db916fec
31 changed files with 315 additions and 107 deletions

View File

@@ -74,7 +74,7 @@ namespace GAS.Runtime
float level = 1,
object userData = null)
{
var spec = ObjectPool.Instance.Fetch<GameplayEffectSpec>();
var spec = JexGasObjectPool.Instance.Fetch<GameplayEffectSpec>();
spec.Awake(this, userData);
spec.Init(creator, owner, level);
return spec;
@@ -86,7 +86,7 @@ namespace GAS.Runtime
/// <returns></returns>
public EntityRef<GameplayEffectSpec> CreateSpec(object userData = null)
{
var spec = ObjectPool.Instance.Fetch<GameplayEffectSpec>();
var spec = JexGasObjectPool.Instance.Fetch<GameplayEffectSpec>();
spec.Awake(this, userData);
return spec;
}
@@ -140,7 +140,7 @@ namespace GAS.Runtime
return Array.Empty<GrantedAbilityFromEffect>();
}
var grantedAbilityFromEffects = ObjectPool.Instance.Fetch<List<GrantedAbilityFromEffect>>();
var grantedAbilityFromEffects = JexGasObjectPool.Instance.Fetch<List<GrantedAbilityFromEffect>>();
foreach (var grantedAbilityConfig in grantedAbilities)
{
if (grantedAbilityConfig.AbilityAsset != null)
@@ -150,7 +150,7 @@ namespace GAS.Runtime
var ret = GrantedAbilityFromEffectArrayPool.Fetch(grantedAbilityFromEffects.Count);
grantedAbilityFromEffects.CopyTo(ret);
grantedAbilityFromEffects.Clear();
ObjectPool.Instance.Recycle(grantedAbilityFromEffects);
JexGasObjectPool.Instance.Recycle(grantedAbilityFromEffects);
return ret;
}

View File

@@ -24,7 +24,7 @@ namespace GAS.Runtime
public void Tick()
{
var gameplayEffectSpecs = ObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
var gameplayEffectSpecs = JexGasObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
gameplayEffectSpecs.AddRange(_gameplayEffectSpecs);
foreach (var gameplayEffectSpec in gameplayEffectSpecs)
@@ -36,7 +36,7 @@ namespace GAS.Runtime
}
gameplayEffectSpecs.Clear();
ObjectPool.Instance.Recycle(gameplayEffectSpecs);
JexGasObjectPool.Instance.Recycle(gameplayEffectSpecs);
}
public void RegisterOnGameplayEffectContainerIsDirty(Action action)
@@ -53,7 +53,7 @@ namespace GAS.Runtime
{
if (tags.Empty) return;
var removeList = ObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
var removeList = JexGasObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
foreach (var gameplayEffectSpec in _gameplayEffectSpecs)
{
@@ -71,7 +71,7 @@ namespace GAS.Runtime
foreach (var gameplayEffectSpec in removeList) RemoveGameplayEffectSpec(gameplayEffectSpec);
removeList.Clear();
ObjectPool.Instance.Recycle(removeList);
JexGasObjectPool.Instance.Recycle(removeList);
}
/// <summary>

View File

@@ -36,7 +36,7 @@ namespace GAS.Runtime
Modifiers = GameplayEffect.Modifiers;
if (gameplayEffect.DurationPolicy != EffectsDurationPolicy.Instant)
{
var periodTicker = ObjectPool.Instance.Fetch<GameplayEffectPeriodTicker>();
var periodTicker = JexGasObjectPool.Instance.Fetch<GameplayEffectPeriodTicker>();
periodTicker.Awake(this);
// EntityRef之前必须确定InstanceId的值
PeriodTicker = periodTicker;
@@ -61,7 +61,7 @@ namespace GAS.Runtime
if (gameplayEffectPeriodTicker != null)
{
gameplayEffectPeriodTicker.Release();
ObjectPool.Instance.Recycle(gameplayEffectPeriodTicker);
JexGasObjectPool.Instance.Recycle(gameplayEffectPeriodTicker);
}
PeriodTicker = default;
@@ -79,12 +79,12 @@ namespace GAS.Runtime
if (grantedAbilitySpecFromEffect != null)
{
grantedAbilitySpecFromEffect.Release();
ObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect);
JexGasObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect);
}
}
GrantedAbilitiesSpecFromEffect.Clear();
ObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect);
JexGasObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect);
GrantedAbilitiesSpecFromEffect = default;
}
@@ -94,13 +94,13 @@ namespace GAS.Runtime
if (SnapshotSourceAttributes != null)
{
SnapshotSourceAttributes.Clear();
ObjectPool.Instance.Recycle(SnapshotSourceAttributes);
JexGasObjectPool.Instance.Recycle(SnapshotSourceAttributes);
}
if (SnapshotTargetAttributes != null && SnapshotSourceAttributes != SnapshotTargetAttributes)
{
SnapshotTargetAttributes.Clear();
ObjectPool.Instance.Recycle(SnapshotTargetAttributes);
JexGasObjectPool.Instance.Recycle(SnapshotTargetAttributes);
}
SnapshotSourceAttributes = null;
@@ -111,14 +111,14 @@ namespace GAS.Runtime
if (_valueMapWithTag != null)
{
_valueMapWithTag.Clear();
ObjectPool.Instance.Recycle(_valueMapWithTag);
JexGasObjectPool.Instance.Recycle(_valueMapWithTag);
_valueMapWithTag = null;
}
if (_valueMapWithName != null)
{
_valueMapWithName.Clear();
ObjectPool.Instance.Recycle(_valueMapWithName);
JexGasObjectPool.Instance.Recycle(_valueMapWithName);
_valueMapWithName = null;
}
@@ -128,7 +128,7 @@ namespace GAS.Runtime
OnStackChanged = default;
}
ObjectPool.Instance.Recycle(this);
JexGasObjectPool.Instance.Recycle(this);
}
public void Init(AbilitySystemComponent source, AbilitySystemComponent owner, float level = 1)
@@ -220,7 +220,7 @@ namespace GAS.Runtime
if (grantedAbilityFromEffects is null) return;
if (grantedAbilityFromEffects.Length == 0) return;
GrantedAbilitiesSpecFromEffect = ObjectPool.Instance.Fetch<List<EntityRef<GrantedAbilitySpecFromEffect>>>();
GrantedAbilitiesSpecFromEffect = JexGasObjectPool.Instance.Fetch<List<EntityRef<GrantedAbilitySpecFromEffect>>>();
foreach (var grantedAbilityFromEffect in grantedAbilityFromEffects)
{
GrantedAbilitiesSpecFromEffect.Add(grantedAbilityFromEffect.CreateSpec(this));
@@ -236,12 +236,12 @@ namespace GAS.Runtime
if (grantedAbilitySpecFromEffect != null)
{
grantedAbilitySpecFromEffect.Release();
ObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect);
JexGasObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect);
}
}
GrantedAbilitiesSpecFromEffect.Clear();
ObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect);
JexGasObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect);
}
public void SetStacking(GameplayEffectStacking stacking)
@@ -315,7 +315,7 @@ namespace GAS.Runtime
ReleaseCueDurationalSpecs();
if (GameplayEffect.CueDurational is { Length: > 0 })
{
_cueDurationalSpecs = ObjectPool.Instance.Fetch<List<GameplayCueDurationalSpec>>();
_cueDurationalSpecs = JexGasObjectPool.Instance.Fetch<List<GameplayCueDurationalSpec>>();
foreach (var cueDurational in GameplayEffect.CueDurational)
{
var cueSpec = cueDurational.ApplyFrom(this);
@@ -323,7 +323,7 @@ namespace GAS.Runtime
}
foreach (var cue in _cueDurationalSpecs)
cue.OnAdd();
cue.OnAdd(-1,-1,-1);
}
}
catch (Exception e)
@@ -342,7 +342,7 @@ namespace GAS.Runtime
if (_cueDurationalSpecs != null)
{
foreach (var cue in _cueDurationalSpecs)
cue.OnRemove();
cue.OnRemove(-1,-1,-1);
}
}
catch (Exception e)
@@ -401,7 +401,7 @@ namespace GAS.Runtime
if (_cueDurationalSpecs != null)
{
foreach (var cue in _cueDurationalSpecs)
cue.OnTick();
cue.OnTick(-1,-1,-1);
}
}
catch (Exception e)
@@ -487,7 +487,7 @@ namespace GAS.Runtime
{
case GameplayEffectSpecifiedSnapshotConfig.ESnapshotTarget.Source:
{
SnapshotSourceAttributes ??= ObjectPool.Instance.Fetch<Dictionary<string, float>>();
SnapshotSourceAttributes ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
var attribute = Source.AttributeSetContainer.GetAttributeAttributeValue(config.AttributeSetName, config.AttributeShortName);
if (attribute != null)
{
@@ -502,7 +502,7 @@ namespace GAS.Runtime
}
case GameplayEffectSpecifiedSnapshotConfig.ESnapshotTarget.Target:
{
SnapshotTargetAttributes ??= ObjectPool.Instance.Fetch<Dictionary<string, float>>();
SnapshotTargetAttributes ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
var attribute = Owner.AttributeSetContainer.GetAttributeAttributeValue(config.AttributeSetName, config.AttributeShortName);
if (attribute != null)
{
@@ -540,13 +540,13 @@ namespace GAS.Runtime
public void RegisterValue(in GameplayTag tag, float value)
{
_valueMapWithTag ??= ObjectPool.Instance.Fetch<Dictionary<GameplayTag, float>>();
_valueMapWithTag ??= JexGasObjectPool.Instance.Fetch<Dictionary<GameplayTag, float>>();
_valueMapWithTag[tag] = value;
}
public void RegisterValue(string name, float value)
{
_valueMapWithName ??= ObjectPool.Instance.Fetch<Dictionary<string, float>>();
_valueMapWithName ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
_valueMapWithName[name] = value;
}
@@ -616,7 +616,7 @@ namespace GAS.Runtime
if (_cueDurationalSpecs != null)
{
_cueDurationalSpecs.Clear();
ObjectPool.Instance.Recycle(_cueDurationalSpecs);
JexGasObjectPool.Instance.Recycle(_cueDurationalSpecs);
_cueDurationalSpecs = null;
}
}

View File

@@ -148,7 +148,7 @@ namespace GAS.Runtime
public GrantedAbilitySpecFromEffect CreateSpec(GameplayEffectSpec sourceEffectSpec)
{
var grantedAbilitySpecFromEffect = ObjectPool.Instance.Fetch<GrantedAbilitySpecFromEffect>();
var grantedAbilitySpecFromEffect = JexGasObjectPool.Instance.Fetch<GrantedAbilitySpecFromEffect>();
grantedAbilitySpecFromEffect.Awake(this, sourceEffectSpec);
return grantedAbilitySpecFromEffect;
}
@@ -178,7 +178,7 @@ namespace GAS.Runtime
Owner = SourceEffectSpec.Owner;
if (Owner.AbilityContainer.HasAbility(AbilityName))
{
Debug.LogError($"GrantedAbilitySpecFromEffect: {Owner.name} already has ability {AbilityName}");
Debug.LogError($"GrantedAbilitySpecFromEffect: {Owner.EntityId} already has ability {AbilityName}");
}
Owner.GrantAbility(GrantedAbility.Ability);