diff --git a/src/TF2HUD.Editor/MainWindow.xaml b/src/TF2HUD.Editor/MainWindow.xaml
index ff81bd57..33fc800d 100644
--- a/src/TF2HUD.Editor/MainWindow.xaml
+++ b/src/TF2HUD.Editor/MainWindow.xaml
@@ -1,22 +1,36 @@
-
-
-
+ WindowStyle="None"
+ AllowsTransparency="True"
+ Background="Transparent"
+ ResizeMode="NoResize"
+ FontFamily="../Resources/Fonts/TF2Secondary.ttf #TF2 Secondary"
+ FontSize="20px">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/TF2HUD.Editor/MainWindow.xaml.cs b/src/TF2HUD.Editor/MainWindow.xaml.cs
index 3a988c18..004381df 100644
--- a/src/TF2HUD.Editor/MainWindow.xaml.cs
+++ b/src/TF2HUD.Editor/MainWindow.xaml.cs
@@ -8,6 +8,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
+using System.Windows.Input;
using HUDEditor.Classes;
using HUDEditor.Models;
using HUDEditor.Properties;
@@ -31,18 +32,21 @@ public partial class MainWindow
public MainWindow()
{
- // Initialize the logger, main window.
- var repository = LogManager.GetRepository(Assembly.GetEntryAssembly());
- XmlConfigurator.Configure(repository, new FileInfo("log4net.config"));
+ // Initialize the logger
+ XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetEntryAssembly()), new FileInfo("log4net.config"));
Logger.Info("=======================================================");
- Logger.Info("Initializing.");
+ Logger.Info($"Starting {Assembly.GetExecutingAssembly().GetName().Name} {Assembly.GetExecutingAssembly().GetName().Version}");
+
+ // Initialize the main window
InitializeComponent();
var mainWindowViewModel = new MainWindowViewModel();
mainWindowViewModel.PropertyChanged += MainWindowViewModelPropertyChanged;
DataContext = mainWindowViewModel;
+
+ // Check for tf/custom directory
SetupDirectory();
- // Check for updates.
+ // Check for updates
if (Settings.Default.app_update_auto == true) UpdateAppSchema();
}
@@ -214,5 +218,15 @@ public static async void UpdateAppVersion()
Console.WriteLine(e);
}
}
+
+ private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left) DragMove();
+ }
+
+ private void CloseButton_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
}
}
\ No newline at end of file
diff --git a/src/TF2HUD.Editor/Properties/Resources.Designer.cs b/src/TF2HUD.Editor/Properties/Resources.Designer.cs
index 25f36664..d7c5e53a 100644
--- a/src/TF2HUD.Editor/Properties/Resources.Designer.cs
+++ b/src/TF2HUD.Editor/Properties/Resources.Designer.cs
@@ -448,7 +448,8 @@ public static string ui_install {
}
///
- /// Looks up a localized string similar to Options.
+ /// Looks up a localized string similar to Options
+ ///.
///
public static string ui_options {
get {
@@ -510,6 +511,15 @@ public static string ui_select {
}
}
+ ///
+ /// Looks up a localized string similar to Settings.
+ ///
+ public static string ui_settings {
+ get {
+ return ResourceManager.GetString("ui_settings", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Switch HUDs.
///
diff --git a/src/TF2HUD.Editor/Properties/Resources.resx b/src/TF2HUD.Editor/Properties/Resources.resx
index 8d91fc3f..a138db71 100644
--- a/src/TF2HUD.Editor/Properties/Resources.resx
+++ b/src/TF2HUD.Editor/Properties/Resources.resx
@@ -246,8 +246,8 @@
Install
-
- Options
+
+ Settings
Remember crosshair selection
@@ -276,4 +276,7 @@
Uninstall
+
+ Options
+
\ No newline at end of file
diff --git a/src/TF2HUD.Editor/ViewModels/MainWindowViewModel.cs b/src/TF2HUD.Editor/ViewModels/MainWindowViewModel.cs
index ed0da16f..1c7b2775 100644
--- a/src/TF2HUD.Editor/ViewModels/MainWindowViewModel.cs
+++ b/src/TF2HUD.Editor/ViewModels/MainWindowViewModel.cs
@@ -11,6 +11,7 @@
using System.Windows;
using System.Windows.Forms;
using CommunityToolkit.Mvvm.Input;
+using Crews.Utility.TgaSharp;
using HUDEditor.Classes;
using HUDEditor.Models;
using HUDEditor.Properties;
@@ -89,29 +90,35 @@ public bool Installing
public MainWindowViewModel()
{
_hudList = new List();
+ var sharedControlsJson = new StreamReader(File.OpenRead("JSON\\shared-hud.json"), new UTF8Encoding(false)).ReadToEnd();
foreach (var jsonFile in Directory.EnumerateFiles("JSON"))
{
// Extract HUD information from the file path and add it to the object list.
var fileInfo = jsonFile.Split("\\")[^1].Split(".");
- if (fileInfo[^1] != "json") continue;
- _hudList.Add(new HUD(fileInfo[0], JsonConvert.DeserializeObject(new StreamReader(File.OpenRead(jsonFile), new UTF8Encoding(false)).ReadToEnd()), true));
- }
+ if (fileInfo[^1] != "json" || fileInfo[0] == "shared-hud") continue;
- // Load all shared huds from JSON/Shared/shared.json, and shared controls from JSON/Shared/controls.json
- // For each hud, assign unique ids for the controls based on the hud name and add to HUDs list.
- var sharedHuds = JsonConvert.DeserializeObject>(new StreamReader(File.OpenRead("JSON\\Shared\\shared.json"), new UTF8Encoding(false)).ReadToEnd());
- var sharedControlsJson = new StreamReader(File.OpenRead("JSON\\Shared\\controls.json"), new UTF8Encoding(false)).ReadToEnd();
+ if (fileInfo[0].Equals("common"))
+ {
+ // Load all common HUDS from `JSON/common.json` and shared controls from `JSON/shared-hud.json`
+ // For each hud, assign unique ids for the controls based on the hud name and add to HUDs list.
+ var sharedHuds = JsonConvert.DeserializeObject>(new StreamReader(File.OpenRead("JSON\\common.json"), new UTF8Encoding(false)).ReadToEnd());
- foreach (var sharedHud in sharedHuds)
- {
- var hudControls = JsonConvert.DeserializeObject(sharedControlsJson);
- foreach (var control in hudControls.Controls.SelectMany(group => hudControls.Controls[group.Key]))
- control.Name = $"{Utilities.EncodeId(sharedHud.Name)}_{Utilities.EncodeId(control.Name)}";
- sharedHud.Layout = hudControls.Layout;
- sharedHud.Controls = hudControls.Controls;
+ foreach (var sharedHud in sharedHuds)
+ {
+ var hudControls = JsonConvert.DeserializeObject(sharedControlsJson);
+ foreach (var control in hudControls.Controls.SelectMany(group => hudControls.Controls[group.Key]))
+ control.Name = $"{Utilities.EncodeId(sharedHud.Name)}_{Utilities.EncodeId(control.Name)}";
+ sharedHud.Layout = hudControls.Layout;
+ sharedHud.Controls = hudControls.Controls;
- _hudList.Add(new HUD(sharedHud.Name, sharedHud, false));
+ _hudList.Add(new HUD(sharedHud.Name, sharedHud, false));
+ }
+ }
+ else
+ {
+ _hudList.Add(new HUD(fileInfo[0], JsonConvert.DeserializeObject(new StreamReader(File.OpenRead(jsonFile), new UTF8Encoding(false)).ReadToEnd()), true));
+ }
}
// Local Shared HUDs
@@ -133,7 +140,7 @@ public MainWindowViewModel()
Layout = sharedProperties.Layout,
Links = new Links
{
- Download = new[] { new Download() { Source = "GitHub", Link = $"file://{sharedHud}\\{hudName}.zip" } }
+ Download = [new Download() { Source = "GitHub", Link = $"file://{sharedHud}\\{hudName}.zip" }]
},
Controls = sharedProperties.Controls
}, false));
@@ -387,7 +394,7 @@ public void BtnSwitch_Click()
[RelayCommand]
public void BtnSettings_Click()
{
- var settings = new Options();
+ var settings = new SettingsWindow();
settings.Owner = System.Windows.Application.Current.MainWindow;
settings.Show();
}
@@ -555,7 +562,7 @@ public async Task Add(string folderPath)
// TF2 HUD Crosshairs
await Utilities.InstallCrosshairs(folderPath);
- var sharedControlsJson = new StreamReader(File.OpenRead("JSON\\Shared\\controls.json"), new UTF8Encoding(false)).ReadToEnd();
+ var sharedControlsJson = new StreamReader(File.OpenRead("JSON\\shared-hud.json"), new UTF8Encoding(false)).ReadToEnd();
var hudControls = JsonConvert.DeserializeObject(sharedControlsJson);
foreach (var group in hudControls.Controls)
foreach (var control in hudControls.Controls[group.Key])