public BgDxLayer(D2D.RenderTarget renderTarget, DxLoadObject settings, OsuModel osuModel) : base(renderTarget, settings, osuModel) { _status = OsuModel.Status; string defName = "default.png"; string covName = "cover.png"; var defBgPath = Path.Combine(OsuLivePlayerPlugin.GeneralConfig.WorkPath, defName); var covBgPath = Path.Combine(OsuLivePlayerPlugin.GeneralConfig.WorkPath, covName); if (File.Exists(defBgPath)) { _defaultBg = renderTarget.LoadBitmap(defBgPath); } else { LogUtil.LogError($"Can not find \"{defName}\""); } if (File.Exists(covBgPath)) { _coverBg = renderTarget.LoadBitmap(covBgPath); } else { LogUtil.LogError($"Can not find \"{covName}\""); } var size = Settings.Render.WindowSize; _windowRect = new Mathe.RawRectangleF(0, 0, size.Width, size.Height); }
private void ListenerManagerOnStatusChanged(OsuListenerManager.OsuStatus lastStatus, OsuListenerManager.OsuStatus status) { GameStatus.CurrentStatus = (OsuGameStatus)status; GameStatus.LastStatus = (OsuGameStatus)lastStatus; if (status == OsuListenerManager.OsuStatus.SelectSong || status == OsuListenerManager.OsuStatus.Rank) { RetryCount = 0; } while (status != OsuListenerManager.OsuStatus.Rank && status != OsuListenerManager.OsuStatus.Playing) { if (Count300 != 0 || CountGeki != 0 || CountKatu != 0 || Count100 != 0 || Count50 != 0 || CountMiss != 0 || Score != 0 || _acc != 0) { Setzero(); } else { break; } if (!(Beatmap is null)) { if (!string.IsNullOrEmpty(NowPlaying)) { NowPlaying = $"{Beatmap.Artist} - {Beatmap.Title} [{Beatmap.Difficulty}]"; } } } }
static void listener_OnStatusChanged( OsuListenerManager.OsuStatus from, OsuListenerManager.OsuStatus to) { update_display(); if (exporter != null && from == OsuListenerManager.OsuStatus.Playing) { exporter.Close(); exporter = null; } if (exportnext && to == OsuListenerManager.OsuStatus.Playing) { exportnext = false; FileStream fs = new FileStream(exportfile + ".ope", FileMode.Create); exporter = new BinaryWriter(fs); form.ResetExport(); } Console.WriteLine("status changed {0} -> {1}", from, to); }
public SongInfoDxLayer(D2D.RenderTarget renderTarget, DxLoadObject settings, OsuModel osuModel) : base(renderTarget, settings, osuModel) { FileInfo eastInfo = new FileInfo(Path.Combine(OsuLivePlayerPlugin.GeneralConfig.WorkPath, "df-gokubutokaisho-w12.ttc")); FileInfo westInfo = new FileInfo(Path.Combine(OsuLivePlayerPlugin.GeneralConfig.WorkPath, "MOD20.ttf")); if (!eastInfo.Exists) { _easternF = new Gdip.FontFamily("等线"); } else { PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile(eastInfo.FullName); _easternF = pfc.Families[0]; LogUtil.LogInfo($"Eastern family was {(_easternF != null ? "ok" : "not found")}"); } if (!westInfo.Exists) { _westernF = new Gdip.FontFamily("等线"); } else { PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile(westInfo.FullName); _westernF = pfc.Families[0]; LogUtil.LogInfo($"Western family was {(_westernF != null ? "ok" : "not found")}"); } _eTFont = new Gdip.Font(_easternF, 25); _wTFont = new Gdip.Font(_westernF, 25); _eAFont = new Gdip.Font(_easternF, 20); _wAFont = new Gdip.Font(_westernF, 20); _wBrush = new Gdip.SolidBrush(Gdip.Color.White); _eBrush = new Gdip.SolidBrush(Gdip.Color.White); _status = OsuModel.Status; }
public void OnStatusChanged(OsuListenerManager.OsuStatus lastStatus, OsuListenerManager.OsuStatus status) { LastStatus = lastStatus; Status = status; }
/// <summary> /// 使用两个<see cref="OsuRTDataProvider.Listen.OsuListenerManager.OsuStatus" />构造一个GMStatus /// </summary> /// <param name="last"></param> /// <param name="now"></param> public GMStatus(OsuListenerManager.OsuStatus last, OsuListenerManager.OsuStatus now) { LastStatus = (OsuGameStatus)last; CurrentStatus = (OsuGameStatus)now; }
public override void OnEnable() { if (getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") is OsuRTDataProviderPlugin ortdp && getHoster().EnumPluings().FirstOrDefault(p => p.Name == "RealTimePPDisplayer") is RealTimePPDisplayerPlugin rtppd) { ortdp.ListenerManager.OnBeatmapChanged += (beatmap) => _beatmap = beatmap; ortdp.ListenerManager.OnStatusChanged += (last, cur) => _status = cur; ortdp.ListenerManager.OnStatusChanged += (last, cur) => { if (cur != OsuListenerManager.OsuStatus.Rank) { using (var mmf = MemoryMappedFile.CreateOrOpen("replay-pp", 2048)) { var buf = new byte[] { 0 }; mmf.CreateViewStream().Write(buf, 0, 1); } } if (cur != OsuListenerManager.OsuStatus.NoFoundProcess || cur != OsuListenerManager.OsuStatus.Unkonwn) { if (_watcher == null) { string replayDirectory = Path.GetDirectoryName(Process.GetProcessesByName("osu!").FirstOrDefault()?.MainModule.FileName); replayDirectory = Path.Combine(replayDirectory, "Replays"); _watcher = new FileSystemWatcher(replayDirectory); _watcher.NotifyFilter = NotifyFilters.LastWrite; _watcher.EnableRaisingEvents = true; _watcher.Changed += (s, e) => { _watcher.EnableRaisingEvents = false; Task.Run(() => { Thread.Sleep(500); _watcher.EnableRaisingEvents = true; }); if (_status == OsuListenerManager.OsuStatus.Rank) { var replay = new ReplayParser(e.FullPath); var cal = GetCalculator(replay.Mode); cal.Beatmap = new BeatmapReader(_beatmap, (int)replay.Mode); cal.Count300 = replay.Count300; cal.Count100 = replay.Count100; cal.Count50 = replay.Count50; cal.CountGeki = replay.CountGeki; cal.CountKatu = replay.CountKatu; cal.CountMiss = replay.CountMiss; cal.Score = replay.Score; cal.MaxCombo = replay.MaxCombo; cal.Mods = replay.Mods; cal.Time = int.MaxValue; var ppTuple = cal.GetPerformance(); using (var mmf = MemoryMappedFile.CreateOrOpen("replay-pp", 2048)) { using (var sw = new StreamWriter(mmf.CreateViewStream())) { var ppStr = _displayer.FormatPp(ppTuple); sw.Write(ppStr); } } var beatmap = cal.Beatmap.OrtdpBeatmap; var mods = cal.Mods; string songs = $"{beatmap.Artist} - {beatmap.Title}[{beatmap.Difficulty}]"; string acc = $"{cal.Accuracy:F2}%"; ModsInfo m = new ModsInfo(); m.Mod = (ModsInfo.Mods)mods; string modsStr = $"{(m != ModsInfo.Mods.None ? "+" + m.ShortName : "")}"; string pp = $"{cal.GetPerformance().RealTimePP:F2}pp"; string msg = $"[Replay]{songs} {modsStr} | {acc} => {pp} ({replay.Mode})"; Sync.Tools.IO.CurrentIO.WriteColor(msg, ConsoleColor.Blue); } }; } } }; } }
private void ListenerManager_OnStatusChanged(OsuListenerManager.OsuStatus last_status, OsuListenerManager.OsuStatus status) { // apply Half-Time/Double-Time modifier when osu! in playing state App.SetCurrentState(status); }