1
This commit is contained in:
parent
094f1d4f48
commit
2bf10f47c4
@ -39,15 +39,54 @@ namespace F6
|
||||
|
||||
}
|
||||
|
||||
|
||||
public sealed class MetaTableFieldAttribute : Attribute
|
||||
{
|
||||
public string fieldName;
|
||||
}
|
||||
|
||||
|
||||
public class BaseMeta
|
||||
{
|
||||
public Dictionary<string, int> nameIdxHash = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
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<T> : IMetaTable
|
||||
{
|
||||
|
||||
|
||||
protected string fileName;
|
||||
protected string primKey;
|
||||
protected bool noLoad;
|
||||
protected List<T> rawList = new List<T>();
|
||||
|
||||
public RawMetaTable(string fileName, string primKey)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
this.primKey = primKey;
|
||||
}
|
||||
|
||||
public void Traverse(TraverseCb<T> 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<T>: RawMetaTable<T>
|
||||
@ -112,6 +157,12 @@ namespace F6
|
||||
{
|
||||
base.LoadPost();
|
||||
}
|
||||
|
||||
public NameMetaTable(string fileName, string primKey):base(fileName, primKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
12
Mt/Equip.cs
12
Mt/Equip.cs
@ -6,7 +6,17 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace cfclient.Mt
|
||||
{
|
||||
class Equip
|
||||
class Equip : Mtb.Equip
|
||||
{
|
||||
}
|
||||
|
||||
class EquipTable :F6.IdMetaTable<Equip>
|
||||
{
|
||||
|
||||
public EquipTable(string fileName, string primKey):base(fileName, primKey)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
14
Mt/Table.cs
Normal file
14
Mt/Table.cs
Normal file
@ -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("", "");
|
||||
}
|
||||
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user