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
        public SourceSplitComponent(LiveSplitState state, bool isLayoutComponent)
        {
            // make Debug.WriteLine prepend update count and tick count
            while (Debug.Listeners.Count > 0)
            {
                Debug.Listeners.RemoveAt(0);
            }
            Debug.Listeners.Add(TimedTraceListener.Instance);
            while (Trace.Listeners.Count > 0)
            {
                Trace.Listeners.RemoveAt(0);
            }
            Trace.Listeners.Add(TimedTraceListener.Instance); // is it okay to use the same instance?
            //Debug.AutoFlush = Trace.AutoFlush = true;

            _state = state;
            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>();

            _gameMemory = new GameMemory(this.Settings);
            _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.StartReading();
        }
예제 #4
0
        public SourceSplitComponent(LiveSplitState state, bool isLayoutComponent)
        {
            // make Debug.WriteLine prepend update count and tick count
            while (Debug.Listeners.Count > 0)
                Debug.Listeners.RemoveAt(0);
            Debug.Listeners.Add(TimedTraceListener.Instance);
            while (Trace.Listeners.Count > 0)
                Trace.Listeners.RemoveAt(0);
            Trace.Listeners.Add(TimedTraceListener.Instance); // is it okay to use the same instance?
            //Debug.AutoFlush = Trace.AutoFlush = true;

            _state = state;
            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>();

            _gameMemory = new GameMemory(this.Settings);
            _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.StartReading();
        }
예제 #5
0
        public SourceSplitComponent(LiveSplitState state)
        {
            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", () => {
                if (_mapTimesForm.Visible)
                {
                    _mapTimesForm.Hide();
                }
                else
                {
                    _mapTimesForm.Show();
                }
            });

            _cache = new GraphicsCache();

            _timer = new TimerModel {
                CurrentState = state
            };
            state.OnSplit += state_OnSplit;
            state.OnReset += state_OnReset;
            state.OnStart += state_OnStart;
            _state         = state;

            _mapTimes     = new List <MapTime>();
            _mapsVisited  = new List <string>();
            _mapTimesForm = new MapTimesForm();

            _gameMemory = new GameMemory(this.Settings);
            _gameMemory.OnSignOnStateChange += gameMemory_OnSignOnStateChange;
            _gameMemory.OnGameTimeUpdate    += gameMemory_OnGameTimeUpdate;
            _gameMemory.StartReading();
        }