This commit is contained in:
PC-20230316NUNE\Administrator
2024-10-23 15:30:22 +08:00
parent a3257421ad
commit 1953e7c25f
34 changed files with 3751 additions and 512 deletions

View File

@@ -169,7 +169,7 @@ namespace GAS.Runtime
}
public void UpdateCurrentValueWhenBaseValueIsDirty(AttributeBase attribute, int sourceId, int oldBaseValue, int newBaseValue)
public void UpdateCurrentValueWhenBaseValueIsDirty(AttributeBase attribute, ulong sourceId, int oldBaseValue, int newBaseValue)
{
if (oldBaseValue == newBaseValue) return;

View File

@@ -15,9 +15,9 @@ namespace GAS.Runtime
// Changed 是提供属性变化后的回调
protected event Action<AttributeBase, int, int> _onCurrentValueChanged;
protected event Action<AttributeBase, int, int, int> _onBaseValueChanged;
protected event Action<AttributeBase, ulong, int, int> _onBaseValueChanged;
protected event Action<AttributeBase, int, int> _onPostCurrentValueChange;
protected event Action<AttributeBase, int, int, int> _onPostBaseValueChange;
protected event Action<AttributeBase, ulong, int, int> _onPostBaseValueChange;
protected event Action<AttributeBase, int> _onPreCurrentValueChange;
@@ -86,7 +86,7 @@ namespace GAS.Runtime
int lenght = strValue.Length;
}
public void SetBaseValue(int sourceId, int value)
public void SetBaseValue(ulong sourceId, int value)
{
if (_onPreBaseValueChangeList.Count > 0)
{
@@ -121,12 +121,12 @@ namespace GAS.Runtime
// _onPreBaseValueChange?.GetInvocationList().Cast<Func<AttributeBase, int, int>>();
}
public void RegisterPostBaseValueChange(Action<AttributeBase, int, int, int> action)
public void RegisterPostBaseValueChange(Action<AttributeBase, ulong, int, int> action)
{
_onPostBaseValueChange += action;
}
public void RegisterBaseValueChanged(Action<AttributeBase, int, int, int> action)
public void RegisterBaseValueChanged(Action<AttributeBase, ulong, int, int> action)
{
_onBaseValueChanged += action;
}
@@ -154,12 +154,12 @@ namespace GAS.Runtime
// _onPreBaseValueChange?.GetInvocationList().Cast<Func<AttributeBase, int, int>>();
}
public void UnregisterPostBaseValueChange(Action<AttributeBase, int, int, int> action)
public void UnregisterPostBaseValueChange(Action<AttributeBase, ulong, int, int> action)
{
_onPostBaseValueChange -= action;
}
public void UnregisterBaseValueChanged(Action<AttributeBase, int, int, int> action)
public void UnregisterBaseValueChanged(Action<AttributeBase, ulong, int, int> action)
{
_onBaseValueChanged -= action;
}
@@ -202,7 +202,7 @@ namespace GAS.Runtime
return value;
}
private void InvokeOnPostBaseValueChange(AttributeBase attribute, int sourceId, int oldBaseValue, int newBaseValue)
private void InvokeOnPostBaseValueChange(AttributeBase attribute, ulong sourceId, int oldBaseValue, int newBaseValue)
{
_onPostBaseValueChange?.Invoke(attribute, sourceId, oldBaseValue, newBaseValue);
_owner.AttributeSetContainer.UpdateCurrentValueWhenBaseValueIsDirty(attribute, sourceId, oldBaseValue, newBaseValue);

View File

@@ -10,7 +10,7 @@ namespace GAS.Runtime
public abstract AttributeBase this[string key] { get; }
public abstract string[] AttributeNames { get; }
public abstract void SetOwner(AbilitySystemComponent owner);
public void ChangeAttributeBase(int sourceId, string attributeShortName, LFloat value)
public void ChangeAttributeBase(ulong sourceId, string attributeShortName, LFloat value)
{
if (this[attributeShortName] != null)
{

View File

@@ -164,7 +164,7 @@ namespace GAS.Runtime
}
}
public void UpdateCurrentValueWhenBaseValueIsDirty(AttributeBase attribute, int sourceId, int oldBaseValue, int newBaseValue)
public void UpdateCurrentValueWhenBaseValueIsDirty(AttributeBase attribute, ulong sourceId, int oldBaseValue, int newBaseValue)
{
if (_attributeAggregators.TryGetValue(attribute.Name, out var aagt))
{

View File

@@ -15,7 +15,7 @@ namespace GAS.Runtime
private IAbilitySystemComponentPreset preset;
public bool enabled { get; protected set; }
public IAbilitySystemComponentPreset Preset => preset;
public int EntityId { get; protected set; }
public ulong EntityId { get; protected set; }
public string EntityName { get; protected set; }
public int Level { get; protected set; }
@@ -72,9 +72,10 @@ namespace GAS.Runtime
preset = ascPreset;
}
public void Init(GameplayTag[] baseTags, Type[] attrSetTypes, string[] baseAbilities, int entityId,
public void Init(GameplayTag[] baseTags, Type[] attrSetTypes, string[] baseAbilities, ulong entityId,
int level)
{
EntityId = entityId;
Prepare();
SetLevel(level);
if (baseTags != null) GameplayTagAggregator.Init(baseTags);

View File

@@ -6,7 +6,7 @@ namespace GAS.Runtime
public interface IAbilitySystemComponent
{
void SetPreset(IAbilitySystemComponentPreset ascPreset);
void Init(GameplayTag[] baseTags, Type[] attrSetTypes, string[] baseAbilities, int entityId, int level);
void Init(GameplayTag[] baseTags, Type[] attrSetTypes, string[] baseAbilities, ulong entityId, int level);
void SetLevel(int level);
bool HasTag(GameplayTag tag);
bool HasAllTags(GameplayTagSet tags);