From 2bf10f47c4ddd044a9abf92cd446159987e8d704 Mon Sep 17 00:00:00 2001 From: azw Date: Sat, 18 May 2024 18:38:27 +0800 Subject: [PATCH] 1 --- F6/MetaTable.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++++--- Mt/Equip.cs | 12 ++++++++++- Mt/Table.cs | 14 ++++++++++++ Mtb/Equip.cs | 3 ++- 4 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 Mt/Table.cs diff --git a/F6/MetaTable.cs b/F6/MetaTable.cs index be23f64..2351992 100644 --- a/F6/MetaTable.cs +++ b/F6/MetaTable.cs @@ -39,15 +39,54 @@ namespace F6 } - public class RawMetaTable: IMetaTable - { - + public sealed class MetaTableFieldAttribute : Attribute + { + public string fieldName; + } + + + public class BaseMeta + { + public Dictionary nameIdxHash = new Dictionary(); + } + + public class BaseTable + { + private BaseMeta _meta; + private BitArray _flags; + public bool HasValue(string fieldName) + { + return this.HasValue(this.GetFieldIdx(fieldName)); + } + + public bool HasValue(int fieldIdx) + { + return this._flags.Get(fieldIdx); + } + + public int GetFieldIdx(string fieldName) + { + int idx = 0; + this._meta.nameIdxHash.TryGetValue(fieldName, out idx); + return idx; + } + + } + + public class RawMetaTable : IMetaTable + { protected string fileName; protected string primKey; protected bool noLoad; protected List rawList = new List(); + public RawMetaTable(string fileName, string primKey) + { + this.fileName = fileName; + this.primKey = primKey; + } + public void Traverse(TraverseCb cb) { foreach(var item in this.rawList) @@ -95,6 +134,12 @@ namespace F6 { base.LoadPost(); } + + public IdMetaTable(string fileName, string primKey) :base(fileName, primKey) + { + // base(fileName, primKey); + } + } public class NameMetaTable: RawMetaTable @@ -112,6 +157,12 @@ namespace F6 { base.LoadPost(); } + + public NameMetaTable(string fileName, string primKey):base(fileName, primKey) + { + + } + } } diff --git a/Mt/Equip.cs b/Mt/Equip.cs index da9e4d4..f63dc8f 100644 --- a/Mt/Equip.cs +++ b/Mt/Equip.cs @@ -6,7 +6,17 @@ using System.Threading.Tasks; namespace cfclient.Mt { - class Equip + class Equip : Mtb.Equip { } + + class EquipTable :F6.IdMetaTable + { + + public EquipTable(string fileName, string primKey):base(fileName, primKey) + { + + } + } + } diff --git a/Mt/Table.cs b/Mt/Table.cs new file mode 100644 index 0000000..442d1ed --- /dev/null +++ b/Mt/Table.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cfclient.Mt +{ + class Table + { + public static EquipTable Equip = new EquipTable("", ""); + } + +} diff --git a/Mtb/Equip.cs b/Mtb/Equip.cs index 938775b..b9a7426 100644 --- a/Mtb/Equip.cs +++ b/Mtb/Equip.cs @@ -6,8 +6,9 @@ using System.Threading.Tasks; namespace cfclient.Mtb { - class Equip + class Equip : F6.BaseTable { + [F6.MetaTableField(fieldName ="id")] public int id { get; } } }