开发:修复错误

pull/2502/MERGE
ChenX 10 months ago
parent a48ec3d0dd
commit d1d1891f09

@ -356,7 +356,7 @@ export class Container
//#region -------------------------File-------------------------
//对象从文件中读取数据,初始化自身
ReadFile(file: NestFiler, parts: Part[])
ReadFile(file: NestFiler, parts: Part[], preParts: Part[])
{
this.ParentId = file.Read();
this.ChildrenIndex = file.Read();
@ -365,8 +365,9 @@ export class Container
this.PlacedParts = [];
for (let i = 0; i < count; i++)
{
let isPrePart = file.Read();
let index = file.Read() as number;
let part = parts[index];
let part = isPrePart ? preParts[index] : parts[index];
part.StateIndex = file.Read();
part.PlacePosition = file.Read();
this.PlacedParts.push(part);
@ -397,6 +398,7 @@ export class Container
file.Write(parts.length);
for (let p of parts)
{
file.Write(p.IsPrePlace);
file.Write(p.Id);
file.Write(p.StateIndex);
file.Write(p.PlacePosition);

@ -344,17 +344,17 @@ export class Individual
let count = file.Read() as number;
this.Containers = [];
for (let i = 0; i < count; i++)
this.Containers.push(new Container().ReadFile(file, this.Parts));
this.Containers.push(new Container().ReadFile(file, this.Parts, this.PreParts));
count = file.Read();
this.HoleContainers = [];
for (let i = 0; i < count; i++)
this.HoleContainers.push(new Container().ReadFile(file, this.Parts));
this.HoleContainers.push(new Container().ReadFile(file, this.Parts, this.PreParts));
count = file.Read();
this.OddmentsContainers = [];
for (let i = 0; i < count; i++)
this.OddmentsContainers.push(new Container().ReadFile(file, this.Parts));
this.OddmentsContainers.push(new Container().ReadFile(file, this.Parts, this.PreParts));
}
//对象将自身数据写入到文件.

Loading…
Cancel
Save