Skip to content

Commit

Permalink
Fix can't download ortdp
Browse files Browse the repository at this point in the history
  • Loading branch information
KedamaOvO committed Oct 21, 2019
1 parent 619aa23 commit df9ba8d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
1 change: 1 addition & 0 deletions RealTimePPDisplayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<Compile Include="Displayer\View\PPWindow.xaml.cs">
<DependentUpon>PPWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Warpper\OsuRTDataProviderWarpper.cs" />
<Compile Include="Warpper\PublicOsuBotTransferWarpper.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
30 changes: 7 additions & 23 deletions RealTimePPDisplayerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using System.Threading.Tasks;
using Sync.Plugins;
using Sync.Tools;
using OsuRTDataProvider;
using RealTimePPDisplayer.Displayer;
using RealTimePPDisplayer.Gui;
using RealTimePPDisplayer.MultiOutput;
using RealTimePPDisplayer.Formatter;
using RealTimePPDisplayer.Warpper;

namespace RealTimePPDisplayer
{
Expand All @@ -19,9 +19,9 @@ public class RealTimePPDisplayerPlugin : Plugin
{
public const string PLUGIN_NAME = "RealTimePPDisplayer";
public const string PLUGIN_AUTHOR = "KedamaOvO";
public const string VERSION= "1.8.6";
public const string VERSION= "1.8.7";

private readonly List<DisplayerController> _osuDisplayerControls = new List<DisplayerController>(16);
private List<DisplayerController> _osuDisplayerControls = new List<DisplayerController>(16);

private PluginConfigurationManager _configManager;

Expand Down Expand Up @@ -73,33 +73,17 @@ public override void OnEnable()
_configManager = new PluginConfigurationManager(this);
_configManager.AddItem(new SettingIni());

var ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin;
var ortdp = new OsuRTDataProviderWarpper(getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider"),ref _osuDisplayerControls);
var gui = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI");

TourneyMode = ortdp.TourneyMode;
TourneyWindowCount = ortdp.TourneyWindowCount;

if (gui != null)
{
GuiRegisterHelper.RegisterFormatEditorWindow(gui);
}

//Create DisplayerController per osu instance
TourneyWindowCount = ortdp.TourneyListenerManagersCount;
int size = 1;
if (TourneyWindowCount != 0)
{
size = TourneyWindowCount;
TourneyMode = true;
}

for (int i = 0; i < size; i++)
{
var manager = ortdp.ListenerManager;
if (TourneyMode)
{
manager = ortdp.TourneyListenerManagers[i];
}
_osuDisplayerControls.Add(new DisplayerController(manager));
}

_fixedInterval = TimeSpan.FromSeconds(1.0 / Setting.FPS);

_fixedUpdateThread = Task.Run(() =>
Expand Down
41 changes: 41 additions & 0 deletions Warpper/OsuRTDataProviderWarpper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using OsuRTDataProvider;
using Sync.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RealTimePPDisplayer.Warpper
{
class OsuRTDataProviderWarpper
{
public int TourneyWindowCount { get;}
public bool TourneyMode { get;}
public OsuRTDataProviderWarpper(Plugin p,ref List<DisplayerController> _osuDisplayerControls)
{
if(p is OsuRTDataProviderPlugin ortdp)
{
TourneyWindowCount = ortdp.TourneyListenerManagersCount;
int size = 1;
if (TourneyWindowCount != 0)
{
size = TourneyWindowCount;
TourneyMode = true;
}


//Create DisplayerController per osu instance
for (int i = 0; i < size; i++)
{
var manager = ortdp.ListenerManager;
if (TourneyMode)
{
manager = ortdp.TourneyListenerManagers[i];
}
_osuDisplayerControls.Add(new DisplayerController(manager));
}
}
}
}
}

0 comments on commit df9ba8d

Please sign in to comment.