public override bool Deserialize(BinaryClassChunk node) { base.Deserialize(node); this.fireDirection = node.GetProperty <float>("fireDirection"); this.firePower = node.GetProperty <float>("firePower"); return(true); }
public override bool Deserialize(BinaryClassChunk node) { base.Deserialize(node); this.stanceSetting = node.GetProperty <int>("stanceSetting"); this.contains = Editor.GetType(node.GetProperty <string>("contains")); this.chestPlate = node.GetProperty <bool>("chestPlate"); this.helmet = node.GetProperty <bool>("helmet"); return(true); }
public override bool Deserialize(BinaryClassChunk node) { base.Deserialize(node); (this.graphic as SpriteMap).frame = node.GetProperty <int>("frame"); return(true); }
public override bool Deserialize(BinaryClassChunk node) { base.Deserialize(node); this.direction = node.GetProperty <int>("direction"); return(true); }
private bool DoDeserialize(BinaryClassChunk node) { System.Type type = Editor.GetType(node.GetProperty <string>("blockType")); if (type == (System.Type)null) { return(false); } bool flag1 = typeof(AutoBlock).IsAssignableFrom(type); this._things = new List <Thing>(); BitBuffer property1 = node.GetProperty <BitBuffer>("data"); if (!typeof(AutoBlock).IsAssignableFrom(type)) { flag1 = false; } List <AutoBlock> autoBlockList = new List <AutoBlock>(); int num1 = property1.ReadInt(); for (int index = 0; index < num1; ++index) { float num2 = property1.ReadFloat(); float num3 = property1.ReadFloat(); int num4 = (int)property1.ReadByte(); bool flag2 = Level.flipH; if (Level.loadingOppositeSymmetry) { flag2 = !flag2; } if (flag2) { num2 = (float)(192.0 - (double)num2 - 16.0); } Thing thing = Editor.CreateThing(type); if (flag2 && thing is AutoBlock) { (thing as AutoBlock).needsRefresh = true; (thing as AutoBlock).isFlipped = true; } if (thing is BackgroundTile) { if (flag2) { (thing as BackgroundTile).isFlipped = true; } (thing as BackgroundTile).oppositeSymmetry = !Level.loadingOppositeSymmetry; } if (flag2 && thing is AutoPlatform) { (thing as AutoPlatform).needsRefresh = true; } thing.x = num2; thing.y = num3; thing.placed = true; if (thing.isStatic) { this._isStatic = true; } if (flag1) { short num5 = property1.ReadShort(); short num6 = property1.ReadShort(); short num7 = property1.ReadShort(); short num8 = property1.ReadShort(); AutoBlock autoBlock = thing as AutoBlock; autoBlock.northIndex = (int)num5; autoBlock.southIndex = (int)num6; if (flag2) { autoBlock.westIndex = (int)num7; autoBlock.eastIndex = (int)num8; } else { autoBlock.eastIndex = (int)num7; autoBlock.westIndex = (int)num8; } autoBlockList.Add(autoBlock); } bool flag3 = true; if (Level.symmetry) { if (Level.leftSymmetry && (double)num2 > 80.0) { flag3 = false; } if (!Level.leftSymmetry && (double)num2 < 96.0) { flag3 = false; } } if (flag3) { thing.frame = num4; this._things.Add(thing); } } if (flag1 && !(Level.current is Editor)) { foreach (AutoBlock autoBlock in autoBlockList) { if (autoBlock.northIndex != -1) { autoBlock.upBlock = (Block)autoBlockList[autoBlock.northIndex]; } if (autoBlock.southIndex != -1) { autoBlock.downBlock = (Block)autoBlockList[autoBlock.southIndex]; } if (autoBlock.eastIndex != -1) { autoBlock.rightBlock = (Block)autoBlockList[autoBlock.eastIndex]; } if (autoBlock.westIndex != -1) { autoBlock.leftBlock = (Block)autoBlockList[autoBlock.westIndex]; } autoBlock.neighborsInitialized = true; } BitBuffer property2 = node.GetProperty <BitBuffer>("groupData"); if (property2 != null) { ushort num2 = property2.ReadUShort(); int num3; for (int index1 = 0; index1 < (int)num2; index1 = num3 + 1) { BlockGroup blockGroup = new BlockGroup(); blockGroup.position = new Vec2(property2.ReadFloat(), property2.ReadFloat()); bool flag2 = Level.flipH; if (Level.loadingOppositeSymmetry) { flag2 = !flag2; } if (flag2) { blockGroup.position.x = (float)(192.0 - (double)blockGroup.position.x - 16.0); } blockGroup.collisionOffset = new Vec2(property2.ReadFloat(), property2.ReadFloat()); blockGroup.collisionSize = new Vec2(property2.ReadFloat(), property2.ReadFloat()); float num4 = 88f; if (Level.symmetry) { if (Level.leftSymmetry) { if ((double)blockGroup.left < (double)num4 && (double)blockGroup.right > (double)num4) { float num5 = blockGroup.right - num4; float x = blockGroup.collisionSize.x - num5; blockGroup.position.x -= num5; blockGroup.position.x += x / 2f; blockGroup.collisionSize = new Vec2(x, blockGroup.collisionSize.y); blockGroup.collisionOffset = new Vec2((float)-((double)x / 2.0), blockGroup.collisionOffset.y); blockGroup.right = num4; } } else { num4 = 88f; if ((double)blockGroup.right > (double)num4 && (double)blockGroup.left < (double)num4) { float num5 = num4 - blockGroup.left; float x = blockGroup.collisionSize.x - num5; blockGroup.position.x += num5; blockGroup.position.x -= x / 2f; blockGroup.collisionSize = new Vec2(x, blockGroup.collisionSize.y); blockGroup.collisionOffset = new Vec2((float)-((double)x / 2.0), blockGroup.collisionOffset.y); blockGroup.left = num4; } } } int num6 = property2.ReadInt(); for (int index2 = 0; index2 < num6; ++index2) { int index3 = (int)property2.ReadShort(); if (index3 >= 0) { AutoBlock autoBlock = autoBlockList[index3]; bool flag3 = true; if (Level.symmetry) { if (Level.leftSymmetry && (double)autoBlock.x > 80.0) { flag3 = false; } if (!Level.leftSymmetry && (double)autoBlock.x < 96.0) { flag3 = false; } } if (flag3) { autoBlock.groupedWithNeighbors = true; blockGroup.Add((Block)autoBlock); blockGroup.physicsMaterial = autoBlock.physicsMaterial; blockGroup.thickness = autoBlock.thickness; } this._things.Remove((Thing)autoBlock); } } num3 = index1 + num6; if (flag2) { blockGroup.needsRefresh = true; } if (Level.symmetry) { if (Level.leftSymmetry && (double)blockGroup.left < (double)num4) { this._things.Add((Thing)blockGroup); } else if (!Level.leftSymmetry && (double)blockGroup.right > (double)num4) { this._things.Add((Thing)blockGroup); } } else { this._things.Add((Thing)blockGroup); } } } } return(true); }
public void DeserializeField(BinaryClassChunk node, string name) => Editor.GetMember(this.GetType(), name)?.SetValue((object)this, node.GetProperty(name));
public override bool Deserialize(BinaryClassChunk node) { base.Deserialize(node); this.contains = MysteryGun.DeserializeTypeProb(node.GetProperty <string>("contains")); return(true); }