Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MilonPL committed Nov 4, 2024
1 parent d05fd6d commit 163e4ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;
public sealed class PriceHistoryTable : BoxContainer
{
private readonly GridContainer _grid;
private static readonly Color PositiveColor = Color.FromHex("#00ff00");
private static readonly Color NegativeColor = Color.FromHex("#ff0000");
private static readonly Color NeutralColor = Color.FromHex("#ffffff");

public PriceHistoryTable()
{
Expand Down Expand Up @@ -43,12 +40,12 @@ public PriceHistoryTable()
// Create and apply the style
var styleBox = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#1a1a1a"),
BackgroundColor = StockTradingUiFragment.BackgroundColor,
ContentMarginLeftOverride = 6,
ContentMarginRightOverride = 6,
ContentMarginTopOverride = 4,
ContentMarginBottomOverride = 4,
BorderColor = Color.FromHex("#404040"),
BorderColor = StockTradingUiFragment.BorderColor,
BorderThickness = new Thickness(1),
};

Expand Down Expand Up @@ -106,9 +103,9 @@ public void Update(List<float> priceHistory)
StyleClasses = { "LabelSubText" },
Modulate = priceChange switch
{
> 0 => PositiveColor,
< 0 => NegativeColor,
_ => NeutralColor,
> 0 => StockTradingUiFragment.PositiveColor,
< 0 => StockTradingUiFragment.NegativeColor,
_ => StockTradingUiFragment.NeutralColor,
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@
namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the

Check failure on line 11 in Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type StockTradingUiFragment should be declared with the 'partial' keyword as it is annotated with the
public sealed partial class StockTradingUiFragment : BoxContainer
public sealed class StockTradingUiFragment : BoxContainer
{
private readonly Dictionary<string, CompanyEntry> _companyEntries = new();

// Event handlers for the parent UI
public event Action<string, float>? OnBuyButtonPressed;
public event Action<string, float>? OnSellButtonPressed;

// Define colors
public static readonly Color PositiveColor = Color.FromHex("#00ff00"); // Green
public static readonly Color NegativeColor = Color.FromHex("#ff0000"); // Red
public static readonly Color NeutralColor = Color.FromHex("#ffffff"); // White
public static readonly Color BackgroundColor = Color.FromHex("#25252a"); // Dark grey
public static readonly Color BorderColor = Color.FromHex("#404040"); // Light grey

public StockTradingUiFragment()
{
RobustXamlLoader.Load(this);
Expand Down Expand Up @@ -61,15 +68,6 @@ private sealed class CompanyEntry
private readonly LineEdit _amountEdit;
private readonly PriceHistoryTable _priceHistory;

// Define colors
private static readonly Color PositiveColor = Color.FromHex("#00ff00"); // Green
private static readonly Color NegativeColor = Color.FromHex("#ff0000"); // Red
private static readonly Color NeutralColor = Color.FromHex("#ffffff"); // White
private static readonly Color BackgroundColor = Color.FromHex("#25252a"); // Dark grey
private static readonly Color BorderColor = Color.FromHex("#404040"); // Light grey



public CompanyEntry(string companyName,
Action<string, float>? onBuyPressed,
Action<string, float>? onSellPressed)
Expand Down
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/deltav/cargo/stocks-commands.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ cmd-changestocksprice-desc = Changes a company's stock price to the specified nu
cmd-changestocksprice-help = changestockprice <Company name> <New price>
cmd-changestocksprice-failure = Failed to execute command! Invalid company name or the new price exceeds the allowed limit.
cmd-addstockscompany-desc = Adds a new company to the stocks market.
cmd-addstockscompany-help = addstockscompany <Company name> <Base price>
cmd-addstockscompany-help = addstockscompany <Name> <Display name> <Base price>
cmd-addstockscompany-already-exists = Failed to execute command! Are you sure the company doesn't exist already?
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ mail-metrics-money-header = Spesos
mail-metrics-total = Total
mail-metrics-progress = {$opened} out of {$total} packages opened!
mail-metrics-progress-percent = Success rate: {$successRate}%
stock-trading-program-name = StockTrading
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
ui: !type:StockTradingUi
- type: StockTradingCartridge
- type: Cartridge
programName: StockTrading
programName: stock-trading-program-name
icon:
sprite: DeltaV/Misc/program_icons.rsi
state: stock_trading
Expand Down

0 comments on commit 163e4ec

Please sign in to comment.