mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-03-24 02:08:47 +00:00
Added much more dota support
This commit is contained in:
parent
1db97b73cb
commit
dcd88331f6
@ -30,6 +30,12 @@
|
|||||||
<setting name="GameDirectory" serializeAs="String">
|
<setting name="GameDirectory" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="CanCastAbility" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="ShowHealth" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</Artemis.Modules.Games.Dota2.Dota2>
|
</Artemis.Modules.Games.Dota2.Dota2>
|
||||||
<Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
|
<Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
|
||||||
<setting name="Enabled" serializeAs="String">
|
<setting name="Enabled" serializeAs="String">
|
||||||
|
|||||||
@ -435,6 +435,7 @@
|
|||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="Modules\Effects\AudioVisualizer\AudioVisualization.settings">
|
<None Include="Modules\Effects\AudioVisualizer\AudioVisualization.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
@ -474,6 +475,7 @@
|
|||||||
</Content>
|
</Content>
|
||||||
<Resource Include="Resources\logo.ico" />
|
<Resource Include="Resources\logo.ico" />
|
||||||
<Resource Include="Resources\logo-disabled.ico" />
|
<Resource Include="Resources\logo-disabled.ico" />
|
||||||
|
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
||||||
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
||||||
<Content Include="Resources\Witcher3\artemis.txt" />
|
<Content Include="Resources\Witcher3\artemis.txt" />
|
||||||
<Resource Include="Resources\Entypo.ttf" />
|
<Resource Include="Resources\Entypo.ttf" />
|
||||||
@ -567,7 +569,7 @@
|
|||||||
<Content Include="LogitechLedEnginesWrapper.dll">
|
<Content Include="LogitechLedEnginesWrapper.dll">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\CounterStrike\gamestateConfiguration.txt" />
|
<Content Include="Resources\CounterStrike\csgoGamestateConfiguration.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||||
|
|||||||
@ -44,7 +44,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
return;
|
return;
|
||||||
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
|
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
|
||||||
{
|
{
|
||||||
var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}",
|
var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
|
||||||
MainManager.GameStateWebServer.Port.ToString());
|
MainManager.GameStateWebServer.Port.ToString());
|
||||||
File.WriteAllText(
|
File.WriteAllText(
|
||||||
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
||||||
|
|||||||
@ -46,5 +46,29 @@ namespace Artemis.Modules.Games.Dota2 {
|
|||||||
this["GameDirectory"] = value;
|
this["GameDirectory"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool CanCastAbility {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["CanCastAbility"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["CanCastAbility"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool ShowHealth {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["ShowHealth"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["ShowHealth"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,5 +8,11 @@
|
|||||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="CanCastAbility" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="ShowHealth" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@ -1,12 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Artemis.KeyboardProviders;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
|
using Artemis.Utilities.Keyboard;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@ -14,6 +17,8 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
{
|
{
|
||||||
class Dota2Model : GameModel
|
class Dota2Model : GameModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private KeyboardRegion _topRow;
|
||||||
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
|
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
@ -29,50 +34,81 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
public Dota2Settings Settings { get; set; }
|
public Dota2Settings Settings { get; set; }
|
||||||
public JObject D2Json { get; set; }
|
public JObject D2Json { get; set; }
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
public KeyboardRectangle HealthRect { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
|
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
|
||||||
|
HealthRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
|
||||||
|
new List<Color>(),
|
||||||
|
LinearGradientMode.Horizontal)
|
||||||
|
{ Height = Scale, ContainedBrush = false };
|
||||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (D2Json == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Settings.CanCastAbility)
|
||||||
|
UpdateAbilities();
|
||||||
|
if (Settings.ShowHealth)
|
||||||
|
UpdateHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHealth()
|
||||||
|
{
|
||||||
|
var health = D2Json["hero"]["health_percent"];
|
||||||
|
if((int)health > 66)
|
||||||
|
HealthRect.Colors = new List<Color> { Color.Lime };
|
||||||
|
else if ((int) health > 33)
|
||||||
|
HealthRect.Colors = new List<Color> {Color.Yellow};
|
||||||
|
else
|
||||||
|
HealthRect.Colors = new List<Color> {Color.Red};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAbilities()
|
||||||
|
{
|
||||||
|
//Update keys according to the abilities they take.
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
}
|
HealthRect.Draw(g);
|
||||||
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
|
||||||
{
|
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
||||||
var jsonString = e.Json.ToString();
|
{
|
||||||
|
var jsonString = e.Json.ToString();
|
||||||
// Ensure it's CS:GO JSON
|
|
||||||
if (!jsonString.Contains("Dota 2"))
|
// Ensure it's Dota 2 JSON
|
||||||
return;
|
if (!jsonString.Contains("Dota 2"))
|
||||||
|
return;
|
||||||
// Parse the JSON
|
|
||||||
D2Json = JsonConvert.DeserializeObject<JObject>(jsonString);
|
// Parse the JSON
|
||||||
|
D2Json = JsonConvert.DeserializeObject<JObject>(jsonString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,23 +18,31 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
|
|
||||||
#region Variables
|
#region Variables
|
||||||
public string GameDirectory { get; set; }
|
public string GameDirectory { get; set; }
|
||||||
|
public bool CanCastAbility { get; set; }
|
||||||
|
public bool ShowHealth { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
|
ShowHealth = Dota2.Default.ShowHealth;
|
||||||
|
CanCastAbility = Dota2.Default.CanCastAbility;
|
||||||
Enabled = Dota2.Default.Enabled;
|
Enabled = Dota2.Default.Enabled;
|
||||||
GameDirectory = Dota2.Default.GameDirectory;
|
GameDirectory = Dota2.Default.GameDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
|
Dota2.Default.ShowHealth = ShowHealth;
|
||||||
|
Dota2.Default.CanCastAbility = CanCastAbility;
|
||||||
Dota2.Default.Enabled = Enabled;
|
Dota2.Default.Enabled = Enabled;
|
||||||
Dota2.Default.GameDirectory = GameDirectory;
|
Dota2.Default.GameDirectory = GameDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ToDefault()
|
public override void ToDefault()
|
||||||
{
|
{
|
||||||
|
ShowHealth = true;
|
||||||
|
CanCastAbility = true;
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
GameDirectory = string.Empty;
|
GameDirectory = string.Empty;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,59 +1,88 @@
|
|||||||
<UserControl x:Class="Artemis.Modules.Games.Dota2.Dota2View"
|
<UserControl x:Class="Artemis.Modules.Games.Dota2.Dota2View"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cal="http://www.caliburnproject.org"
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
mc:Ignorable="d"
|
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||||
d:DesignHeight="424" d:DesignWidth="635">
|
mc:Ignorable="d"
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
d:DesignHeight="424" d:DesignWidth="635">
|
||||||
<Grid Margin="15, 5, 15, 5">
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid Margin="15, 5, 15, 5">
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="80" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="80" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition Height="*" />
|
||||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
</Grid.RowDefinitions>
|
||||||
<Label FontSize="20" HorizontalAlignment="Left">
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||||
<Label.Content>
|
<Label FontSize="20" HorizontalAlignment="Left">
|
||||||
<AccessText TextWrapping="Wrap"
|
<Label.Content>
|
||||||
Text="Shows various information Dota 2." />
|
<AccessText TextWrapping="Wrap"
|
||||||
</Label.Content>
|
Text="Shows various information Dota 2." />
|
||||||
</Label>
|
</Label.Content>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
</Label>
|
||||||
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||||
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
||||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||||
</StackPanel>
|
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1"
|
|
||||||
Grid.Column="0"
|
<StackPanel Grid.Row="1"
|
||||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
Grid.Column="0"
|
||||||
<Label FontSize="16" Content="Dota 2 Directory" FontFamily="Segoe UI Semibold" Foreground="#535353"
|
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||||
Width="130" HorizontalAlignment="Left" />
|
<Label FontSize="16" Content="Dota 2 Directory" FontFamily="Segoe UI Semibold" Foreground="#535353"
|
||||||
<Grid>
|
Width="130" HorizontalAlignment="Left" />
|
||||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
<Grid>
|
||||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||||
HorizontalAlignment="Right" Width="25"
|
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||||
Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
HorizontalAlignment="Right" Width="25"
|
||||||
</Grid>
|
Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</Grid>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
|
||||||
|
<!-- Abilities Display -->
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||||
|
Height="16" Margin="0,10,0,9">
|
||||||
|
Show abilities that can be cast.
|
||||||
|
</TextBlock>
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.CanCastAbility, Mode=TwoWay}"
|
||||||
|
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="0,0,-5,0" Width="114" />
|
||||||
|
|
||||||
|
<!-- Health Display -->
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||||
|
Height="16" Margin="0,10,0,9">
|
||||||
|
Show health on F-Keys.
|
||||||
|
</TextBlock>
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowHealth, Mode=TwoWay}"
|
||||||
|
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="0,0,-5,0" Width="114" />
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,61 +1,73 @@
|
|||||||
using System.IO;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.IO;
|
||||||
using Artemis.Managers;
|
using System.Windows.Forms;
|
||||||
using Artemis.Properties;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.Properties;
|
||||||
|
using Artemis.ViewModels.Abstract;
|
||||||
namespace Artemis.Modules.Games.Dota2
|
|
||||||
{
|
|
||||||
public class Dota2ViewModel : GameViewModel
|
|
||||||
{
|
|
||||||
public Dota2ViewModel(MainManager mainManager)
|
|
||||||
{
|
|
||||||
MainManager = mainManager;
|
|
||||||
GameSettings = new Dota2Settings();
|
|
||||||
|
|
||||||
GameModel = new Dota2Model(mainManager, (Dota2Settings) GameSettings);
|
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
|
||||||
PlaceConfigFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Name => "Dota 2";
|
|
||||||
public string Content => "Dota 2 Content";
|
|
||||||
|
|
||||||
public void BrowseDirectory()
|
namespace Artemis.Modules.Games.Dota2
|
||||||
{
|
{
|
||||||
var dialog = new FolderBrowserDialog { SelectedPath = ((Dota2Settings)GameSettings).GameDirectory };
|
public class Dota2ViewModel : GameViewModel
|
||||||
var result = dialog.ShowDialog();
|
{
|
||||||
if (result != DialogResult.OK)
|
public Dota2ViewModel(MainManager mainManager)
|
||||||
return;
|
{
|
||||||
|
MainManager = mainManager;
|
||||||
((Dota2Settings)GameSettings).GameDirectory = dialog.SelectedPath;
|
GameSettings = new Dota2Settings();
|
||||||
NotifyOfPropertyChange(() => GameSettings);
|
|
||||||
|
GameModel = new Dota2Model(mainManager, (Dota2Settings) GameSettings);
|
||||||
GameSettings.Save();
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
PlaceConfigFile();
|
PlaceConfigFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlaceConfigFile()
|
public static string Name => "Dota 2";
|
||||||
{
|
public string Content => "Dota 2 Content";
|
||||||
if (((Dota2Settings)GameSettings).GameDirectory == string.Empty)
|
|
||||||
return;
|
public void BrowseDirectory()
|
||||||
if (Directory.Exists(((Dota2Settings)GameSettings).GameDirectory + "/dota2/cfg"))
|
{
|
||||||
{
|
var dialog = new FolderBrowserDialog { SelectedPath = ((Dota2Settings)GameSettings).GameDirectory };
|
||||||
var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}",
|
var result = dialog.ShowDialog();
|
||||||
MainManager.GameStateWebServer.Port.ToString());
|
if (result != DialogResult.OK)
|
||||||
File.WriteAllText(
|
return;
|
||||||
((Dota2Settings)GameSettings).GameDirectory + "/dota2/cfg/gamestate_integration_artemis.cfg",
|
|
||||||
cfgFile);
|
((Dota2Settings)GameSettings).GameDirectory = dialog.SelectedPath;
|
||||||
|
NotifyOfPropertyChange(() => GameSettings);
|
||||||
return;
|
|
||||||
}
|
GameSettings.Save();
|
||||||
|
PlaceConfigFile();
|
||||||
MainManager.DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
|
}
|
||||||
@"By default Dota 2 is in \SteamApps\common\Dota2");
|
|
||||||
((Dota2Settings)GameSettings).GameDirectory = string.Empty;
|
public void PlaceConfigFile()
|
||||||
NotifyOfPropertyChange(() => GameSettings);
|
{
|
||||||
|
if (((Dota2Settings)GameSettings).GameDirectory == string.Empty)
|
||||||
GameSettings.Save();
|
return;
|
||||||
}
|
if (Directory.Exists(((Dota2Settings)GameSettings).GameDirectory + "/game/dota/cfg"))
|
||||||
}
|
{
|
||||||
|
var cfgFile = Resources.dotaGamestateConfiguration.Replace("{{port}}",
|
||||||
|
MainManager.GameStateWebServer.Port.ToString());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(
|
||||||
|
((Dota2Settings)GameSettings).GameDirectory + "/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg",
|
||||||
|
cfgFile);
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(((Dota2Settings) GameSettings).GameDirectory + "/game/dota/cfg/gamestate_integration/");
|
||||||
|
File.WriteAllText(
|
||||||
|
((Dota2Settings)GameSettings).GameDirectory + "/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg",
|
||||||
|
cfgFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainManager.DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
|
||||||
|
@"By default Dota 2 is in \SteamApps\common\Dota2");
|
||||||
|
((Dota2Settings)GameSettings).GameDirectory = string.Empty;
|
||||||
|
NotifyOfPropertyChange(() => GameSettings);
|
||||||
|
|
||||||
|
GameSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
79
Artemis/Artemis/Properties/Resources.Designer.cs
generated
79
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -61,14 +61,14 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-16"?>
|
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-16"?>
|
||||||
///<!-- Used by Artemis to get the active Sign -->
|
///<!-- Used by Artemis to get the active Sign -->
|
||||||
///<UserConfig>
|
///<UserConfig>
|
||||||
/// <Group id="Artemis" displayName="Artemis">
|
/// <Group id="Artemis" displayName="Artemis">
|
||||||
/// <VisibleVars>
|
/// <VisibleVars>
|
||||||
/// <Var id="ActiveSign" displayName="ActiveSign" displayType="SLIDER:0:1:1000000"/>
|
/// <Var id="ActiveSign" displayName="ActiveSign" displayType="SLIDER:0:1:1000000"/>
|
||||||
/// </VisibleVars>
|
/// </VisibleVars>
|
||||||
/// </Group>
|
/// </Group>
|
||||||
///</UserConfig>.
|
///</UserConfig>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string artemisXml {
|
internal static string artemisXml {
|
||||||
@ -88,28 +88,53 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to "Artemis"
|
/// Looks up a localized string similar to "Artemis"
|
||||||
///{
|
///{
|
||||||
/// "uri" "http://localhost:{{port}}/csgo_game_event"
|
/// "uri" "http://localhost:{{port}}/csgo_game_event"
|
||||||
/// "timeout" "5.0"
|
/// "timeout" "5.0"
|
||||||
/// "buffer" "0.1"
|
/// "buffer" "0.1"
|
||||||
/// "throttle" "0.1"
|
/// "throttle" "0.1"
|
||||||
/// "heartbeat" "30.0"
|
/// "heartbeat" "30.0"
|
||||||
/// "data"
|
/// "data"
|
||||||
/// {
|
/// {
|
||||||
/// "provider" "1"
|
/// "provider" "1"
|
||||||
/// "map" "1"
|
/// "map" "1"
|
||||||
/// "round" "1"
|
/// "round" "1"
|
||||||
/// "player_id" "1"
|
/// "player_id" "1"
|
||||||
/// "player_state" "1"
|
/// "player_state" "1"
|
||||||
/// "player_weapons" "1"
|
/// "player_weapons" "1"
|
||||||
/// "player_match_stats" "1"
|
/// "player_match_stats" "1"
|
||||||
/// }
|
/// }
|
||||||
///}.
|
///}.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string gamestateConfiguration {
|
internal static string csgoGamestateConfiguration {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("gamestateConfiguration", resourceCulture);
|
return ResourceManager.GetString("csgoGamestateConfiguration", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to "Artemis"
|
||||||
|
///{
|
||||||
|
/// "uri" "http://localhost:4000/"
|
||||||
|
/// "timeout" "5.0"
|
||||||
|
/// "buffer" "0.1"
|
||||||
|
/// "throttle" "0.1"
|
||||||
|
/// "heartbeat" "30.0"
|
||||||
|
/// "data"
|
||||||
|
/// {
|
||||||
|
/// "provider" "1"
|
||||||
|
/// "map" "1"
|
||||||
|
/// "player" "1"
|
||||||
|
/// "hero" "1"
|
||||||
|
/// "abilities" "1"
|
||||||
|
/// "items" "1"
|
||||||
|
/// }
|
||||||
|
///}.
|
||||||
|
/// </summary>
|
||||||
|
internal static string dotaGamestateConfiguration {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("dotaGamestateConfiguration", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,8 +124,11 @@
|
|||||||
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="csgoGamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
<value>..\resources\counterstrike\csgoGamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
|
</data>
|
||||||
|
<data name="dotaGamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\dota2\dotaGamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
"Artemis"
|
||||||
|
{
|
||||||
|
"uri" "http://localhost:{{port}}/"
|
||||||
|
"timeout" "5.0"
|
||||||
|
"buffer" "0.1"
|
||||||
|
"throttle" "0.1"
|
||||||
|
"heartbeat" "30.0"
|
||||||
|
"data"
|
||||||
|
{
|
||||||
|
"provider" "1"
|
||||||
|
"map" "1"
|
||||||
|
"player" "1"
|
||||||
|
"hero" "1"
|
||||||
|
"abilities" "1"
|
||||||
|
"items" "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user