【修复】修复data_resources导出
parent
8164d641e4
commit
00a56c0a37
|
|
@ -7,160 +7,158 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Luban.Job.Cfg.DataVisitors
|
namespace Luban.Job.Cfg.DataVisitors
|
||||||
{
|
{
|
||||||
class ResourceExportor : IDataActionVisitor<DefField, List<ResourceInfo>>
|
class ResourceExportor : IDataActionVisitor<TType, List<ResourceInfo>>
|
||||||
{
|
{
|
||||||
|
public const string ResTagName = "res";
|
||||||
|
|
||||||
public static ResourceExportor Ins { get; } = new ResourceExportor();
|
public static ResourceExportor Ins { get; } = new ResourceExportor();
|
||||||
|
|
||||||
public void Accept(DBool type, DefField x, List<ResourceInfo> y)
|
public void Accept(DBool type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DByte type, DefField x, List<ResourceInfo> y)
|
public void Accept(DByte type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DShort type, DefField x, List<ResourceInfo> y)
|
public void Accept(DShort type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DFshort type, DefField x, List<ResourceInfo> y)
|
public void Accept(DFshort type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DInt type, DefField x, List<ResourceInfo> y)
|
public void Accept(DInt type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DFint type, DefField x, List<ResourceInfo> y)
|
public void Accept(DFint type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DLong type, DefField x, List<ResourceInfo> y)
|
public void Accept(DLong type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DFlong type, DefField x, List<ResourceInfo> y)
|
public void Accept(DFlong type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DFloat type, DefField x, List<ResourceInfo> y)
|
public void Accept(DFloat type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DDouble type, DefField x, List<ResourceInfo> y)
|
public void Accept(DDouble type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DEnum type, DefField x, List<ResourceInfo> y)
|
public void Accept(DEnum type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DString type, DefField x, List<ResourceInfo> y)
|
public void Accept(DString type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
//if (!string.IsNullOrEmpty(type.Value))
|
if (!string.IsNullOrEmpty(type.Value) && x.HasTag(ResTagName))
|
||||||
//{
|
{
|
||||||
// y.Add(new ResourceInfo() { Resource = type.Value, Tag = x.ResourceTag });
|
y.Add(new ResourceInfo() { Resource = type.Value, Tag = x.GetTag(ResTagName) });
|
||||||
//}
|
}
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DBytes type, DefField x, List<ResourceInfo> y)
|
public void Accept(DText type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DText type, DefField x, List<ResourceInfo> y)
|
public void Accept(DBytes type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DBean type, DefField _, List<ResourceInfo> y)
|
public void Accept(DDateTime type, TType x, List<ResourceInfo> y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Accept(DVector2 type, TType x, List<ResourceInfo> y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Accept(DVector3 type, TType x, List<ResourceInfo> y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Accept(DVector4 type, TType x, List<ResourceInfo> y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Accept(DBean type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
var def = type.ImplType;
|
var def = type.ImplType;
|
||||||
if (def == null)
|
if (def == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//int index = 0;
|
int index = 0;
|
||||||
//foreach (DType fieldData in type.Fields)
|
foreach (DType fieldData in type.Fields)
|
||||||
//{
|
{
|
||||||
// var fieldDef = (DefField)def.HierarchyFields[index++];
|
if (fieldData == null)
|
||||||
// if (fieldDef.IsResource)
|
{
|
||||||
// {
|
continue;
|
||||||
// fieldData.Apply(this, fieldDef, y);
|
}
|
||||||
// }
|
var fieldDef = ((DefField)def.HierarchyFields[index++]).CType;
|
||||||
//}
|
fieldData.Apply(this, fieldDef, y);
|
||||||
throw new NotSupportedException();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Accept(DefField def, List<DType> datas, TType elementType, List<ResourceInfo> ress)
|
private void Accept(List<DType> datas, TType elementType, List<ResourceInfo> ress)
|
||||||
{
|
{
|
||||||
//if (def.IsResource || (elementType is TBean))
|
foreach (var e in datas)
|
||||||
//{
|
{
|
||||||
// foreach (var e in datas)
|
if (e != null)
|
||||||
// {
|
{
|
||||||
// e.Apply(this, def, ress);
|
e.Apply(this, elementType, ress);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DArray type, DefField x, List<ResourceInfo> y)
|
public void Accept(DArray type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
Accept(x, type.Datas, type.Type.ElementType, y);
|
Accept(type.Datas, type.Type.ElementType, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DList type, DefField x, List<ResourceInfo> y)
|
public void Accept(DList type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
Accept(x, type.Datas, type.Type.ElementType, y);
|
Accept(type.Datas, type.Type.ElementType, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DSet type, DefField x, List<ResourceInfo> y)
|
public void Accept(DSet type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
Accept(x, type.Datas, type.Type.ElementType, y);
|
Accept(type.Datas, type.Type.ElementType, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Accept(DMap type, DefField x, List<ResourceInfo> y)
|
public void Accept(DMap type, TType x, List<ResourceInfo> y)
|
||||||
{
|
{
|
||||||
//if (x.IsResource || (type.Type.ValueType is TBean))
|
TMap mtype = (TMap)x;
|
||||||
//{
|
foreach (var (k, v) in type.Datas)
|
||||||
// foreach (var e in type.Datas.Values)
|
|
||||||
// {
|
|
||||||
// e.Apply(this, x, y);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Accept(DVector2 type, DefField x, List<ResourceInfo> y)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
k.Apply(this, mtype.KeyType, y);
|
||||||
}
|
v.Apply(this, mtype.ValueType, y);
|
||||||
|
}
|
||||||
public void Accept(DVector3 type, DefField x, List<ResourceInfo> y)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Accept(DVector4 type, DefField x, List<ResourceInfo> y)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Accept(DDateTime type, DefField x, List<ResourceInfo> y)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Luban.Job.Cfg.Defs;
|
||||||
using Luban.Job.Cfg.l10n;
|
using Luban.Job.Cfg.l10n;
|
||||||
using Luban.Job.Cfg.RawDefs;
|
using Luban.Job.Cfg.RawDefs;
|
||||||
using Luban.Job.Common.Tpl;
|
using Luban.Job.Common.Tpl;
|
||||||
|
using Luban.Job.Common.Types;
|
||||||
using Luban.Job.Common.Utils;
|
using Luban.Job.Common.Utils;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
using Scriban;
|
using Scriban;
|
||||||
|
|
@ -167,7 +168,7 @@ namespace Luban.Job.Cfg.Utils
|
||||||
var resList = new List<ResourceInfo>();
|
var resList = new List<ResourceInfo>();
|
||||||
foreach (Record res in records)
|
foreach (Record res in records)
|
||||||
{
|
{
|
||||||
ResourceExportor.Ins.Accept(res.Data, null, resList);
|
ResourceExportor.Ins.Accept(res.Data, TBean.Create(false, res.Data.Type, null), resList);
|
||||||
}
|
}
|
||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue