public Trigger(OsuRTDataProviderPlugin ortdp_plugin) { OrtdpPlugin = ortdp_plugin; ortdp_plugin.ListenerManager.OnComboChanged += OnComboChanged; ortdp_plugin.ListenerManager.OnStatusChanged += OnStatusChanged; }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent @event) { ortdp = (OsuRTDataProviderPlugin)getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider"); ortdp.ListenerManager.OnStatusChanged += ListenerManager_OnStatusChanged; ortdp.ListenerManager.OnBeatmapChanged += ListenerManager_OnBeatmapChanged; Task.Run(CheckProcess); }
private void InitListener(OsuRTDataProviderPlugin pl) { GameMode = new GmMode(OsuPlayMode.Unknown, OsuPlayMode.Unknown); GameStatus = new GMStatus(OsuListenerManager.OsuStatus.Unkonwn, OsuListenerManager.OsuStatus.Unkonwn); HitChanged(); _p = pl; _listenerManager = _p.ListenerManager; _listenerManager.OnCountGekiChanged += ListenerManagerOnCountGekiChanged; _listenerManager.OnCount300Changed += ListenerManagerOnCount300Changed; _listenerManager.OnCountKatuChanged += ListenerManagerOnCountKatuChanged; _listenerManager.OnCount100Changed += ListenerManagerOnCount100Changed; _listenerManager.OnCount50Changed += ListenerManagerOnCount50Changed; _listenerManager.OnCountMissChanged += ListenerManagerOnCountMissChanged; _listenerManager.OnComboChanged += ListenerManagerOnComboChanged; _listenerManager.OnScoreChanged += ListenerManagerOnScoreChanged; _listenerManager.OnPlayingTimeChanged += ListenerManagerOnPlayingTimeChanged; _listenerManager.OnHealthPointChanged += ListenerManagerOnHealthPointChanged; _listenerManager.OnAccuracyChanged += ListenerManagerOnAccuracyChanged; _listenerManager.OnBeatmapChanged += ListenerManagerOnBeatmapChanged; _listenerManager.OnModsChanged += ListenerManagerOnModsChanged; _listenerManager.OnPlayModeChanged += ListenerManagerOnPlayModeChanged; _listenerManager.OnStatusChanged += ListenerManagerOnStatusChanged; _listenerManager.OnHitEventsChanged += ListenerManagerOnHitEventsChanged; _listenerManager.OnPlayerChanged += ListenerManagerOnPlayerChanged; }
public ExtraApis(Plugin ortdp, Plugin rtppd) { _ortdp = ortdp as OsuRTDataProviderPlugin; _rtppd = rtppd as RealTimePPDisplayerPlugin; _ortdp.ListenerManager.OnPlayModeChanged += (l, c) => _mode = c; _ortdp.ListenerManager.OnModsChanged += (c) => _mods = (uint)c.Mod; _ortdp.ListenerManager.OnBeatmapChanged += (b) => _beatmap = b; }
/// <summary> /// Plugin Init /// </summary> public override void OnEnable() { _configManager = new PluginConfigurationManager(this); _configManager.AddItem(new SettingIni()); _ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin; var gui = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); if (gui != null) { GuiRegisterHelper.RegisterFormatEditorWindow(gui); } if (_ortdp == null) { IO.CurrentIO.WriteColor("No found OsuRTDataProvider!", ConsoleColor.Red); return; } int size = TourneyMode ? _ortdp.TourneyListenerManagersCount : 1; for (int i = 0; i < size; i++) { var manager = _ortdp.ListenerManager; if (TourneyMode) { manager = _ortdp.TourneyListenerManagers[i]; } _osuPpControls[i] = new DisplayerController(manager); } _fixedInterval = TimeSpan.FromSeconds(1.0 / Setting.FPS); _fixedUpdateThread = Task.Run(() => { while (!_stopFixedUpdate) { lock (_allDisplayerMtx) { foreach (var d in _allDisplayers) { d.Value.FixedDisplay(_fixedInterval.TotalSeconds); } } Thread.Sleep(_fixedInterval); } }); RegisterDisplayer("wpf", id => new WpfDisplayer(id)); RegisterDisplayer("mmf", id => new MmfDisplayer(id)); RegisterDisplayer("mmf-split", id => new MmfDisplayer(id, true)); RegisterDisplayer("text", id => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()))); RegisterDisplayer("text-split", id => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()), true)); RegisterDisplayer("console", id => new ConsoleDisplayer()); IO.CurrentIO.WriteColor(PLUGIN_NAME + " By " + PLUGIN_AUTHOR, ConsoleColor.DarkCyan); }
/// <summary> /// 使用<see cref="OsuRTDataProvider.OsuRTDataProviderPlugin" />辅助构建ORTDP类 /// </summary> public OrtdpWrapper(OsuRTDataProviderPlugin ortdp) { _beatmapDb = new OsuBeatmapDb(); Beatmap = new Beatmap(); InitListener(ortdp); Application.ThreadException += Application_ThreadException; var format = LocalizationInfo.Current.Translations["LANG_INFO_STH_INITED"]; OutputHelper.Output(string.Format(format, "ORTDP")); Application.ThreadException += Application_ThreadException; }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { OrtdpPlugin = e.Host.EnumPluings().OfType <OsuRTDataProviderPlugin>().FirstOrDefault(); if (OrtdpPlugin == null) { throw new Exception("MyLovely2dWifePlugin must require OsuRTDataProviderPlugin but there isnt exist."); } //default show window ShowWindow(); }
/// <summary> /// Plugin Init /// </summary> public override void OnEnable() { m_config_manager = new PluginConfigurationManager(this); m_config_manager.AddItem(new SettingIni()); m_memory_reader = getHoster().EnumPluings().Where(p => p.Name == "OsuRTDataProvider").FirstOrDefault() as OsuRTDataProviderPlugin; if (m_memory_reader == null) { Sync.Tools.IO.CurrentIO.WriteColor("No found OsuRTDataProvider!", ConsoleColor.Red); return; } int size = TourneyMode ? m_memory_reader.TourneyListenerManagersCount : 1; for (int i = 0; i < size; i++) { var manager = m_memory_reader.ListenerManager; int?id = null; if (TourneyMode) { id = i; manager = m_memory_reader.TourneyListenerManagers[i]; } m_osu_pp_controls[i] = new PPControl(manager, id); } m_fixed_interval = TimeSpan.FromSeconds(1.0 / Setting.FPS); m_fixed_update_thread = Task.Run(() => { while (!m_stop_fixed_update) { lock (m_all_displayer_mtx) { foreach (var d in m_all_displayers) { d.Value.FixedDisplay(m_fixed_interval.TotalSeconds); } } Thread.Sleep(m_fixed_interval); } }); RegisterDisplayer("wpf", (id) => new WpfDisplayer(id)); RegisterDisplayer("mmf", (id) => new MmfDisplayer(id)); RegisterDisplayer("text", (id) => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()))); Sync.Tools.IO.CurrentIO.WriteColor(PLUGIN_NAME + " By " + PLUGIN_AUTHOR, ConsoleColor.DarkCyan); }
/// <summary> /// 使用<see cref="OsuRTDataProvider.OsuRTDataProviderPlugin" />及 /// <see cref="RealTimePPDisplayer.RealTimePPDisplayerPlugin" />辅助构建ORTDP类 /// </summary> public OrtdpWrapper(OsuRTDataProviderPlugin ortdp, RealTimePPDisplayerPlugin rtppd, RtppdInfo d) { _beatmapDb = new OsuBeatmapDb(); Beatmap = new Beatmap(); _arp = rtppd ?? new RealTimePPDisplayerPlugin(); _rtppi = d ?? new RtppdInfo(); _arp.RegisterDisplayer("osuToolsDisplayer", id => _rtppi = _rtppi ?? new RtppdInfo()); InitListener(ortdp); var format = LocalizationInfo.Current.Translations["LANG_INFO_STH_INITED"]; OutputHelper.Output(string.Format(format, "ORTDP")); Application.ThreadException += Application_ThreadException; }
private void OnPluginLoadComplete(PluginEvents.LoadCompleteEvent e) { ortdp_plugin = (from plugin in e.Host.EnumPluings() where plugin is OsuRTDataProviderPlugin select plugin as OsuRTDataProviderPlugin).FirstOrDefault(); if (ortdp_plugin == null) { logger.LogInfomation($"找不到ORTDP插件,请输入命令\"plugins install provider\"并重启Sync"); return; } source_wrapper = ortdp_plugin.ModsChangedAtListening ? new SourcesWrapper.ORTDP.RealtimeDataProviderModsWrapper(ortdp_plugin, this) : new SourcesWrapper.ORTDP.OsuRTDataProviderWrapper(ortdp_plugin, this); source_wrapper.OnTrigEvent += Source_wrapper_OnTrigEvent; source_wrapper.Attach(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (OrtdpPlugin == null) { OrtdpPlugin = new OsuRTDataProviderPlugin(); } var o = new StoryboardGroup(this.MainCanvas); var s = new StoryboardCanvasHost(this.BgCanvas); LayerList.AddRange(new LayerBase[] { //new BackgroundLayer(o) , new BackgroundLayer2(s) }); StartListen(); }
static void listener_init() { OsuRTDataProviderPlugin p = new OsuRTDataProviderPlugin(); p.OnEnable(); lm = p.ListenerManager; lm.OnStatusChanged += listener_OnStatusChanged; lm.OnCount300Changed += listener_OnCount300Changed; lm.OnCountGekiChanged += listener_OnCountGekiChanged; lm.OnCount100Changed += listener_OnCount100Changed; lm.OnCountKatuChanged += listener_OnCountKatuChanged; lm.OnCount50Changed += listener_OnCount50Changed; lm.OnCountMissChanged += listener_OnCountMissChanged; lm.OnComboChanged += listener_OnComboChanged; lm.OnAccuracyChanged += listener_OnAccuracyChanged; lm.OnPlayingTimeChanged += listener_OnPlayingTimeChanged; lm.OnBeatmapChanged += listener_OnBeatmapChanged; lm.OnPlayModeChanged += listener_OnPlayModeChanged; lm.Start(); }
private void FirstInit(PluginEvents.LoadCompleteEvent evt) { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(this); OsuRTDataProviderPlugin ortdp_plugin = (from plugin in evt.Host.EnumPluings() where plugin is OsuRTDataProviderPlugin select plugin).First() as OsuRTDataProviderPlugin; if (ortdp_plugin == null) { Utils.Output("未找到ortdp插件,初始化失败", ConsoleColor.Red); return; } ortdp_plugin.ListenerManager.OnPlayingTimeChanged += OnCurrentPlayTimeChanged; ortdp_plugin.ListenerManager.OnBeatmapChanged += map => current_beatmap = map; ortdp_plugin.ListenerManager.OnStatusChanged += (old, now) => { if (now == OsuRTDataProvider.Listen.OsuListenerManager.OsuStatus.Playing) { OnPlay(); } else { OnClean(); } }; Init(); if (lyrics_provider == null) { Utils.Output("初始化失败,请确认配置是否正确", ConsoleColor.Red); } else { Utils.Output("初始化成功", ConsoleColor.Green); } }
private void OnPluginLoaded(PluginEvents.LoadCompleteEvent @event) { //Get ORTDP&RTPP plugin ortdp_plugin = @event.Host.EnumPluings().OfType <OsuRTDataProviderPlugin>().FirstOrDefault(); rtpp_plugin = @event.Host.EnumPluings().OfType <RealTimePPDisplayerPlugin>().FirstOrDefault(); if (ortdp_plugin == null) { logger.LogError("Plugin ORTDP is not found and can't able to collect/upload play data. please install ORTDP plugin. just type 'plugins install provider' and restart Sync."); return; } if (rtpp_plugin == null) { logger.LogError("Plugin RTPP is not found and can't able to collect/upload play data. please install RTPP plugin. just type 'plugins install displayer' and restart Sync."); return; } //bind events. ortdp_plugin.ListenerManager.OnStatusChanged += ListenerManager_OnStatusChanged; ortdp_plugin.ListenerManager.OnBeatmapChanged += ListenerManager_OnBeatmapChanged; ortdp_plugin.ListenerManager.OnPlayerChanged += ListenerManager_OnPlayerChanged; ortdp_plugin.ListenerManager.OnErrorStatisticsChanged += ListenerManager_OnErrorStatisticsChanged; //add a shadow display for getting data easy from rtpp plugin. var shadow_displayer_name = "cute_bunny"; Func <int?, DisplayerBase> displayer_creator = new Func <int?, DisplayerBase>(id => displayer); rtpp_plugin.RegisterDisplayer(shadow_displayer_name, displayer_creator); var add_displayer_method = typeof(RealTimePPDisplayerPlugin).GetMethod("AddDisplayer", BindingFlags.NonPublic | BindingFlags.Instance); add_displayer_method.Invoke(rtpp_plugin, new object[] { shadow_displayer_name }); logger.LogInfomation("Plugin is ready."); }
public RealtimeDataProviderModsWrapper(OsuRTDataProviderPlugin ref_plugin, OsuLiveStatusPanelPlugin plugin) : base(ref_plugin, plugin) { }
public RealtimeDataProviderModsWrapper(OsuRTDataProviderPlugin ref_plugin, DifficultParamModifyPlugin plugin) : base(ref_plugin, plugin) { }
public OrtdpApis(Plugin plugin) { ortdp = plugin as OsuRTDataProviderPlugin; }
public BackgroundLayer2(StoryboardCanvasHost group) : base(group) { _ortdpPlugin = MainWindow.OrtdpPlugin; Logger.LogInfo("background2 layer"); }
public OrtdpController(OsuRTDataProviderPlugin ortdpPlugin) { _ortdpPlugin = ortdpPlugin; }
public OsuRTDataProviderWrapper(OsuRTDataProviderPlugin ref_plugin, OsuLiveStatusPanelPlugin plugin) : base(ref_plugin, plugin) { }