parent
f82df5d68d
commit
ec84a0be64
|
|
@ -0,0 +1,126 @@
|
||||||
|
using Luban.Job.Cfg.Datas;
|
||||||
|
using System;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace Luban.Job.Cfg.DataVisitors
|
||||||
|
{
|
||||||
|
class IsSimpleLiteralDataVisitor2 : IDataFuncVisitor<bool>
|
||||||
|
{
|
||||||
|
public static IsSimpleLiteralDataVisitor2 Ins { get; } = new();
|
||||||
|
|
||||||
|
public bool Accept(DBool type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DByte type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DShort type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DFshort type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DInt type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DFint type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DLong type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DFlong type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DFloat type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DDouble type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DEnum type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DString type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DBytes type)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DText type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DBean type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DArray type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DList type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DSet type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DMap type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DVector2 type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DVector3 type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DVector4 type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Accept(DDateTime type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -353,7 +353,7 @@ namespace Luban.Job.Cfg.Defs
|
||||||
|
|
||||||
for (int i = 1; i < attrs.Length; i++)
|
for (int i = 1; i < attrs.Length; i++)
|
||||||
{
|
{
|
||||||
var pair = attrs[i].Split('=');
|
var pair = attrs[i].Split('=', 2);
|
||||||
if (pair.Length != 2)
|
if (pair.Length != 2)
|
||||||
{
|
{
|
||||||
throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!");
|
throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!");
|
||||||
|
|
@ -406,6 +406,11 @@ namespace Luban.Job.Cfg.Defs
|
||||||
cf.DefaultValue = attrValue;
|
cf.DefaultValue = attrValue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "tags":
|
||||||
|
{
|
||||||
|
cf.Tags = attrValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!");
|
throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!");
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ namespace Luban.Job.Cfg.Utils
|
||||||
return type.Apply(IsSimpleLiteralDataVisitor.Ins);
|
return type.Apply(IsSimpleLiteralDataVisitor.Ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsSimpleLiteralData2(DType type)
|
||||||
|
{
|
||||||
|
return type.Apply(IsSimpleLiteralDataVisitor2.Ins);
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToLocalizedText(DText type)
|
public static string ToLocalizedText(DText type)
|
||||||
{
|
{
|
||||||
var ass = DefAssembly.LocalAssebmly;
|
var ass = DefAssembly.LocalAssebmly;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue