public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (!gameMemory.ProcessHook()) { return; } if (logic.ShouldStart()) { logic.ResetLogic(); if (liveSplitState.CurrentPhase == TimerPhase.Running) { timerModel.Reset(); } timerModel.Start(); } if (liveSplitState.CurrentPhase == TimerPhase.Running) { if (logic.ShouldSplit(liveSplitState.CurrentSplitIndex, liveSplitState.Run.Count)) { timerModel.Split(); } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (SplitsAreDifferent(state)) { settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); ReloadLogFile(); } if (LanguageIsDifferent()) { InitTesseract(); } liveSplitState = state; /* * liveSplitState = state; * if (GameName != state.Run.GameName || GameCategory != state.Run.CategoryName) * { * //Reload settings for different game or category * GameName = state.Run.GameName; * GameCategory = state.Run.CategoryName; * * settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); * } */ CaptureLoads(); if (settings.isCalibratingBlacklevel) { CalibrateBlacklevel(); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { UpdateAll(state); if (Item != null) { Cache.Restart(); Cache["Icon"] = Item.Icon; Cache["DisplayIcon"] = DisplayIcon; Cache["ShowGoal"] = ShowGoal; Cache["NameLabel"] = NameLabel.Text; Cache["CountLabel"] = CountLabel.Text; Cache["GoalLabel"] = GoalLabel.Text; Cache["NameFont"] = NameFont; Cache["CountFont"] = CountFont; Cache["GoalFont"] = GoalFont; Cache["NameColor"] = NameLabel.ForeColor.ToArgb(); Cache["CountColor"] = CountLabel.ForeColor.ToArgb(); Cache["GoalColor"] = GoalLabel.ForeColor.ToArgb(); Cache["BackColor"] = Settings.BackgroundColor.ToArgb(); if (invalidator != null && Cache.HasChanged) { invalidator.Invalidate(0, 0, width, height); } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { HeaderText = PusherClient.InfoText; if (Settings.RaceActive) { HeaderText = Settings.RaceName; } else { HeaderText = "No Active Race"; } RaceMode = Settings.RaceMode; PlayerCount = Settings.PlayerCount; invalidator.Invalidate(0, 0, width, height); //InternalComponent.Update(invalidator, state, width, height, mode); if (state.Run.HasChanged) { Settings.CurrentSplits.Clear(); foreach (Segment s in state.Run) { Settings.CurrentSplits.Add(s.Name); } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { InternalComponent.InformationName = Settings.ProbabilityText; InternalComponent.LongestString = Settings.ProbabilityText; InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { List <Area> areas = memory.GetMapCompletion(); decimal total = 0; Area currentArea = default(Area); for (int i = 0; i < areas.Count; i++) { Area area = areas[i]; total += area.Progress; if (area.Current) { currentArea = area; } } if (areas.Count > 0) { total /= areas.Count; } textInfo.InformationName = "Total Map: " + total.ToString("0.00") + "%"; textInfo.InformationValue = currentArea.Name + " - " + currentArea.Progress.ToString("0.00") + "%"; textInfo.LongestString = "Valley Of The Wind - 100.00%"; textInfo.Update(invalidator, state, width, height, mode); if (invalidator != null) { invalidator.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode) { try { if (Settings.Hook != null) { Settings.Hook.Poll(); } } catch { } this.state = state; CounterNameLabel.Text = Settings.CounterText; CounterValueLabel.Text = Counter.Count.ToString(); Cache.Restart(); Cache["CounterNameLabel"] = CounterNameLabel.Text; Cache["CounterValueLabel"] = CounterValueLabel.Text; if (invalidator != null && Cache.HasChanged) { invalidator.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (invalidator == null) { return; } var oldTransform = invalidator.Transform.Clone(); var scaleFactor = mode == LayoutMode.Vertical ? height / OverallSize : width / OverallSize; for (var ind = 0; ind < VisibleComponents.Count(); ind++) { var component = VisibleComponents.ElementAt(ind); if (mode == LayoutMode.Vertical) { InvalidateVerticalComponent(ind, state, invalidator, width, height, scaleFactor); } else { InvalidateHorizontalComponent(ind, state, invalidator, width, height, scaleFactor); } } invalidator.Transform = oldTransform; }
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) { if (SplitsAreDifferent(state)) { settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); ReloadLogFile(); } if (loading) { framesSinceStartOfLoad++; } if (loading && !doneLoading && framesSinceStartOfLoad >= settings.MaxFramesToWaitForSwirl) /*Arbitrary number of frames to wait*/ { var currentGameTime = timer.CurrentState.CurrentTime.GameTime; currentGameTime += timer.CurrentState.CurrentTime.RealTime - loadStartTime; framesSinceStartOfLoad = 0; UpdateLoadingState(1, 0, true); timer.CurrentState.SetGameTime(currentGameTime); UpdateGameTimerState(); loadStartTime = null; } liveSplitState = state; UpdateMemoryRead(); if (memory.ProcessHooked) { invalidator?.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode) { int completedExitCount = 0; if (Settings.AutoTotalCount) { completedExitCount = Math.Max(completedExitCount, state.CurrentSplitIndex); ExitCounterLabel.Text = Settings.ExitCounterText + " " + completedExitCount.ToString() + "/" + state.Run.Count; } else { try { completedExitCount = int.Parse(state.CurrentSplit.Name) - 1; } catch { try { completedExitCount = Math.Max(completedExitCount, state.CurrentSplitIndex); } catch { } } ExitCounterLabel.Text = Settings.ExitCounterText + " " + completedExitCount.ToString() + "/" + Settings.TotalExitCount.ToString(); } Cache.Restart(); Cache["ExitCounterLabel"] = ExitCounterLabel.Text; if (invalidator != null && Cache.HasChanged) { invalidator.Invalidate(0, 0, width, height); } }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (updateTask.Exception != null) { throw updateTask.Exception; } }
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) { if (Model == null) { Model = new TimerModel() { CurrentState = state }; state.OnReset += OnReset; state.OnPause += OnPause; state.OnResume += OnResume; state.OnStart += OnStart; state.OnSplit += OnSplit; state.OnUndoSplit += OnUndoSplit; state.OnSkipSplit += OnSkipSplit; } oriState.Loop(); oriState.oriTriggers.timerRunning = (Model.CurrentState.CurrentPhase == TimerPhase.Running); if (Settings.showMapDisplay) { textInfo.InformationName = "Total Map: " + oriState.sMapCompletion.ToString("0.00") + "%"; textInfo.InformationValue = oriState.sCurrentArea.ToString(); textInfo.LongestString = "Valley Of The Wind - 100.00%"; textInfo.Update(invalidator, state, width, height, mode); if (invalidator != null) { invalidator.Invalidate(0, 0, width, height); } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (invalidator != null) { invalidator.Invalidate(0, 0, width, height); } }
public override void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode) { if (state.CurrentPhase == TimerPhase.NotRunning) { if (AutoSplitter.ShouldStart(state)) { Model.Start(); } } else if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { if (AutoSplitter.ShouldReset(state)) { Model.Reset(); return; } else if (AutoSplitter.ShouldSplit(state)) { Model.Split(); } state.IsGameTimePaused = AutoSplitter.IsGameTimePaused(state); var gameTime = AutoSplitter.GetGameTime(state); if (gameTime != null) state.SetGameTime(gameTime); } }
/// <summary> /// Adds <see cref="GameMemory"/> and <see cref="Autosplitter"/> management to <see cref="AutoSplitComponent.Update"/>. /// </summary> /// <param name="invalidator"><see cref="IInvalidator"/> passed by LiveSplit</param> /// <param name="state"><see cref="LiveSplitState"/> passed by LiveSplit</param> /// <param name="width">width passed by LiveSplit</param> /// <param name="height">height passed by LiveSplit</param> /// <param name="mode"><see cref="LayoutMode"/> passed by LiveSplit</param> /// <remarks> /// This override allows <see cref="Autosplitter"/> to use <see cref="GameMemory"/> in its logic. /// </remarks> public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (_splitter.GameMemory.Update()) { base.Update(invalidator, state, width, height, mode); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { frame_count++; if (SplitsAreDifferent(state)) { settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); ReloadLogFile(); } if (settings.RecordImages && (frame_count % 3) == 0) { settings.StoreCaptureImage(GameName, GameCategory); } liveSplitState = state; /* * liveSplitState = state; * if (GameName != state.Run.GameName || GameCategory != state.Run.CategoryName) * { * //Reload settings for different game or category * GameName = state.Run.GameName; * GameCategory = state.Run.CategoryName; * * settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); * } */ CaptureLoads(); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (timer == null) { timer = new TimerModel(); timer.CurrentState = state; state.OnStart += (sender, args) => { OnStart(); }; state.OnSplit += (sender, args) => { splitCollection.OnSplit(); UpdateRunState(); }; state.OnUndoSplit += (sender, args) => { splitCollection.OnUndoSplit(); UpdateRunState(); }; state.OnSkipSplit += (sender, args) => { splitCollection.OnSkipSplit(); UpdateRunState(); }; state.OnReset += (sender, value) => { OnReset(); }; } Refresh(state.CurrentPhase); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (!Settings.AutoSplittingEnabled) { return; } try { GetHooksIfNeeded(state); // After this call we assume we have a valid AutoSplitter if no exception was thrown var status = AutoSplitter.Update(state); if (!StatusWindow.IsDisposed) { StatusWindow.SetStatus(status.Type, status.Message); } } catch (Exception e) { ClearAutoSplitter(); if (!StatusWindow.IsDisposed) { StatusWindow.SetErrorStatus(e.Message); } } }
public override void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode) { if (state.CurrentPhase == TimerPhase.NotRunning) { if (AutoSplitter.ShouldStart(state)) { Model.Start(); } } else if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) { if (AutoSplitter.ShouldReset(state)) { Model.Reset(); return; } else if (AutoSplitter.ShouldSplit(state)) { Model.Split(); } state.IsGameTimePaused = AutoSplitter.IsGameTimePaused(state); var gameTime = AutoSplitter.GetGameTime(state); if (gameTime != null) { state.SetGameTime(gameTime); } } }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { int memoryIGT = this.model.GetMemoryInGameTime(); this.state.IsGameTimePaused = this.settings.UseGameTime; if (this.settings.UseGameTime && this.state.CurrentPhase == TimerPhase.Running) { this.state.SetGameTime(new TimeSpan(0, 0, 0, 0, this.model.GetInGameTime())); } if (memoryIGT > 0 && memoryIGT < IGT_START_THRESHOLD) { if (this.settings.StartTimerAutomatically && this.state.CurrentPhase == TimerPhase.NotRunning) { this.timerModel.Start(); } if (this.settings.InventoryResetEnabled && !this.resetIndexesLatch) { this.model.ResetIndexes(); this.resetIndexesLatch = true; } } }
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) { InternalComponent.LongestString = InternalComponent.InformationName; InternalComponent.InformationValue = state.CurrentComparison; InternalComponent.Update(invalidator, state, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (SplitsAreDifferent(state)) { settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); settings.ReloadDetectorSettings(GameName, GameCategory); } liveSplitState = state; /* * liveSplitState = state; * if (GameName != state.Run.GameName || GameCategory != state.Run.CategoryName) * { * //Reload settings for different game or category * GameName = state.Run.GameName; * GameCategory = state.Run.CategoryName; * * settings.ChangeAutoSplitSettingsToGameName(GameName, GameCategory); * } */ CaptureLoads(); }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { state.IsGameTimePaused = true; bool start = false; lock (eventsLock) { foreach (var ev in events) { if (ev is GameEndEvent) { if (state.CurrentPhase == TimerPhase.Running && settings.ShouldSplitOnGameEnd()) { state.SetGameTime(ev.Time); model.Split(); } } else if (ev is MapChangeEvent) { var e = (MapChangeEvent)ev; if (visitedMaps.Add(e.Map) && settings.ShouldSplitOn(e.Map)) { state.SetGameTime(e.Time); model.Split(); } } else if (ev is TimerResetEvent) { if (settings.IsAutoResetEnabled()) { state.SetGameTime(ev.Time); model.Reset(); } } else if (ev is TimerStartEvent) { if (settings.IsAutoStartEnabled()) { state.SetGameTime(ev.Time); start = true; } } } events.Clear(); } if (start) { model.Start(); } TimeSpan curTime; lock (currentTimeLock) { curTime = currentTime; } state.SetGameTime(curTime); }
public virtual void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (!HasInvalidated && invalidator != null) { invalidator.Invalidate(0, 0, width, height); HasInvalidated = true; } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (invalidator != null && (_stateChanged || _ready_timer.IsRunning)) { _stateChanged = false; invalidator.Invalidate(0, 0, width, height); } }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (Initialized) { discord.RunCallbacks(); UpdatePresence(state); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { GameLoader.game?.Update(state); if (invalidator != null) { InternalComponent.Update(invalidator, state, width, height, mode); } }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (state.CurrentPhase != _prevPhase && state.CurrentPhase == TimerPhase.Ended) { UpdateBearCartPB(true); } _prevPhase = state.CurrentPhase; }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if ((Settings.ScriptPath != OldScriptPath && !String.IsNullOrEmpty(Settings.ScriptPath)) || DoReload) { Script = ASLParser.Parse(File.ReadAllText(Settings.ScriptPath)); OldScriptPath = Settings.ScriptPath; FSWatcher.Path = Path.GetDirectoryName(Settings.ScriptPath); FSWatcher.Filter = Path.GetFileName(Settings.ScriptPath); FSWatcher.EnableRaisingEvents = true; DoReload = false; } if (Script != null) Script.Update(state); }
public SlideshowInvalidator(IInvalidator innerInvalidator, Invalidation invalidationCallback) { this.innerInvalidator = innerInvalidator; this.invalidationCallback = invalidationCallback; }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { 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 abstract void Update(IInvalidator invalidator, Model.LiveSplitState state, float width, float height, LayoutMode mode);
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Cache.Restart(); Cache["DisplayedSize"] = DisplayedSize; Cache["UseSeparatorColor"] = UseSeparatorColor; Cache["LockToBottom"] = LockToBottom; if (invalidator != null && Cache.HasChanged) invalidator.Invalidate(0, 0, width, height); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (Split != null) { UpdateAll(state); NeedUpdateAll = false; IsActive = (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) && state.CurrentSplit == Split; Cache.Restart(); Cache["Icon"] = Split.Icon; if (Cache.HasChanged) { if (Split.Icon == null) FrameCount = 0; else FrameCount = Split.Icon.GetFrameCount(new FrameDimension(Split.Icon.FrameDimensionsList[0])); } Cache["DisplayIcon"] = DisplayIcon; Cache["SplitName"] = NameLabel.Text; Cache["IsActive"] = IsActive; Cache["NameColor"] = NameLabel.ForeColor.ToArgb(); Cache["ColumnsCount"] = ColumnsList.Count(); foreach (var label in LabelsList) { Cache["Columns" + LabelsList.IndexOf(label) + "Text"] = label.Text; Cache["Columns" + LabelsList.IndexOf(label) + "Color"] = label.ForeColor.ToArgb(); } if (invalidator != null && Cache.HasChanged || FrameCount > 1) { invalidator.Invalidate(0, 0, width, height); } } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { // hack to prevent flicker, doesn't actually pause anything state.IsGameTimePaused = true; // Update is called every 25ms, so up to 25ms IGT can be lost if using delay and no auto-start if (_waitingForDelay) { if (state.CurrentTime.RealTime >= TimeSpan.Zero) { _sessionTimeOffset = _sessionTime; _waitingForDelay = false; } else { state.SetGameTime(state.CurrentTime.RealTime); } } if (!_waitingForDelay) // update game time, don't show negative time due to tick adjusting state.SetGameTime(this.GameTime >= TimeSpan.Zero ? this.GameTime : TimeSpan.Zero); if (!this.Settings.ShowGameTime) return; this.InternalComponent.TimeValue = state.CurrentTime[state.CurrentTimingMethod == TimingMethod.GameTime ? TimingMethod.RealTime : TimingMethod.GameTime]; this.InternalComponent.InformationName = state.CurrentTimingMethod == TimingMethod.GameTime ? "Real Time" : "Game Time"; _cache.Restart(); _cache["TimeValue"] = this.InternalComponent.ValueLabel.Text; _cache["TimingMethod"] = state.CurrentTimingMethod; if (invalidator != null && _cache.HasChanged) invalidator.Invalidate(0f, 0f, width, height); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (process != null && settings.Pointer != null && !process.HasExited && process.ProcessName == settings.ProcessName) { switch (settings.ValueType) { case MemoryType.Float: currentValue = settings.Pointer.Deref<float>(process); break; case MemoryType.Int: currentValue = settings.Pointer.Deref<int>(process); break; case MemoryType.FloatVec2: currentValue = (float)settings.Pointer.Deref<FloatVec2>(process).Norm; break; case MemoryType.FloatVec3: currentValue = (float)settings.Pointer.Deref<FloatVec3>(process).Norm; break; case MemoryType.IntVec2: currentValue = (float)settings.Pointer.Deref<IntVec2>(process).Norm; break; case MemoryType.IntVec3: currentValue = (float)settings.Pointer.Deref<IntVec3>(process).Norm; break; case MemoryType.FloatVec2XZY: currentValue = (float)settings.Pointer.Deref<FloatVec2XZY>(process).Norm; break; case MemoryType.IntVec2XZY: currentValue = (float)settings.Pointer.Deref<IntVec2XZY>(process).Norm; break; } if (invalidator != null) { invalidator.Invalidate(0, 0, width, height); } } else { process = System.Diagnostics.Process.GetProcessesByName(settings.ProcessName).FirstOrDefault(); } }
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 S3Renderer WithInvalidator(IInvalidator instance) { this.invalidator = instance; return this; }
public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode) { if (Model == null) { Model = new TimerModel() { CurrentState = lvstate }; lvstate.OnReset += OnReset; lvstate.OnPause += OnPause; lvstate.OnResume += OnResume; lvstate.OnStart += OnStart; lvstate.OnSplit += OnSplit; lvstate.OnUndoSplit += OnUndoSplit; lvstate.OnSkipSplit += OnSkipSplit; } GetValues(invalidator, lvstate, width, height, mode); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var lastSplitOffset = state.CurrentSplitIndex == state.Run.Count ? -1 : 0; var timingMethod = state.CurrentTimingMethod; if (Settings.TimingMethod == "Real Time") timingMethod = TimingMethod.RealTime; else if (Settings.TimingMethod == "Game Time") timingMethod = TimingMethod.GameTime; var formatter = new SegmentTimesFormatter(Settings.SegmentTimesAccuracy); if (state.CurrentSplitIndex >= 0) { Comparison = Settings.Comparison == "Current Comparison" ? state.CurrentComparison : Settings.Comparison; Comparison2 = Settings.Comparison2 == "Current Comparison" ? state.CurrentComparison : Settings.Comparison2; HideComparison = Settings.HideComparison; if (HideComparison || !state.Run.Comparisons.Contains(Comparison2) || Comparison2 == "None") { HideComparison = true; if (!state.Run.Comparisons.Contains(Comparison) || Comparison == "None") Comparison = state.CurrentComparison; } else if (!state.Run.Comparisons.Contains(Comparison) || Comparison == "None") { HideComparison = true; Comparison = Comparison2; } else if (Comparison == Comparison2) HideComparison = true; ComparisonName = CompositeComparisons.GetShortComparisonName(Comparison); ComparisonName2 = CompositeComparisons.GetShortComparisonName(Comparison2); TimeSpan? segmentTime = null; if (Comparison == BestSegmentsComparisonGenerator.ComparisonName) segmentTime = state.Run[state.CurrentSplitIndex + lastSplitOffset].BestSegmentTime[timingMethod]; else { if (state.CurrentSplitIndex == 0 || (state.CurrentSplitIndex == 1 && lastSplitOffset == -1)) segmentTime = state.Run[0].Comparisons[Comparison][timingMethod]; else if (state.CurrentSplitIndex > 0) segmentTime = state.Run[state.CurrentSplitIndex + lastSplitOffset].Comparisons[Comparison][timingMethod] - state.Run[state.CurrentSplitIndex - 1 + lastSplitOffset].Comparisons[Comparison][timingMethod]; } LabelSegment.Text = ComparisonName + ":"; LabelBest.Text = ComparisonName2 + ":"; if (Comparison != "None") { if (segmentTime != null) SegmentTime.Text = formatter.Format(segmentTime); else SegmentTime.Text = "-"; } if (!HideComparison) { TimeSpan? bestSegmentTime = null; if (Comparison2 == BestSegmentsComparisonGenerator.ComparisonName) bestSegmentTime = state.Run[state.CurrentSplitIndex + lastSplitOffset].BestSegmentTime[timingMethod]; else { if (state.CurrentSplitIndex == 0 || (state.CurrentSplitIndex == 1 && lastSplitOffset == -1)) bestSegmentTime = state.Run[0].Comparisons[Comparison2][timingMethod]; else if (state.CurrentSplitIndex > 0) bestSegmentTime = state.Run[state.CurrentSplitIndex + lastSplitOffset].Comparisons[Comparison2][timingMethod] - state.Run[state.CurrentSplitIndex - 1 + lastSplitOffset].Comparisons[Comparison2][timingMethod]; } if (bestSegmentTime != null) BestSegmentTime.Text = formatter.Format(bestSegmentTime); else BestSegmentTime.Text = "-"; } if (state.CurrentSplitIndex >= 0) SplitName.Text = state.Run[state.CurrentSplitIndex + lastSplitOffset].Name; else SplitName.Text = ""; } SegmentTimer.Settings.TimingMethod = Settings.TimingMethod; InternalComponent.Settings.TimingMethod = Settings.TimingMethod; SegmentTimer.Update(null, state, width, height, mode); InternalComponent.Update(null, state, width, height, mode); var icon = state.CurrentSplitIndex >= 0 ? state.Run[state.CurrentSplitIndex + lastSplitOffset].Icon : null; Cache.Restart(); Cache["SplitIcon"] = icon; if (Cache.HasChanged) { if (icon == null) FrameCount = 0; else FrameCount = icon.GetFrameCount(new FrameDimension(icon.FrameDimensionsList[0])); } Cache["SplitName"] = SplitName.Text; Cache["LabelSegment"] = LabelSegment.Text; Cache["LabelBest"] = LabelBest.Text; Cache["SegmentTime"] = SegmentTime.Text; Cache["BestSegmentTime"] = BestSegmentTime.Text; Cache["SegmentTimerText"] = SegmentTimer.BigTextLabel.Text + SegmentTimer.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); } }
private void GetValues(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode) { if (!GetKTANE()) { return; } if (Model != null && Model.CurrentState != null) { ReadData(); foreach (LogLine line in logLines) { if (Model.CurrentState.CurrentPhase != TimerPhase.Running && line.Message.Equals("[BombGenerator] Generator settings: Time: 300, NumStrikes: 3, FrontFaceOnly: True\r3 Pools:\r[Wires] Count: 1\r[BigButton] Count: 1\r[Keypad] Count: 1")) { Model.Start(); continue; } if (currentSplit <= 0 || currentSplit >= 33 || Model.CurrentState.CurrentPhase != TimerPhase.Running || line.Time < DateTime.Now - Model.CurrentState.CurrentTime.RealTime.Value) { continue; } if (line.Message.IndexOf("[Bomb] A winner is you!!") >= 0) { if (Model.CurrentState.Run.Count < 8) { switch (currentSplit) { case 1: case 5: case 12: case 16: case 22: case 26: case 32: Model.Split(); break; default: currentSplit++; break; } } else { Model.Split(); } endOfBomb = line.Time; } else if (line.Message.IndexOf("[BombGenerator] Generator settings: Time: ") >= 0) { int index = line.Message.IndexOf("Time: ") + 6; bestTime = decimal.Parse(line.Message.Substring(index, line.Message.IndexOf(",", index) - index)); } else if (line.Message.IndexOf("[BombGenerator] Generating Widgets") >= 0) { startOfBomb = line.Time; endOfBomb = DateTime.MinValue; XDocument x = XDocument.Load(BestTimes); var xmlList = x.Descendants("dictionary").Elements().ToList(); if (xmlList.Count >= currentSplit) { foreach (XElement ele in xmlList) { if (ele.Element("key").Element("string").Value == missions[currentSplit - 1]) { bestTimeRTA = decimal.Parse(ele.Element("value").Element("GameRecord").Element("RealTimeElapsed").Value); bestTime -= decimal.Parse(ele.Element("value").Element("GameRecord").Element("TimeElapsed").Value); break; } } } else { bestTimeRTA = 0; } } else if (line.Message.IndexOf("[Bomb] Boom") >= 0) { startOfBomb = DateTime.MinValue; endOfBomb = DateTime.MinValue; } } } //textInfo.InformationName = "Best Time" + (bestTime > 0 ? " (" + TimeSpan.FromSeconds((double)bestTime).ToString(@"m\:") + (bestTime % 60).ToString("00.000") + ")" : ""); textInfo.InformationName = "Best Time"; textInfo.InformationValue = (startOfBomb > DateTime.MinValue ? ((endOfBomb > DateTime.MinValue ? endOfBomb : DateTime.Now) - startOfBomb).TotalSeconds.ToString("0.000") : "0.000") + " / " + bestTimeRTA.ToString("0.000"); textInfo.Update(invalidator, lvstate, width, height, mode); if (invalidator != null) { invalidator.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Calculate(state); Cache.Restart(); Cache["FinalSplit"] = FinalSplit.ToString(); Cache["IsBestSegment"] = IsBestSegment; Cache["DeltasCount"] = Deltas.Count; for (var ind = 0; ind < Deltas.Count; ind++) { Cache["Deltas" + ind] = Deltas[ind] == null ? "null" : Deltas[ind].ToString(); } if (invalidator != null && Cache.HasChanged) { invalidator.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { invalidator.Invalidate(0, 0, width, height); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Cache.Restart(); Cache["SingleLine"] = Settings.SingleLine; Cache["GameName"] = state.Run.GameName; Cache["CategoryName"] = state.Run.CategoryName; Cache["LayoutMode"] = mode; if (Cache.HasChanged) { if (Settings.SingleLine) { var text = string.Format("{0} - {1}", state.Run.GameName, state.Run.CategoryName); GameNameLabel.Text = text; GameNameLabel.AlternateText = mode == LayoutMode.Vertical ? text.GetAbbreviations().ToList() : new List<string>(); CategoryNameLabel.Text = ""; } else { GameNameLabel.Text = state.Run.GameName; GameNameLabel.AlternateText = mode == LayoutMode.Vertical ? state.Run.GameName.GetAbbreviations().ToList() : new List<string>(); CategoryNameLabel.Text = state.Run.CategoryName; } } Cache.Restart(); Cache["AttemptHistoryCount"] = state.Run.AttemptHistory.Count; Cache["Run"] = state.Run; if (Cache.HasChanged) FinishedRunsCount = state.Run.AttemptHistory.Where(x => x.Time.RealTime != null).Count(); if (Settings.ShowAttemptCount && Settings.ShowFinishedRunsCount) AttemptCountLabel.Text = string.Format("{0}/{1}", FinishedRunsCount, state.Run.AttemptCount); else if (Settings.ShowAttemptCount) AttemptCountLabel.Text = state.Run.AttemptCount.ToString(); else if (Settings.ShowFinishedRunsCount) AttemptCountLabel.Text = FinishedRunsCount.ToString(); Cache.Restart(); Cache["GameIcon"] = state.Run.GameIcon; if (Cache.HasChanged) { if (state.Run.GameIcon == null) FrameCount = 0; else FrameCount = state.Run.GameIcon.GetFrameCount(new FrameDimension(state.Run.GameIcon.FrameDimensionsList[0])); } Cache["GameNameLabel"] = GameNameLabel.Text; Cache["CategoryNameLabel"] = CategoryNameLabel.Text; Cache["AttemptCountLabel"] = AttemptCountLabel.Text; if (invalidator != null && Cache.HasChanged || FrameCount > 1) { invalidator.Invalidate(0, 0, width, height); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Cache.Restart(); Cache["LockToBottom"] = LockToBottom; if (invalidator != null && Cache.HasChanged) invalidator.Invalidate(0, 0, width, height); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { Cache.Restart(); Cache["NameText"] = InformationName; Cache["ValueText"] = InformationValue; Cache["NameColor"] = NameLabel.ForeColor.ToArgb(); Cache["ValueColor"] = ValueLabel.ForeColor.ToArgb(); Cache["DisplayTwoRows"] = DisplayTwoRows; if (invalidator != null && Cache.HasChanged) { invalidator.Invalidate(0, 0, width, height); } }
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) { 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 lvstate, float width, float height, LayoutMode mode) { if (Model == null) { Model = new TimerModel() { CurrentState = lvstate }; Model.InitializeGameTime(); Model.CurrentState.IsGameTimePaused = true; lvstate.OnReset += OnReset; lvstate.OnPause += OnPause; lvstate.OnResume += OnResume; lvstate.OnStart += OnStart; lvstate.OnSplit += OnSplit; lvstate.OnUndoSplit += OnUndoSplit; lvstate.OnSkipSplit += OnSkipSplit; } GetValues(); }
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); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (invalidator != null) InternalComponent.Update(invalidator, state, width, height, mode); }
protected void InvalidateVerticalComponent(int index, LiveSplitState state, IInvalidator invalidator, float width, float height, float scaleFactor) { var component = VisibleComponents.ElementAt(index); var topPadding = Math.Min(GetPaddingAbove(index), component.PaddingTop) / 2f; var bottomPadding = Math.Min(GetPaddingBelow(index), component.PaddingBottom) / 2f; var totalHeight = scaleFactor * (component.VerticalHeight - topPadding - bottomPadding); component.Update(invalidator, state, width, totalHeight, LayoutMode.Vertical); invalidator.Transform.Translate(0.0f, totalHeight); }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { }
protected void InvalidateHorizontalComponent(int index, LiveSplitState state, IInvalidator invalidator, float width, float height, float scaleFactor) { var component = VisibleComponents.ElementAt(index); var leftPadding = Math.Min(GetPaddingToLeft(index), component.PaddingLeft) / 2f; var rightPadding = Math.Min(GetPaddingToRight(index), component.PaddingRight) / 2f; var totalWidth = scaleFactor * (component.HorizontalWidth - leftPadding - rightPadding); component.Update(invalidator, state, totalWidth, height, LayoutMode.Horizontal); invalidator.Transform.Translate(totalWidth, 0.0f); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { var oldTransform = invalidator.Transform.Clone(); var scaleFactor = mode == LayoutMode.Vertical ? height / OverallHeight : width / OverallWidth; for (var ind = 0; ind < VisibleComponents.Count(); ind++) { var component = VisibleComponents.ElementAt(ind); if (mode == LayoutMode.Vertical) InvalidateVerticalComponent(ind, state, invalidator, width, height, scaleFactor); else InvalidateHorizontalComponent(ind, state, invalidator, width, height, scaleFactor); } invalidator.Transform = oldTransform; }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (state.CurrentPhase == TimerPhase.Paused && TimeStamp.Now - PauseTime > TimeSpan.FromSeconds(Settings.PauseLength)) { Model.Pause(); } }