internal void Read(ParameterTree tree) { Type = tree.Get <uint>("type"); Radius = tree.Get <float>("radius"); if (tree.OpenScope("bone")) { if (tree.OpenScope(0)) { Bone0.Read(tree); tree.CloseScope(); } if (tree.OpenScope(1)) { Bone1.Read(tree); tree.CloseScope(); } tree.CloseScope(); } }
internal void Read(ParameterTree tree) { if (tree.OpenScope("root")) { Force = tree.Get <float>("force"); ForceGain = tree.Get <float>("force_gain"); AirResistance = tree.Get <float>("air_res"); RotationY = tree.Get <float>("rot_y"); RotationZ = tree.Get <float>("rot_z"); Friction = tree.Get <float>("friction"); WindAffection = tree.Get <float>("wind_afc"); CollisionType = tree.Get <uint>("coli_type"); InitRotationY = tree.Get <float>("init_rot_y"); InitRotationZ = tree.Get <float>("init_rot_z"); HingeY = tree.Get <float>("hinge_y", 90); HingeZ = tree.Get <float>("hinge_z", 90); CollisionRadius = tree.Get <float>("coli_r"); Stiffness = tree.Get <float>("stiffness"); MoveCancel = tree.Get <float>("move_cancel"); CollisionTargetOsage = tree.Get <string>("colli_tgt_osg"); tree.Enumerate("coli", i => { var collision = new OsageCollisionParameter(); collision.Read(tree); Collisions.Add(collision); }); tree.Enumerate("boc", i => { var boc = new OsageBocParameter(); boc.Read(tree); Bocs.Add(boc); }); tree.CloseScope(); } tree.Enumerate("node", i => { var node = new OsageNodeParameter(); node.Read(tree); Nodes.Add(node); }); }
public override void Read(EndianBinaryReader reader, ISection section = null) { if (section != null) { ReadModern(); } else { ReadClassic(); } void ReadClassic() { var paramTree = new ParameterTree(reader); foreach (string key in paramTree.Keys) { var param = new OsageSkinParameter(); param.Name = key; paramTree.OpenScope(key); { param.Read(paramTree); } paramTree.CloseScope(); Parameters.Add(param); } } void ReadModern() { int count0, count1, count2; long offset0, offset1, offset2; if (section.Format == BinaryFormat.X) { count0 = reader.ReadInt32(); count1 = reader.ReadInt32(); count2 = reader.ReadInt32(); offset0 = reader.ReadOffset(); offset1 = reader.ReadOffset(); offset2 = reader.ReadOffset(); } else { count0 = reader.ReadInt32(); offset0 = reader.ReadOffset(); count1 = reader.ReadInt32(); offset1 = reader.ReadOffset(); count2 = reader.ReadInt32(); offset2 = reader.ReadOffset(); } reader.ReadAtOffset(offset0, () => { Parameters.Capacity = count0; for (int i = 0; i < count0; i++) { var parameter = new OsageSkinParameter(); parameter.Read(reader); Parameters.Add(parameter); } }); } }