Renamed Obj to BodyTemplate

This commit is contained in:
2026-06-13 21:30:02 +02:00
parent 659ddb7a10
commit 24926d01d3
6 changed files with 46 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ using System.IO;
namespace _2DGAMELIB
{
[Serializable]
public class Obj
public class BodyTemplate
{
public string Tag = "";
@@ -189,7 +189,7 @@ namespace _2DGAMELIB
}
}
public Obj SetDefaultR()
public BodyTemplate SetDefaultR()
{
foreach (VariantGrid value in Difss.Values)
{
@@ -198,7 +198,7 @@ namespace _2DGAMELIB
return this;
}
public Obj()
public BodyTemplate()
{
}

View File

@@ -31,19 +31,19 @@ namespace _2DGAMELIB
["四足下腕"] = "四足LowerArm",
};
public static void MigrateKeys(this Obj obj)
public static void MigrateKeys(this BodyTemplate BodyTemplate)
{
var newDict = new OrderedDictionary<string, VariantGrid>();
foreach (var key in obj.Keys)
foreach (var key in BodyTemplate.Keys)
{
var newKey = KeyMap.TryGetValue(key, out var mapped) ? mapped : key;
var difs = obj.Difss[key];
var difs = BodyTemplate.Difss[key];
newDict.Add(newKey, difs);
}
obj.Difss = newDict;
BodyTemplate.Difss = newDict;
}
}

View File

@@ -156,16 +156,16 @@ namespace _2DGAMELIB
GetMinMaxY(ShapePart, ref MM[1].Y, ref MM[0].Y);
}
public static Obj ObjLoad(this byte[] bd)
public static BodyTemplate ObjLoad(this byte[] bd)
{
return bd.Load<byte[]>().ToDeserialObject<Obj>().SetDefaultR();
return bd.Load<byte[]>().ToDeserialObject<BodyTemplate>().SetDefaultR();
}
public static Obj? ObjLoadRaw(this byte[] bd)
public static BodyTemplate? ObjLoadRaw(this byte[] bd)
{
try
{
return bd.Load<byte[]>().ToDeserialObject<Obj>();
return bd.Load<byte[]>().ToDeserialObject<BodyTemplate>();
}
catch
{

View File

@@ -21,7 +21,8 @@ namespace _2DGAMELIB
.Add("_2DGAMELIB.Out", typeof(CurveOutline))
.Add("_2DGAMELIB.Joi", typeof(JointPoint))
.Add("_2DGAMELIB.Dif", typeof(MorphVariant))
.Add("_2DGAMELIB.Difs", typeof(VariantGrid));
.Add("_2DGAMELIB.Difs", typeof(VariantGrid))
.Add("_2DGAMELIB.Obj", typeof(BodyTemplate));
private static BinaryFormatter NewFormatter()
{