public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { InternalComponent.LongestString = InternalComponent.InformationName; InternalComponent.InformationValue = state.CurrentComparison; InternalComponent.Update(invalidator, state, width, height, mode); }
public override void OnComponentUsed(AddonComponent component, Mobile from) { if (!Activated && component != null && component is InternalComponent && from.InRange(component.Location, 2)) { InternalComponent comp = component as InternalComponent; if (!comp.Active) { comp.Active = true; comp.WhoActivated = from; if (Activator1.Active && Activator2.Active && Activator1.WhoActivated != Activator2.WhoActivated) { if (ActiveTimer != null) { ActiveTimer.Stop(); ActiveTimer = null; } Activated = true; CheckNetwork(); } else if (ActiveTimer == null) { ActiveTimer = Timer.DelayCall(TimeSpan.FromSeconds(1), Reset); } } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var skipCount = Math.Min( Math.Max( 0, state.CurrentSplitIndex - (visualSplitCount - 2 - Settings.SplitPreviewCount + (Settings.AlwaysShowLastSplit ? 0 : 1))), state.Run.Count - visualSplitCount); ScrollOffset = Math.Min(Math.Max(ScrollOffset, -skipCount), state.Run.Count - skipCount - visualSplitCount); skipCount += ScrollOffset; var i = 0; if (SplitComponents.Count >= visualSplitCount) { foreach (var split in state.Run.Skip(skipCount).Take(visualSplitCount - 1 + (Settings.AlwaysShowLastSplit ? 0 : 1))) { SplitComponents[i].Split = split; i++; } if (Settings.AlwaysShowLastSplit) { SplitComponents[i].Split = state.Run.Last(); } } if (invalidator != null) { InternalComponent.Update(invalidator, state, width, height, mode); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Cache.Restart(); Cache["Game"] = state.Run.GameName; Cache["Category"] = state.Run.CategoryName; Cache["PlatformID"] = Settings.FilterPlatform ? state.Run.Metadata.PlatformName : null; Cache["RegionID"] = Settings.FilterRegion ? state.Run.Metadata.RegionName : null; Cache["UsesEmulator"] = Settings.FilterPlatform ? (bool?)state.Run.Metadata.UsesEmulator : null; Cache["Variables"] = Settings.FilterVariables ? string.Join(",", state.Run.Metadata.VariableValueNames.Values) : null; if (Cache.HasChanged) { IsLoading = true; PersonalRecord = null; ShowPersonalRecord(mode); Task.Factory.StartNew(RefreshPersonalRecord); } else if (LastUpdate != null && TimeStamp.Now - LastUpdate >= RefreshInterval) { Task.Factory.StartNew(RefreshPersonalRecord); } else { Cache["CenteredText"] = Settings.CenteredText && !Settings.Display2Rows && mode == LayoutMode.Vertical; Cache["RealPBTime"] = GetPBTime(Model.TimingMethod.RealTime); Cache["GamePBTime"] = GetPBTime(Model.TimingMethod.GameTime); if (Cache.HasChanged) { ShowPersonalRecord(mode); } } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (invalidator != null) { InternalComponent.Update(invalidator, state, width, height, mode == LayoutMode.Vertical ? LayoutMode.Horizontal : LayoutMode.Vertical); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { GameLoader.game?.Update(state); if (invalidator != null && (GameLoader.game?.IsRunning() ?? false)) { InternalComponent.Update(invalidator, state, width, height, mode); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var comparison = Settings.Comparison == "Current Comparison" ? state.CurrentComparison : Settings.Comparison; if (!state.Run.Comparisons.Contains(comparison)) { comparison = state.CurrentComparison; } var comparisonName = CompositeComparisons.GetShortComparisonName(comparison); var componentName = (Settings.TotalTimeSave ? "Total " : "") + "Possible Time Save" + (Settings.Comparison == "Current Comparison" ? "" : " (" + comparisonName + ")"); if (InternalComponent.InformationName != componentName) { InternalComponent.AlternateNameText.Clear(); if (componentName.Contains("Total")) { InternalComponent.AlternateNameText.Add("Total Possible Time Save"); } InternalComponent.AlternateNameText.Add("Possible Time Save"); InternalComponent.AlternateNameText.Add("Poss. Time Save"); InternalComponent.AlternateNameText.Add("Time Save"); } InternalComponent.LongestString = componentName; InternalComponent.InformationName = componentName; if (Settings.TotalTimeSave) { if (state.CurrentPhase == TimerPhase.Ended) { InternalComponent.TimeValue = TimeSpan.Zero; } else { var totalPossibleTimeSave = state.Run .Skip(state.CurrentSplitIndex) .Select(x => GetPossibleTimeSave(state, x, comparison, true)) .Where(x => x.HasValue) .Aggregate((TimeSpan?)TimeSpan.Zero, (a, b) => a + b); InternalComponent.TimeValue = totalPossibleTimeSave; } } else { if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { InternalComponent.TimeValue = GetPossibleTimeSave(state, state.CurrentSplit, comparison); } else { InternalComponent.TimeValue = null; } } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { InternalComponent.InformationName = Settings.Text1; InternalComponent.InformationValue = Settings.Text2; InternalComponent.LongestString = Settings.Text1.Length > Settings.Text2.Length ? Settings.Text1 : Settings.Text2; InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { string textPercentage = (tracker.IsRunning) ? PercentageFormatter.Format(progress.Percentage, Settings.Accuracy) : "-"; if (invalidator != null && this.InternalComponent.InformationValue != textPercentage) { this.InternalComponent.InformationValue = textPercentage; invalidator.Invalidate(0f, 0f, width, height); InternalComponent.Update(invalidator, state, width, height, mode); } }
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, System.Drawing.Region clipRegion) { DrawBackground(g, state, HorizontalWidth, height); PrepareDraw(state, LayoutMode.Horizontal); InternalComponent.DrawHorizontal(g, state, height, clipRegion); g.DrawEllipse(new Pen(Color.Aqua), new Rectangle(new Point(10, 0), new Size((int)HorizontalWidth - 10, (int)height))); if (UserIcon != null) { g.DrawImage(UserIcon, new Point(10, (int)height / 2 - 50)); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (CheckIfRunChanged(state)) { UpdateStreakValue(state); } InternalComponent.InformationValue = StreakText; InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (CheckIfRunChanged(state)) { UpdateSumOfBestValue(state); } InternalComponent.TimeValue = SumOfBestValue; InternalComponent.Update(invalidator, state, width, height, mode); }
void IComponent.Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { string newCategory = State.Run.GameName + State.Run.CategoryName; if (newCategory != category) { Recalculate(); category = newCategory; } InternalComponent.Update(invalidator, state, width, height, mode); }
void IComponent.Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { string newCategory = State.Run.GameName + State.Run.CategoryName; if (newCategory != category) { resetOrNotCalculator.OnCategoryChanged(newCategory); UpdateShouldResetText(); category = newCategory; } InternalComponent.Update(invalidator, state, width, height, mode); }
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion) { DrawGeneral(g, state, HorizontalWidth, height); var oldMatrix = g.Transform; InternalComponent.Settings.TimerWidth = HorizontalWidth; InternalComponent.DrawHorizontal(g, state, height * ((100f - Settings.SegmentTimerSizeRatio) / 100f), clipRegion); g.Transform = oldMatrix; g.TranslateTransform(0, height * ((100f - Settings.SegmentTimerSizeRatio) / 100f)); SegmentTimer.DrawHorizontal(g, state, height * (Settings.SegmentTimerSizeRatio / 100f), clipRegion); SegmentTimer.Settings.TimerWidth = HorizontalWidth; g.Transform = oldMatrix; }
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion) { DrawGeneral(g, state, width, VerticalHeight); var oldMatrix = g.Transform; InternalComponent.Settings.TimerHeight = VerticalHeight * ((100f - Settings.SegmentTimerSizeRatio) / 100f); InternalComponent.DrawVertical(g, state, width, clipRegion); g.Transform = oldMatrix; g.TranslateTransform(0, VerticalHeight * ((100f - Settings.SegmentTimerSizeRatio) / 100f)); SegmentTimer.Settings.TimerHeight = VerticalHeight * (Settings.SegmentTimerSizeRatio / 100f); SegmentTimer.DrawVertical(g, state, width, clipRegion); g.Transform = oldMatrix; }
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion) { DrawBackground(g, state, HorizontalWidth, height); InternalComponent.NameLabel.HasShadow = InternalComponent.ValueLabel.HasShadow = state.LayoutSettings.DropShadows; InternalComponent.NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor; InternalComponent.ValueLabel.ForeColor = Settings.OverrideTimeColor ? Settings.TimeColor : state.LayoutSettings.TextColor; InternalComponent.DrawHorizontal(g, state, height, clipRegion); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var comparison = Settings.Comparison; if (!state.Run.Comparisons.Contains(comparison)) { // #1682: Currently, support "Best Segments" comparison only ("Current Comparison" not supported) InternalComponent.InformationName = "Split #" + Settings.VisualCompareSplitNumber + " comparison not available"; InternalComponent.TimeValue = null; } else { if (Settings.VisualCompareSplitNumber > state.Run.Count) { InternalComponent.InformationName = "Split #" + Settings.VisualCompareSplitNumber + " not available"; InternalComponent.TimeValue = null; } else // get information for Settings.VisualCompareSplitNumber { ISegment visualCompareSplitNumberSegment = state.Run[Settings.VisualCompareSplitNumber - 1]; if (state.CurrentSplitIndex > Settings.VisualCompareSplitNumber - 1) { InternalComponent.InformationName = "Time (" + visualCompareSplitNumberSegment.Name + ")"; InternalComponent.TimeValue = visualCompareSplitNumberSegment.SplitTime[state.CurrentTimingMethod].GetValueOrDefault(); } else { InternalComponent.InformationName = "Best Possible Time (" + visualCompareSplitNumberSegment.Name + ")"; if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { TimeSpan?delta = LiveSplitStateHelper.GetLastDelta(state, state.CurrentSplitIndex, comparison, state.CurrentTimingMethod) ?? TimeSpan.Zero; var liveDelta = state.CurrentTime[state.CurrentTimingMethod] - state.CurrentSplit.Comparisons[comparison][state.CurrentTimingMethod]; if (liveDelta > delta) { delta = liveDelta; } InternalComponent.TimeValue = delta + visualCompareSplitNumberSegment.Comparisons[comparison][state.CurrentTimingMethod]; } else { TimeSpan?timeValue = visualCompareSplitNumberSegment.Comparisons[comparison][state.CurrentTimingMethod]; InternalComponent.TimeValue = timeValue; } } } } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var comparison = Settings.Comparison == "Current Comparison" ? state.CurrentComparison : Settings.Comparison; if (!state.Run.Comparisons.Contains(comparison)) { comparison = state.CurrentComparison; } var comparisonName = comparison.StartsWith("[Race] ") ? comparison.Substring(7) : comparison; if (InternalComponent.InformationName != comparisonName) { InternalComponent.AlternateNameText.Clear(); InternalComponent.AlternateNameText.Add(CompositeComparisons.GetShortComparisonName(comparison)); } InternalComponent.LongestString = comparisonName; InternalComponent.InformationName = comparisonName; var useLiveDelta = false; if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { TimeSpan?delta = LiveSplitStateHelper.GetLastDelta(state, state.CurrentSplitIndex, comparison, state.CurrentTimingMethod); var liveDelta = state.CurrentTime[state.CurrentTimingMethod] - state.CurrentSplit.Comparisons[comparison][state.CurrentTimingMethod]; if (liveDelta > delta || (delta == null && liveDelta > TimeSpan.Zero)) { delta = liveDelta; useLiveDelta = true; } InternalComponent.TimeValue = delta; } else if (state.CurrentPhase == TimerPhase.Ended) { InternalComponent.TimeValue = state.Run.Last().SplitTime[state.CurrentTimingMethod] - state.Run.Last().Comparisons[comparison][state.CurrentTimingMethod]; } else { InternalComponent.TimeValue = null; } var color = LiveSplitStateHelper.GetSplitColor(state, InternalComponent.TimeValue, state.CurrentSplitIndex - (useLiveDelta ? 0 : 1), true, false, comparison, state.CurrentTimingMethod); if (color == null) { color = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor; } InternalComponent.ValueLabel.ForeColor = color.Value; InternalComponent.Update(invalidator, state, width, height, mode); }
public void startUpProjectTest3() { IEnvironment env = new StubEnv(); var target = new InternalComponent(env); string defProject = env.StartupProjectString; Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject = project1]")); Assert.AreEqual("project1", env.StartupProjectString); Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject =]")); Assert.AreEqual(defProject, env.StartupProjectString); Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); }
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion) { DrawBackground(g, state, width, VerticalHeight); InternalComponent.DisplayTwoRows = Settings.Display2Rows; InternalComponent.NameLabel.HasShadow = InternalComponent.ValueLabel.HasShadow = state.LayoutSettings.DropShadows; InternalComponent.NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor; InternalComponent.ValueLabel.ForeColor = Settings.OverrideTimeColor ? Settings.TimeColor : state.LayoutSettings.TextColor; InternalComponent.DrawVertical(g, state, width, clipRegion); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var timingMethod = state.CurrentTimingMethod; if (Settings.TimingMethod == "Real Time") { timingMethod = TimingMethod.RealTime; } else if (Settings.TimingMethod == "Game Time") { timingMethod = TimingMethod.GameTime; } var formatter = new AlternateTimeFormatter(Settings.AlternateTimeAccuracy); TimeSpan?altTime = null; if (AlternateTimer != null) { altTime = AlternateTimer.GetTime(state, timingMethod); } AlternateTimer.Settings.TimingMethod = Settings.TimingMethod; InternalComponent.Settings.TimingMethod = Settings.TimingMethod; AlternateTimer.Update(null, state, width, height, mode); InternalComponent.Update(null, state, width, height, mode); Cache.Restart(); Cache["AlternateTimerText"] = AlternateTimer.BigTextLabel.Text + AlternateTimer.SmallTextLabel.Text; Cache["InternalComponentText"] = InternalComponent.BigTextLabel.Text + InternalComponent.SmallTextLabel.Text; if (InternalComponent.BigTextLabel.Brush != null && invalidator != null) { if (InternalComponent.BigTextLabel.Brush is LinearGradientBrush) { Cache["TimerColor"] = ((LinearGradientBrush)InternalComponent.BigTextLabel.Brush).LinearColors.First().ToArgb(); } else { Cache["TimerColor"] = InternalComponent.BigTextLabel.ForeColor.ToArgb(); } } if (invalidator != null && (Cache.HasChanged)) //|| FrameCount > 1)) { invalidator.Invalidate(0, 0, width, height); } }
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion) { var scaleFactor = (float)height / Math.Max(InternalComponent.OverallHeight, 1f); var oldMatrix = g.Transform; try { g.ScaleTransform(scaleFactor, scaleFactor); InternalComponent.DrawVertical(g, state, HorizontalWidth / scaleFactor, clipRegion); } catch (Exception ex) { Log.Error(ex); } g.Transform = oldMatrix; }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { InternalComponent.Formatter = Settings.ShowTotalHours ? HoursTimeFormatter : DaysTimeFormatter; if (LastAttemptCount != state.Run.AttemptHistory.Count || LastPhase != state.CurrentPhase || LastRun != state.Run || state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { InternalComponent.TimeValue = CalculateTotalPlaytime(state); LastAttemptCount = state.Run.AttemptHistory.Count; LastPhase = state.CurrentPhase; LastRun = state.Run; } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var comparison = Settings.Comparison == "Current Comparison" ? state.CurrentComparison : Settings.Comparison; if (!state.Run.Comparisons.Contains(comparison)) { comparison = state.CurrentComparison; } InternalComponent.InformationName = InternalComponent.LongestString = GetDisplayedName(comparison); if (InternalComponent.InformationName != PreviousInformationName) { SetAlternateText(comparison); PreviousInformationName = InternalComponent.InformationName; } if (InternalComponent.InformationName.StartsWith("Current Pace") && state.CurrentPhase == TimerPhase.NotRunning) { InternalComponent.TimeValue = null; } else if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { TimeSpan?delta = LiveSplitStateHelper.GetLastDelta(state, state.CurrentSplitIndex, comparison, state.CurrentTimingMethod) ?? TimeSpan.Zero; var liveDelta = state.CurrentTime[state.CurrentTimingMethod] - state.CurrentSplit.Comparisons[comparison][state.CurrentTimingMethod]; if (liveDelta > delta) { delta = liveDelta; } InternalComponent.TimeValue = delta + state.Run.Last().Comparisons[comparison][state.CurrentTimingMethod]; } else if (state.CurrentPhase == TimerPhase.Ended) { InternalComponent.TimeValue = state.Run.Last().SplitTime[state.CurrentTimingMethod]; } else { InternalComponent.TimeValue = state.Run.Last().Comparisons[comparison][state.CurrentTimingMethod]; } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { // If the actual comparison or timing method have changed, we'll need to invalidate the // data structures. if (!GetActualComparison(state).Equals(ActualComparison) || !GetActualTimingMethod(state).Equals(ActualTimingMethod)) { SplitCompletionsValid = false; } // If the underlying data structures have been invalidated by the start of a new run, // or the timing method changing, we need to re-initialize. if (!SplitCompletionsValid) { Initialize(state); } float newProgress = GetProgress(state) * 100; if (CurrentProgress != newProgress) { CurrentProgress = newProgress; InternalComponent.LongestString = InternalComponent.InformationName; string completionFormat = $"{CurrentProgress:0}%"; if (Settings.Accuracy.Equals(CompletionEstimateSettings.CompletionAccuracy.OneDecimal)) { completionFormat = Settings.ShowTrailingZeroes ? $"{CurrentProgress:0.0}%" : $"{CurrentProgress:0.#}%"; } else if (Settings.Accuracy.Equals(CompletionEstimateSettings.CompletionAccuracy.TwoDecimal)) { completionFormat = Settings.ShowTrailingZeroes ? $"{CurrentProgress:0.00}%" : $"{CurrentProgress:0.##}%"; } // If we can't make an estimate, just display "?". InternalComponent.InformationValue = CurrentProgress >= 0 ? completionFormat : "?"; } InternalComponent.Update(invalidator, state, width, height, mode); }
public void Dispose() { foreach (Image shadowImage in ShadowImages.Values) { shadowImage.Dispose(); } ShadowImages.Clear(); CurrentState.ComparisonRenamed -= state_ComparisonRenamed; InternalComponent.Dispose(); foreach (SplitComponent splitComponent in SplitComponents) { splitComponent.Dispose(); } SplitComponents.Clear(); Settings.SplitLayoutChanged -= Settings_SplitLayoutChanged; Settings.Dispose(); }
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion) { DrawBackground(g, state, HorizontalWidth, height); PrepareDraw(state); InternalComponent.DrawHorizontal(g, state, height, clipRegion); }
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion) { DrawBackground(g, state, width, VerticalHeight); PrepareDraw(state); InternalComponent.DrawVertical(g, state, width, clipRegion); }
public void Dispose() { InternalComponent.Dispose(); }