Skip to content

Commit 2858c35

Browse files
committed
Add support for WPF controls in plugins and method parameters in plugin commands
1 parent 8bf7cd2 commit 2858c35

32 files changed

Lines changed: 472 additions & 19 deletions

‎Torch.API/IPluginManager.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
using System;
22
using System.Collections.Generic;
3+
using Torch.API.Plugins;
34
using VRage.Collections;
45
using VRage.Plugins;
56

67
namespace Torch.API
78
{
89
public interface IPluginManager : IEnumerable<ITorchPlugin>
910
{
11+
event Action<List<ITorchPlugin>> PluginsLoaded;
12+
List<ITorchPlugin> Plugins { get; }
1013
void UpdatePlugins();
1114
void Init();
1215
void DisposePlugins();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Text;
66
using System.Threading.Tasks;
77

8-
namespace Torch.API
8+
namespace Torch.API.Plugins
99
{
1010
public interface ITorchPlugin : IDisposable
1111
{

‎Torch.API/Plugins/IWpfPlugin.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows.Controls;
7+
8+
namespace Torch.API.Plugins
9+
{
10+
public interface IWpfPlugin : ITorchPlugin
11+
{
12+
/// <summary>
13+
/// Used by the server's WPF interface to load custom plugin controls.
14+
/// Do not instantiate your plugin control outside of this method! It will throw an exception.
15+
/// </summary>
16+
UserControl GetControl();
17+
}
18+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Threading.Tasks;
66

7-
namespace Torch.API
7+
namespace Torch.API.Plugins
88
{
99
public class PluginAttribute : Attribute
1010
{

‎Torch.API/Torch.API.csproj‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@
114114
<Compile Include="IChatMessage.cs" />
115115
<Compile Include="IMultiplayer.cs" />
116116
<Compile Include="IPluginManager.cs" />
117-
<Compile Include="ITorchPlugin.cs" />
117+
<Compile Include="Plugins\ITorchPlugin.cs" />
118118
<Compile Include="IServerControls.cs" />
119119
<Compile Include="ITorchBase.cs" />
120+
<Compile Include="Plugins\IWpfPlugin.cs" />
120121
<Compile Include="ModAPI\Ingame\GridExtensions.cs" />
121122
<Compile Include="ModAPI\TorchAPI.cs" />
122-
<Compile Include="PluginAttribute.cs" />
123+
<Compile Include="Plugins\PluginAttribute.cs" />
123124
<Compile Include="Properties\AssemblyInfo.cs" />
124125
</ItemGroup>
125126
<ItemGroup>

‎Torch.Client/Properties/AssemblyInfo.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
[assembly: AssemblyCulture("")]
1313
[assembly: ComVisible(false)]
1414

15-
[assembly: AssemblyVersion("1.0.89.507")]
16-
[assembly: AssemblyFileVersion("1.0.89.507")]
15+
[assembly: AssemblyVersion("1.0.89.540")]
16+
[assembly: AssemblyFileVersion("1.0.89.540")]

‎Torch.Server/Torch.Server.csproj‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@
165165
<Compile Include="TorchServiceInstaller.cs">
166166
<SubType>Component</SubType>
167167
</Compile>
168+
<Compile Include="ViewModels\CharacterViewModel.cs" />
168169
<Compile Include="ViewModels\ConfigDedicatedViewModel.cs" />
170+
<Compile Include="ViewModels\EntityTreeViewModel.cs" />
171+
<Compile Include="ViewModels\EntityViewModel.cs" />
172+
<Compile Include="ViewModels\GridViewModel.cs" />
173+
<Compile Include="ViewModels\PluginManagerViewModel.cs" />
174+
<Compile Include="ViewModels\PluginViewModel.cs" />
169175
<Compile Include="ViewModels\SessionSettingsViewModel.cs" />
170176
<Compile Include="Views\AddWorkshopItemsDialog.xaml.cs">
171177
<DependentUpon>AddWorkshopItemsDialog.xaml</DependentUpon>
@@ -179,9 +185,15 @@
179185
<Compile Include="Views\ConfigControl.xaml.cs">
180186
<DependentUpon>ConfigControl.xaml</DependentUpon>
181187
</Compile>
188+
<Compile Include="Views\EntitiesControl.xaml.cs">
189+
<DependentUpon>EntitiesControl.xaml</DependentUpon>
190+
</Compile>
182191
<Compile Include="Views\ModsControl.xaml.cs">
183192
<DependentUpon>ModsControl.xaml</DependentUpon>
184193
</Compile>
194+
<Compile Include="Views\PluginsControl.xaml.cs">
195+
<DependentUpon>PluginsControl.xaml</DependentUpon>
196+
</Compile>
185197
<Compile Include="Views\TorchUI.xaml.cs">
186198
<DependentUpon>TorchUI.xaml</DependentUpon>
187199
</Compile>
@@ -242,10 +254,18 @@
242254
<SubType>Designer</SubType>
243255
<Generator>MSBuild:Compile</Generator>
244256
</Page>
257+
<Page Include="Views\EntitiesControl.xaml">
258+
<SubType>Designer</SubType>
259+
<Generator>MSBuild:Compile</Generator>
260+
</Page>
245261
<Page Include="Views\ModsControl.xaml">
246262
<SubType>Designer</SubType>
247263
<Generator>MSBuild:Compile</Generator>
248264
</Page>
265+
<Page Include="Views\PluginsControl.xaml">
266+
<SubType>Designer</SubType>
267+
<Generator>MSBuild:Compile</Generator>
268+
</Page>
249269
<Page Include="Views\TorchUI.xaml">
250270
<Generator>MSBuild:Compile</Generator>
251271
<SubType>Designer</SubType>

‎Torch.Server/TorchConfig.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public TorchConfig() : this("Torch") { }
2525
public TorchConfig(string instanceName = "Torch", string instancePath = null, int autosaveInterval = 5, bool autoRestart = false)
2626
{
2727
InstanceName = instanceName;
28-
InstancePath = instancePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Torch", InstanceName);
28+
InstancePath = instancePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SpaceEngineersDedicated", InstanceName);
2929
Autosave = autosaveInterval;
3030
AutoRestart = autoRestart;
3131
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Torch.Server.ViewModels
8+
{
9+
/*
10+
public class CharacterViewModel : EntityViewModel
11+
{
12+
}*/
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Torch.Server.ViewModels
8+
{
9+
/*
10+
public class EntityTreeViewModel : ViewModel
11+
{
12+
public string GridsHeader => null;
13+
public MTObservableCollection<>
14+
15+
public void Refresh()
16+
{
17+
18+
}
19+
}*/
20+
}

0 commit comments

Comments
 (0)