예제 #1
0
        public DetailForm(ReplayFile replayFile, RequestManager requestManager, ExeManager exeManager, ReplayPlayer replayPlayer, Scribe scribe)
        {
            _replayFile     = replayFile;
            _requestManager = requestManager;
            _exeManager     = exeManager;
            _replayPlayer   = replayPlayer;
            _logger         = scribe;

            InitializeComponent();

            // Load split button menu for game executables
            LeagueExecutable[] listOfExecs = _exeManager.GetExecutables();

            // No items? Don't load the menu
            if (listOfExecs.Count() > 0)
            {
                var execMenu = new ContextMenuStrip
                {
                    ShowCheckMargin = false,
                    ShowImageMargin = false,
                };

                execMenu.ItemClicked += new ToolStripItemClickedEventHandler(GeneralStartReplayMenuItem_Click);

                foreach (var item in listOfExecs)
                {
                    execMenu.Items.Add(item.Name);
                }

                this.GeneralPlayReplaySplitButton.Menu = execMenu;
            }
        }
예제 #2
0
        // public string LatestDataDragonVersion { get; private set; }

        public MainWindowViewModel(FileManager files, RequestManager requests, SettingsManager settingsManager, ReplayPlayer player, RiZhi log)
        {
            SettingsManager = settingsManager ?? throw new ArgumentNullException(nameof(settingsManager));
            _fileManager    = files ?? throw new ArgumentNullException(nameof(files));
            _log            = log ?? throw new ArgumentNullException(nameof(log));
            _player         = player ?? throw new ArgumentNullException(nameof(player));

            RequestManager = requests ?? throw new ArgumentNullException(nameof(requests));

            KnownPlayers = SettingsManager.Settings.KnownPlayers;

            PreviewReplays = new ObservableCollection <ReplayPreview>();
            FileResults    = new Dictionary <string, FileResult>();

            SortParameters = new QueryProperties
            {
                SearchTerm = String.Empty,
                SortMethod = SortMethod.DateDesc
            };

            StatusBarModel = new StatusBar();

            // By default we do not want to delete our cache
            ClearItemsCacheOnClose  = false;
            ClearChampsCacheOnClose = false;
            ClearReplayCacheOnClose = false;
        }
예제 #3
0
        private void CreateCommonObjects()
        {
            // Create common objects
            var assemblyName = Assembly.GetEntryAssembly()?.GetName();

            _log = new RiZhi()
            {
                FilePrefix      = "ReplayBookLog",
                AssemblyName    = assemblyName.Name,
                AssemblyVersion = assemblyName.Version.ToString(2)
            };

            try
            {
                _settingsManager = new SettingsManager(_log);
                _files           = new FileManager(_settingsManager.Settings, _log);
                _requests        = new RequestManager(_settingsManager.Settings, _log);
                _player          = new ReplayPlayer(_files, _settingsManager, _log);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                _log.WriteLog();
                throw;
            }
        }
예제 #4
0
        public MainWindow(RiZhi log, SettingsManager settingsManager, RequestManager requests, FileManager files, ReplayPlayer player)
        {
            InitializeComponent();

            _log             = log;
            _settingsManager = settingsManager;
            _requests        = requests;
            _files           = files;
            _player          = player;

            _lastSelection = null;

            Dispatcher.UnhandledException += (object sender, DispatcherUnhandledExceptionEventArgs e) =>
            {
                _log.Error(e.Exception.ToString());
                _log.WriteLog();
            };

            var context = new MainWindowViewModel(_files, _requests, _settingsManager, _player, _log);

            this.DataContext = context;

            // Decide to show welcome window
            context.ShowWelcomeWindow();
            context.ShowMissingReplayFoldersMessageBox();
        }
