表格重构
This commit is contained in:
122
Assets/Scripts/Configs~/Gen/ConfigAssets.Gen.cs
Normal file
122
Assets/Scripts/Configs~/Gen/ConfigAssets.Gen.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改**/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ConfigAssets
|
||||
{
|
||||
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(BaitConfig))
|
||||
{
|
||||
BaitConfigArr = ParseLine<BaitConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(BobberConfig))
|
||||
{
|
||||
BobberConfigArr = ParseLine<BobberConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(FeederConfig))
|
||||
{
|
||||
FeederConfigArr = ParseLine<FeederConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(FishAcceptConfig))
|
||||
{
|
||||
FishAcceptConfigArr = ParseLine<FishAcceptConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(FishConfig))
|
||||
{
|
||||
FishConfigArr = ParseLine<FishConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(HookConfig))
|
||||
{
|
||||
HookConfigArr = ParseLine<HookConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(LeadersConfig))
|
||||
{
|
||||
LeadersConfigArr = ParseLine<LeadersConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(LineConfig))
|
||||
{
|
||||
LineConfigArr = ParseLine<LineConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(LureConfig))
|
||||
{
|
||||
LureConfigArr = ParseLine<LureConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(ReelConfig))
|
||||
{
|
||||
ReelConfigArr = ParseLine<ReelConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(RingConfig))
|
||||
{
|
||||
RingConfigArr = ParseLine<RingConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(RodConfig))
|
||||
{
|
||||
RodConfigArr = ParseLine<RodConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(UnitConfig))
|
||||
{
|
||||
UnitConfigArr = ParseLine<UnitConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
if (type == typeof(WeightConfig))
|
||||
{
|
||||
WeightConfigArr = ParseLine<WeightConfig>(arr, tableNameAttribute);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AssociationContexts()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user