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
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterLogic"/> class.
 /// </summary>
 /// <param name="ball">Ball Model Interface.</param>
 /// <param name="character">Character  Model Interface.</param>
 /// <param name="score">Score Model Interface.</param>
 /// <param name="timer">Timer Model Interface.</param>
 public CharacterLogic(IBallModel ball, ICharacterModel character, IScoreModel score, ITimerModel timer)
 {
     this.ball      = ball;
     this.character = character;
     this.score     = score;
     this.timer     = timer;
 }
        public MainWindowViewModel(IScheduler scheduler, ITimerModel model)
        {
            _scheduler = scheduler;
            _model     = model;

            _disposables.Add(_model.CurrentDateTime
                             .Select(dt => dt.ToString("yyyy-MM-dd HH:mm:ss"))
                             .ObserveOn(_scheduler)
                             .Subscribe(x => DateInfo = x));
        }
Пример #4
0
        public RacetimeChannel(LiveSplitState state, ITimerModel model)
        {
            reconnect_cts = new CancellationTokenSource();

            Model = model;

            state.OnSplit     += State_OnSplit;
            state.OnUndoSplit += State_OnUndoSplit;
            state.OnReset     += State_OnReset;
            model.OnPause     += Model_OnPause;
        }
Пример #5
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit      += (s, e) => OnSplit?.Invoke(this, e);
     model.OnSkipSplit  += (s, e) => OnSkipSplit?.Invoke(this, e);
     model.OnUndoSplit  += (s, e) => OnUndoSplit?.Invoke(this, e);
     model.OnStart      += (s, e) => OnStart?.Invoke(this, e);
     model.OnReset      += (s, e) => OnReset?.Invoke(this, e);
     model.OnPause      += (s, e) => OnPause?.Invoke(this, e);
     model.OnResume     += (s, e) => OnResume?.Invoke(this, e);
     model.OnScrollUp   += (s, e) => OnScrollUp?.Invoke(this, e);
     model.OnScrollDown += (s, e) => OnScrollDown?.Invoke(this, e);
     model.OnSwitchComparisonPrevious += (s, e) => OnSwitchComparisonPrevious?.Invoke(this, e);
     model.OnSwitchComparisonNext     += (s, e) => OnSwitchComparisonNext?.Invoke(this, e);
 }
Пример #6
0
 public SpeedRunsLiveIRC(LiveSplitState state, ITimerModel model, IEnumerable<string> channels)
 {
     ChannelsToJoin = channels.ToList();
     Client = new IrcClient();
     Client.ConnectFailed += Client_ConnectFailed;
     Client.Connected += Client_Connected;
     Client.Registered += Client_Registered;
     Client.RawMessageReceived += Client_RawMessageReceived;
     Client.ConnectFailed += Client_ConnectFailed;
     Client.Disconnected += Client_Disconnected;
     Model = model;
     state.OnSplit += Model_OnSplit;
     state.OnUndoSplit += Model_OnUndoSplit;
     state.OnReset += Model_OnReset;
     RaceState = RaceState.NotInRace;
 }
Пример #7
0
 public SpeedRunsLiveIRC(LiveSplitState state, ITimerModel model, IEnumerable <string> channels)
 {
     ChannelsToJoin             = channels.ToList();
     Client                     = new IrcClient();
     Client.ConnectFailed      += Client_ConnectFailed;
     Client.Connected          += Client_Connected;
     Client.Registered         += Client_Registered;
     Client.RawMessageReceived += Client_RawMessageReceived;
     Client.ConnectFailed      += Client_ConnectFailed;
     Client.Disconnected       += Client_Disconnected;
     Model              = model;
     state.OnSplit     += Model_OnSplit;
     state.OnUndoSplit += Model_OnUndoSplit;
     state.OnReset     += Model_OnReset;
     RaceState          = RaceState.NotInRace;
 }
Пример #8
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);
        }
Пример #9
0
 public SpeedRunsLiveForm(LiveSplitState state, ITimerModel model, string gameName, string gameID, string gameCategory)
 {
     GameId                        = gameID;
     GameCategory                  = gameCategory;
     SRLClient                     = new SpeedRunsLiveIRC(state, model, new[] { "#speedrunslive" });
     SRLClient.GameName            = gameName;
     SRLClient.ChannelJoined      += SRLClient_ChannelJoined;
     SRLClient.RawMessageReceived += SRLClient_RawMessageReceived;
     SRLClient.MessageReceived    += SRLClient_MessageReceived;
     SRLClient.StateChanged       += SRLClient_StateChanged;
     SRLClient.UserListRefreshed  += SRLClient_UserListRefreshed;
     SRLClient.GoalChanged        += SRLClient_GoalChanged;
     SRLClient.PasswordIncorrect  += SRLClient_PasswordIncorrect;
     SRLClient.NicknameInUse      += SRLClient_NicknameInUse;
     SRLClient.Disconnected       += SRLClient_Disconnected;
     SRLClient.Kicked             += SRLClient_Kicked;
     InitializeComponent();
     SRLClient_StateChanged(null, RaceState.NotInRace);
     btnJoinQuit.Enabled = false;
     FormIsClosing       = false;
 }
Пример #10
0
        // Update the script
        public void Update(LiveSplitState state, DeltaOutput d)
        {
            if (Timer == null)
            {
                Timer = new TimerModel()
                {
                    CurrentState = state
                };
                PreviousPhase      = state.CurrentPhase;
                Timer.OnUndoSplit += Timer_OnUndoSplit;
            }

            if (!InitCompleted)
            {
                DoInit(state, d);
            }
            else
            {
                DoUpdate(state, d);
            }
            ScriptUpdateFinished?.Invoke(this, d);
        }
Пример #11
0
 public SpeedRunsLiveForm(LiveSplitState state, ITimerModel model, string raceId)
 {
     DownloadAllEmotes();
     RaceId = raceId;
     GameCategory = null;
     var raceChannel = string.Format("#srl-{0}", raceId);
     var liveSplitChannel = string.Format("{0}-livesplit", raceChannel);
     SRLClient = new SpeedRunsLiveIRC(state, model, new[] { "#speedrunslive", raceChannel, liveSplitChannel });
     SRLClient.ChannelJoined += SRLClient_ChannelJoined;
     SRLClient.RawMessageReceived += SRLClient_RawMessageReceived;
     SRLClient.MessageReceived += SRLClient_MessageReceived;
     SRLClient.StateChanged += SRLClient_StateChanged;
     SRLClient.UserListRefreshed += SRLClient_UserListRefreshed;
     SRLClient.GoalChanged += SRLClient_GoalChanged;
     SRLClient.PasswordIncorrect += SRLClient_PasswordIncorrect;
     SRLClient.NicknameInUse += SRLClient_NicknameInUse;
     SRLClient.Disconnected += SRLClient_Disconnected;
     SRLClient.Kicked += SRLClient_Kicked;
     InitializeComponent();
     SRLClient_StateChanged(null, RaceState.NotInRace);
     btnJoinQuit.Enabled = false;
     FormIsClosing = false;
 }
Пример #12
0
 public SpeedRunsLiveForm(LiveSplitState state, ITimerModel model, string raceId)
 {
     DownloadAllEmotes();
     RaceId = raceId;
     GameCategory = null;
     var raceChannel = string.Format("#srl-{0}", raceId);
     var liveSplitChannel = string.Format("{0}-livesplit", raceChannel);
     SRLClient = new SpeedRunsLiveIRC(state, model, new[] { "#speedrunslive", raceChannel, liveSplitChannel });
     SRLClient.ChannelJoined += SRLClient_ChannelJoined;
     SRLClient.RawMessageReceived += SRLClient_RawMessageReceived;
     SRLClient.MessageReceived += SRLClient_MessageReceived;
     SRLClient.StateChanged += SRLClient_StateChanged;
     SRLClient.UserListRefreshed += SRLClient_UserListRefreshed;
     SRLClient.GoalChanged += SRLClient_GoalChanged;
     SRLClient.PasswordIncorrect += SRLClient_PasswordIncorrect;
     SRLClient.NicknameInUse += SRLClient_NicknameInUse;
     SRLClient.Disconnected += SRLClient_Disconnected;
     SRLClient.Kicked += SRLClient_Kicked;
     InitializeComponent();
     SRLClient_StateChanged(null, RaceState.NotInRace);
     btnJoinQuit.Enabled = false;
     FormIsClosing = false;
 }
 public LoadRemoverSplitter(ITimerModel timer, ComponentSettings settings)
 {
     this.settings = settings;
     this.timer    = timer;
     timer.CurrentState.OnStart += HandleResetRuns;
 }
Пример #14
0
 public DoubleTapPrevention(ITimerModel model)
 {
     InternalModel = model;
 }
Пример #15
0
 public DoubleTapPrevention(ITimerModel model)
 {
     InternalModel = model;
     LastEvent     = TimeStamp.Now - LongDelay;
 }
Пример #16
0
 public void Join(ITimerModel model, string id)
 {
     var channel = new RacetimeChannel(model.CurrentState, model);
     var form    = new ChannelForm(channel, id, model.CurrentState.LayoutSettings.AlwaysOnTop);
 }
Пример #17
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit += (s, e) =>
     {
         if (OnSplit != null)
             OnSplit(this, e);
     };
     model.OnSkipSplit += (s, e) =>
     {
         if (OnSkipSplit != null)
             OnSkipSplit(this, e);
     };
     model.OnUndoSplit += (s, e) =>
     {
         if (OnUndoSplit != null)
             OnUndoSplit(this, e);
     };
     model.OnStart += (s, e) =>
     {
         if (OnStart != null)
             OnStart(this, e);
     };
     model.OnReset += (s, e) =>
     {
         if (OnReset != null)
             OnReset(this, e);
     };
     model.OnPause += (s, e) =>
     {
         if (OnPause != null)
             OnPause(this, e);
     };
     model.OnResume += (s, e) =>
     {
         if (OnResume != null)
             OnResume(this, e);
     };
     model.OnScrollUp += (s, e) =>
     {
         if (OnScrollUp != null)
             OnScrollUp(this, e);
     };
     model.OnScrollDown += (s, e) =>
     {
         if (OnScrollDown != null)
             OnScrollDown(this, e);
     };
     model.OnSwitchComparisonPrevious += (s, e) =>
     {
         if (OnSwitchComparisonPrevious != null)
             OnSwitchComparisonPrevious(this, e);
     };
     model.OnSwitchComparisonNext += (s, e) =>
     {
         if (OnSwitchComparisonNext != null)
             OnSwitchComparisonNext(this, e);
     };
 }
