protected override void Execute(List <GameEntity> entities) { foreach (var entity in entities) { switch (entity.newGameStatus.Value) { case EnmGameStatus.Running: if (_contexts.game.hasLogicSystem && _contexts.game.hasLastTick) { var logicSys = _contexts.game.logicSystem.Value; var recordEntities = _recordGroup.GetEntities(); ReplayUtil.Replay(_contexts, logicSys, _contexts.game.lastTick.Value, recordEntities); } break; case EnmGameStatus.Pause: _contexts.game.ReplaceLastTick(_contexts.game.tick.Value); break; } _contexts.game.ReplaceGameStatus(entity.newGameStatus.Value); entity.isDestroyed = true; } }
public Replay(Window window, ReplayUtil replayUtil)//构造 { InitializeComponent(); replayView = new ReplayView(this, replayUtil, new VideoUtil(mediaPlayer)); this.DataContext = replayView; this.Owner = window; }
public static Replay CreateReplay(Window window, ReplayUtil replayUtil) { if (singleReplay == null) { singleReplay = new Replay(window, replayUtil); } return(singleReplay); }
public ReplayView(Window window, ReplayUtil replayUtil, VideoUtil videoUtil) { this.videoUtil = videoUtil; this.VideoPath = replayUtil.ReplayPath; GetFile(); this.SearchCommand = new DelegateCommand(Search); this.SearchAllCommand = new DelegateCommand(SearchAll); timer = new Timer();//时间函数 timer.Interval = 50; timer.Elapsed += new ElapsedEventHandler(Time_Elapsed); timer.Start(); PlayImage = "Image/Play.png"; }
protected override void Execute(List <GameEntity> entities) { if (!_contexts.game.hasLogicSystem) { DebugUtil.LogErrorFormat("Replay System error: there is no logic system"); return; } var logicSys = _contexts.game.logicSystem.Value; var recordEntities = _recordGroup.GetEntities(); foreach (var entity in entities) { ReplayUtil.Replay(_contexts, logicSys, entity.replay.ToTick, recordEntities); entity.isDestroyed = true; } }