Ejemplo n.º 1
0
 public void SaveOrLoad(Serializer serializer)
 {
     var nestedScriptEntries = new[]
     {
         LoadAndSaveEntry.Create(reader => Number = reader.ReadUInt16(), writer => writer.WriteUInt16(Number), 8),
         LoadAndSaveEntry.Create(reader => Where = (WhereIsObject)reader.ReadByte(), writer => writer.WriteByte((byte)Where), 8),
         LoadAndSaveEntry.Create(reader => Slot = reader.ReadByte(), writer => writer.WriteByte(Slot), 8),
     };
     nestedScriptEntries.ForEach(e => e.Execute(serializer));
 }
Ejemplo n.º 2
0
        public void SaveOrLoad(Serializer serializer)
        {
            var nestedScriptEntries = new[]
            {
                LoadAndSaveEntry.Create(reader => Number = reader.ReadUInt16(), writer => writer.WriteUInt16(Number), 8),
                LoadAndSaveEntry.Create(reader => Where  = (WhereIsObject)reader.ReadByte(), writer => writer.WriteByte((byte)Where), 8),
                LoadAndSaveEntry.Create(reader => Slot   = reader.ReadByte(), writer => writer.WriteByte(Slot), 8),
            };

            nestedScriptEntries.ForEach(e => e.Execute(serializer));
        }
Ejemplo n.º 3
0
        public void SaveOrLoad(Serializer serializer, System.Collections.Generic.IList <ScriptData> localScripts, int numGlobalScripts)
        {
            var scriptSlotEntries = new[]
            {
                LoadAndSaveEntry.Create(
                    reader => Offset = reader.ReadUInt32(),
                    writer =>
                {
                    var offsetToSave = Offset;
                    if (Where == WhereIsObject.Global)
                    {
                        offsetToSave += 6;
                    }
                    else if (Where == WhereIsObject.Local && Number >= numGlobalScripts && localScripts[Number - numGlobalScripts] != null)
                    {
                        offsetToSave = (uint)(Offset + localScripts[Number - numGlobalScripts].Offset);
                    }
                    writer.WriteUInt32(offsetToSave);
                }, 8),

                LoadAndSaveEntry.Create(reader => Delay            = reader.ReadInt32(), writer => writer.WriteInt32(Delay), 8),
                LoadAndSaveEntry.Create(reader => Number           = reader.ReadUInt16(), writer => writer.WriteUInt16(Number), 8),
                LoadAndSaveEntry.Create(reader => DelayFrameCount  = reader.ReadUInt16(), writer => writer.WriteUInt16(DelayFrameCount), 8),
                LoadAndSaveEntry.Create(reader => Status           = (ScriptStatus)reader.ReadByte(), writer => writer.WriteByte((byte)Status), 8),
                LoadAndSaveEntry.Create(reader => Where            = (WhereIsObject)reader.ReadByte(), writer => writer.WriteByte((byte)Where), 8),
                LoadAndSaveEntry.Create(reader => FreezeResistant  = reader.ReadBoolean(), writer => writer.WriteByte(FreezeResistant), 8),
                LoadAndSaveEntry.Create(reader => Recursive        = reader.ReadBoolean(), writer => writer.WriteByte(Recursive), 8),
                LoadAndSaveEntry.Create(reader => freezeCount      = reader.ReadByte(), writer => writer.WriteByte(freezeCount), 8),
                LoadAndSaveEntry.Create(reader => IsExecuted       = reader.ReadBoolean(), writer => writer.WriteByte(IsExecuted), 8),
                LoadAndSaveEntry.Create(reader => CutSceneOverride = reader.ReadByte(), writer => writer.WriteByte(CutSceneOverride), 8),
                LoadAndSaveEntry.Create(reader => reader.ReadByte(), writer => writer.WriteByte(0), 46),
                LoadAndSaveEntry.Create(reader => reader.ReadByte(), writer => writer.WriteByte(0), 8, 10),
            };

            scriptSlotEntries.ForEach(e => e.Execute(serializer));
        }
Ejemplo n.º 4
0
        public void SaveOrLoad(Serializer serializer, System.Collections.Generic.IList<ScriptData> localScripts, int numGlobalScripts)
        {
            var scriptSlotEntries = new[]
            {
                LoadAndSaveEntry.Create(
                    reader => Offset = reader.ReadUInt32(),
                    writer =>
                    {
                        var offsetToSave = Offset;
                        if (Where == WhereIsObject.Global)
                        {
                            offsetToSave += 6;
                        }
                        else if (Where == WhereIsObject.Local && Number >= numGlobalScripts && localScripts[Number - numGlobalScripts] != null)
                        {
                            offsetToSave = (uint)(Offset + localScripts[Number - numGlobalScripts].Offset);
                        }
                        writer.WriteUInt32(offsetToSave);
                    }, 8),

                LoadAndSaveEntry.Create(reader => Delay = reader.ReadInt32(), writer => writer.WriteInt32(Delay), 8),
                LoadAndSaveEntry.Create(reader => Number = reader.ReadUInt16(), writer => writer.WriteUInt16(Number), 8),
                LoadAndSaveEntry.Create(reader => DelayFrameCount = reader.ReadUInt16(), writer => writer.WriteUInt16(DelayFrameCount), 8),
                LoadAndSaveEntry.Create(reader => Status = (ScriptStatus)reader.ReadByte(), writer => writer.WriteByte((byte)Status), 8),
                LoadAndSaveEntry.Create(reader => Where = (WhereIsObject)reader.ReadByte(), writer => writer.WriteByte((byte)Where), 8),
                LoadAndSaveEntry.Create(reader => FreezeResistant = reader.ReadBoolean(), writer => writer.WriteByte(FreezeResistant), 8),
                LoadAndSaveEntry.Create(reader => Recursive = reader.ReadBoolean(), writer => writer.WriteByte(Recursive), 8),
                LoadAndSaveEntry.Create(reader => freezeCount = reader.ReadByte(), writer => writer.WriteByte(freezeCount), 8),
                LoadAndSaveEntry.Create(reader => IsExecuted = reader.ReadBoolean(), writer => writer.WriteByte(IsExecuted), 8),
                LoadAndSaveEntry.Create(reader => CutSceneOverride = reader.ReadByte(), writer => writer.WriteByte(CutSceneOverride), 8),
                LoadAndSaveEntry.Create(reader => reader.ReadByte(), writer => writer.WriteByte(0), 46),
                LoadAndSaveEntry.Create(reader => reader.ReadByte(), writer => writer.WriteByte(0), 8, 10),
            };

            scriptSlotEntries.ForEach(e => e.Execute(serializer));
        }