Skip to content

Commit

Permalink
feat: new background on game page, equipment fix and restyling, fixed…
Browse files Browse the repository at this point in the history
… stat table, added favicon and map generater upscale to 80x80
  • Loading branch information
Fabiano1010 committed Nov 21, 2024
1 parent 016845e commit 1b53a96
Show file tree
Hide file tree
Showing 14 changed files with 219 additions and 98 deletions.
2 changes: 1 addition & 1 deletion Server/Components/Pages/Error.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/Error"
@using System.Diagnostics

<link rel="icon" type="image/png" href="assets/favicon.png"/>
<PageTitle>Error</PageTitle>

<h1 class="text-danger">Error.</h1>
Expand Down
2 changes: 2 additions & 0 deletions Server/Components/Pages/GamePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
@inject VersionInfoProvider VersionInfoProvider
@inject IMapGeneratorService MapGeneratorService

<link rel="icon" type="image/png" href="assets/favicon.png"/>

<div id="container">
<div class="leftPanel borderPanel">
<div class="stats">
Expand Down
2 changes: 2 additions & 0 deletions Server/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
@inject ProtectedSessionStorage ProtectedSessionStore

<link rel="icon" type="image/png" href="assets/favicon.png"/>

<div id="container">

<div class="title">
Expand Down
34 changes: 19 additions & 15 deletions Server/Components/Popups/EquipmentPopup.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@
@inject IItemsRepository ItemsRepository
@inject ILogger<EquipmentPopup> Logger



<div class="row">
<div class="buttonEquipBg">
<button class = "buttonEquip" @onclick="GenerateNewItem">Generate new item </button>
</div>
<div class=equipmentContent style="height: 65vh">
<div class="eqColumn">
Inventory
@foreach (var item in Inventory.Where(x => !IsEquipped(x)))
{
<ItemCard Item="@item" OnEquipClicked="() => Equip(item)" IsEquipped="IsEquipped(item)" OnUnequipClicked="() => Unequip(item)"></ItemCard>
}
</div>
<div class="eqColumn">
Equipped
@foreach (var item in Equipment)
{
<ItemCard Item="@item" OnEquipClicked="() => Equip(item)" IsEquipped="IsEquipped(item)" OnUnequipClicked="() => Unequip(item)"></ItemCard>
}
</div>
<div class=equipmentContent>
<div>Inventory</div>
<div class="eqColumn">

@foreach (var item in Inventory.Where(x => !IsEquipped(x)))
{
<ItemCard Item="@item" OnEquipClicked="() => Equip(item)" IsEquipped="IsEquipped(item)" OnUnequipClicked="() => Unequip(item)"></ItemCard>
}
</div>
<div>Equipped</div>
<div class="eqColumn">

@foreach (var item in Equipment)
{
<ItemCard Item="@item" OnEquipClicked="() => Equip(item)" IsEquipped="IsEquipped(item)" OnUnequipClicked="() => Unequip(item)"></ItemCard>
}
</div>

</div>
</div>
Expand Down
43 changes: 29 additions & 14 deletions Server/Components/UI/ItemCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,42 @@
@using Fracture.Server.EnumExtensions

<div class="col">
<div class="card" style="min-width: 13rem;">
<div class="card-header" style="background-color: var(@Item.Rarity.ToCssClassName())">
@Item.Name
</div>
<div class="card-body">
<button class="buttonEquip" @onmouseover="ShowItemHistoryAsync" @onmouseleave="HideItemHistoryAsync" data-bs-toggle="collapse" data-bs-target="#collapse-@guid">Item History </button>
<div class="collapse" id="collapse-@guid">
<p class="card-text">@Item.History</p>
</div>
<ItemStats Item="@Item"></ItemStats>
<div>@Item.Type.ToString()</div>

