void startMenu_StartVideo(object sender, EventArgs e) { if (Directory.Exists(@".\rep")) { System.Windows.Forms.OpenFileDialog op = new System.Windows.Forms.OpenFileDialog(); op.InitialDirectory = @".\rep\"; op.Title = "请选择一个录像文件"; op.FileName = ""; op.Filter = "录像文件(*.grep)|*.grep"; op.Multiselect = false; if (op.ShowDialog() != System.Windows.Forms.DialogResult.Cancel) { StreamReader reader = new StreamReader(op.FileName); world = new World(0, this, ambientOn, reader.ReadLine());//视频组注意,把World构造函数中的null换为相应记录下的CurrentMap reader.Close(); SaveReplayFlag = false; repController = new ReplayController(world); lableManager = new LabelManager(world); repController.setReplay(op.FileName); GameState.currentGameState = GameState.State.Video; } else { System.Windows.Forms.MessageBox.Show("提示: 没有选择录像文件!"); } } else { System.Windows.Forms.MessageBox.Show("提示: 没有可播放录像文件!"); } }
void startMenu_StartPVA(object sender, EventArgs e) { world = new World(1, this, ambientOn, null); SaveReplayFlag = false; //by 李翔 lableManager = new LabelManager(world); LabelManager.currentLabelState = LabelManager.LabelState.WaitForConnect; repController = new ReplayController(world); if (requestManager != null) { requestManager.clearAll(); } requestManager = new RequestManager(this); Components.Add(requestManager); if (currentServer != null) { currentServer.finalStop(); } currentServer = new AIMessageServer(this, world, requestManager, 1, repController); Components.Add(currentServer); currentServer.start(IP, Port); GameState.currentGameState = GameState.State.PlayerVsAI; }
private void Initialize() { Utils.ConfigureColumns <PlayListObject>(PlayList, hiddenColumns: new [] { "Player" }); _replayController = new ReplayController(ViewerBox, Global.AppSettings.ReplayViewer.RenderingSettings); _replayController.UpdateReplaySettings(); foreach (var resolution in DisplayDevice.Default.AvailableResolutions) { ResolutionBox.Items.Add( $"{resolution.Width}x{resolution.Height}x{resolution.BitsPerPixel}, {resolution.RefreshRate} Hz"); if (resolution.Equals(DisplayDevice.Default.SelectResolution(1, 1, 1, 1))) { ResolutionBox.SelectedIndex = ResolutionBox.Items.Count - 1; } } Size = Global.AppSettings.ReplayViewer.Size; playbackSpeedBar.Value = 0; FollowDriverBox.Checked = Global.AppSettings.ReplayViewer.FollowDriver; followAlsoWhenZooming.Checked = Global.AppSettings.ReplayViewer.FollowAlsoWhenZooming; LoopPlayingBox.Checked = Global.AppSettings.ReplayViewer.LoopPlaying; ShowDriverPathBox.Checked = Global.AppSettings.ReplayViewer.ShowDriverPath; MouseClickZoomBox.Text = Global.AppSettings.ReplayViewer.MouseClickStep.ToString(); MouseWheelZoomBox.Text = Global.AppSettings.ReplayViewer.MouseWheelStep.ToString(); LockedCamBox.Checked = Global.AppSettings.ReplayViewer.LockedCamera; TransparentInactiveBox.Checked = Global.AppSettings.ReplayViewer.DrawTransparentInactive; PictBackGroundBox.Checked = Global.AppSettings.ReplayViewer.PicturesInBackGround; PlayerFramesBox.Checked = Global.AppSettings.ReplayViewer.DrawOnlyPlayerFrames; SelectNoPlayersBox.Checked = Global.AppSettings.ReplayViewer.DontSelectPlayersByDefault; HideStartObjectBox.Checked = Global.AppSettings.ReplayViewer.HideStartObject; multiSpyBox.Checked = Global.AppSettings.ReplayViewer.MultiSpy; WindowState = Global.AppSettings.ReplayViewer.WindowState; UpdateControlColor(ActivePlayerPanel, Global.AppSettings.ReplayViewer.ActivePlayerColor); UpdateControlColor(InActivePlayerPanel, Global.AppSettings.ReplayViewer.InactivePlayerColor); SetupEventHandlers(); }
public MessageManager(AISocket socket, int faction, World world, ReplayController repController) { this.socket = socket; this.faction = faction; this.world = world; this.repController = repController; }
void GetTimeStamp() { if (Game.CurrentGame.ReplayController == null) { return; } byte[] ts = new byte[8]; client.ReplayStream.Read(ts, 0, 8); Int64 last = BitConverter.ToInt64(ts, 0); if (lastTS != 0) { Int64 toSleep = last - lastTS; ReplayController controller = Game.CurrentGame.ReplayController; if (!controller.NoDelays) { if (controller.EvenDelays) { toSleep = ReplayController.EvenReplayBaseSpeedInMs; } if (controller.Speed != 0) { toSleep = (Int64)(((double)toSleep) / controller.Speed); } controller.Lock(); controller.Unlock(); Thread.Sleep((int)toSleep); } } lastTS = last; }
public AIMessageServer(Game mainGame, World world, RequestManager requestManager, int RunNumber, ReplayController repController) : base(mainGame) { this.world = world; this.requestManager = requestManager; this.RunNumber = RunNumber; this.repController = repController; }
public void StartReplay(Stream replayStream) { this.replayStream = replayStream; networkService = new ClientGamer(); networkService.DataStream = new NullOutputStream(replayStream); ReplayController = new Utils.ReplayController(); ReplayController.EvenDelays = true; }
void Start() { gameManager = FindObjectOfType <MyGameManager>(); markersPool = FindObjectOfType <MarkersPool>(); replayController = FindObjectOfType <ReplayController>(); playerMovement = FindObjectOfType <PlayerMovement>(); playerMovement.OnPlayerJump += OnJump; }
private void Awake() { Random.InitState((int)System.DateTime.UtcNow.Second); gameController = FindObjectOfType <GameController>(); replayController = FindObjectOfType <ReplayController>(); rb = GetComponent <Rigidbody>(); audioSource = GetComponent <AudioSource>(); startingPosition = transform.position; }
private void Awake() { gameTimer = FindObjectOfType <Timer>(); replayController = FindObjectOfType <ReplayController>(); replayCameraController = FindObjectOfType <ReplayCameraController>(); frozenGameObjectsVelocities = new Vector3[gameObjectsToFreezeOnPause.Count]; if (enableDebug) { dbgInfo = gameObject.AddComponent <DebugInformation>(); //Only adds the component if the checkbox is true on Inspector. } }
public void Loop() { if (gameMgr.GetReplayControl() != repController) { repController = gameMgr.GetReplayControl(); if (repController != null) { Sender.Send($"ReplayDetail:{ReplayData.Parse(Data.ReplayBattleInfo)}"); } } }
public void ButtonUnchecked(object sender, RoutedEventArgs e) { var s = (sender as ToggleButton); switch (s.Tag) { case "tfui": ReplayController.CloseTeamFightUI(); break; default: break; } s.Background = ReplayControlViewModel.OffBrush; }
void Start() { gameManager = FindObjectOfType <MyGameManager>(); gameManager.OnPlaybackModeOn += OnPlaybackModeOn; gameManager.OnPlayModeOn += OnPlayModeOn; animator = GetComponent <Animator>(); jetpackConfiguration = FindObjectOfType <JetpackConfiguration>(); playerMovement = GetComponent <PlayerMovement>(); playerMovement.OnPlayerJump += OnJump; replayController = GetComponent <ReplayController>(); CurrentJumpState = JumpState.flyDown; }
public void Loop() { if (gameMgr.IsNetworkBattle && gameMgr.IsReplayBattle) { gameMgr.IsAdmin = true; } if (gameMgr.GetReplayControl() != repController) { repController = gameMgr.GetReplayControl(); if (repController != null) { Sender.Send($"ReplayDetail:{ReplayData.Parse(Data.ReplayBattleInfo)}"); } } }
public void Loop() { if (gameMgr.IsNetworkBattle && gameMgr.IsReplayBattle) { gameMgr.IsAdmin = true; } if (gameMgr.GetProperty <ReplayController>("_ReplayControl") != repController) { repController = gameMgr.GetProperty <ReplayController>("_ReplayControl"); if (repController != null) { Sender.Send("ReplayDetail", $"{ReplayData.Parse(Data.ReplayBattleInfo)}"); } } }
void Awake() { commandList = new CommandsList(); // ChecksumRecorder checksumRecorder = new ChecksumRecorder (new GameStateChecksumProvider (_gameStateBuilder, this)); // TODO: set replay.... gameFixedUpdate = new LockstepFixedUpdate(new CommandsListLockstepLogic(commandList, this)); gameFixedUpdate.GameFramesPerLockstep = gameFramesPerLockstep; gameFixedUpdate.FixedStepTime = fixedTimestepMilliseconds / 1000.0f; gameFixedUpdate.SetGameLogic(this); GameFixedUpdateDebug updateDebug = gameObject.AddComponent <GameFixedUpdateDebug> (); updateDebug.SetGameFixedUpdate(gameFixedUpdate); _checksumProvider = new GameStateChecksumProvider(this); ChecksumRecorderDebug checksumRecorderDebug = gameObject.AddComponent <ChecksumRecorderDebug> (); checksumRecorderDebug.checksumRecorder = new ChecksumRecorder(_checksumProvider); _commandSender = new CommandQueueBase(gameFixedUpdate, this); ResetGameState(); _replay = new MyCustomReplay(_checksumProvider, this); _replay.SaveInitialGameState(GetGameState()); _replayController = new ReplayController(gameFixedUpdate, _checksumProvider, recorderView, commandList, _replay); _replayController.GameFramesPerChecksumCheck = gameFramesPerChecksumCheck; StartRecording(); // debug... Application.targetFrameRate = 60; // commandList.AddCommand (new Command () { // CreationFrame = 0, // ProcessFrame = gameFixedUpdate.GetFirstLockstepFrame() // }); }
private void startReplay(string replayFilePath = null) { lock (_syncLockObj) { if (_gameController != null && _gameController is GameController) { ((GameController)_gameController).Dispose(); _gameController = null; } if (replayFilePath == null) { replayFilePath = OpenReplayDialog(); } _gameController = ReplayController.LoadReplay(replayFilePath); _gameController.StartGame(); fillComboBox(_gameController); } skControl1.Invalidate(); changeTimerSpeed(); }
private void Init() { //Start Data Dragon dataDragon = new DataDragon(); dataDragon.FinishedLoading += (sender, args) => { Logging.Info("Data Dragon init finished"); Logging.Verbose("Init champ select controller"); _ = new LeagueBroadcastHub.State.Client.State(); Logging.Verbose("State generated"); clientController = new ClientController(); Logging.Verbose("Init ingame controller"); gameController = new GameController(); Logging.Verbose("Init state controller"); stateController = new StateController(this); Logging.Verbose("Init replay controller"); replayController = new ReplayController(); //Start Frontend Webserver (HTTP/WS) var WebServer = new EmbedIOServer("localhost", 9001); tickTimer = new Timer { Interval = 1000 / tickRate }; tickTimer.Elapsed += DoTick; Logging.Verbose($"Starting LBH with tickrate of {tickRate}tps"); tickTimer.Start(); Logging.Info("Init complete"); PostInit(); }; }
public AISocket(TcpClient client, int faction, World world, RequestManager requestManager, ReplayController repController) { this.requestManager = requestManager; curClient = client; netStream = client.GetStream(); reader = new StreamReader(netStream); writer = new StreamWriter(netStream); this.faction = faction; this.world = world; getAIinfo(); if (AIName == "") { AIName = "Faction" + faction.ToString(); } world.InitShip(faction, new Color(r, g, b), AIName, FactionControllerType.AI); isActive = true; messageManager = new MessageManager(this, faction, world, repController); messageCooldown = 0; messageQueue = new Queue <string>(); }
void Awake() { _replayController = this; ReplaySpeed = 0; PlayRecordButton.interactable = false; }
public void SetReplay(ReplayController replayController) { _replayController = replayController; }
public ReplayControllerViewModel(ReplayController controller) : this() { Controller = controller; }
private void Replay_Executed(object sender, ExecutedRoutedEventArgs e) { e.Handled = true; try { if (ViewModel.IsGameFinished) { ReplayModel.T replayModel = ModelException.TryThrow <ReplayModel.T>(ReplayModel.tryCreate(ViewModel.Model.Board, ViewModel.Model.PlayerSettings)); ReplayController.T controller = ModelException.TryThrow <ReplayController.T>(ReplayController.tryCreate(replayModel)); ReplayWindowViewModel vm = new ReplayWindowViewModel(replayModel); ReplayWindow win = new ReplayWindow(controller, vm); win.Owner = this; win.ShowDialog(); } } catch (Exception exc) { MessageBox.Show(this, "Okno přehrávače nelze otevřít." + Environment.NewLine + ViewModelCommon.ConvertExceptionToShortString(exc), "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); } }