コード例 #1
0
        private void ReadAtomDeltasSection(PacketStream stream)
        {
            UInt16 atomDeltasCount = stream.ReadUInt16();

            for (int i = 0; i < atomDeltasCount; i++)
            {
                UInt32 atomID = stream.ReadUInt32();
                DreamDeltaState.AtomDelta atomDelta = new DreamDeltaState.AtomDelta();

                AtomDeltaValueID valueID;
                do
                {
                    valueID = (AtomDeltaValueID)stream.ReadByte();

                    if (valueID == AtomDeltaValueID.ScreenLocation)
                    {
                        atomDelta.ScreenLocation = stream.ReadScreenLocation();
                    }
                    else if (valueID == AtomDeltaValueID.IconAppearance)
                    {
                        atomDelta.NewIconAppearanceID = (int)stream.ReadUInt32();
                    }
                    else if (valueID != AtomDeltaValueID.End)
                    {
                        throw new Exception("Invalid atom delta value ID in delta game state packet (" + valueID.ToString() + ")");
                    }
                } while (valueID != AtomDeltaValueID.End);

                DeltaState.AtomDeltas.Add(atomID, atomDelta);
            }
        }
コード例 #2
0
 public void ReadFromStream(PacketStream stream)
 {
     AtomID         = stream.ReadUInt32();
     IconX          = stream.ReadByte();
     IconY          = stream.ReadByte();
     ScreenLocation = stream.ReadScreenLocation();
     ModifierShift  = stream.ReadBool();
     ModifierCtrl   = stream.ReadBool();
     ModifierAlt    = stream.ReadBool();
 }
コード例 #3
0
        private void ReadAtomCreationsSection(PacketStream stream)
        {
            UInt16 atomCreationsCount = stream.ReadUInt16();

            for (int i = 0; i < atomCreationsCount; i++)
            {
                UInt32 atomID = stream.ReadUInt32();
                DreamDeltaState.AtomCreation atomCreation = new DreamDeltaState.AtomCreation((AtomType)stream.ReadByte(), (int)stream.ReadUInt32());

                atomCreation.LocationID = stream.ReadUInt32();
                if (atomCreation.Type == AtomType.Movable)
                {
                    atomCreation.ScreenLocation = stream.ReadScreenLocation();
                }

                DeltaState.AtomCreations.Add(atomID, atomCreation);
            }
        }
コード例 #4
0
        private void ReadAtomsSection(PacketStream stream)
        {
            UInt32 atomCount = stream.ReadUInt32();

            for (int i = 0; i < atomCount; i++)
            {
                DreamFullState.Atom atom = new DreamFullState.Atom();
                atom.AtomID           = stream.ReadUInt32();
                atom.Type             = (AtomType)stream.ReadByte();
                atom.LocationID       = stream.ReadUInt32();
                atom.IconAppearanceID = (int)stream.ReadUInt32();
                if (atom.Type == AtomType.Movable)
                {
                    atom.ScreenLocation = stream.ReadScreenLocation();
                }

                FullState.Atoms[atom.AtomID] = atom;
            }
        }