Skip to content

Commit

Permalink
Allow different art to be used on left/right suports from front/back …
Browse files Browse the repository at this point in the history
…supports
  • Loading branch information
qkmaxware committed Dec 22, 2021
1 parent 633e249 commit 42fade5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
16 changes: 8 additions & 8 deletions Shared/TerrainDrawer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ if (Terrain.Kind == TerrainKind.Freestanding) {
<div style="display: flex;">
<div class="solid cut-left cut-top fold-right cut-bottom" style="width: @(Terrain.Height)in; height: @(Terrain.Height)in;"></div>
<div class="solid fold-left fold-right cut-top fold-bottom" style="width: @(Terrain.Length)in; height: @(Terrain.Height)in;">
@if (Terrain.SupportArt != null && !string.IsNullOrEmpty(Terrain.SupportArt.Url)) {
@if (Terrain.FrontBackSupportArt != null && !string.IsNullOrEmpty(Terrain.FrontBackSupportArt.Url)) {
<div class="fill">
<img class="fill pixelart yflip" src="@Terrain.SupportArt.Url" style="object-fit: fill;">
<img class="fill pixelart yflip" src="@Terrain.FrontBackSupportArt.Url" style="object-fit: fill;">
</div>
}
</div>
<div class="solid cut-right cut-top fold-left cut-bottom" style="width: @(Terrain.Height)in; height: @(Terrain.Height)in;"></div>
</div>
<div style="display: flex;">
<div class="solid cut-left cut-top fold-right cut-bottom" style="width: @(Terrain.Height)in; height: @(Terrain.Depth)in;">
@if (Terrain.SupportArt != null && !string.IsNullOrEmpty(Terrain.SupportArt.Url)) {
@if (Terrain.LeftRightSupportArt != null && !string.IsNullOrEmpty(Terrain.LeftRightSupportArt.Url)) {
<div class="fill center-image-rotate90">
<img class="pixelart" src="@Terrain.SupportArt.Url" style="object-fit: fill; width: @(Terrain.Length)in; height: @(Terrain.Depth)in;">
<img class="pixelart" src="@Terrain.LeftRightSupportArt.Url" style="object-fit: fill; width: @(Terrain.Length)in; height: @(Terrain.Depth)in;">
</div>
}
</div>
Expand All @@ -81,19 +81,19 @@ if (Terrain.Kind == TerrainKind.Freestanding) {
</div>
</div>
<div class="solid cut-right cut-top fold-left cut-bottom" style="width: @(Terrain.Height)in; height: @(Terrain.Depth)in;">
@if (Terrain.SupportArt != null && !string.IsNullOrEmpty(Terrain.SupportArt.Url)) {
@if (Terrain.LeftRightSupportArt != null && !string.IsNullOrEmpty(Terrain.LeftRightSupportArt.Url)) {
<div class="fill center-image-rotate-90">
<img class="pixelart" src="@Terrain.SupportArt.Url" style="object-fit: fill; width: @(Terrain.Length)in; height: @(Terrain.Height)in;">
<img class="pixelart" src="@Terrain.LeftRightSupportArt.Url" style="object-fit: fill; width: @(Terrain.Length)in; height: @(Terrain.Height)in;">
</div>
}
</div>
</div>
<div style="display: flex;">
<div class="solid cut-left cut-top fold-right cut-bottom" style="width: @(Terrain.Height)in; height: @(Terrain.Height)in;"></div>
<div class="solid fold-left fold-right fold-top cut-bottom" style="width: @(Terrain.Length)in; height: @(Terrain.Height)in;">
@if (Terrain.SupportArt != null && !string.IsNullOrEmpty(Terrain.SupportArt.Url)) {
@if (Terrain.FrontBackSupportArt != null && !string.IsNullOrEmpty(Terrain.FrontBackSupportArt.Url)) {
<div class="fill">
<img class="fill pixelart" src="@Terrain.SupportArt.Url" style="object-fit: fill;">
<img class="fill pixelart" src="@Terrain.FrontBackSupportArt.Url" style="object-fit: fill;">
</div>
}
</div>
Expand Down
29 changes: 22 additions & 7 deletions Shared/TerrainEditor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,25 @@
<FilePicker Accept="image/*" AsDataUrl=true OnFileLoad=@((url) => { mini.Art.Url = url; StateHasChanged(); })></FilePicker>
} else {
if (mini.Kind.UsesSupportWalls()) {
<label>URL</label>
<input class="w3-input" @bind=@mini.SupportArt.Url style="background-color:inherit; color:inherit;">
<div class="w3-center w3-padding">
OR
<label><b>Front/Back Art</b></label>
<div class="w3-margin-left w3-margin-bottom">
<label>URL</label>
<input class="w3-input" @bind=@mini.FrontBackSupportArt.Url style="background-color:inherit; color:inherit;">
<div class="w3-center w3-padding">
OR
</div>
<FilePicker Accept="image/*" AsDataUrl=true OnFileLoad=@((url) => { mini.FrontBackSupportArt.Url = url; StateHasChanged(); })></FilePicker>
</div>

<label><b>Left/Right Art</b></label>
<div class="w3-margin-left">
<label>URL</label>
<input class="w3-input" @bind=@mini.LeftRightSupportArt.Url style="background-color:inherit; color:inherit;">
<div class="w3-center w3-padding">
OR
</div>
<FilePicker Accept="image/*" AsDataUrl=true OnFileLoad=@((url) => { mini.LeftRightSupportArt.Url = url; StateHasChanged(); })></FilePicker>
</div>
<FilePicker Accept="image/*" AsDataUrl=true OnFileLoad=@((url) => { mini.SupportArt.Url = url; StateHasChanged(); })></FilePicker>
} else {
<p>
This kind of terrain does not have support walls
Expand Down Expand Up @@ -103,8 +116,10 @@
if (value == false)
_secondArtTab = false;
else if (mini != null) {
if (mini.SupportArt == null)
mini.SupportArt = new TerrainArt();
if (mini.FrontBackSupportArt == null)
mini.FrontBackSupportArt = new TerrainArt();
if (mini.LeftRightSupportArt == null)
mini.LeftRightSupportArt = new TerrainArt();
_secondArtTab = value;
}
}
Expand Down
3 changes: 2 additions & 1 deletion TerrainData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class Terrain {
public string Name {get; set;}
public TerrainKind Kind {get; set;}
public TerrainArt Art {get; set;}
public TerrainArt SupportArt {get; set;}
public TerrainArt FrontBackSupportArt {get; set;}
public TerrainArt LeftRightSupportArt {get; set;}
public int Replicas {get; set;}

public float Length {get; set;}
Expand Down

0 comments on commit 42fade5

Please sign in to comment.