예제 #5
0
        public void ReplayShouldntQueueSameCommandMultipleTimes()
        {
            var commands = NSubstitute.Substitute.For <Commands> ();
            var replay   = NSubstitute.Substitute.For <Replay> ();

            ReplayPlayer replayPlayer = new ReplayPlayer(replay, commands);

            replay.When(r => r.GetStoredCommands(5, Arg.Any <List <Command> >())).Do(args => {
                List <Command> list = args.ArgAt <List <Command> >(1);
                list.Add(new CommandBase()
                {
                    ProcessFrame = 13,
                });
            });

            replayPlayer.Replay(5);

            commands.Received().AddCommand(Arg.Is <Command>(c => c.ProcessFrame == 13));

            replay.When(r => r.GetStoredCommands(10, Arg.Any <List <Command> >())).Do(args => {
            });

            commands.ClearReceivedCalls();

            replayPlayer.Replay(10);

            commands.DidNotReceive().AddCommand(Arg.Any <Command> ());
        }
예제 #6
0
 void Start()
 {
     //benim değiştirmem
     replayPlayer = FindObjectOfType <ReplayPlayer>();
     replayPlayer.Add(this);
     frames   = new List <Frame>();
     maxFrame = replayPlayer.maxFrame;
 }
예제 #7
0
        public void OnReplayPlayStarted(ReplayPlayer replayPlayer)
        {
            Debug.Log("OnReplayPlayStarted");
            _replayPlayer = replayPlayer;
            status.SetActive(true);
            statusIconRecord.gameObject.SetActive(false);
            statusIconPlay.gameObject.SetActive(true);
            statusIconPause.gameObject.SetActive(false);
            timeLinePanel.SetActive(true);
            camBackground.SetActive(true);
            statusText.text       = "Playing Replay...";
            playBtn.interactable  = false;
            pauseBtn.interactable = true;
            stopBtn.gameObject.SetActive(false);
            recordBtn.gameObject.SetActive(false);
            backBtn.interactable    = true;
            forwardBtn.interactable = true;

            foreach (var timeline in _replayTimelineUis)
            {
                Destroy(timeline.gameObject);
            }

            _replayTimelineUis.Clear();

            for (var i = 0; i < _replayPlayer.ReplayMetaHeader.TimelineCount; i++)
            {
                _replayTimelineUis.Add(Instantiate(timeLine, timeLinePanel.transform).GetComponent <ReplayTimelineUI>());
                _replayTimelineUis[_replayTimelineUis.Count - 1].toggle.group      = timeLinePanel.GetComponent <ToggleGroup>();
                _replayTimelineUis[_replayTimelineUis.Count - 1].timelineText.text =
                    $"{0} sec / {GetCorrectedTimeValueString(_replayPlayer.Timelines[i].ReplayLength)} sec";
                _replayTimelineUis[_replayTimelineUis.Count - 1].timelineSlider.interactable = false;
            }

            var id = _replayPlayer.CurrentReplayTimeline.TimelineIndex;

            _replayTimelineUis[id].timelineSlider.onValueChanged.AddListener(delegate { TimelineCallback(); });
            _replayTimelineUis[id].toggle.isOn = true;
            _replayTimelineUis[id].timelineSlider.interactable = true;
            fileStatus.text = $"Playing Replay with Compressionmethod: {_replayPlayer.CurrentReplayTimeline.deltaMode}";

            for (var i = 0; i < _replayPlayer.ReplayMetaHeader.TimelineCount; i++)
            {
                var newId = i;
                _replayTimelineUis[i].toggle.onValueChanged.AddListener((on) => {
                    if (on)
                    {
                        _replayTimelineUis[id].timelineSlider.onValueChanged.RemoveAllListeners();
                        _replayTimelineUis[id].timelineSlider.interactable = false;
                        _replayPlayer.Pause();
                        _replayPlayer.CurrentReplayTimeline = _replayPlayer.Timelines[newId];
                        _replayTimelineUis[newId].timelineSlider.interactable = true;
                        _replayTimelineUis[newId].timelineSlider.onValueChanged.AddListener(delegate { TimelineCallback(); });
                    }
                });
            }
        }
        private void OnReplayPlayStarted(ReplayPlayer player)
        {
            var cameras = GameObject.FindGameObjectsWithTag("ReplayCamera");

            foreach (var cam in cameras)
            {
                _cameras.Add(cam.GetComponent <Camera>());
            }
            SetNextActiveCamera();
        }
