Skip to content

Commit

Permalink
MM UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 1, 2024
1 parent 7292c66 commit 1845186
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
Binary file modified Fika.Core/Bundles/Files/newmatchmakerui.bundle
Binary file not shown.
2 changes: 2 additions & 0 deletions Fika.Core/UI/Custom/MatchMakerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class MatchMakerUI : MonoBehaviour
[SerializeField]
public Button StartButton;
[SerializeField]
public Button CloseButton;
[SerializeField]
public TextMeshProUGUI PlayerAmountText;

public void SetServerNumberText(string text)
Expand Down
38 changes: 29 additions & 9 deletions Fika.Core/UI/Custom/MatchMakerUIScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ protected void OnDestroy()
{
StopQuery = true;
if (NewBackButton != null)
{
Destroy(NewBackButton);
}
}

private void CreateMatchMakerUI()
Expand Down Expand Up @@ -102,6 +104,15 @@ private void CreateMatchMakerUI()
}
});

fikaMatchMakerUi.CloseButton.onClick.AddListener(() =>
{
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.ButtonClick);
if (fikaMatchMakerUi.PlayerAmountSelection.active)
{
fikaMatchMakerUi.PlayerAmountSelection.SetActive(false);
}
});

fikaMatchMakerUi.StartButton.onClick.AddListener(() =>
{
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.ButtonClick);
Expand All @@ -124,21 +135,19 @@ private void CreateMatchMakerUI()

if (!IPAddress.TryParse(ip, out _))
{
Singleton<PreloaderUI>.Instance.ShowCriticalErrorScreen(
"ERROR FORCING IP",
$"'{ip}' is not a valid IP address to connect to! Check your 'Force IP' setting.",
ErrorScreen.EButtonType.OkButton, 10f, null, null);
Singleton<PreloaderUI>.Instance.ShowCriticalErrorScreen("ERROR FORCING IP",
$"'{ip}' is not a valid IP address to connect to! Check your 'Force IP' setting.",
ErrorScreen.EButtonType.OkButton, 10f, null, null);
return;
}
}
if (FikaPlugin.ForceBindIP.Value != "Disabled")
{
if (!IPAddress.TryParse(FikaPlugin.ForceBindIP.Value, out _))
{
Singleton<PreloaderUI>.Instance.ShowCriticalErrorScreen(
"ERROR BINDING",
$"'{FikaPlugin.ForceBindIP.Value}' is not a valid IP address to bind to! Check your 'Force Bind IP' setting.",
ErrorScreen.EButtonType.OkButton, 10f, null, null);
Singleton<PreloaderUI>.Instance.ShowCriticalErrorScreen("ERROR BINDING",
$"'{FikaPlugin.ForceBindIP.Value}' is not a valid IP address to bind to! Check your 'Force Bind IP' setting.",
ErrorScreen.EButtonType.OkButton, 10f, null, null);
return;
}
}
Expand All @@ -165,11 +174,22 @@ private void CreateMatchMakerUI()
Traverse.Create(newButtonComponent).Field("OnClick").SetValue(newEvent);

if (!NewBackButton.active)
{
NewBackButton.SetActive(true);
}

BackButton.gameObject.SetActive(false);
}

private void AutoRefresh()
{
Matches = FikaRequestHandler.LocationRaids(RaidSettings);

_lastRefreshed = Time.time;

RefreshUI();
}

private void ManualRefresh()
{
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.ButtonClick);
Expand Down Expand Up @@ -442,7 +462,7 @@ public IEnumerator ServerQuery()
{
while (!StopQuery)
{
ManualRefresh();
AutoRefresh();

while (Time.time < _lastRefreshed + FikaPlugin.AutoRefreshRate.Value)
{
Expand Down

0 comments on commit 1845186

Please sign in to comment.