reworked boon management for guild wars 2 builds

This commit is contained in:
t.ruspekhofer 2022-03-08 14:17:03 +01:00
parent 4a95958658
commit 3d7d409646
3 changed files with 31 additions and 17 deletions

View file

@ -24,26 +24,26 @@
<p>
<label>
Might:
<InputNumber @bind-Value="_build.Might" />
<InputCheckbox @bind-Value="_hasMight" />
Might
</label>
</p>
<p>
<label>
Quickness:
<InputNumber @bind-Value="_build.Quickness" />
<InputCheckbox @bind-Value="_hasHeal" />
Heal
</label>
</p>
<p>
<label>
Alacrity:
<InputNumber @bind-Value="_build.Alacrity" />
<InputCheckbox @bind-Value="_hasQuickness" />
Quickness
</label>
</p>
<p>
<label>
Heal:
<InputNumber @bind-Value="_build.Heal" />
<InputCheckbox @bind-Value="_hasAlacrity" />
Alacrity
</label>
</p>
@ -83,12 +83,21 @@
public string buildId { get; set; }
public GuildWars2Build _build;
private bool _hasMight;
private bool _hasHeal;
private bool _hasQuickness;
private bool _hasAlacrity;
protected override async Task OnInitializedAsync()
{
if(!string.IsNullOrEmpty(buildId) && int.TryParse(buildId, out int parsedId))
{
_build = GuildWars2BuildService.GetBuild(parsedId);
_hasMight = _build.Might > 0;
_hasHeal = _build.Heal > 0;
_hasQuickness = _build.Quickness > 0;
_hasAlacrity = _build.Alacrity > 0;
}
else
{
@ -108,6 +117,11 @@
private async Task HandleValidSubmit()
{
_build.Might = _hasMight ? (short)5 : (short)0;
_build.Heal = _hasHeal ? (short)5 : (short)0;
_build.Quickness = _hasQuickness ? (short)5 : (short)0;
_build.Alacrity = _hasAlacrity ? (short)5 : (short)0;
await GuildWars2BuildService.AddOrEditBuild(_build);
NavigationManager.NavigateTo("buildoverview");
}

View file

@ -35,10 +35,10 @@
</td>
<td>@build.Class.ToString()</td>
<td>@build.EliteSpecialization.ToString()</td>
<td>@build.Might.ToString()</td>
<td>@build.Heal.ToString()</td>
<td>@build.Quickness.ToString()</td>
<td>@build.Alacrity.ToString()</td>
<td><input type="checkbox" checked="@(build.Might > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Heal > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Quickness > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Alacrity > 0)" disabled="disabled" /></td>
</tr>
}
</table>

View file

@ -70,10 +70,10 @@
<td>@build.BuildName</td>
<td>@build.Class.ToString()</td>
<td>@build.EliteSpecialization.ToString()</td>
<td><input type="checkbox" checked="@(build.Might > 0)" disabled="true" /></td>
<td><input type="checkbox" checked="@(build.Heal > 0)" disabled="true" /></td>
<td><input type="checkbox" checked="@(build.Quickness > 0)" disabled="true" /></td>
<td><input type="checkbox" checked="@(build.Alacrity > 0)" disabled="true" /></td>
<td><input type="checkbox" checked="@(build.Might > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Heal > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Quickness > 0)" disabled="disabled" /></td>
<td><input type="checkbox" checked="@(build.Alacrity > 0)" disabled="disabled" /></td>
</tr>
}
</table>