예제 #9
0
        private void GameSceneLoaded()
        {
            ReplayPlayer replayPlayer = GameObject.FindObjectOfType <ReplayPlayer>();

            IsPlayingReplay = (replayPlayer != null) ? replayPlayer.playbackEnabled : false;

            if (IsEnabled)
            {
                SetupCamera();
            }
        }
예제 #10
0
        void OnReplayPlayStarted(ReplayPlayer _replayPlayer)
        {
            foreach (var scriptToDisable in scriptsToDisable)
            {
                scriptToDisable.enabled = false;
            }

            foreach (var scriptToEnable in scriptsToEnable)
            {
                scriptToEnable.enabled = true;
            }
        }
예제 #11
0
 void Start()
 {
     if (player == null)
     {
         player = FindObjectOfType <ReplayPlayer>();
     }
     if (player)
     {
         player.Add(this);
         maxLength = player.maxLength;
         frames    = new List <Frame>();
     }
 }
예제 #12
0
    // Start is called before the first frame update
    void Start()
    {
        player = GetComponentInParent <ReplayPlayer>();
        var players = player.GetComponentsInChildren <ReplayCharacter>();

        foreach (var player in players)
        {
            if (player == this)
            {
                continue;
            }
            opponent = player;
        }
    }
예제 #13
0
        private static void StartReplay(string replayPath, ExeManager exeManager, ReplayPlayer replayPlayer, string execName = "default")
        {
            LeagueExecutable exec = null;

            // Get default exec or specified exec
            if (execName.Equals("default"))
            {
                // Start update form with default
                var result = new UpdateSplashForm(exeManager).ShowDialog();

                if (result == DialogResult.OK)
                {
                    exec = exeManager.GetDefaultExecutable();
                }
                else
                {
                    // Failed to get exec, stop
                    MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                // Start update form with target
                var result = new UpdateSplashForm(exeManager, execName).ShowDialog();

                if (result == DialogResult.OK)
                {
                    exec = exeManager.GetExecutable(execName);
                }
                else
                {
                    // Failed to get exec, stop
                    MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (exec == null)
            {
                MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            replayPlayer.Play(exec, replayPath);
        }
예제 #14
0
        // Token: 0x0600049D RID: 1181 RVA: 0x00017A18 File Offset: 0x00015C18
        public void run()
        {
            osu = new OsuManager();
            getOsu();
            DependencyContainer.Cache <OsuManager>(osu);
            aimAssist    = new AimAssist();
            relax        = new Relax();
            replayPlayer = new ReplayPlayer();
            gui          = new GUI(this);
            user         = new User("", "");
            gui.Text     = "OsuBuddyCrack - " + this.user.getUsername();
            gui.updateLoginGui(this.user.getUsername(), this.user.getSubscriptionExpirationDate());
            Thread thread = new Thread((ThreadStart) delegate
            {
                gui.ShowDialog(null);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            StartTasks();
        }
예제 #15
0
        public ReplayController(GameFixedUpdate gameFixedUpdate, ChecksumProvider checksumProvider, ReplayView recorderView, Commands commands, Replay replay)
        {
            _recording = true;

            _checksumProvider = checksumProvider;

            _replay = replay;

//			_replay = new ReplayBase (checksumProvider);

            _gameFixedUpdate = gameFixedUpdate;
            _recorderView    = recorderView;
            _commands        = commands;

            if (_recorderView != null)
            {
                _recorderView.SetReplay(this);
            }

            _replayRecorder = new ReplayRecorder(_replay, _commands);
            _replayPlayer   = new ReplayPlayer(_replay, _commands);
        }
예제 #16
0
        public void PlayReplay(ReplayPreview preview)
        {
            _log.Information($"Playing replay...");

            if (preview == null)
            {
                throw new ArgumentNullException(nameof(preview));
            }

            var replay = FileResults[preview.Location];

            var executables = SettingsManager.Executables.GetExecutablesByPatch(preview.GameVersion);

            if (!executables.Any())
            {
                _log.Information($"No executables found to play replay");

                // No executable found that can be used to play
                MessageBox.Show
                (
                    Application.Current.TryFindResource("ExecutableNotFoundErrorText") as String + " " + preview.GameVersion,
                    Application.Current.TryFindResource("ExecutableNotFoundErrorTitle") as String,
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                );
                return;
            }

            LeagueExecutable target;

            if (executables.Count > 1)
            {
                _log.Information($"More than one possible executable, asking user...");
                // More than one?????
                target = ShowChooseReplayDialog(executables);
                if (target == null)
                {
                    return;
                }
            }
            else
            {
                target = executables.First();
            }

            if (SettingsManager.Settings.PlayConfirmation)
            {
                _log.Information($"Asking user for confirmation");
                // Show confirmation dialog
                var msgResult = MessageBox.Show
                                (
                    Application.Current.TryFindResource("ReplayPlayConfirmationText") as String,
                    Application.Current.TryFindResource("ReplayPlayConfirmationText") as String,
                    MessageBoxButton.OKCancel,
                    MessageBoxImage.Question
                                );

                if (msgResult != MessageBoxResult.OK)
                {
                    return;
                }
            }

            _log.Information($"Using {target.Name} to play replay {replay.FileInfo.Path}");
            ReplayPlayer.Play(target, replay.FileInfo.Path);
        }
예제 #17
0
        [STAThread] // This is required for system dialogs
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Scribe logger = new Scribe();

            //*/
            try
            {
                ExeManager exeManager = null;
                try
                {
                    exeManager = new ExeManager();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ROFLPlayer was not able to find League of Legends. Please add it now.", "First time setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    logger.Info(_className, $"First time setup kicked off by exception:\n{ex.ToString()}");
                    // Start add exec form
                    var addForm    = new ExecAddForm(new ExeTools());
                    var formResult = addForm.ShowDialog();

                    // If form exited with ok
                    if (formResult == DialogResult.OK)
                    {
                        // Get new exec
                        LeagueExecutable newExec = addForm.NewLeagueExec;
                        newExec.IsDefault = true;

                        // Save execinfo file
                        exeManager = new ExeManager(newExec);
                        exeManager.Save();
                    }
                    else
                    {
                        // Exit if form exited any other way
                        Environment.Exit(1);
                    }

                    addForm.Dispose();
                }

                ReplayPlayer replayPlayer = new ReplayPlayer(exeManager);

                if (args.Length == 0)
                {
                    // Update default exec
                    Application.Run(new UpdateSplashForm(exeManager));
                    Application.Run(new SettingsForm(exeManager));
                }
                else
                {
                    // StartupMode, 1  = show detailed information, 0 = launch replay immediately
                    if (RoflSettings.Default.StartupMode == 0)
                    {
                        StartReplay(args[0], exeManager, replayPlayer);
                    }
                    else
                    {
                        var replayFile = Task.Run(() => SetupReplayFileAsync(args[0]));

                        replayFile.Wait();

                        RequestManager requestManager = new RequestManager();

                        Application.Run(new DetailForm(replayFile.Result, requestManager, exeManager, replayPlayer, logger));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"ROFLPlayer encountered an unhandled exception, please record this message and report it here https://github.com/andrew1421lee/ROFL-Player/issues" + "\n\n" + ex.ToString(), "Critical Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Error(_className, "Unhandled exception: " + ex.ToString());
                Environment.Exit(1);
            }
            //*/
        }