Esempio n. 1
0
        void Undo(long UID, int time, Level l, Player online)
        {
            long since = DateTime.Now.AddSeconds(-time).Ticks;
            int  count = 0;

            foreach (var ch in BlockChangeHistory.GetCurrentIfUID(l.Name, (uint)UID, since))
            {
                RedoHistory.Add((uint)UID, l.Name, ch.Item1, ch.Item2, ch.Item3, ch.Item4);
                count++;
            }
            foreach (var ch in BlockChangeHistory.Undo(l.Name, (uint)UID, since))
            {
                l.BlockChange(ch.Item1, ch.Item2, ch.Item3, ch.Item4);
            }
            online.SendMessage("&e" + count + Server.DefaultColor + " Blocks changed");
            return;
        }
Esempio n. 2
0
        public void Undo()
        {
            if (UndoHistory.Any())
            {
                BeginUndoRedo?.Invoke(this, EventArgs.Empty);

                var lastAction = UndoHistory.Last();
                CurrentChangeID = lastAction.ChangeID - 1;

                UndoHistory.Remove(lastAction);
                RedoHistory.Add(lastAction);

                ExecutingUndoRedo = true;
                lastAction.Undo();
                ExecutingUndoRedo = false;

                EndUndoRedo?.Invoke(this, EventArgs.Empty);
                UndoHistoryChanged?.Invoke(this, EventArgs.Empty);
            }
        }