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); } }
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); }
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); } }
public void OnBaseUndoSplit(object sender, EventArgs e) { OnUndoSplit?.Invoke(sender, e); }