Пример #1
0
        public void UndoSplit()
        {
            if (CurrentState.CurrentPhase != TimerPhase.NotRunning &&
                CurrentState.CurrentSplitIndex > 0)
            {
                ISegment prevParent;
                int      undoneSplitDeaths;
                if (CurrentState.CurrentPhase == TimerPhase.Ended)
                {
                    CurrentState.CurrentPhase = TimerPhase.Running;
                    undoneSplitDeaths         = 0;
                    prevParent = null;
                }
                else
                {
                    undoneSplitDeaths = Math.Max(CurrentState.CurrentSplit.DeathCount, 0);
                    CurrentState.CurrentSplit.DeathCount = -1;
                    prevParent = CurrentState.CurrentSplit.Parent;
                }
                DoUndoSplit(undoneSplitDeaths);

                if (prevParent != null && prevParent != CurrentState.CurrentSplit.Parent)
                {
                    prevParent.DeathCount = -1;
                }

                if (CurrentState.CurrentSplitIndex > 0 && IsParentOf(CurrentState.CurrentSplit, CurrentState.Run[CurrentState.CurrentSplitIndex - 1]))
                {
                    DoUndoSplit(undoneSplitDeaths);
                }

                CurrentState.Run.HasChanged = true;
                OnUndoSplit?.Invoke(this, null);
            }
        }
Пример #2
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit      += (s, e) => OnSplit?.Invoke(this, e);
     model.OnSkipSplit  += (s, e) => OnSkipSplit?.Invoke(this, e);
     model.OnUndoSplit  += (s, e) => OnUndoSplit?.Invoke(this, e);
     model.OnStart      += (s, e) => OnStart?.Invoke(this, e);
     model.OnReset      += (s, e) => OnReset?.Invoke(this, e);
     model.OnPause      += (s, e) => OnPause?.Invoke(this, e);
     model.OnResume     += (s, e) => OnResume?.Invoke(this, e);
     model.OnScrollUp   += (s, e) => OnScrollUp?.Invoke(this, e);
     model.OnScrollDown += (s, e) => OnScrollDown?.Invoke(this, e);
     model.OnSwitchComparisonPrevious += (s, e) => OnSwitchComparisonPrevious?.Invoke(this, e);
     model.OnSwitchComparisonNext     += (s, e) => OnSwitchComparisonNext?.Invoke(this, e);
 }
Пример #3
0
        public void UndoSplit()
        {
            if (CurrentState.CurrentPhase != TimerPhase.NotRunning &&
                CurrentState.CurrentSplitIndex > 0)
            {
                if (CurrentState.CurrentPhase == TimerPhase.Ended)
                {
                    CurrentState.CurrentPhase = TimerPhase.Running;
                }
                CurrentState.CurrentSplitIndex--;
                CurrentState.CurrentSplit.SplitTime = default(Time);
                CurrentState.Run.HasChanged         = true;

                OnUndoSplit?.Invoke(this, null);
            }
        }
Пример #4
0
 public void OnBaseUndoSplit(object sender, EventArgs e)
 {
     OnUndoSplit?.Invoke(sender, e);
 }