unsafe public override void Load(FakeStruct fake) { transfrom = *(TransfromData *)fake.ip; var buff = fake.buffer; Int16[] coms = buff.GetData(transfrom.coms) as Int16[]; if (coms != null) { for (int i = 0; i < coms.Length; i++) { int index = coms[i]; i++; int type = coms[i]; var fs = buff.GetData(index) as FakeStruct; if (fs != null) { var dc = ModelManager2D.Load(type); if (dc != null) { dc.Load(fs); components.Add(dc); } } } } Int16[] chi = fake.buffer.GetData(transfrom.child) as Int16[]; if (chi != null) { for (int i = 0; i < chi.Length; i++) { var fs = buff.GetData(chi[i]) as FakeStruct; if (fs != null) { TransfromModel model = new TransfromModel(); model.Load(fs); child.Add(model); } } } name = buff.GetData(transfrom.name) as string; tag = buff.GetData(transfrom.tag) as string; }
public unsafe static PrefabAsset LoadModels(byte[] buff, string name) { DataBuffer db = new DataBuffer(buff); TransfromModel model = new TransfromModel(); model.Load(db.fakeStruct); var asset = new PrefabAsset(); asset.models = model; asset.name = name; for (int i = 0; i < prefabAssets.Count; i++) { if (prefabAssets[i].name == name) { prefabAssets.RemoveAt(i); break; } } prefabAssets.Add(asset); return(asset); }