From cee3da0a582aa0709da2e63b32c7bb568391bef9 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Mon, 22 Feb 2016 14:04:33 +0100 Subject: [PATCH] Smoothed out Witcher 3 mod installation, updated links to refer to the Wiki --- .../Games/CounterStrike/CounterStrikeModel.cs | 16 ++++++++++---- .../Games/Witcher3/Witcher3ViewModel.cs | 21 ++++++++++++++++++- .../Artemis/ViewModels/OverlaysViewModel.cs | 10 +++++++-- Artemis/Artemis/Views/WelcomeView.xaml | 2 +- Artemis/Artemis/Views/WelcomeView.xaml.cs | 2 +- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs index d7cef57e7..2843fd51b 100644 --- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs +++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; +using Artemis.KeyboardProviders.Corsair; +using Artemis.KeyboardProviders.Logitech; using Artemis.Models; using Artemis.Utilities; using Artemis.Utilities.GameState; @@ -42,12 +44,18 @@ namespace Artemis.Modules.Games.CounterStrike public override void Enable() { - // TODO: Size stuff - AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List(), + // Some keyboards have a different baseline, Corsair F-keys start at row 1 + int baseLine; + if (MainModel.ActiveKeyboard is CorsairRGB) + baseLine = 1; + else + baseLine = 0; + + AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine, new List(), LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false}; - TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 1, new List(), + TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine + 1, new List(), LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale}; - EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 1, new List(), + EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine + 1, new List(), LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale}; MainModel.GameStateWebServer.GameDataReceived += HandleGameData; } diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs index 2e420cdd6..c94c3b9c6 100644 --- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs +++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs @@ -1,4 +1,6 @@ -using System.IO; +using System; +using System.Diagnostics; +using System.IO; using System.Linq; using System.Windows.Forms; using Artemis.Models; @@ -101,6 +103,23 @@ namespace Artemis.Modules.Games.Witcher3 "Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) + "\n\nOnce you press OK you will be taken to an instructions page.", "Conflicting mod found"); + + // Put the mod in the documents folder instead + // Create the directory structure + var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis"; + if ( + !Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player")) + Directory.CreateDirectory(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"); + if ( + !Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc")) + Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"); + + // Install the mod files + File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",Resources.artemisXml); + File.WriteAllText(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",Resources.playerWitcherWs); + + Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3")); + return; } } diff --git a/Artemis/Artemis/ViewModels/OverlaysViewModel.cs b/Artemis/Artemis/ViewModels/OverlaysViewModel.cs index 1b326b4ca..8a707be80 100644 --- a/Artemis/Artemis/ViewModels/OverlaysViewModel.cs +++ b/Artemis/Artemis/ViewModels/OverlaysViewModel.cs @@ -6,18 +6,24 @@ namespace Artemis.ViewModels { public class OverlaysViewModel : Conductor.Collection.OneActive { - private readonly VolumeDisplayViewModel _volumeDisplayVm; + private readonly MainModel _mainModel; + private VolumeDisplayViewModel _volumeDisplayVm; public OverlaysViewModel(MainModel mainModel) { - _volumeDisplayVm = new VolumeDisplayViewModel(mainModel) {DisplayName = "Volume Display"}; + _mainModel = mainModel; } protected override void OnActivate() { base.OnActivate(); + Items.Clear(); + + // This VM appears to be going out of scope, so recreating it every time just to be sure. + _volumeDisplayVm = new VolumeDisplayViewModel(_mainModel) { DisplayName = "Volume Display" }; ActivateItem(_volumeDisplayVm); + ActiveItem = _volumeDisplayVm; } } } \ No newline at end of file diff --git a/Artemis/Artemis/Views/WelcomeView.xaml b/Artemis/Artemis/Views/WelcomeView.xaml index 41c054280..bf85f005d 100644 --- a/Artemis/Artemis/Views/WelcomeView.xaml +++ b/Artemis/Artemis/Views/WelcomeView.xaml @@ -41,7 +41,7 @@ There is also an FAQ available over + NavigateUri="https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-(FAQ)"> here. diff --git a/Artemis/Artemis/Views/WelcomeView.xaml.cs b/Artemis/Artemis/Views/WelcomeView.xaml.cs index 1078b2303..bcbd826e4 100644 --- a/Artemis/Artemis/Views/WelcomeView.xaml.cs +++ b/Artemis/Artemis/Views/WelcomeView.xaml.cs @@ -16,7 +16,7 @@ namespace Artemis.Views private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) { - Process.Start("https://github.com/SpoinkyNL/Artemis"); + Process.Start("https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-(FAQ)"); } } } \ No newline at end of file