void ResetData() { for (int i = 0; i < MaxCutsceneNum; i++) { Data[i] = new CutSceneData(); } }
public void SaveOrLoad(Serializer serializer) { var entries = new LoadAndSaveEntry[] { LoadAndSaveEntry.Create(reader => { StackPointer = reader.ReadByte(); var cutScenePtr = reader.ReadInt32s(MaxCutsceneNum); var cutSceneScript = reader.ReadBytes(MaxCutsceneNum); var cutSceneData = reader.ReadInt16s(MaxCutsceneNum); // load Cut Scene Data for (var i = 0; i < MaxCutsceneNum; i++) { var data = new CutSceneData { Pointer = cutScenePtr[i], Script = cutSceneScript[i], Data = cutSceneData[i] }; Data[i] = data; } ScriptIndex = reader.ReadInt16(); }, writer => { var cutScenePtr = new int[MaxCutsceneNum]; var cutSceneScript = new byte[MaxCutsceneNum]; var cutSceneData = new short[MaxCutsceneNum]; var cutSceneStack = Data; for (var i = 0; i < cutSceneStack.Length; i++) { cutScenePtr[i] = cutSceneStack[i].Pointer; cutSceneScript[i] = cutSceneStack[i].Script; cutSceneData[i] = (short)cutSceneStack[i].Data; } writer.WriteByte(StackPointer); writer.WriteInt32s(cutScenePtr, MaxCutsceneNum); writer.WriteBytes(cutSceneScript, MaxCutsceneNum); writer.WriteInt16s(cutSceneData, MaxCutsceneNum); writer.WriteInt16(ScriptIndex); }, 8) }; entries.ForEach(e => e.Execute(serializer)); }
public CutScene() { Data = new CutSceneData[MaxCutsceneNum]; ResetData(); }