-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly implement markings for all gens
- Loading branch information
1 parent
e4d10a8
commit d5af51c
Showing
11 changed files
with
137 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="@MarkingClass" @onclick="@Toggle"> | ||
@DisplayString | ||
</span> |
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,37 @@ | ||
using static Pkmds.Rcl.MarkingsHelper; | ||
|
||
namespace Pkmds.Rcl.Components; | ||
|
||
public partial class MarkingComponent | ||
{ | ||
[Parameter, EditorRequired] | ||
public PKM? Pokemon { get; set; } | ||
|
||
[Parameter, EditorRequired] | ||
public Markings Shape { get; set; } | ||
|
||
private string DisplayString => Shape switch | ||
{ | ||
Markings.Circle => Circle, | ||
Markings.Triangle => Triangle, | ||
Markings.Square => Square, | ||
Markings.Heart => Heart, | ||
Markings.Star => Star, | ||
Markings.Diamond => Diamond, | ||
_ => string.Empty, | ||
}; | ||
|
||
private string MarkingClass => $"marking{Pokemon?.GetMarking((int)Shape) switch | ||
{ | ||
null => string.Empty, | ||
0 => " gray-mark", | ||
1 => Pokemon.Generation >= 7 ? " blue-mark" : " black-mark", | ||
2 => " red-mark", | ||
_ => string.Empty, | ||
}}"; | ||
|
||
private void Toggle() | ||
{ | ||
Pokemon?.ToggleMarking((int)Shape); | ||
} | ||
} |
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,25 @@ | ||
.marking { | ||
max-width: 68.63px; | ||
font-size: 3.0rem; | ||
text-align: center; | ||
cursor: pointer; | ||
user-select: none; | ||
border: 1px solid lightgray; | ||
border-radius: 10px; | ||
} | ||
|
||
.gray-mark { | ||
color: gray; | ||
} | ||
|
||
.black-mark { | ||
color: black; | ||
} | ||
|
||
.blue-mark { | ||
color: blue; | ||
} | ||
|
||
.red-mark { | ||
color: red; | ||
} |
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,25 @@ | ||
@if (Pokemon is { Generation: >= 3 }) | ||
{ | ||
<div class="@ContainerClass"> | ||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Circle" /> | ||
|
||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Triangle" /> | ||
|
||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Square" /> | ||
|
||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Heart" /> | ||
|
||
@if (Pokemon.Generation >= 4) | ||
{ | ||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Star" /> | ||
|
||
<MarkingComponent Pokemon="@Pokemon" | ||
Shape="MarkingsHelper.Markings.Diamond" /> | ||
} | ||
</div> | ||
} |
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,13 @@ | ||
namespace Pkmds.Rcl.Components; | ||
|
||
public partial class MarkingsContainer | ||
{ | ||
[Parameter, EditorRequired] | ||
public PKM? Pokemon { get; set; } | ||
|
||
private string ContainerClass => $"markings-container{(Pokemon is { Generation: 3 } ? " gen-3" : string.Empty)}"; | ||
|
||
protected override void OnInitialized() => RefreshService.OnAppStateChanged += StateHasChanged; | ||
|
||
public void Dispose() => RefreshService.OnAppStateChanged -= StateHasChanged; | ||
} |
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,12 @@ | ||
.markings-container { | ||
display: grid; | ||
grid-template-columns: repeat(3, 1fr); | ||
grid-template-rows: repeat(2, 1fr); | ||
grid-gap: 25px; | ||
padding-top: 3px; | ||
} | ||
|
||
.gen-3 { | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-template-rows: repeat(2, 1fr); | ||
} |
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,21 @@ | ||
namespace Pkmds.Rcl; | ||
|
||
public static class MarkingsHelper | ||
{ | ||
public enum Markings | ||
{ | ||
Circle = 0, | ||
Triangle = 1, | ||
Square = 2, | ||
Heart = 3, | ||
Star = 4, | ||
Diamond = 5, | ||
} | ||
|
||
public const string Circle = "●"; | ||
public const string Triangle = "▲"; | ||
public const string Square = "■"; | ||
public const string Heart = "♥︎"; | ||
public const string Star = "★"; | ||
public const string Diamond = "♦︎"; | ||
} |
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