Update theme sfx
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7854f585bbc6d2c574b614dbb36ba2600cc3d450ad835fed441f60cfe3363642
|
||||
size 112932
|
||||
oid sha256:bc028fc3c6b7fe9d9851f84da3d784923ccfb38af77605dd57c1e7e12e4c5817
|
||||
size 113080
|
||||
|
||||
@@ -34,7 +34,9 @@ namespace BrewMonster.UI
|
||||
bool isDoneWorldRender = false;
|
||||
bool isDoneNPCRender = false;
|
||||
private SynchronizationContext context;
|
||||
public AudioClip loginBGM;
|
||||
[Header("Audio")]
|
||||
[Tooltip("Set 3 clips to pick a random login theme.")]
|
||||
[SerializeField] private AudioClip[] _loginBGMs;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -64,7 +66,11 @@ namespace BrewMonster.UI
|
||||
|
||||
void Start()
|
||||
{
|
||||
AudioManager.Instance.PlayBGM(loginBGM, 1.5f);
|
||||
var chosenBgm = PickLoginBGM();
|
||||
if (chosenBgm != null && AudioManager.Instance != null)
|
||||
{
|
||||
AudioManager.Instance.PlayBGM(chosenBgm, 1.5f);
|
||||
}
|
||||
_loginButton.onClick.AddListener(OnLoginButtonClicked);
|
||||
context = SynchronizationContext.Current;
|
||||
#if UNITY_EDITOR
|
||||
@@ -80,6 +86,17 @@ namespace BrewMonster.UI
|
||||
// ApplyLoginEntry(LogoutFlowState.ConsumeNextLoginEntry());
|
||||
}
|
||||
|
||||
private AudioClip PickLoginBGM()
|
||||
{
|
||||
if (_loginBGMs != null && _loginBGMs.Length > 0)
|
||||
{
|
||||
// UnityEngine.Random is deterministic per session and good enough here.
|
||||
int idx = UnityEngine.Random.Range(0, _loginBGMs.Length);
|
||||
return _loginBGMs[idx];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -159,38 +176,8 @@ namespace BrewMonster.UI
|
||||
await UnityGameSession.Login(username, password, OnLoginComplete);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply how LoginScene should look after a logout flow.
|
||||
/// Call this when LoginScene is already loaded (additive) and you need to switch UI without reloading the scene.
|
||||
/// </summary>
|
||||
public void ApplyLoginEntry(BrewMonster.Network.LogoutFlowState.LoginEntryTarget entry)
|
||||
{
|
||||
_loginInProgress = false;
|
||||
if (_loginButton != null) _loginButton.interactable = true;
|
||||
|
||||
// Always refresh fields from PlayerPrefs (LogoutAccount clears them).
|
||||
if (_usernameInputField != null) _usernameInputField.text = PlayerPrefs.GetString("username", "");
|
||||
if (_passwordInputField != null) _passwordInputField.text = PlayerPrefs.GetString("password", "");
|
||||
|
||||
if (_selectCharacterScreen != null)
|
||||
_selectCharacterScreen.gameObject.SetActive(false);
|
||||
|
||||
if (entry == BrewMonster.Network.LogoutFlowState.LoginEntryTarget.SelectRole)
|
||||
{
|
||||
// If we're returning to select role, skip straight to select role without showing login UI again, since we never fully left the game session.
|
||||
OnLoginComplete(true);
|
||||
return;
|
||||
|
||||
// Auto-login to reach Select Role like the original client, without showing Tech3C auth UI again.
|
||||
if (!string.IsNullOrEmpty(_usernameInputField.text) && !string.IsNullOrEmpty(_passwordInputField.text))
|
||||
{
|
||||
BMLogger.Log("[LoginScreenUI] Auto-login triggered (return-to-select-role).");
|
||||
_loginInProgress = true;
|
||||
if (_loginButton != null) _loginButton.interactable = false;
|
||||
_ = BeginGameLoginAsync(_usernameInputField.text, _passwordInputField.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOTE: Previously had an ApplyLoginEntry helper that referenced LogoutFlowState.
|
||||
// It was unused and caused build/lint issues on some platforms, so it's been removed.
|
||||
|
||||
/// <summary>
|
||||
/// Callback when the login is complete.
|
||||
|
||||
Reference in New Issue
Block a user