public override CVariable Copy(CR2WCopyAction context) { var var = (CLayerGroup)base.Copy(context); var.World = (CHandle)World.Copy(context); var.LayergroupParent = (CHandle)LayergroupParent.Copy(context); var.NumGroups = (CDynamicInt)NumGroups.Copy(context); var.ChildrenGroups = (CArray)ChildrenGroups.Copy(context); var.NumInfos = (CDynamicInt)NumInfos.Copy(context); var.ChildrenInfos = (CArray)ChildrenInfos.Copy(context); return(var); }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); // unknown bytes // first 4 bytes are a handle to the w2w resource World.ChunkHandle = true; World.val = file.ReadInt32(); base.AddVariable(World); // next 4 bytes are a handle to the CLayerGroupParent (in the first case, this is 0) LayergroupParent.ChunkHandle = true; LayergroupParent.val = file.ReadInt32(); base.AddVariable(LayergroupParent); // next are two arrays, with one-byte (of Type CDynamicInt?) length // first is an array of handles to all children of type CLayerGroup NumGroups.Read(file, 1); if (NumGroups.val > 0) { for (int i = 0; i < NumGroups.val; i++) { var curhandle = new CHandle(base.cr2w) { ChunkHandle = true, val = file.ReadInt32(), Name = "LayerGroup", }; ChildrenGroups.AddVariable(curhandle); } base.AddVariable(ChildrenGroups); } // second is an array of handles to all children of type CLayerGroup NumInfos.Read(file, 1); if (NumInfos.val > 0) { for (int i = 0; i < NumInfos.val; i++) { var curhandle = new CHandle(base.cr2w) { ChunkHandle = true, val = file.ReadInt32(), Name = "LayerInfo", }; ChildrenInfos.AddVariable(curhandle); } base.AddVariable(ChildrenInfos); } }