This commit is contained in:
2026-04-09 02:55:12 +05:30
parent cace0cc664
commit ced9c9fa35
13 changed files with 5758 additions and 1514 deletions
+5
View File
@@ -47,6 +47,11 @@ public class CupidLobby : MonoBehaviour
}
}
public static CupidLobby instance;
void Awake(){
instance=this;
}
void Start()
{
string token = !string.IsNullOrEmpty(LoginManager.AuthToken)
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -18,6 +18,8 @@ MonoBehaviour:
introMusic: {fileID: 8300000, guid: 40c3654169239df42aac74005ba8757f, type: 3}
menuMusic: {fileID: 8300000, guid: d0dfd1dd9f429a64ab99b9f176bb16da, type: 3}
gameMusic: {fileID: 0}
coinsSfx:
- {fileID: 8300000, guid: f4a643acd600e4949bce26be25eb6909, type: 3}
ballHits:
- {fileID: 8300000, guid: 5cf8cf451cd18c9468d5372136cc10c7, type: 3}
puckHits:
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -113,7 +113,7 @@ public class LoginManager : MonoBehaviour
if (passwordInputLogin != null) passwordInputLogin.text = devPass;
string loginJson = "{\"username\":\"" + EscapeJsonString(devUser) + "\",\"password\":\"" + EscapeJsonString(devPass) + "\"}";
StartCoroutine(AuthPostCoroutine(AuthBaseUrl + "/auth/login", loginJson, "Signed in."));
// StartCoroutine(AuthPostCoroutine(AuthBaseUrl + "/auth/login", loginJson, "Signed in."));
#else
if (!string.IsNullOrEmpty(AuthToken))
{
+103 -1
View File
@@ -5,6 +5,12 @@ using UnityEngine.UI;
public class MainMenuManager : MonoBehaviour
{
const string CryptoAddressPrefsKey = "MainMenu.CryptoAddress";
/// <summary>500 CC fee to process a withdrawal.</summary>
const int WithdrawalFeeCc = 500;
/// <summary>$20 USD = 20.0 RC, stored in DB as 80 rc coins (4 coins per 1.0 RC).</summary>
const int MinimumWithdrawalRcCoins = 80;
[Header("Stats")]
[SerializeField] private GameObject statsPanel;
[SerializeField] private TMP_Text usernameText;
@@ -15,12 +21,22 @@ public class MainMenuManager : MonoBehaviour
public GameObject mainMenuScreen;
public GameObject gameModesScreen;
public GameObject dummyBuyScreen;
public GameObject withdrawalScreen;
[Header("Play")]
public Button btnPlay;
public TMP_Text rcPlayText;
[Header("Dummy Buy")]
public Button btnBuyUsd5;
public Button btnBuyUsd20;
public Button btnBuyUsd50;
[Header("Withdrawal")]
public Button btnWithdrawal;
public Button btnPaste;
public TMP_InputField inputCryptoAddress;
public TMP_Text txtWithdrawStatus;
void Awake()
{
if(LoginManager.instance==null){
@@ -45,12 +61,75 @@ public class MainMenuManager : MonoBehaviour
btnBuyUsd20.onClick.AddListener(() => OnBuy(RcPack.Usd20));
btnBuyUsd50.onClick.AddListener(() => OnBuy(RcPack.Usd50));
if (inputCryptoAddress != null)
{
inputCryptoAddress.text = PlayerPrefs.GetString(CryptoAddressPrefsKey, string.Empty);
inputCryptoAddress.onValueChanged.AddListener(OnCryptoAddressChanged);
}
UpdateWithdrawalStatus();
if (btnPaste != null)
btnPaste.onClick.AddListener(OnPasteFromClipboard);
btnPlay.onClick.AddListener(OnPlay);
}
void OnPlay(){
if(LoginManager.CurrentUser.rc < 21){
Debug.LogError("Not enough RC to play");
return;
}
CupidLobby.instance.Matchmake();
}
void OnCryptoAddressChanged(string value)
{
PlayerPrefs.SetString(CryptoAddressPrefsKey, value ?? string.Empty);
PlayerPrefs.Save();
UpdateWithdrawalStatus();
}
void UpdateWithdrawalStatus(UserData user = null)
{
if (txtWithdrawStatus == null)
return;
UserData u = user ?? LoginManager.CurrentUser;
if (u == null)
return;
if (inputCryptoAddress != null && string.IsNullOrWhiteSpace(inputCryptoAddress.text))
{
txtWithdrawStatus.text = "Enter a valid wallet address to withdraw safely.";
return;
}
if (u.rc < MinimumWithdrawalRcCoins)
{
txtWithdrawStatus.text = "Your RC balance is below the minimum withdrawal amount ($20 USD / 20.0 RC).";
return;
}
if (u.cc < WithdrawalFeeCc)
{
txtWithdrawStatus.text = "Withdrawal costs 500 CC. Your CC balance is below 500 CC.";
return;
}
txtWithdrawStatus.text = string.Empty;
}
void OnPasteFromClipboard()
{
if (inputCryptoAddress == null)
return;
string clip = GUIUtility.systemCopyBuffer;
if (!string.IsNullOrEmpty(clip))
inputCryptoAddress.text = clip;
}
void OnBuy(string packId){
LoginManager.instance.PurchaseRcPack(packId, (success, error) => {
if(success){
OnUserUpdated(LoginManager.CurrentUser);
AudioManager.instance.PlayCoinsSfx();
}
});
}
@@ -68,8 +147,18 @@ public class MainMenuManager : MonoBehaviour
void OnUserUpdated(UserData user){
usernameText.text = user.username;
ccText.text = CoinHelper.FormatString(user.cc) + " CC";
ccText.text = user.cc.ToString("N0") + " CC";
rcText.text = CoinHelper.FormatString(user.rc) + " RC";
if(LoginManager.CurrentUser.rc < 21){
rcPlayText.text = "Not enough RC to play";
btnPlay.interactable = false;
}else{
rcPlayText.text = "";
btnPlay.interactable = true;
}
UpdateWithdrawalStatus(user);
}
@@ -78,6 +167,7 @@ public class MainMenuManager : MonoBehaviour
mainMenuScreen.SetActive(true);
gameModesScreen.SetActive(false);
dummyBuyScreen.SetActive(false);
withdrawalScreen.SetActive(false);
}
public void ShowGameModesScreen(){
@@ -85,6 +175,7 @@ public class MainMenuManager : MonoBehaviour
mainMenuScreen.SetActive(false);
gameModesScreen.SetActive(true);
dummyBuyScreen.SetActive(false);
withdrawalScreen.SetActive(false);
}
public void ShowDummyBuyScreen(){
@@ -92,5 +183,16 @@ public class MainMenuManager : MonoBehaviour
mainMenuScreen.SetActive(false);
gameModesScreen.SetActive(false);
dummyBuyScreen.SetActive(true);
withdrawalScreen.SetActive(false);
}
public void ShowWithdrawalScreen(){
statsPanel.SetActive(false);
mainMenuScreen.SetActive(false);
gameModesScreen.SetActive(false);
dummyBuyScreen.SetActive(false);
withdrawalScreen.SetActive(true);
UpdateWithdrawalStatus();
}
}
@@ -15,6 +15,7 @@ public class AudioDirectory : ScriptableObject
public AudioClip gameMusic;
[Header("SFX")]
public AudioClip[] coinsSfx;
[Header("Ball")]
public AudioClip[] ballHits;
public AudioClip[] puckHits;
@@ -295,6 +295,11 @@ public class AudioManager : MonoBehaviour
return clips[Random.Range(0, clips.Length)];
}
public void PlayCoinsSfx(){
if (audioDirectory.coinsSfx != null && audioDirectory.coinsSfx.Length > 0)
uiSfxSource.PlayOneShot(audioDirectory.coinsSfx[Random.Range(0, audioDirectory.coinsSfx.Length)]);
}
public void PlayTimerBeep(){
if (audioDirectory.timerBeep != null && audioDirectory.timerBeep.Length > 0)
uiSfxSource.PlayOneShot(audioDirectory.timerBeep[Random.Range(0, audioDirectory.timerBeep.Length)]);
+8 -1
View File
@@ -7,8 +7,15 @@ public static class CoinHelper
return float.Parse(whole + "." + fraction);
}
public static int RcToCoins(float coins){
string s = coins.ToString("N1");
int whole = int.Parse(s.Split('.')[0]);
int fraction = int.Parse(s.Split('.')[1]);
return (whole * 4) + fraction;
}
public static string FormatString(int coins)
{
return Format(coins).ToString("N2");
return Format(coins).ToString("N1");
}
}
+20
View File
@@ -0,0 +1,20 @@
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TMP_Text))]
public class CopyTextTMP : MonoBehaviour
{
public TMP_Text origin;
TMP_Text _text;
void Awake()
{
_text = GetComponent<TMP_Text>();
}
void Update()
{
_text.text = origin.text;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 981262cae0f1178448cf21d0273828dc
+52 -39
View File
@@ -1,40 +1,53 @@
Logger initiated at 4/5/2026 9:39:57 PM
Logger initiated at 4/9/2026 1:34:31 AM
[4/5/2026 9:39:57 PM] Error retreiving settings from server JSON parse error: The document root must not follow by other values.
[4/5/2026 9:39:57 PM] 403 Unauthorized
[4/5/2026 9:40:02 PM] Starting matchmake as warlock
[4/5/2026 9:40:06 PM] Got into a room
[4/5/2026 9:40:06 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:07 PM] Got into a room
[4/5/2026 9:40:07 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:08 PM] Got into a room
[4/5/2026 9:40:08 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:10 PM] Got into a room
[4/5/2026 9:40:10 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:11 PM] Got into a room
[4/5/2026 9:40:11 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:12 PM] Got into a room
[4/5/2026 9:40:12 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:13 PM] Got into a room
[4/5/2026 9:40:13 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:15 PM] Got into a room
[4/5/2026 9:40:15 PM] {"Players":[{"Name":"warlock","LastSeen":1775405406006,"UserId":4,"l10_wins":2,"l10_losses":2},{"Name":"warlock2","LastSeen":1775405414767,"UserId":5,"l10_wins":2,"l10_losses":2}],"GameName":"soccar","Port":26379,"InitTime":1775405406006,"match_id":21,"your_team":"red"}
[4/5/2026 9:40:15 PM] Configured dedicated match reporting for match id 21 with secret 38516e39d3406225b7c3015a66e5d25c54e9b2024c0755212122bdcea3e3a328 and internal api base http://vps.playpoolstudios.com:2612
[4/5/2026 9:40:15 PM] Setting cupid to load game scene
[4/5/2026 9:40:15 PM] Loading game scene
[4/5/2026 9:40:19 PM] Starting client at $vps.playpoolstudios.com:26379
[4/5/2026 9:40:26 PM] Selected team changed from Red to Blue
[4/5/2026 9:40:31 PM] Score changed from 0 to 1
[4/5/2026 9:40:39 PM] Selected team changed from Blue to Red
[4/5/2026 9:40:52 PM] Selected team changed from Red to Blue
[4/5/2026 9:40:54 PM] Score changed from 0 to 1
[4/5/2026 9:41:03 PM] Selected team changed from Blue to Red
[4/5/2026 9:41:09 PM] Selected team changed from Red to Blue
[4/5/2026 9:41:11 PM] Score changed from 1 to 2
[4/5/2026 9:41:19 PM] Selected team changed from Blue to Red
[4/5/2026 9:41:31 PM] Selected team changed from Red to Blue
[4/5/2026 9:41:35 PM] Selected team changed from Blue to Red
[4/5/2026 9:41:44 PM] Selected team changed from Red to Blue
[4/5/2026 9:41:50 PM] Score changed from 2 to 3
[4/5/2026 9:41:57 PM] Error retreiving settings from server JSON parse error: The document root must not follow by other values.
[4/5/2026 9:41:57 PM] 403 Unauthorized
[4/9/2026 1:34:32 AM] Error retreiving settings from server JSON parse error: The document root must not follow by other values.
[4/9/2026 1:34:32 AM] 403 Unauthorized
[4/9/2026 1:35:31 AM] Starting matchmake as warlock
[4/9/2026 1:35:33 AM] Got into a room
[4/9/2026 1:35:33 AM] {"Players":[{"Name":"warlock","LastSeen":1775678733189,"UserId":4,"l10_wins":2,"l10_losses":3}],"GameName":"soccar","Port":26518,"InitTime":1775678733189,"match_id":32,"your_team":"red"}
[4/9/2026 1:35:35 AM] Got into a room
[4/9/2026 1:35:35 AM] {"Players":[{"Name":"warlock","LastSeen":1775678733189,"UserId":4,"l10_wins":2,"l10_losses":3}],"GameName":"soccar","Port":26518,"InitTime":1775678733189,"match_id":32,"your_team":"red"}
[4/9/2026 1:35:36 AM] Got into a room
[4/9/2026 1:35:36 AM] {"Players":[{"Name":"warlock","LastSeen":1775678733189,"UserId":4,"l10_wins":2,"l10_losses":3},{"Name":"warlock2","LastSeen":1775678734931,"UserId":5,"l10_wins":3,"l10_losses":2}],"GameName":"soccar","Port":26518,"InitTime":1775678733189,"match_id":32,"your_team":"red"}
[4/9/2026 1:35:36 AM] Configured dedicated match reporting for match id 32 with secret 38516e39d3406225b7c3015a66e5d25c54e9b2024c0755212122bdcea3e3a328 and internal api base http://vps.playpoolstudios.com:2612
[4/9/2026 1:35:36 AM] Setting cupid to load game scene
[4/9/2026 1:35:36 AM] Loading game scene
[4/9/2026 1:35:40 AM] Starting client at $vps.playpoolstudios.com:26518
[4/9/2026 1:35:48 AM] Selected team changed from Red to Blue
[4/9/2026 1:35:56 AM] Selected team changed from Blue to Red
[4/9/2026 1:36:02 AM] Selected team changed from Red to Blue
[4/9/2026 1:36:07 AM] Selected team changed from Blue to Red
[4/9/2026 1:36:10 AM] Score changed from 0 to 1
[4/9/2026 1:36:21 AM] Selected team changed from Red to Blue
[4/9/2026 1:36:27 AM] Selected team changed from Blue to Red
[4/9/2026 1:36:32 AM] Selected team changed from Red to Blue
[4/9/2026 1:36:38 AM] Selected team changed from Blue to Red
[4/9/2026 1:36:43 AM] Selected team changed from Red to Blue
[4/9/2026 1:36:49 AM] Selected team changed from Blue to Red
[4/9/2026 1:36:56 AM] Selected team changed from Red to Blue
[4/9/2026 1:37:00 AM] Score changed from 1 to 2
[4/9/2026 1:37:09 AM] Selected team changed from Blue to Red
[4/9/2026 1:37:15 AM] Selected team changed from Red to Blue
[4/9/2026 1:37:20 AM] Selected team changed from Blue to Red
[4/9/2026 1:37:25 AM] Selected team changed from Red to Blue
[4/9/2026 1:37:30 AM] Selected team changed from Blue to Red
[4/9/2026 1:37:35 AM] Selected team changed from Red to Blue
[4/9/2026 1:37:40 AM] Selected team changed from Blue to Red
[4/9/2026 1:37:45 AM] Selected team changed from Red to Blue
[4/9/2026 1:37:52 AM] Selected team changed from Blue to Red
[4/9/2026 1:37:59 AM] Selected team changed from Red to Blue
[4/9/2026 1:38:04 AM] Selected team changed from Blue to Red
[4/9/2026 1:38:09 AM] Selected team changed from Red to Blue
[4/9/2026 1:38:15 AM] Selected team changed from Blue to Red
[4/9/2026 1:38:22 AM] Selected team changed from Red to Blue
[4/9/2026 1:38:24 AM] Score changed from 0 to 1
[4/9/2026 1:38:33 AM] Selected team changed from Blue to Red
[4/9/2026 1:38:40 AM] Selected team changed from Red to Blue
[4/9/2026 1:38:46 AM] Selected team changed from Blue to Red
[4/9/2026 1:38:51 AM] Selected team changed from Red to Blue
[4/9/2026 1:38:56 AM] Selected team changed from Blue to Red
[4/9/2026 1:39:00 AM] Selected team changed from Red to Blue
[4/9/2026 1:39:04 AM] Selected team changed from Blue to Red
[4/9/2026 1:39:07 AM] Score changed from 2 to 3
[4/9/2026 1:39:16 AM] Error retreiving settings from server JSON parse error: The document root must not follow by other values.
[4/9/2026 1:39:16 AM] 403 Unauthorized