Beispiel #1
0
        private static NbtList GenerateEventsListTag <T>(Queue <ReplayEvent <T> > replayEvents) where T : INbtSerializable
        {
            NbtList eventsTag = new NbtList(EVENTS_TAG);

            while (replayEvents.Count != 0)
            {
                ReplayEvent <T> next = replayEvents.Dequeue();
                eventsTag.Add(next.SaveTag());
            }

            return(eventsTag);
        }
Beispiel #2
0
        public void LoadReplay()
        {
            NbtCompound rootTag = ReplayFileManager.LoadRootTagFromFile(_replayFolderPath, _compressionMethod);

            NbtList eventsTag = rootTag.Get <NbtList>(ReplayTagManager.EVENTS_TAG);

            foreach (NbtTag tag in eventsTag)
            {
                ReplayEvent <T> replayEvent = new ReplayEvent <T>().LoadTag(tag as NbtCompound, _typeById);
                _replayEvents.Enqueue(replayEvent);
                _actions.Enqueue(replayEvent.Action);
            }
        }