diff --git a/src/TF2HUD.Editor/Classes/HUD/HUD.cs b/src/TF2HUD.Editor/Classes/HUD/HUD.cs
index ef7af6bc..d9874491 100644
--- a/src/TF2HUD.Editor/Classes/HUD/HUD.cs
+++ b/src/TF2HUD.Editor/Classes/HUD/HUD.cs
@@ -20,22 +20,23 @@ public partial class HUD
private HUDBackground hudBackground;
private bool isRendered;
private string[][] layout;
- public bool Maximize;
+ public bool Maximize, Customizable;
- public string Name, UpdateUrl, GitHubUrl, IssueUrl, HudsTfUrl, SteamUrl, DiscordUrl;
+ public string Name, Description, Author, UpdateUrl, GitHubUrl, HudsTfUrl, SteamUrl, DiscordUrl;
public double Opacity;
public HUDSettings Settings;
public string Thumbnail, Background, CustomizationsFolder, EnabledFolder;
+ public string[] Screenshots;
///
/// Initialize the HUD object with values from the JSON schema.
///
/// Name of the HUD object.
/// Contents of the HUD's schema file.
- public HUD(string name, HudJson schema)
+ public HUD(string name, HudJson schema, bool isCustomizable = true)
{
// Basic Schema Properties.
- Name = name;
+ Name = schema.Name ?? name;
Settings = new HUDSettings(Name);
Opacity = schema.Opacity;
Maximize = schema.Maximize;
@@ -44,6 +45,10 @@ public HUD(string name, HudJson schema)
DirtyControls = new List();
Thumbnail = schema.Thumbnail;
Background = schema.Background;
+ Description = schema.Description;
+ Author = schema.Author;
+ Customizable = isCustomizable;
+ Screenshots = schema.Screenshots;
// Download and Media Links.
if (schema.Links is not null)
diff --git a/src/TF2HUD.Editor/Classes/Json.cs b/src/TF2HUD.Editor/Classes/Json.cs
index d7e42141..e523be0e 100644
--- a/src/TF2HUD.Editor/Classes/Json.cs
+++ b/src/TF2HUD.Editor/Classes/Json.cs
@@ -6,6 +6,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Documents;
using HUDEditor.Models;
using HUDEditor.Properties;
using Newtonsoft.Json;
@@ -31,7 +32,10 @@ public Json()
var json = new StreamReader(File.OpenRead(jsonFile), new UTF8Encoding(false)).ReadToEnd();
// Add the HUD object to the list.
- hudList.Add(new HUD(hudName, JsonConvert.DeserializeObject(json)));
+ if (hudName.Equals("shared"))
+ hudList.AddRange(JsonConvert.DeserializeObject>(json).Select(hud => new HUD(hudName, hud, false)));
+ else
+ hudList.Add(new HUD(hudName, JsonConvert.DeserializeObject(json)));
}
HUDList = hudList.ToArray();
@@ -50,6 +54,7 @@ public void SetHUDByName(string name)
/// Name of the HUD the user wants to view.
public HUD GetHUDByName(string name)
{
+ if (name.Equals("shared")) return HUDList[0];
foreach (var hud in HUDList)
if (string.Equals(hud.Name, name, StringComparison.InvariantCultureIgnoreCase))
return hud;
diff --git a/src/TF2HUD.Editor/JSON/rayshud.json b/src/TF2HUD.Editor/JSON/rayshud.json
index cb3a9c79..4a400f76 100644
--- a/src/TF2HUD.Editor/JSON/rayshud.json
+++ b/src/TF2HUD.Editor/JSON/rayshud.json
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/CriticalFlaw/TF2HUD.Editor/master/src/TF2HUD.Editor/JSON/Schema/schema.json",
- "Thumbnail": "https://huds.tf/site/xthreads_attach.php/572_1486499416_dd57b51a/8daf74d7f23cd9e2dd4abd849b3f0644/directory.jpg",
- "Background": "https://imgur.com/UIHWxBv.png",
+ "Thumbnail": "https://huds.tf/site/xthreads_attach.php/572_1625449753_caa6f785/5f18a61726cef2bcddd21c3a5043be3e/rayshud-new2.png",
+ "Background": "https://i.imgur.com/vC7qekD.png",
"Layout": [
"0 0 1 1 6 6",
"2 2 3 3 6 6",
diff --git a/src/TF2HUD.Editor/JSON/zeeshud.json b/src/TF2HUD.Editor/JSON/zeeshud.json
index 84db2f5e..f6ba83f9 100644
--- a/src/TF2HUD.Editor/JSON/zeeshud.json
+++ b/src/TF2HUD.Editor/JSON/zeeshud.json
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/CriticalFlaw/TF2HUD.Editor/master/src/TF2HUD.Editor/JSON/Schema/schema.json",
- "Thumbnail": "https://huds.tf/site/xthreads_attach.php/3403_1622089359_0ae9f236/6bdb991d2d780d34bd92ccafeb0ba092/zeeshudlogo_card.jpg",
+ "Thumbnail": "https://huds.tf/site/xthreads_attach.php/3403_1627843846_e18896e8/26d23f685f415d0fa5181c80aba3fdc6/zeeshudlogo_card.jpg",
"Background": "https://i.imgur.com/U4m1mOx.png",
"Layout": [
"0 0 4 4 1 1",
diff --git a/src/TF2HUD.Editor/MainWindow.xaml b/src/TF2HUD.Editor/MainWindow.xaml
index 1773c8ff..93bad2ba 100644
--- a/src/TF2HUD.Editor/MainWindow.xaml
+++ b/src/TF2HUD.Editor/MainWindow.xaml
@@ -67,12 +67,12 @@
-
+
-
+
@@ -101,6 +101,26 @@
+
+
+
+
+ HUD Developer
+ HUD Description
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/TF2HUD.Editor/MainWindow.xaml.cs b/src/TF2HUD.Editor/MainWindow.xaml.cs
index bff34b2f..f33f18d8 100644
--- a/src/TF2HUD.Editor/MainWindow.xaml.cs
+++ b/src/TF2HUD.Editor/MainWindow.xaml.cs
@@ -153,7 +153,7 @@ public void SetPageControls()
File.Delete(Directory.GetCurrentDirectory() + "\\temp.zip");
// If the HUD Selection is visible, disable most control buttons.
- if (GbSelectHud.IsVisible)
+ if (AppInfo.IsVisible)
{
LblStatus.Content = string.Empty;
BtnInstall.IsEnabled = false;
@@ -176,12 +176,14 @@ public void SetPageControls()
BtnInstall.IsEnabled = true;
BtnInstall.Content = Utilities.GetLocalizedString(isInstalled ? "ui_reinstall" : "ui_install");
BtnUninstall.IsEnabled = isInstalled;
- BtnSave.IsEnabled = isInstalled;
- BtnReset.IsEnabled = isInstalled;
- BtnSwitch.IsEnabled = true;
+ BtnSave.IsEnabled = isInstalled && !HudInfo.IsVisible;
+ BtnReset.IsEnabled = isInstalled && !HudInfo.IsVisible;
+ BtnSwitch.IsEnabled = !HudInfo.IsVisible;
LblStatus.Content = string.Format(isInstalled
? Properties.Resources.status_installed
: Properties.Resources.status_installed_not, HudSelection);
+ HudStatus.Content = LblStatus.Content;
+ HudStatus.Foreground = isInstalled ? new SolidColorBrush(Colors.GreenYellow) : new SolidColorBrush(Colors.Red);
}
else
{
@@ -191,7 +193,7 @@ public void SetPageControls()
BtnUninstall.IsEnabled = false;
BtnSave.IsEnabled = false;
BtnReset.IsEnabled = false;
- BtnSwitch.IsEnabled = true;
+ BtnSwitch.IsEnabled = !HudInfo.IsVisible;
LblStatus.Content = Properties.Resources.status_pathNotSet;
}
@@ -223,24 +225,66 @@ private void SetPageView()
var selection = Json.GetHUDByName(Settings.Default.hud_selected);
// Display a list of available HUDs if a HUD selection has not been set.
- GbSelectHud.Visibility = selection is null ? Visibility.Visible : Visibility.Hidden;
- MainToolbar.Visibility = selection is null ? Visibility.Hidden : Visibility.Visible;
+ GbSelectHud.Visibility = Visibility.Visible;
+ MainToolbar.Visibility = Visibility.Hidden;
EditorContainer.Children.Clear();
// If there's a HUD selection, generate the controls for that HUD's page.
if (selection is null) return;
Logger.Info($"Changing page view to: {selection.Name}.");
- EditorContainer.Children.Add(selection.GetControls());
- selection.PresetChanged += (sender, Preset) =>
+ if (selection.Customizable)
{
- EditorContainer.Children.Clear();
+ GbSelectHud.Visibility = Visibility.Hidden;
+ MainToolbar.Visibility = Visibility.Visible;
+
EditorContainer.Children.Add(selection.GetControls());
- };
- // Maximize the application window if a given HUD schema requests it.
- Application.Current.MainWindow.WindowState =
- selection.Maximize ? WindowState.Maximized : WindowState.Normal;
+ selection.PresetChanged += (_, _) =>
+ {
+ EditorContainer.Children.Clear();
+ EditorContainer.Children.Add(selection.GetControls());
+ };
+
+ // Maximize the application window if a given HUD schema requests it.
+ Application.Current.MainWindow.WindowState = selection.Maximize ? WindowState.Maximized : WindowState.Normal;
+ }
+ else
+ {
+ AppInfo.Visibility = Visibility.Hidden;
+ HudInfo.Visibility = Visibility.Visible;
+
+ HudName.Content = selection.Name;
+ HudAuthor.Text = string.Format(Properties.Resources.ui_author, selection.Author);
+ HudDesc.Text = selection.Description;
+
+ int rowIndex = 0, columnIndex = 0;
+ HudScreenshots.Children.Clear();
+ foreach (var x in selection.Screenshots)
+ {
+ var screenshot = new Image
+ {
+ Source = new BitmapImage(new Uri(x))
+ };
+
+ if (columnIndex > 1)
+ {
+ rowIndex++;
+ columnIndex = 0;
+ }
+
+ Grid.SetRow(screenshot, rowIndex);
+ Grid.SetColumn(screenshot, columnIndex);
+
+ columnIndex++;
+ HudScreenshots.Children.Add(screenshot);
+ }
+
+ BtnGitHub.IsEnabled = !string.IsNullOrWhiteSpace(selection.GitHubUrl);
+ BtnHuds.IsEnabled = !string.IsNullOrWhiteSpace(selection.HudsTfUrl);
+ BtnDiscord.IsEnabled = !string.IsNullOrWhiteSpace(selection.DiscordUrl);
+ BtnSteam.IsEnabled = !string.IsNullOrWhiteSpace(selection.SteamUrl);
+ }
// Disable the social media buttons if they don't have a link.
BtnGitHub.IsEnabled = !string.IsNullOrWhiteSpace(selection.GitHubUrl);
@@ -260,15 +304,11 @@ private void SetPageView()
private void SetPageBackground()
{
// Reset the application to the default background color.
- if (GbSelectHud.IsVisible)
- {
- MainGrid.Background = (Brush) new BrushConverter().ConvertFromString("#2B2724");
- return;
- }
+ MainGrid.Background = (Brush)new BrushConverter().ConvertFromString("#2B2724");
// If a HUD is selected, retrieve the set Background value if available.
var selection = Json.GetHUDByName(Settings.Default.hud_selected);
- if (selection?.Background == null) return;
+ if (selection?.Background == null || AppInfo.IsVisible) return;
Logger.Info($"Changing background to: {selection.Background}");
if (selection.Background.StartsWith("http"))
@@ -377,15 +417,15 @@ private void BtnInstall_OnClick(object sender, RoutedEventArgs e)
if (string.IsNullOrWhiteSpace(HudSelection)) return;
var selection = Json.GetHUDByName(Settings.Default.hud_selected);
selection.Settings.SaveSettings();
+ if (!selection.Customizable) return;
EditorContainer.Children.Clear();
EditorContainer.Children.Add(selection.GetControls());
+ selection.ApplyCustomizations();
});
};
worker.RunWorkerCompleted += (_, _) =>
{
LblStatus.Content = string.Format(Properties.Resources.status_installed_now, Settings.Default.hud_selected, DateTime.Now);
- Json.GetHUDByName(Settings.Default.hud_selected).ApplyCustomizations();
- LblStatus.Content = string.Format(Properties.Resources.status_applied, Settings.Default.hud_selected, DateTime.Now);
SetPageControls();
};
worker.RunWorkerAsync();
@@ -478,6 +518,8 @@ private void BtnSwitch_OnClick(object sender, RoutedEventArgs e)
{
Logger.Info("Changing page view to: main menu.");
GbSelectHud.Visibility = Visibility.Visible;
+ AppInfo.Visibility = Visibility.Visible;
+ HudInfo.Visibility = Visibility.Hidden;
EditorContainer.Children.Clear();
SetPageControls();
SetPageBackground();
diff --git a/src/TF2HUD.Editor/Models/HudJson.cs b/src/TF2HUD.Editor/Models/HudJson.cs
index 03fe3b87..2fdb71ec 100644
--- a/src/TF2HUD.Editor/Models/HudJson.cs
+++ b/src/TF2HUD.Editor/Models/HudJson.cs
@@ -16,6 +16,10 @@ public class HudJson
[JsonPropertyName("Maximize")] public bool Maximize;
[JsonPropertyName("Opacity")] public double Opacity = 0.5;
[JsonPropertyName("Thumbnail")] public string Thumbnail;
+ [JsonPropertyName("Name")] public string Name;
+ [JsonPropertyName("Description")] public string Description;
+ [JsonPropertyName("Author")] public string Author;
+ [JsonPropertyName("Screenshots")] public string[] Screenshots;
}
public class Links
diff --git a/src/TF2HUD.Editor/Properties/Resources.Designer.cs b/src/TF2HUD.Editor/Properties/Resources.Designer.cs
index 623f211e..e2b3ed0d 100644
--- a/src/TF2HUD.Editor/Properties/Resources.Designer.cs
+++ b/src/TF2HUD.Editor/Properties/Resources.Designer.cs
@@ -303,6 +303,24 @@ public static string ui_apply {
}
}
+ ///
+ /// Looks up a localized string similar to Created by: {0}.
+ ///
+ public static string ui_author {
+ get {
+ return ResourceManager.GetString("ui_author", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Back.
+ ///
+ public static string ui_back {
+ get {
+ return ResourceManager.GetString("ui_back", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Set Directory.
///
diff --git a/src/TF2HUD.Editor/Properties/Resources.resx b/src/TF2HUD.Editor/Properties/Resources.resx
index e99ee916..9134b0a9 100644
--- a/src/TF2HUD.Editor/Properties/Resources.resx
+++ b/src/TF2HUD.Editor/Properties/Resources.resx
@@ -198,6 +198,12 @@
Apply Changes
+
+ Created by: {0}
+
+
+ Back
+
Set Directory