forfeiture, abandoning, entry_fee_collection at start
This commit is contained in:
@@ -47,6 +47,14 @@ public class MainMenuManager : MonoBehaviour
|
||||
public TMP_Text txtWithdrawStatus;
|
||||
private bool isCoinBuyInProgress;
|
||||
|
||||
[Header("Settings")]
|
||||
public ProfileInfoFetcher profileInfoFetcher;
|
||||
public TMP_Text txtUsername;
|
||||
public TMP_Text txtEmail;
|
||||
public TMP_Text txtAge,txtMatches,txtWinRatio;
|
||||
public TMP_Text txtId;
|
||||
public Button btnLogout;
|
||||
|
||||
[Header("Audio")]
|
||||
public ToggleButton toggleSfx;
|
||||
public ToggleButton toggleMusic;
|
||||
@@ -77,6 +85,7 @@ public class MainMenuManager : MonoBehaviour
|
||||
if (success)
|
||||
{
|
||||
OnUserUpdated(user);
|
||||
RefreshSettingsProfile();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,6 +96,8 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
});
|
||||
|
||||
RefreshSettingsProfile();
|
||||
|
||||
btnBuyUsd5.onClick.AddListener(() => OnBuy(RcPack.Usd5));
|
||||
btnBuyUsd20.onClick.AddListener(() => OnBuy(RcPack.Usd20));
|
||||
btnBuyUsd50.onClick.AddListener(() => OnBuy(RcPack.Usd50));
|
||||
@@ -112,6 +123,9 @@ public class MainMenuManager : MonoBehaviour
|
||||
toggleSfx.SetIsOn(AudioManager.instance.IsSFXOn());
|
||||
toggleMusic.SetIsOn(AudioManager.instance.IsMusicOn());
|
||||
|
||||
if (btnLogout != null)
|
||||
btnLogout.onClick.AddListener(OnLogout);
|
||||
|
||||
if (!LevelLoadManager.BlocksMainMenuSettingsBootstrap)
|
||||
StartCoroutine(CoBootstrapSettingsWithoutLoader());
|
||||
}
|
||||
@@ -122,6 +136,14 @@ public class MainMenuManager : MonoBehaviour
|
||||
toggleMusic.onToggleValueChanged.RemoveListener(OnToggleMusic);
|
||||
if (btnTutorial != null && btnTutorial != btnPlay)
|
||||
btnTutorial.onClick.RemoveListener(OnPlayTutorial);
|
||||
if (btnLogout != null)
|
||||
btnLogout.onClick.RemoveListener(OnLogout);
|
||||
}
|
||||
|
||||
void OnLogout()
|
||||
{
|
||||
LoginManager.Logout();
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
void OnToggleSfx(bool isOn)
|
||||
@@ -334,8 +356,18 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
|
||||
|
||||
void SetStatsPanelVisible(bool visible)
|
||||
{
|
||||
if (statsPanel == null)
|
||||
return;
|
||||
statsPanel.SetActive(visible);
|
||||
Transform topPanel = statsPanel.transform.parent;
|
||||
if (topPanel != null)
|
||||
topPanel.gameObject.SetActive(visible);
|
||||
}
|
||||
|
||||
public void ShowMainMenuScreen(){
|
||||
statsPanel.SetActive(true);
|
||||
SetStatsPanelVisible(true);
|
||||
mainMenuScreen.SetActive(true);
|
||||
gameModesScreen.SetActive(false);
|
||||
dummyBuyScreen.SetActive(false);
|
||||
@@ -344,7 +376,7 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ShowGameModesScreen(){
|
||||
statsPanel.SetActive(true);
|
||||
SetStatsPanelVisible(true);
|
||||
mainMenuScreen.SetActive(false);
|
||||
gameModesScreen.SetActive(true);
|
||||
dummyBuyScreen.SetActive(false);
|
||||
@@ -353,7 +385,7 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ShowDummyBuyScreen(){
|
||||
statsPanel.SetActive(false);
|
||||
SetStatsPanelVisible(false);
|
||||
mainMenuScreen.SetActive(false);
|
||||
gameModesScreen.SetActive(false);
|
||||
dummyBuyScreen.SetActive(true);
|
||||
@@ -362,7 +394,7 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ShowWithdrawalScreen(){
|
||||
statsPanel.SetActive(false);
|
||||
SetStatsPanelVisible(false);
|
||||
mainMenuScreen.SetActive(false);
|
||||
gameModesScreen.SetActive(false);
|
||||
dummyBuyScreen.SetActive(false);
|
||||
@@ -372,12 +404,49 @@ public class MainMenuManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ShowSettingsScreen(){
|
||||
statsPanel.SetActive(false);
|
||||
SetStatsPanelVisible(false);
|
||||
mainMenuScreen.SetActive(false);
|
||||
gameModesScreen.SetActive(false);
|
||||
dummyBuyScreen.SetActive(false);
|
||||
withdrawalScreen.SetActive(false);
|
||||
settingsScreen.SetActive(true);
|
||||
RefreshSettingsProfile();
|
||||
}
|
||||
|
||||
void RefreshSettingsProfile()
|
||||
{
|
||||
if (profileInfoFetcher == null)
|
||||
return;
|
||||
|
||||
UserData user = LoginManager.CurrentUser;
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
profileInfoFetcher.GetPlayerProfile(user.id, (success, error, profile) =>
|
||||
{
|
||||
if (!success || profile == null)
|
||||
{
|
||||
Debug.LogWarning("Settings profile fetch failed: " + (error ?? "unknown"));
|
||||
return;
|
||||
}
|
||||
ApplySettingsProfile(profile);
|
||||
});
|
||||
}
|
||||
|
||||
void ApplySettingsProfile(PlayerProfileApiResponse profile)
|
||||
{
|
||||
if (txtUsername != null)
|
||||
txtUsername.text = profile.username ?? "";
|
||||
if (txtEmail != null)
|
||||
txtEmail.text = profile.email ?? "";
|
||||
if (txtId != null)
|
||||
txtId.text = profile.player_id.ToString();
|
||||
if (txtAge != null)
|
||||
txtAge.text = profile.days_since_registration.ToString();
|
||||
if (txtMatches != null)
|
||||
txtMatches.text = profile.matches_played.ToString();
|
||||
if (txtWinRatio != null)
|
||||
txtWinRatio.text = (profile.win_ratio * 100f).ToString("0.#") + "%";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user