表格相关逻辑修改和组件定义

This commit is contained in:
2025-08-25 00:10:04 +08:00
parent 5ca8118694
commit e41fd7dd2d
136 changed files with 962 additions and 981 deletions

View File

@@ -10,106 +10,113 @@ namespace NBF
{
public partial class ConfigAssets
{
public List<GameBaits> GameBaitsArr;
public List<GameFeeders> GameFeedersArr;
public List<GameFishAccepts> GameFishAcceptsArr;
public List<GameFish> GameFishArr;
public List<GameFloats> GameFloatsArr;
public List<GameHooks> GameHooksArr;
public List<GameLeaders> GameLeadersArr;
public List<GameLines> GameLinesArr;
public List<GameLures> GameLuresArr;
public List<GameReels> GameReelsArr;
public List<GameRings> GameRingsArr;
public List<GameRods> GameRodsArr;
public List<GameWeights> GameWeightsArr;
public List<BaitConfig> BaitConfigArr;
public List<BobberConfig> BobberConfigArr;
public List<FeederConfig> FeederConfigArr;
public List<FishAcceptConfig> FishAcceptConfigArr;
public List<FishConfig> FishConfigArr;
public List<HookConfig> HookConfigArr;
public List<LeadersConfig> LeadersConfigArr;
public List<LineConfig> LineConfigArr;
public List<LureConfig> LureConfigArr;
public List<ReelConfig> ReelConfigArr;
public List<RingConfig> RingConfigArr;
public List<RodConfig> RodConfigArr;
public List<UnitConfig> UnitConfigArr;
public List<WeightConfig> WeightConfigArr;
public void Parse(JToken[] arr, Type type)
{
var tableNameAttribute = type.GetCustomAttribute<TableNameAttribute>();
if (tableNameAttribute == null) return;
if (type == typeof(GameBaits))
if (type == typeof(BaitConfig))
{
GameBaitsArr = ParseLine<GameBaits>(arr, tableNameAttribute);
BaitConfigArr = ParseLine<BaitConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameFeeders))
if (type == typeof(BobberConfig))
{
GameFeedersArr = ParseLine<GameFeeders>(arr, tableNameAttribute);
BobberConfigArr = ParseLine<BobberConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameFishAccepts))
if (type == typeof(FeederConfig))
{
GameFishAcceptsArr = ParseLine<GameFishAccepts>(arr, tableNameAttribute);
FeederConfigArr = ParseLine<FeederConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameFish))
if (type == typeof(FishAcceptConfig))
{
GameFishArr = ParseLine<GameFish>(arr, tableNameAttribute);
FishAcceptConfigArr = ParseLine<FishAcceptConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameFloats))
if (type == typeof(FishConfig))
{
GameFloatsArr = ParseLine<GameFloats>(arr, tableNameAttribute);
FishConfigArr = ParseLine<FishConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameHooks))
if (type == typeof(HookConfig))
{
GameHooksArr = ParseLine<GameHooks>(arr, tableNameAttribute);
HookConfigArr = ParseLine<HookConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameLeaders))
if (type == typeof(LeadersConfig))
{
GameLeadersArr = ParseLine<GameLeaders>(arr, tableNameAttribute);
LeadersConfigArr = ParseLine<LeadersConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameLines))
if (type == typeof(LineConfig))
{
GameLinesArr = ParseLine<GameLines>(arr, tableNameAttribute);
LineConfigArr = ParseLine<LineConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameLures))
if (type == typeof(LureConfig))
{
GameLuresArr = ParseLine<GameLures>(arr, tableNameAttribute);
LureConfigArr = ParseLine<LureConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameReels))
if (type == typeof(ReelConfig))
{
GameReelsArr = ParseLine<GameReels>(arr, tableNameAttribute);
ReelConfigArr = ParseLine<ReelConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameRings))
if (type == typeof(RingConfig))
{
GameRingsArr = ParseLine<GameRings>(arr, tableNameAttribute);
RingConfigArr = ParseLine<RingConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameRods))
if (type == typeof(RodConfig))
{
GameRodsArr = ParseLine<GameRods>(arr, tableNameAttribute);
RodConfigArr = ParseLine<RodConfig>(arr, tableNameAttribute);
}
if (type == typeof(GameWeights))
if (type == typeof(UnitConfig))
{
GameWeightsArr = ParseLine<GameWeights>(arr, tableNameAttribute);
UnitConfigArr = ParseLine<UnitConfig>(arr, tableNameAttribute);
}
if (type == typeof(WeightConfig))
{
WeightConfigArr = ParseLine<WeightConfig>(arr, tableNameAttribute);
}
}
public void AssociationContexts()
{
new ConfigContext<GameBaits>().Association(GameBaitsArr);
new ConfigContext<GameFeeders>().Association(GameFeedersArr);
new ConfigContext<GameFishAccepts>().Association(GameFishAcceptsArr);
new ConfigContext<GameFish>().Association(GameFishArr);
new ConfigContext<GameFloats>().Association(GameFloatsArr);
new ConfigContext<GameHooks>().Association(GameHooksArr);
new ConfigContext<GameLeaders>().Association(GameLeadersArr);
new ConfigContext<GameLines>().Association(GameLinesArr);
new ConfigContext<GameLures>().Association(GameLuresArr);
new ConfigContext<GameReels>().Association(GameReelsArr);
new ConfigContext<GameRings>().Association(GameRingsArr);
new ConfigContext<GameRods>().Association(GameRodsArr);
new ConfigContext<GameWeights>().Association(GameWeightsArr);
new ConfigContext<BaitConfig>().Association(BaitConfigArr);
new ConfigContext<BobberConfig>().Association(BobberConfigArr);
new ConfigContext<FeederConfig>().Association(FeederConfigArr);
new ConfigContext<FishAcceptConfig>().Association(FishAcceptConfigArr);
new ConfigContext<FishConfig>().Association(FishConfigArr);
new ConfigContext<HookConfig>().Association(HookConfigArr);
new ConfigContext<LeadersConfig>().Association(LeadersConfigArr);
new ConfigContext<LineConfig>().Association(LineConfigArr);
new ConfigContext<LureConfig>().Association(LureConfigArr);
new ConfigContext<ReelConfig>().Association(ReelConfigArr);
new ConfigContext<RingConfig>().Association(RingConfigArr);
new ConfigContext<RodConfig>().Association(RodConfigArr);
new ConfigContext<UnitConfig>().Association(UnitConfigArr);
new ConfigContext<WeightConfig>().Association(WeightConfigArr);
}
}
}