public override void OnDeserialize(BitBuffer d) { base.OnDeserialize(d); byte num = d.ReadByte(); for (int index = 0; index < (int)num; ++index) { this.indexes.Add((int)d.ReadByte()); } }
public override void OnDeserialize(BitBuffer d) { base.OnDeserialize(d); byte num = d.ReadByte(); for (int index = 0; index < (int)num; ++index) { this._enabledModifiers.Add(d.ReadByte()); } }
public override void OnDeserialize(BitBuffer d) { this.levelIndex = d.ReadByte(); this.count = (int)d.ReadUShort(); this.type = PhysicsParticle.ConvertNetType((byte)d.ReadBits(typeof(byte), 4)); this.data = d.ReadBitBuffer(); }
public override void OnDeserialize(BitBuffer d) { base.OnDeserialize(d); this._levelIndex = d.ReadByte(); byte num = d.ReadByte(); for (int index = 0; index < (int)num; ++index) { NMFireBullet nmFireBullet = new NMFireBullet(); BitBuffer msg = d.ReadBitBuffer(); nmFireBullet.OnDeserialize(msg); AmmoType instance = Activator.CreateInstance(AmmoType.indexTypeMap[this.ammoType]) as AmmoType; instance.ReadAdditionalData(d); nmFireBullet.typeInstance = instance; this._fireEvents.Add(nmFireBullet); } }
public static long ReadMask(System.Type t, BitBuffer b) { int length = Editor.AllStateFields[t].Length; if (length <= 8) { return((long)b.ReadByte()); } if (length <= 16) { return((long)b.ReadShort()); } return(length <= 32 ? (long)b.ReadInt() : b.ReadLong()); }
public override void OnDeserialize(BitBuffer msg) { this._index = msg.ReadByte(); byte num1 = msg.ReadByte(); DeviceInputMapping deviceInputMapping = new DeviceInputMapping(); switch (num1) { case 0: deviceInputMapping.deviceOverride = (InputDevice) new Keyboard("", 0); break; case 1: deviceInputMapping.deviceOverride = (InputDevice) new XInputPad(0); break; default: deviceInputMapping.deviceOverride = (InputDevice) new DInputPad(0); break; } deviceInputMapping.deviceOverride.overrideMap = deviceInputMapping; if (msg.ReadBool()) { byte num2 = msg.ReadByte(); for (int index = 0; index < (int)num2; ++index) { byte key = msg.ReadByte(); int num3 = msg.ReadInt(); deviceInputMapping.map[Triggers.fromIndex[key]] = num3; } if (msg.ReadBool()) { byte num3 = msg.ReadByte(); for (int index1 = 0; index1 < (int)num3; ++index1) { int key = msg.ReadInt(); int index2 = (int)msg.ReadByte(); deviceInputMapping.graphicMap[key] = Input.buttonStyles[index2].texture.textureName; } } } this._mapping = deviceInputMapping; base.OnDeserialize(msg); }
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 NetDeserialize(BitBuffer data) { RockWeather._timeOfDay = data.ReadFloat(); RockWeather._weather = (Weather)data.ReadByte(); }