Skip to content

Commit

Permalink
Add error and fail to start when you have chars unlocked
Browse files Browse the repository at this point in the history
  • Loading branch information
gmjosack committed Jan 16, 2023
1 parent 3691faf commit f33d7ec
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
15 changes: 11 additions & 4 deletions AchievementsTracker/AchievementsTracker/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,17 @@ public void update()
int newCharSelect = memoryReader.ReadCharSelect();
if (state == ScreenState.ChooseCharacter && charSelect == 0 && newCharSelect != 0)
{
// Start timer
Log.WriteLine("Character selected!");
tracker.RunStarted(time, false);
tracker.SendRunStart(time);
if (characters == 0)
{
// Start timer
Log.WriteLine("Character selected!");
tracker.RunStarted(time, false);
tracker.SendRunStart(time);
}
else
{
tracker.SetErrorMessage("Characters Unexpectedly Unlocked!");
}
}
charSelect = newCharSelect;

Expand Down
15 changes: 15 additions & 0 deletions AchievementsTracker/AchievementsTracker/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions AchievementsTracker/AchievementsTracker/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void SetResetHotKey(int modifiers, Keys key)
UnregisterHotKey(Handle, RESET_HOTKEY_ID);
RegisterHotKey(Handle, RESET_HOTKEY_ID, modifiers, (int)key);
}

// Hotkey
protected override void WndProc(ref Message m)
{
Expand All @@ -96,11 +96,12 @@ public void Reset()
{
room.Text = "";
roomStatus.Text = "";
errorMsg.Text = "";

SetHideLoadless(false);

startTime = 0;

// Init timer
if (runTimer != null)
{
Expand Down Expand Up @@ -251,12 +252,18 @@ public void Reset()
currentlyPlaying = false;
}

public void SetErrorMessage(string msg)
{
errorMsg.Text = msg;
}

public void setRoomCode(string code)
{
if (code != null)
{
room.Text = "Room: " + code;
} else
}
else
{
room.Text = "";
}
Expand Down Expand Up @@ -940,7 +947,8 @@ public void SetHideLoadless(bool hide)
{
loadlessTimer.Hide();
loadlessLabel.Hide();
} else
}
else
{
loadlessTimer.Show();
loadlessLabel.Show();
Expand Down
7 changes: 6 additions & 1 deletion AchievementsTracker/AchievementsTracker/Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public async void MultiplayerMain()
byte[] charBytes = charArray.Select(jv => (byte)jv).ToArray();
byte[] chars = new byte[16 * 4];
int charNum = 0;
for (int i = 0; i < 16; i ++)
for (int i = 0; i < 16; i++)
{
chars[4 * i] = charBytes[i];
if (charBytes[i] > 0) charNum++;
Expand Down Expand Up @@ -496,6 +496,11 @@ public async void MultiplayerMain()
}
}

public void SetErrorMessage(string msg)
{
ui.SetErrorMessage(msg);
}

public void Main()
{
running = false;
Expand Down

0 comments on commit f33d7ec

Please sign in to comment.