upload
This commit is contained in:
commit
1c7a8cf25f
579 files changed
+83196
No files matched your search
@@ -0,0 +1,10 @@
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
public enum Complaint
|
||||
{
|
||||
None,
|
||||
TooDark,
|
||||
WashedOut,
|
||||
EyeStrain,
|
||||
FlatRecordings
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
public static class DemoEngine
|
||||
{
|
||||
internal sealed class NeverTouchesGamma : IGammaRamp
|
||||
{
|
||||
public void Apply(ushort[] ramp)
|
||||
{
|
||||
throw new InvalidOperationException("The first-run demonstration must never write a gamma ramp. Windows does not restore ramps when a process dies, so a crash mid-demo would leave a stranger's monitor altered with no PlexusX behind it. Everything the demo shows goes through the colour matrix, which dies with the process.");
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public readonly record struct Built(VibranceEngine? Engine, ISaturationOverlay? Overlay);
|
||||
|
||||
public static Built TryBuild(Func<ISaturationOverlay> overlay, Func<IVibranceController> driver, Action<Exception> log)
|
||||
{
|
||||
if (overlay == null)
|
||||
{
|
||||
throw new ArgumentNullException("overlay");
|
||||
}
|
||||
if (driver == null)
|
||||
{
|
||||
throw new ArgumentNullException("driver");
|
||||
}
|
||||
ISaturationOverlay saturationOverlay = null;
|
||||
try
|
||||
{
|
||||
saturationOverlay = overlay();
|
||||
return new Built(Create(saturationOverlay, driver().DriverState), saturationOverlay);
|
||||
}
|
||||
catch (Exception obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
log?.Invoke(obj);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (saturationOverlay is IDisposable disposable)
|
||||
{
|
||||
try
|
||||
{
|
||||
disposable.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public static VibranceEngine Create(ISaturationOverlay overlay, VibranceDriverState driverState)
|
||||
{
|
||||
if (overlay == null)
|
||||
{
|
||||
throw new ArgumentNullException("overlay");
|
||||
}
|
||||
return new VibranceEngine(new NullVibranceController(driverState), overlay, new NeverTouchesGamma())
|
||||
{
|
||||
PaidControlsUnlocked = true
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
public static class DemoGrades
|
||||
{
|
||||
public readonly record struct Grade(int Saturation, int Vibrance, int Brightness, int Contrast, int Temperature)
|
||||
{
|
||||
public void ApplyTo(VibranceEngine engine)
|
||||
{
|
||||
if (engine == null)
|
||||
{
|
||||
throw new ArgumentNullException("engine");
|
||||
}
|
||||
engine.Saturation = Saturation;
|
||||
engine.Vibrance = Vibrance;
|
||||
engine.Brightness = Brightness;
|
||||
engine.Contrast = Contrast;
|
||||
engine.Temperature = Temperature;
|
||||
}
|
||||
}
|
||||
|
||||
private const int UntouchedVibrance = 50;
|
||||
|
||||
public static Grade Opening => new Grade(205, 100, 100, 104, -6);
|
||||
|
||||
public static Grade ForGame(string? game)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(game) || game == "Something else")
|
||||
{
|
||||
return Opening;
|
||||
}
|
||||
if (!SetupAnswers.Games.Any((string g) => string.Equals(g, game, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return Opening;
|
||||
}
|
||||
return new Grade(SetupAnswers.SaturationFor(game), 50, 100, 100, 0);
|
||||
}
|
||||
|
||||
public static Grade ForComplaint(Complaint complaint)
|
||||
{
|
||||
return complaint switch
|
||||
{
|
||||
Complaint.WashedOut => new Grade(245, 100, 100, 110, -8),
|
||||
Complaint.TooDark => new Grade(215, 100, 108, 92, -12),
|
||||
Complaint.EyeStrain => new Grade(150, 90, 96, 98, 18),
|
||||
Complaint.FlatRecordings => new Grade(230, 100, 100, 104, -6),
|
||||
_ => Opening,
|
||||
};
|
||||
}
|
||||
|
||||
public static string AnswerLine(Complaint complaint, VibranceDriverState driver)
|
||||
{
|
||||
return complaint switch
|
||||
{
|
||||
Complaint.WashedOut => "More colour and more separation between shades. Grey stops being one shade of grey.",
|
||||
Complaint.TooDark => "The dark end opened up and contrast eased off, so shade stops being a solid mass.",
|
||||
Complaint.EyeStrain => "Warmer, and less colour rather than more. This one asks for less - it is the only setting here that does.",
|
||||
Complaint.FlatRecordings => (driver == VibranceDriverState.Available) ? "Digital Vibrance is added after the picture is put together, so no recorder ever sees it. Everything PlexusX just did is in the picture itself, which is why a recording keeps it." : "All of this is in the picture itself, so what you record is what you see.",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
public static class Pricing
|
||||
{
|
||||
public const string MonthlyPlan = "monthly";
|
||||
|
||||
public const string LifetimePlan = "lifetime";
|
||||
|
||||
public const string MonthlyPrice = "€4.99";
|
||||
|
||||
public const string LifetimePrice = "€15.99";
|
||||
|
||||
public const string MonthlyLabel = "€4.99 / month";
|
||||
|
||||
public const string LifetimeLabel = "€15.99 once";
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
public sealed class SetupAnswers
|
||||
{
|
||||
public const string OtherGame = "Something else";
|
||||
|
||||
private static readonly string[] TunedGames = new string[6] { "Rust", "CS2", "Fortnite", "PUBG", "Valorant", "Rainbow Six Siege" };
|
||||
|
||||
private const int CalmSaturation = 100;
|
||||
|
||||
public static IReadOnlyList<string> Games => TunedGames.Concat(new string[1] { "Something else" }).ToList();
|
||||
|
||||
public string Game { get; set; } = "";
|
||||
|
||||
public Complaint Complaint { get; set; }
|
||||
|
||||
public bool WantsCrosshair { get; set; }
|
||||
|
||||
public int SeededSaturation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Complaint != Complaint.EyeStrain)
|
||||
{
|
||||
return SaturationFor(Game);
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
public static int SaturationFor(string? game)
|
||||
{
|
||||
if (string.Equals(game, "Valorant", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 145;
|
||||
}
|
||||
if (string.Equals(game, "Rainbow Six Siege", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 160;
|
||||
}
|
||||
if (string.Equals(game, "Fortnite", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 175;
|
||||
}
|
||||
if (string.Equals(game, "Rust", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 190;
|
||||
}
|
||||
if (string.Equals(game, "CS2", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 220;
|
||||
}
|
||||
if (string.Equals(game, "PUBG", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return 235;
|
||||
}
|
||||
return DemoGrades.Opening.Saturation;
|
||||
}
|
||||
|
||||
public void ApplyTo(AppSettings settings)
|
||||
{
|
||||
if (settings == null)
|
||||
{
|
||||
throw new ArgumentNullException("settings");
|
||||
}
|
||||
settings.FavoriteGame = Game ?? "";
|
||||
settings.CrosshairEnabled = WantsCrosshair;
|
||||
settings.EyeCare = Complaint == Complaint.EyeStrain;
|
||||
settings.StreamingMode = Complaint == Complaint.FlatRecordings;
|
||||
settings.SaturationPercent = SeededSaturation;
|
||||
}
|
||||
|
||||
public string Headline()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Game) && !(Game == "Something else"))
|
||||
{
|
||||
return "Your " + Game + " setup is ready";
|
||||
}
|
||||
return "Your setup is ready";
|
||||
}
|
||||
|
||||
public IEnumerable<string> WhatWasSetUp()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Game) && Game != "Something else")
|
||||
{
|
||||
yield return Game + " presets";
|
||||
}
|
||||
if (Complaint == Complaint.EyeStrain)
|
||||
{
|
||||
yield return "Eye care, to take the edge off long sessions";
|
||||
}
|
||||
if (WantsCrosshair)
|
||||
{
|
||||
yield return "Crosshair overlay";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using VibranceHud.Controls;
|
||||
using VibranceHud.Design;
|
||||
|
||||
namespace VibranceHud.Onboarding;
|
||||
|
||||
internal static class WizardChrome
|
||||
{
|
||||
internal const int Radius = 8;
|
||||
|
||||
internal const int Border = 1;
|
||||
|
||||
internal static void Shape(Form form)
|
||||
{
|
||||
using GraphicsPath path = Glass.RoundedPath(new RectangleF(0f, 0f, form.Width + 1, form.Height + 1), Tokens.Scale(8));
|
||||
form.Region = new Region(path);
|
||||
}
|
||||
|
||||
internal static void PaintRim(Graphics g, Form form)
|
||||
{
|
||||
SmoothingMode smoothingMode = g.SmoothingMode;
|
||||
PixelOffsetMode pixelOffsetMode = g.PixelOffsetMode;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.PixelOffsetMode = PixelOffsetMode.Half;
|
||||
float num = 0.5f;
|
||||
using GraphicsPath path = Glass.RoundedPath(new RectangleF(num, num, (float)form.Width - num * 2f, (float)form.Height - num * 2f), Math.Max(1f, (float)Tokens.Scale(8) - num));
|
||||
using Pen pen = new Pen(SignalDialogWindow.EdgeInk, 1f);
|
||||
g.DrawPath(pen, path);
|
||||
g.SmoothingMode = smoothingMode;
|
||||
g.PixelOffsetMode = pixelOffsetMode;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user