sounds and screens with improved matchmaker
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
public static class CoinHelper
|
||||
{
|
||||
public static float Format(int coins)
|
||||
{
|
||||
int whole = coins / 4;
|
||||
int fraction = coins % 4;
|
||||
return float.Parse(whole + "." + fraction);
|
||||
}
|
||||
|
||||
public static string FormatString(int coins)
|
||||
{
|
||||
return Format(coins).ToString("N2");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bf3c59f7c1a7e640a05edc5f9828abd
|
||||
@@ -3,6 +3,7 @@ using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
public class LevelLoadManager : MonoBehaviour
|
||||
{
|
||||
public static LevelLoadManager instance;
|
||||
@@ -13,6 +14,14 @@ public class LevelLoadManager : MonoBehaviour
|
||||
|
||||
public bool isShowing => canvasGroup.alpha == 1;
|
||||
|
||||
[Header("Matchmade UI")]
|
||||
public GameObject matchmadeUI;
|
||||
public GameObject p1_red,p2_red,p1_blue,p2_blue;
|
||||
public Image p1_icon, p2_icon;
|
||||
public TMP_Text p1_name, p2_name;
|
||||
public TMP_Text p1_l10, p2_l10;
|
||||
public Sprite redIcon, blueIcon;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if(instance != null){
|
||||
@@ -24,6 +33,8 @@ public class LevelLoadManager : MonoBehaviour
|
||||
|
||||
DontDestroyOnLoad(gameObject);
|
||||
Hide();
|
||||
|
||||
matchmadeUI.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +49,11 @@ public class LevelLoadManager : MonoBehaviour
|
||||
IEnumerator CoroutineLoadLevel(string levelName){
|
||||
instance.Show();
|
||||
yield return new WaitForSeconds(transitionDuration);
|
||||
if(matchmadeUI.activeSelf){
|
||||
yield return new WaitForSeconds(3f);
|
||||
}
|
||||
yield return SceneManager.LoadSceneAsync(levelName);
|
||||
|
||||
instance.Hide();
|
||||
}
|
||||
|
||||
@@ -58,4 +73,32 @@ public class LevelLoadManager : MonoBehaviour
|
||||
canvasGroup.DOFade(0, transitionDuration).SetEase(Ease.InSine);
|
||||
contentImage.DOFillAmount(0, transitionDuration).SetEase(Ease.InSine);
|
||||
}
|
||||
|
||||
|
||||
public void SetupMatchMade(Team myTeam, string opponentName, string myName, string myL10, string opponentL10){
|
||||
matchmadeUI.SetActive(true);
|
||||
|
||||
if(myTeam == Team.Red){
|
||||
p1_red.SetActive(true);
|
||||
p1_blue.SetActive(false);
|
||||
p2_red.SetActive(false);
|
||||
p2_blue.SetActive(true);
|
||||
|
||||
p1_icon.sprite = redIcon;
|
||||
p2_icon.sprite = blueIcon;
|
||||
}else{
|
||||
p1_red.SetActive(false);
|
||||
p1_blue.SetActive(true);
|
||||
p2_red.SetActive(true);
|
||||
p2_blue.SetActive(false);
|
||||
|
||||
p1_icon.sprite = blueIcon;
|
||||
p2_icon.sprite = redIcon;
|
||||
}
|
||||
|
||||
p1_name.text = myName;
|
||||
p2_name.text = opponentName;
|
||||
p1_l10.text = myL10;
|
||||
p2_l10.text = opponentL10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd2602c01ff00f047aab3e93a95bb230
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <summary>Typical <c>pack</c> ids for <see cref="LoginManager.PurchaseRcPack"/>; prefer <see cref="LoginManager.GetRcPacks"/> for the live list.</summary>
|
||||
public static class RcPack
|
||||
{
|
||||
public const string Usd5 = "usd_5";
|
||||
public const string Usd20 = "usd_20";
|
||||
public const string Usd50 = "usd_50";
|
||||
|
||||
public static bool IsValid(string packId)
|
||||
{
|
||||
return packId == Usd5 || packId == Usd20 || packId == Usd50;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 241f412d7db597748af9c1138e640e0e
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class UserData
|
||||
{
|
||||
public int id;
|
||||
public string username;
|
||||
public int cc;
|
||||
public int rc;
|
||||
public string created_at;
|
||||
public string last_logged_at;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fa72c32d6a0d1e4abc0b724b1988d8c
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 031adef9a13d67c48b0969916c4e2160
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class AuthApiResponse
|
||||
{
|
||||
public bool ok;
|
||||
public string error;
|
||||
public string token;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91e26300ebc95df47949bbd3744bf975
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class AuthUserApiResponse
|
||||
{
|
||||
public bool ok;
|
||||
public string error;
|
||||
public UserData user;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d82de2425d5fb6448bc038942fb1aa88
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class MatchmadePlayer
|
||||
{
|
||||
public string Name;
|
||||
public long LastSeen;
|
||||
public int l10_wins;
|
||||
public int l10_losses;
|
||||
public int UserId;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class MatchmadeResponse
|
||||
{
|
||||
public MatchmadePlayer[] Players;
|
||||
public string GameName;
|
||||
public int Port;
|
||||
public long InitTime;
|
||||
public int match_id;
|
||||
public string your_team;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f3314f8ed9de9c4babeefda34b3026c
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class PurchaseRcApiResponse
|
||||
{
|
||||
public bool ok;
|
||||
public string error;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4aef938f509352a43920aa7bc5eb593d
|
||||
Reference in New Issue
Block a user