public SourceSplitComponent(LiveSplitState state, bool isLayoutComponent)
        {
#if DEBUG
            // make Debug.WriteLine prepend update count and tick count
            Debug.Listeners.Clear();
            Debug.Listeners.Add(TimedTraceListener.Instance);
            Trace.Listeners.Clear();
            Trace.Listeners.Add(TimedTraceListener.Instance);
#endif

            this.IsLayoutComponent = isLayoutComponent;

            this.Settings = new SourceSplitSettings();

            AltTimingComponent = new InternalComponent(Settings.ShowGameTime.Value, new InfoTextComponent("Game Time", ""));
            TickCountComponent = new InternalComponent(Settings.ShowTickCount.Value, new InfoTextComponent("Tick Count", ""));

            _componentRenderer.Components.AddRange(new InternalComponent[]
            {
                AltTimingComponent,
                TickCountComponent
            });

            this.ContextMenuControls = new Dictionary <String, Action>();
            this.ContextMenuControls.Add("SourceSplit: Map Times", () => MapTimesForm.Instance.Show());

            _cache = new GraphicsCache();

            _timer = new TimerModel {
                CurrentState = state
            };

            state.OnUndoSplit += state_OnUndoSplit;
            state.OnSplit     += state_OnSplit;
            state.OnReset     += state_OnReset;
            state.OnStart     += state_OnStart;

            _splitOperations.Clear();

            _intervalPerTick             = 0.015f; // will update these when attached to game
            _gameRecommendedTimingMethod = GameTimingMethod.EngineTicksWithPauses;

            _gameMemory = new GameMemory(this.Settings);
            _gameMemory.OnSetTickRate         += gameMemory_OnSetTickRate;
            _gameMemory.OnSetTimingMethod     += gameMemory_OnSetTimingMethod;
            _gameMemory.OnSessionTimeUpdate   += gameMemory_OnSessionTimeUpdate;
            _gameMemory.OnPlayerGainedControl += gameMemory_OnPlayerGainedControl;
            _gameMemory.OnPlayerLostControl   += gameMemory_OnPlayerLostControl;
            _gameMemory.ManualSplit           += gameMemory_ManualSplit;
            _gameMemory.OnMapChanged          += gameMemory_OnMapChanged;
            _gameMemory.OnSessionStarted      += gameMemory_OnSessionStarted;
            _gameMemory.OnSessionEnded        += gameMemory_OnSessionEnded;
            _gameMemory.OnNewGameStarted      += gameMemory_OnNewGameStarted;
            _gameMemory.OnMiscTime            += gameMemory_OnMiscTime;
            _gameMemory.StartReading();
        }
Пример #2
0
        public SourceSplitComponent(LiveSplitState state, bool isLayoutComponent)
        {
#if DEBUG
            // make Debug.WriteLine prepend update count and tick count
            Debug.Listeners.Clear();
            Debug.Listeners.Add(TimedTraceListener.Instance);
            Trace.Listeners.Clear();
            Trace.Listeners.Add(TimedTraceListener.Instance);
#endif

            this.IsLayoutComponent = isLayoutComponent;

            this.Settings          = new SourceSplitSettings();
            this.InternalComponent = new InfoTimeComponent("Game Time", null, new RegularTimeFormatter(TimeAccuracy.Hundredths));

            this.ContextMenuControls = new Dictionary <String, Action>();
            this.ContextMenuControls.Add("SourceSplit: Map Times", () => MapTimesForm.Instance.Show());

            _cache = new GraphicsCache();

            _timer = new TimerModel {
                CurrentState = state
            };

            state.OnSplit += state_OnSplit;
            state.OnReset += state_OnReset;
            state.OnStart += state_OnStart;

            _mapsVisited = new List <string>();

            _intervalPerTick             = 0.015f; // will update these when attached to game
            _gameRecommendedTimingMethod = GameTimingMethod.EngineTicks;

            _gameMemory = new GameMemory(this.Settings);
            _gameMemory.OnSetTickRate         += gameMemory_OnSetTickRate;
            _gameMemory.OnSetTimingMethod     += gameMemory_OnSetTimingMethod;
            _gameMemory.OnSessionTimeUpdate   += gameMemory_OnSessionTimeUpdate;
            _gameMemory.OnPlayerGainedControl += gameMemory_OnPlayerGainedControl;
            _gameMemory.OnPlayerLostControl   += gameMemory_OnPlayerLostControl;
            _gameMemory.OnMapChanged          += gameMemory_OnMapChanged;
            _gameMemory.OnSessionStarted      += gameMemory_OnSessionStarted;
            _gameMemory.OnSessionEnded        += gameMemory_OnSessionEnded;
            _gameMemory.OnNewGameStarted      += gameMemory_OnNewGameStarted;
            _gameMemory.OnGamePaused          += gameMemory_OnGamePaused;
            _gameMemory.StartReading();
        }
Пример #3
0
 void gameMemory_OnSetTimingMethod(object sender, SetTimingMethodEventArgs e)
 {
     _gameRecommendedTimingMethod = e.GameTimingMethod;
 }
Пример #4
0
 public SetTimingMethodEventArgs(GameTimingMethod gameTimingMethod)
 {
     this.GameTimingMethod = gameTimingMethod;
 }
Пример #5
0
 public void SendSetTimingMethodEvent(GameTimingMethod gameTimingMethod)
 {
     _uiThread.Post(d => {
         this.OnSetTimingMethod?.Invoke(this, new SetTimingMethodEventArgs(gameTimingMethod));
     }, null);
 }