Skip to content

Commit

Permalink
Archipelago PlayerName in FileTab (#1110)
Browse files Browse the repository at this point in the history
* Update GoalTab.razor

* Update FileTab.razor

* Deleted unnecessary
  • Loading branch information
brbrofsvl authored Dec 21, 2024
1 parent 70a1365 commit 7f53137
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
21 changes: 20 additions & 1 deletion FF1Blazorizer/Tabs/FileTab.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using System.ComponentModel;
@using System.ComponentModel;
@using System.IO;
@using System.Web;
@using RomUtilities;
Expand Down Expand Up @@ -44,6 +44,16 @@
<input style="width: calc(100% - 80px);" type="text" class="nes-input" value="@Flagstring" @onchange="@OnFlagsInputChanged" />
<a class="styled-button" @onclick="@OnCopyToClipboard">Export</a>
</p>

@if (Flags.Archipelago)
{
<p>
Archipelago Player Name:
<br>
<input type="text" style="width: calc(100% - 80px);" class="nes-input" maxlength="16" @onchange="@OnPlayerNameChanged" value="@(Preferences.PlayerName)" />
</p>
}

<p>@((MarkupString)StatusMessage)</p>
<div class="row">&nbsp;</div>
<a class="styled-button generate-button" @onclick="@OnRandomize">Generate ROM</a>
Expand Down Expand Up @@ -221,6 +231,15 @@
}
}

void OnPlayerNameChanged(ChangeEventArgs e)
{
string playername = (e.Value as string);

Preferences.PlayerName = playername.Length > 16 ? playername.Substring(0, 16) : playername;

UpdateAction?.Invoke("UpdateFlagstring","");
}

async Task OnRandomize(MouseEventArgs e)
{
if (_fileData == null)
Expand Down
6 changes: 5 additions & 1 deletion FF1Blazorizer/Tabs/GoalTab.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using FF1Lib;
@using FF1Lib;
@using static FF1Lib.FF1Rom;


Expand Down Expand Up @@ -65,5 +65,9 @@
string playername = (e.Value as string);

Preferences.PlayerName = playername.Length > 16 ? playername.Substring(0, 16) : playername;

UpdateAction?.Invoke("UpdateFlagstring","");
}


}

0 comments on commit 7f53137

Please sign in to comment.