S4-07 process 2
当前 `Tag.txt -> DRTag -> TagGenerationRuleRegistry` 已形成组件 Tag 生成规则闭环: - `InventoryTagRuleService` 不再主要依赖内部 `MinRarity` 硬编码,而是统一消费 `DRTag` 提供的 `MinRarity + Weight` - `ShopFormUseCase`、`EnemyDropResolver`、`InventorySeedUtility` 也已切回这一统一入口。 - 现阶段的职责边界明确为:`Tag.txt` 负责基础字典与生成规则,`TagConfig.txt` 负责触发阶段、描述与效果参数。
This commit is contained in:
+3
-54
@@ -17,20 +17,16 @@ namespace GeometryTD.CustomComponent
|
||||
|
||||
private readonly List<DROutGameDropPool> _eligibleDropPoolBuffer = new();
|
||||
private readonly Dictionary<RarityType, float> _rarityRollWeightBuffer = new();
|
||||
private readonly Dictionary<TagType, RarityType> _tagMinRarityByTag = new();
|
||||
|
||||
private IDataTable<DROutGameDropPool> _drOutGameDropPool;
|
||||
private IDataTable<DRMuzzleComp> _drMuzzleComp;
|
||||
private IDataTable<DRBearingComp> _drBearingComp;
|
||||
private IDataTable<DRBaseComp> _drBaseComp;
|
||||
private IDataTable<DRTag> _drTag;
|
||||
private long _nextDropItemInstanceId = 1;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_eligibleDropPoolBuffer.Clear();
|
||||
_rarityRollWeightBuffer.Clear();
|
||||
_tagMinRarityByTag.Clear();
|
||||
_nextDropItemInstanceId = 1;
|
||||
}
|
||||
|
||||
@@ -307,35 +303,6 @@ namespace GeometryTD.CustomComponent
|
||||
return _drOutGameDropPool;
|
||||
}
|
||||
|
||||
private bool EnsureTagMinRarityLookup()
|
||||
{
|
||||
if (_tagMinRarityByTag.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_drTag ??= GameEntry.DataTable.GetDataTable<DRTag>();
|
||||
if (_drTag == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DRTag[] rows = _drTag.GetAllDataRows();
|
||||
for (int i = 0; i < rows.Length; i++)
|
||||
{
|
||||
DRTag row = rows[i];
|
||||
if (row == null || row.Id <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TagType tagType = (TagType)row.Id;
|
||||
_tagMinRarityByTag[tagType] = row.MinRarity;
|
||||
}
|
||||
|
||||
return _tagMinRarityByTag.Count > 0;
|
||||
}
|
||||
|
||||
private bool TryBuildDropItem(DROutGameDropPool row, out TowerCompItemData droppedItem)
|
||||
{
|
||||
droppedItem = null;
|
||||
@@ -372,11 +339,6 @@ namespace GeometryTD.CustomComponent
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureTagMinRarityLookup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DRMuzzleComp config = _drMuzzleComp.GetDataRow(row.ItemId);
|
||||
if (config == null)
|
||||
{
|
||||
@@ -398,8 +360,7 @@ namespace GeometryTD.CustomComponent
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
instanceId,
|
||||
config.Id,
|
||||
_tagMinRarityByTag),
|
||||
config.Id),
|
||||
AttackDamage = config.AttackDamage != null ? (int[])config.AttackDamage.Clone() : Array.Empty<int>(),
|
||||
DamageRandomRate = config.DamageRandomRate,
|
||||
AttackMethodType = config.AttackMethodType
|
||||
@@ -416,11 +377,6 @@ namespace GeometryTD.CustomComponent
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureTagMinRarityLookup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DRBearingComp config = _drBearingComp.GetDataRow(row.ItemId);
|
||||
if (config == null)
|
||||
{
|
||||
@@ -442,8 +398,7 @@ namespace GeometryTD.CustomComponent
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
instanceId,
|
||||
config.Id,
|
||||
_tagMinRarityByTag),
|
||||
config.Id),
|
||||
RotateSpeed = config.RotateSpeed != null ? (float[])config.RotateSpeed.Clone() : Array.Empty<float>(),
|
||||
AttackRange = config.AttackRange != null ? (float[])config.AttackRange.Clone() : Array.Empty<float>()
|
||||
};
|
||||
@@ -459,11 +414,6 @@ namespace GeometryTD.CustomComponent
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureTagMinRarityLookup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DRBaseComp config = _drBaseComp.GetDataRow(row.ItemId);
|
||||
if (config == null)
|
||||
{
|
||||
@@ -485,8 +435,7 @@ namespace GeometryTD.CustomComponent
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
instanceId,
|
||||
config.Id,
|
||||
_tagMinRarityByTag),
|
||||
config.Id),
|
||||
AttackSpeed = config.AttackSpeed != null ? (float[])config.AttackSpeed.Clone() : Array.Empty<float>(),
|
||||
AttackPropertyType = config.AttackPropertyType
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user