1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Changed decision making slightly

This commit is contained in:
Logan Saso 2016-03-09 22:08:30 -08:00
parent bfea9edc14
commit a2a9cdd287
7 changed files with 124 additions and 36 deletions

View File

@ -48,6 +48,12 @@
<setting name="ShowDead" serializeAs="String">
<value>True</value>
</setting>
<setting name="MainColor" serializeAs="String">
<value>#FFFF0000</value>
</setting>
<setting name="ManaColor" serializeAs="String">
<value>#FF0000FF</value>
</setting>
</Artemis.Modules.Games.Dota2.Dota2>
<Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
<setting name="Enabled" serializeAs="String">

View File

@ -118,5 +118,29 @@ namespace Artemis.Modules.Games.Dota2 {
this["ShowDead"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
public global::System.Windows.Media.Color MainColor {
get {
return ((global::System.Windows.Media.Color)(this["MainColor"]));
}
set {
this["MainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FF0000FF")]
public global::System.Windows.Media.Color ManaColor {
get {
return ((global::System.Windows.Media.Color)(this["ManaColor"]));
}
set {
this["ManaColor"] = value;
}
}
}
}

View File

@ -26,5 +26,11 @@
<Setting Name="ShowDead" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF0000</Value>
</Setting>
<Setting Name="ManaColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF0000FF</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -14,6 +14,7 @@ using Artemis.Utilities.Keyboard;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Artemis.Modules.Games.Dota2;
using Artemis.Utilities;
namespace Artemis.Modules.Games.Dota2
{
@ -95,8 +96,12 @@ namespace Artemis.Modules.Games.Dota2
if (D2Json == null)
return;
if (Settings.ShowDead)
UpdateDead();
if (Settings.ShowDead && D2Json?.hero?.alive != null && !D2Json.hero.alive)
{
UpdateLifeStatus();
return;
}
UpdateMainColor();
if (Settings.CanCastAbility)
UpdateAbilities();
if (Settings.ShowHealth)
@ -107,15 +112,28 @@ namespace Artemis.Modules.Games.Dota2
UpdateMana();
if (Settings.CanCastItem)
UpdateItems();
}
private void UpdateDead()
private void UpdateMainColor()
{
if (D2Json?.hero?.alive == null)
return;
var list = new List<Color> { ColorHelpers.ToDrawingColor(Settings.MainColor) };
EventRectangle.Colors = list;
DayCycleRectangle.Colors = list;
HealthRectangle.Colors = list;
ManaRectangle.Colors = list;
}
EventRectangle.Colors = D2Json.hero.alive ? new List<Color> { Color.Lime } : new List<Color> {Color.LightGray};
private void UpdateLifeStatus()
{
var list = new List<Color> { Color.LightGray };
EventRectangle.Colors = list;
DayCycleRectangle.Colors = list;
HealthRectangle.Colors = list;
ManaRectangle.Colors = list;
}
private void UpdateDay()
@ -143,7 +161,7 @@ namespace Artemis.Modules.Games.Dota2
return;
var manaPercent = D2Json.hero.mana_percent;
ManaRectangle.Colors = new List<Color> {Color.Blue};
ManaRectangle.Colors = new List<Color> { ColorHelpers.ToDrawingColor(Settings.ManaColor) };
ManaRectangle.Width = (int)Math.Floor(_topRow.BottomRight.Y / 100.00 * manaPercent) * Scale;
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Windows.Media;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -24,11 +25,15 @@ namespace Artemis.Modules.Games.Dota2
public bool CanCastItem { get; set; }
public bool ShowMana { get; set; }
public bool ShowDead { get; set; }
public Color MainColor { get; set; }
public Color ManaColor { get; set; }
#endregion
public override void Load()
{
MainColor = Dota2.Default.MainColor;
ManaColor = Dota2.Default.ManaColor;
ShowHealth = Dota2.Default.ShowHealth;
CanCastAbility = Dota2.Default.CanCastAbility;
Enabled = Dota2.Default.Enabled;
@ -41,6 +46,8 @@ namespace Artemis.Modules.Games.Dota2
public override void Save()
{
Dota2.Default.MainColor = MainColor;
Dota2.Default.ManaColor = ManaColor;
Dota2.Default.ShowDayCycle = ShowDayCycle;
Dota2.Default.ShowHealth = ShowHealth;
Dota2.Default.CanCastAbility = CanCastAbility;
@ -56,9 +63,11 @@ namespace Artemis.Modules.Games.Dota2
public override void ToDefault()
{
Enabled = false;
Enabled = true;
GameDirectory = string.Empty;
MainColor = Color.FromArgb(255,255,0,0);
ManaColor = Color.FromArgb(255,0,0,255);
ShowHealth = true;
CanCastAbility = true;
ShowDayCycle = true;

View File

@ -5,8 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="424" d:DesignWidth="635">
d:DesignHeight="495" d:DesignWidth="635">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<Grid.ColumnDefinitions>
@ -23,13 +24,15 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
<Label FontSize="20" HorizontalAlignment="Left">
<Label.Content>
<AccessText TextWrapping="Wrap"
Text="Shows various information Dota 2." />
Text="Shows game states and events from Dota 2." />
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
@ -41,6 +44,8 @@
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2" Margin="0,0,1,0">
@ -56,64 +61,84 @@
</Grid>
</StackPanel>
<!-- Main Color -->
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Width="114" VerticalAlignment="Center"
Height="16" Margin="0,8">
Main keyboard color
</TextBlock>
<xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
<!-- 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" />
<!-- Items Display -->
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Show items that can be cast.
Castable abilities
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.CanCastItem, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.CanCastAbility, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Health Display -->
<!-- Items Display -->
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Show health on F-Keys.
Castable items
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowHealth, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.CanCastItem, Mode=TwoWay}"
Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Mana Display-->
<!-- Health Display -->
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Show mana on the number keys.
Display health
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowMana, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowHealth, Mode=TwoWay}"
Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Daytime Display -->
<!-- Mana Display-->
<TextBlock Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Show day/night cycle.
Display mana
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowDayCycle, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowMana, Mode=TwoWay}"
Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Dead Display -->
<TextBlock Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
<!-- Mana Color -->
<TextBlock Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left" Width="114" VerticalAlignment="Center"
Height="16" Margin="0,8">
Mana color
</TextBlock>
<xctk:ColorPicker x:Name="ManaColor"
SelectedColor="{Binding Path=GameSettings.ManaColor, Mode=TwoWay}"
Grid.Row="7" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
<!-- Daytime Display -->
<TextBlock Grid.Row="8" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Turn grey when dead.
Display day/night
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowDayCycle, Mode=TwoWay}"
Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Dead Display -->
<TextBlock Grid.Row="9" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
Height="16" Margin="0,10,0,9">
Display gray when dead
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowDead, Mode=TwoWay}"
Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Grid.Row="9" 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">
<StackPanel Grid.Column="0" Grid.Row="11" 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"

View File

@ -63,7 +63,7 @@ namespace Artemis.Modules.Games.Dota2
}
MainManager.DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
@"By default Dota 2 is in \SteamApps\common\Dota2");
@"By default Dota 2 is in \SteamApps\common\dota 2 beta");
((Dota2Settings)GameSettings).GameDirectory = string.Empty;
NotifyOfPropertyChange(() => GameSettings);