using Content.Shared._NF.Research;
using Robust.Client.Graphics;
using Robust.Shared.Maths;
namespace Content.Client._NF.Research.UI;
///
/// Utility class for creating research-themed UI elements
///
public static class ResearchUIHelpers
{
///
/// Create a StyleBoxFlat with research-appropriate colors
///
/// Background color
/// Border color
/// Border thickness (default: 1)
/// Configured StyleBoxFlat
public static StyleBoxFlat CreateResearchStyleBox(Color backgroundColor, Color borderColor,
float borderThickness = 1f)
{
return new StyleBoxFlat
{
BackgroundColor = backgroundColor,
BorderColor = borderColor,
BorderThickness = new Thickness(borderThickness),
Padding = new Thickness(3),
ContentMarginBottomOverride = 3,
ContentMarginLeftOverride = 5,
ContentMarginRightOverride = 5,
ContentMarginTopOverride = 3,
};
}
///
/// Create a research-themed StyleBoxFlat for a specific availability state
///
/// Research availability state
/// Primary discipline color
/// Border thickness (default: 2.5)
/// Configured StyleBoxFlat
public static StyleBoxFlat CreateTechItemStyleBox(ResearchAvailability availability, Color primaryColor,
float borderThickness = 2.5f)
{
var darkenFactor = ResearchColorScheme.GetBackgroundInterpolationFactor(availability);
var backgroundColor = Color.InterpolateBetween(primaryColor, Color.Black, darkenFactor);
var borderColor = ResearchColorScheme.GetTechBorderColor(availability);
return CreateResearchStyleBox(backgroundColor, borderColor, borderThickness);
}
///
/// Create a research-themed RoundedStyleBoxFlat for a specific availability state
///
/// Research availability state
/// Primary discipline color
/// Border thickness (default: 2.5)
/// Corner radius (default: 8)
/// Configured RoundedStyleBoxFlat
public static RoundedStyleBoxFlat CreateRoundedTechItemStyleBox(ResearchAvailability availability,
Color primaryColor, float borderThickness = 2.5f, float cornerRadius = 8f)
{
var darkenFactor = ResearchColorScheme.GetBackgroundInterpolationFactor(availability);
var backgroundColor = Color.InterpolateBetween(primaryColor, Color.Black, darkenFactor);
var borderColor = ResearchColorScheme.GetTechBorderColor(availability);
return new RoundedStyleBoxFlat
{
BackgroundColor = backgroundColor,
BorderColor = borderColor,
BorderThickness = new Thickness(borderThickness),
CornerRadius = cornerRadius
};
}
///
/// Create scrollbar StyleBoxFlat with research theme
///
/// Scrollbar state (normal, hovered, grabbed)
/// Configured StyleBoxFlat
public static StyleBoxFlat CreateScrollbarStyleBox(string state = "normal")
{
var color = state.ToLower() switch
{
"hovered" => ResearchColorScheme.UIColors.Scrollbar.Hovered,
"grabbed" => ResearchColorScheme.UIColors.Scrollbar.Grabbed,
_ => ResearchColorScheme.UIColors.Scrollbar.Normal
};
return new StyleBoxFlat
{
BackgroundColor = color,
ContentMarginLeftOverride = 10,
ContentMarginTopOverride = 10
};
}
}