<div class="card" >
<div class="card-header">
<div class="item-name">@Item.Type.ToString()</div>
@if (IsEquipped)
{
<button class="buttonEquip" @onclick="OnUnequipClicked">Unequip this</button>
<div class="item-card" style="background-color: var(@Item.Rarity.ToCssClassName()); opacity: 1;">
@Item.Name
</div>
}
else
{
<button class="buttonEquip" @onclick="OnEquipClicked">Equip this</button>
<div class="item-card" style="background-color: var(@Item.Rarity.ToCssClassName())">
@Item.Name
</div>
}
</div>

<div class="card-body">
<div class="body-buttons">
<div class="actionButton itemButton" @onmouseover="ShowItemHistoryAsync" @onmouseleave="HideItemHistoryAsync" data-bs-toggle="collapse" data-bs-target="#collapse-@guid"><div class="actionButton-content">Item History </div></div>
@if (IsEquipped)
{
<div class="actionButton itemButton" @onclick="OnUnequipClicked"><div class="actionButton-content">Unequip this</div></div>
}
else
{
<div class="actionButton itemButton" @onclick="OnEquipClicked"><div class="actionButton-content">Equip this</div></div>
}
</div>
<div class="collapse" id="collapse-@guid">
<p class="card-text">@Item.History</p>
</div>
<div class="item-stats">
<ItemStats Item="@Item"></ItemStats>
</div>
</div>
</div>
</div>
<div class="collapse">
Expand Down
4 changes: 2 additions & 2 deletions Server/Components/UI/ItemStats.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@using Fracture.Server.Modules.Items.Models

<table class="table table-striped">
<table>
@foreach (var itemStat in Enum.GetValues<ItemStat>())
{
<tr><td>@itemStat</td><td class="text-end">@Item.Statistics.GetStatFromItemStat(itemStat)</td></tr>
<tr><td class="stat-value-right-align">@itemStat</td><td class="stat-value">@Item.Statistics.GetStatFromItemStat(itemStat)</td></tr>
}
</table>

Expand Down
8 changes: 6 additions & 2 deletions Server/Components/UI/UserStats.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
@using Fracture.Server.Modules.Items.Models
@using System.Collections.ObjectModel

<table>
<table class="stat-table">
@foreach (var itemStat in Enum.GetValues<ItemStat>())
{
var stat = Equipment.Sum(x => x.Statistics.GetStatFromItemStat(itemStat));
<tr><td><img src=@("assets/" + images[itemStat])></td><td>@itemStat</td><td>@stat</td></tr>
<tr>
<td><img src=@("assets/" + images[itemStat])></td>
<td>@itemStat</td>
<td class="stat-value-right-align">@stat</td>
</tr>
}
</table>

Expand Down
6 changes: 3 additions & 3 deletions Server/Modules/MapGenerator/Services/MapGeneratorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class MapGeneratorService : IMapGeneratorService
private readonly float _persistence = 0.5f; // How much consecutive octaves contribute to the noise
private readonly float _lacunarity = 2f; // How fast the frequency increases for each octave
private readonly int _octaves = 3; // Number of octaves
private readonly float _scale = 3f; // Scale of the noise, bigger scale = more zoomed in
private readonly float _scale = 1f; // Scale of the noise, bigger scale = more zoomed in
private readonly float _falloff = 0.3f; // How much the falloff map affects the heightmap
private readonly float _sharpness = 1f; // How "sharp" heightmap is. Just a power function
private readonly float _boost = 0.2f; // Flat boost to heightmap. Adds, then clamps
Expand All @@ -35,8 +35,8 @@ public Task<MapData> GetMap(NoiseParameters noiseParameters)

private MapData GenerateMap(NoiseParameters noiseParameters)
{
int width = 64;
int height = 64;
int width = 80;
int height = 80;
bool useFalloff = true;
_seed = noiseParameters.UseRandomSeed ? _rnd.Next(int.MaxValue) : noiseParameters.Seed;

Expand Down
Binary file added Server/wwwroot/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Server/wwwroot/assets/panelbg1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1b53a96

Please sign in to comment.