Пример #18
0
 public void Create(ITimerModel model)
 {
     Process.Start(GetUri(Properties.Resources.CREATE_RACE_ADDRESS).AbsoluteUri);
 }
Пример #19
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit                    += (s, e) => OnSplit?.Invoke(this, e);
     model.OnSkipSplit                += (s, e) => OnSkipSplit?.Invoke(this, e);
     model.OnUndoSplit                += (s, e) => OnUndoSplit?.Invoke(this, e);
     model.OnStart                    += (s, e) => OnStart?.Invoke(this, e);
     model.OnReset                    += (s, e) => OnReset?.Invoke(this, e);
     model.OnPause                    += (s, e) => OnPause?.Invoke(this, e);
     model.OnResume                   += (s, e) => OnResume?.Invoke(this, e);
     model.OnScrollUp                 += (s, e) => OnScrollUp?.Invoke(this, e);
     model.OnScrollDown               += (s, e) => OnScrollDown?.Invoke(this, e);
     model.OnSwitchComparisonPrevious += (s, e) => OnSwitchComparisonPrevious?.Invoke(this, e);
     model.OnSwitchComparisonNext     += (s, e) => OnSwitchComparisonNext?.Invoke(this, e);
 }
Пример #20
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit += (s, e) =>
     {
         if (OnSplit != null)
         {
             OnSplit(this, e);
         }
     };
     model.OnSkipSplit += (s, e) =>
     {
         if (OnSkipSplit != null)
         {
             OnSkipSplit(this, e);
         }
     };
     model.OnUndoSplit += (s, e) =>
     {
         if (OnUndoSplit != null)
         {
             OnUndoSplit(this, e);
         }
     };
     model.OnStart += (s, e) =>
     {
         if (OnStart != null)
         {
             OnStart(this, e);
         }
     };
     model.OnReset += (s, e) =>
     {
         if (OnReset != null)
         {
             OnReset(this, e);
         }
     };
     model.OnPause += (s, e) =>
     {
         if (OnPause != null)
         {
             OnPause(this, e);
         }
     };
     model.OnResume += (s, e) =>
     {
         if (OnResume != null)
         {
             OnResume(this, e);
         }
     };
     model.OnScrollUp += (s, e) =>
     {
         if (OnScrollUp != null)
         {
             OnScrollUp(this, e);
         }
     };
     model.OnScrollDown += (s, e) =>
     {
         if (OnScrollDown != null)
         {
             OnScrollDown(this, e);
         }
     };
     model.OnSwitchComparisonPrevious += (s, e) =>
     {
         if (OnSwitchComparisonPrevious != null)
         {
             OnSwitchComparisonPrevious(this, e);
         }
     };
     model.OnSwitchComparisonNext += (s, e) =>
     {
         if (OnSwitchComparisonNext != null)
         {
             OnSwitchComparisonNext(this, e);
         }
     };
 }
 public RaceProviderAPI Create(ITimerModel model)
 {
     return(RacetimeAPI.Instance);
 }
Пример #22
0
 public SpeedRunsLiveForm(LiveSplitState state, ITimerModel model, string gameName, string gameID, string gameCategory)
 {
     DownloadAllEmotes();
     GameId = gameID;
     GameCategory = gameCategory;
     SRLClient = new SpeedRunsLiveIRC(state, model, new[] { "#speedrunslive" });
     SRLClient.GameName = gameName;
     SRLClient.ChannelJoined += SRLClient_ChannelJoined;
     SRLClient.RawMessageReceived += SRLClient_RawMessageReceived;
     SRLClient.MessageReceived += SRLClient_MessageReceived;
     SRLClient.StateChanged += SRLClient_StateChanged;
     SRLClient.UserListRefreshed += SRLClient_UserListRefreshed;
     SRLClient.GoalChanged += SRLClient_GoalChanged;
     SRLClient.PasswordIncorrect += SRLClient_PasswordIncorrect;
     SRLClient.NicknameInUse += SRLClient_NicknameInUse;
     SRLClient.Disconnected += SRLClient_Disconnected;
     SRLClient.Kicked += SRLClient_Kicked;
     InitializeComponent();
     SRLClient_StateChanged(null, RaceState.NotInRace);
     btnJoinQuit.Enabled = false;
     FormIsClosing = false;
 }
Пример #23
0
 public DoubleTapPrevention(ITimerModel model)
 {
     InternalModel = model;
 }
Пример #24
0
 public RaceProviderAPI Create(ITimerModel model, RaceProviderSettings settings)
 {
     return(SpeedRunsLiveAPI.Instance);
 }