-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
69 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...es/Shared/ImageChangers/BacgroundImage.cs → ...s/Shared/ImageChangers/BackgroundImage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 24 additions & 18 deletions
42
...ed/ImageChangers/BacgroundImageChanger.cs → ...d/ImageChangers/BackgroundImageChanger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,76 @@ | ||
using Fracture.Server.Components.Pages; | ||
using Fracture.Server.Modules.MapGenerator.Models; | ||
using Fracture.Server.Modules.MapGenerator.Models; | ||
using Fracture.Server.Modules.MapGenerator.UI; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Fracture.Server.Modules.Shared.ImageChanger; | ||
namespace Fracture.Server.Modules.Shared.ImageChangers; | ||
|
||
public class BacgroundImageChanger | ||
public class BackgroundImageChanger | ||
{ | ||
[Parameter] | ||
public required BacgroundImage? _bacgroundImage { get; set; } | ||
public required BackgroundImage? BackgroundImage { get; set; } | ||
|
||
[Parameter] | ||
public required MapData Map { get; set; } | ||
|
||
public Task changeBgImgAsync() | ||
private ILogger<BackgroundImageChanger> logger; | ||
public Task ChangeBgImgAsync() | ||
{ | ||
Console.WriteLine(MapView.CharacterXX); | ||
var biome = Map.Grid[MapView.CharacterXX, MapView.CharacterYY].TerrainType; | ||
Console.WriteLine(biome); | ||
|
||
|
||
if (BackgroundImage is null) | ||
{ | ||
logger.LogError("BackgroundImage is missing"); | ||
return Task.CompletedTask; | ||
} | ||
|
||
switch (biome) | ||
{ | ||
case TerrainType.Forest: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/river.jpg"; | ||
Console.WriteLine(_bacgroundImage.bgImg); | ||
BackgroundImage.bgImg = "../assets/background/river.jpg"; | ||
break; | ||
} | ||
case TerrainType.Grassland: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/river.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/river.jpg"; | ||
break; | ||
} | ||
case TerrainType.Mountains: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/mountains.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/mountains.jpg"; | ||
break; | ||
} | ||
case TerrainType.Beach: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/lava.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/lava.jpg"; | ||
break; | ||
} | ||
case TerrainType.HighMountains: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
break; | ||
} | ||
case TerrainType.DeepOcean: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
break; | ||
} | ||
case TerrainType.ShallowWater: | ||
{ | ||
_bacgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
break; | ||
} | ||
default: | ||
_bacgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
BackgroundImage.bgImg = "../assets/background/mountainsRiver.jpg"; | ||
break; | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public event EventHandler<EventArgs> BgImgChanged; | ||
public event EventHandler<EventArgs>? BgImgChanged; | ||
|
||
public void NotifyListChanged(object sender, EventArgs e) => BgImgChanged?.Invoke(sender, e); | ||
public void NotifyListChanged(object? sender, EventArgs e) => BgImgChanged?.Invoke(sender, e); | ||
} |
12 changes: 0 additions & 12 deletions
12
Server/Modules/Shared/ImageChangers/IBacgroundImageChanger.cs
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Server/Modules/Shared/ImageChangers/IBackgroundImageChanger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Fracture.Server.Modules.Shared.ImageChangers; | ||
|
||
public interface IBackgroundImageChanger | ||
{ | ||
[Parameter] | ||
BackgroundImage BackgroundImage { get; set; } | ||
|
||
void change(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters