コード例 #1
0
        public UnrealLoadsComponent(LiveSplitState state, ITimerModel timer, IGameMemory gameMemory, IUnrealLoadsSettings settings)
        {
            bool debug = false;

#if DEBUG
            debug = true;
#endif
            Trace.WriteLine("[NoLoads] Using LiveSplit.UnrealLoads component version " + Assembly.GetExecutingAssembly().GetName().Version + " " + ((debug) ? "Debug" : "Release") + " build");

            _state        = state;
            _timer        = timer;
            _splitHistory = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            Settings      = settings;

            _state.OnStart += _state_OnStart;

            _gameMemory                = gameMemory;
            _gameMemory.OnReset       += gameMemory_OnReset;
            _gameMemory.OnStart       += gameMemory_OnStart;
            _gameMemory.OnSplit       += _gameMemory_OnSplit;
            _gameMemory.OnLoadStarted += gameMemory_OnLoadStarted;
            _gameMemory.OnLoadEnded   += gameMemory_OnLoadEnded;
            _gameMemory.OnMapChange   += _gameMemory_OnMapChange;

            _gameMemory.StartMonitoring();
        }
コード例 #2
0
        public UnrealLoadsComponentTests()
        {
            _fixture = new Fixture().Customize(new AutoNSubstituteCustomization()
            {
                ConfigureMembers = true
            });

            _settings            = _fixture.Create <IUnrealLoadsSettings>();
            _settings.DbgShowMap = false;
            _settings.AutoReset
                    = _settings.AutoStart
                    = _settings.AutoSplitOncePerMap
                    = _settings.AutoSplitOnMapChange = true;

            _state      = new LiveSplitState(null, null, null, null, null);
            _gameMemory = Substitute.For <IGameMemory>();
            _timer      = Substitute.For <ITimerModel>();

            _sut = new UnrealLoadsComponent(_state, _timer, _gameMemory, _settings);
        }