Exemplo n.º 1
0
        private DialogResult WarnAboutResetting()
        {
            var warnUser = false;

            for (var index = 0; index < fzzy.state.Run.Count; index++)
            {
                if (!LiveSplitStateHelper.CheckBestSegment(fzzy.state, index, fzzy.state.CurrentTimingMethod))
                {
                    continue;
                }
                warnUser = true;
                break;
            }

            if (!warnUser && (fzzy.state.Run.Last().SplitTime[fzzy.state.CurrentTimingMethod] != null &&
                              fzzy.state.Run.Last().PersonalBestSplitTime[fzzy.state.CurrentTimingMethod] == null) ||
                fzzy.state.Run.Last().SplitTime[fzzy.state.CurrentTimingMethod] <
                fzzy.state.Run.Last().PersonalBestSplitTime[fzzy.state.CurrentTimingMethod])
            {
                warnUser = true;
            }
            if (!warnUser)
            {
                return(DialogResult.Yes);
            }
            var result = MessageBox.Show("You have beaten some of your best times.\r\nDo you want to update them?",
                                         "Update Times?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            return(result);
        }
Exemplo n.º 2
0
 public bool CheckBestSegment(LiveSplitState state, int splitNumber, TimingMethod method)
 {
     if (Settings.ShowBestSegments)
     {
         return(LiveSplitStateHelper.CheckBestSegment(state, splitNumber, method));
     }
     return(false);
 }
Exemplo n.º 3
0
        private SplitState GetSplitState(
            LiveSplitState state,
            TimeSpan?timeDifference,
            int splitNumber,
            string comparison,
            TimingMethod method)
        {
            SplitState splitState = SplitState.Unknown;

            if (splitNumber < 0)
            {
                return(splitState);
            }

            if (timeDifference != null)
            {
                if (timeDifference < TimeSpan.Zero)
                {
                    splitState = SplitState.AheadGaining;
                    var lastDelta = LiveSplitStateHelper.GetLastDelta(state, splitNumber - 1, comparison, method);
                    if (splitNumber > 0 && lastDelta != null && timeDifference > lastDelta)
                    {
                        splitState = SplitState.AheadLosing;
                    }
                }
                else
                {
                    splitState = SplitState.BehindLosing;
                    var lastDelta = LiveSplitStateHelper.GetLastDelta(state, splitNumber - 1, comparison, method);
                    if (splitNumber > 0 && lastDelta != null && timeDifference < lastDelta)
                    {
                        splitState = SplitState.BehindGaining;
                    }
                }
            }

            if (LiveSplitStateHelper.CheckBestSegment(state, splitNumber, method))
            {
                splitState = SplitState.BestSegment;
            }

            return(splitState);
        }
        private void ResolveForCount(IRun run)
        {
            int gold = 0, good = 0, bad = 0;
            foreach (ISegment segment in run)
            {
                var hasTime = segment.SplitTime[State.CurrentTimingMethod] != null;
                if (!hasTime)
                {
                    continue;
                }
                
                var wasGold = LiveSplitStateHelper.CheckBestSegment(State, run.IndexOf(segment), State.CurrentTimingMethod);
                var delta = LiveSplitStateHelper.GetPreviousSegmentDelta(State, run.IndexOf(segment),
                    State.CurrentComparison, State.CurrentTimingMethod);
                if (wasGold)
                {
                    gold++;
                }

                if (delta < TimeSpan.Zero)
                {
                    good++;
                }
                else
                {
                    bad++;
                }
            }

            if (Settings.ResolveOnGoldSplits)
            {
				_ = ResolveCurrentPredictionAsync(gold >= Settings.ResolveOnAmount);
            }
            else if (Settings.ResolveOnGoodSplits)
            {
				_ = ResolveCurrentPredictionAsync(good >= Settings.ResolveOnAmount);
            }
            else if (Settings.ResolveOnBadSplits)
            {
				_ = ResolveCurrentPredictionAsync(bad >= Settings.ResolveOnAmount);
            }
        }