Leaderboard
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -538,11 +538,11 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 3ddb0f465d3ba0e458bedcfedbb40f27, type: 3}
|
||||
m_FontSize: 100
|
||||
m_FontSize: 81
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 128
|
||||
m_MaxSize: 300
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
@@ -5470,7 +5470,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 8
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
@@ -5716,7 +5716,7 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 3ddb0f465d3ba0e458bedcfedbb40f27, type: 3}
|
||||
m_FontSize: 145
|
||||
m_FontSize: 120
|
||||
m_FontStyle: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
@@ -5924,7 +5924,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
@@ -6751,7 +6751,7 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 3ddb0f465d3ba0e458bedcfedbb40f27, type: 3}
|
||||
m_FontSize: 145
|
||||
m_FontSize: 120
|
||||
m_FontStyle: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
@@ -6804,7 +6804,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1191879597}
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 7
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
@@ -7081,7 +7081,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 186191ea380174ca9b4fe72856cda52c, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 6b1501126a13040439292b25ab57f05c, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
@@ -7131,7 +7131,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 7
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
@@ -7706,7 +7706,7 @@ RectTransform:
|
||||
- {fileID: 1046342272}
|
||||
- {fileID: 2139777084}
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 8
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -7914,6 +7914,7 @@ GameObject:
|
||||
- component: {fileID: 1046342272}
|
||||
- component: {fileID: 1046342274}
|
||||
- component: {fileID: 1046342273}
|
||||
- component: {fileID: 1046342275}
|
||||
m_Layer: 5
|
||||
m_Name: Btn_mute
|
||||
m_TagString: Untagged
|
||||
@@ -7980,6 +7981,50 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1046342271}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1046342275
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1046342271}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1046342273}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &1145873324
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -8019,7 +8064,7 @@ RectTransform:
|
||||
- {fileID: 1238002589}
|
||||
- {fileID: 554004756}
|
||||
m_Father: {fileID: 1659871499}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -8524,11 +8569,11 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 3ddb0f465d3ba0e458bedcfedbb40f27, type: 3}
|
||||
m_FontSize: 100
|
||||
m_FontSize: 81
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 128
|
||||
m_MaxSize: 300
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
@@ -9726,12 +9771,12 @@ RectTransform:
|
||||
- {fileID: 1707417705}
|
||||
- {fileID: 371826265}
|
||||
- {fileID: 835454441}
|
||||
- {fileID: 567030193}
|
||||
- {fileID: 944569653}
|
||||
- {fileID: 1145873325}
|
||||
- {fileID: 281121120}
|
||||
- {fileID: 749441541}
|
||||
- {fileID: 190842544}
|
||||
- {fileID: 567030193}
|
||||
- {fileID: 944569653}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 8
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -20340,6 +20385,9 @@ MonoBehaviour:
|
||||
gameOverTotalScoreTxt: {fileID: 554004758}
|
||||
GameOverUI: {fileID: 1145873324}
|
||||
PauseMenuUI: {fileID: 944569652}
|
||||
muteBtn: {fileID: 1046342275}
|
||||
muteIcon: {fileID: 21300000, guid: 8c13b3c1bb85146b69b4c89f795e2fdb, type: 3}
|
||||
unmuteIcon: {fileID: 21300000, guid: 26080ddb3c39a4527a91a12d6002a470, type: 3}
|
||||
HoleInOne: {fileID: 190842548}
|
||||
curHoleIndex: 0
|
||||
isGrounded: 0
|
||||
|
||||
@@ -12,6 +12,8 @@ public class AudioManager : MonoBehaviour
|
||||
|
||||
if(PlayerPrefs.HasKey("mute")){
|
||||
isMute = PlayerPrefs.GetInt("mute") == 1;
|
||||
}else{
|
||||
isMute=false;
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public static class DataManager{
|
||||
public const string API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/golf/api/";
|
||||
private const string key = "#2CuV1Bit^S!sW1ZcgRv8BhrO";
|
||||
public static UserData userData{get; private set;}
|
||||
public static List<LeaderboardItemData> Leaderboard{get; private set;}
|
||||
public static bool isLogged{ get{return userData != null;}}
|
||||
|
||||
public static void Signout(){
|
||||
@@ -82,7 +83,7 @@ public static class DataManager{
|
||||
await Task.Yield();
|
||||
}
|
||||
Debug.Log("glogin response: " +request.downloadHandler.text);
|
||||
MessageBox.ShowMessage(request.downloadHandler.text);
|
||||
// MessageBox.ShowMessage(request.downloadHandler.text);
|
||||
|
||||
if(request.downloadHandler.text.Contains("{")){
|
||||
try{
|
||||
@@ -160,6 +161,47 @@ public static class DataManager{
|
||||
LoadingScreen.LoadLevel("MainMenu");
|
||||
}
|
||||
|
||||
public static async Task RefreshLeaderboard(){
|
||||
WWWForm form = new WWWForm();
|
||||
|
||||
Debug.Log(userData.ToString());
|
||||
|
||||
form.AddField("username", userData.username);
|
||||
|
||||
using (UnityWebRequest request = UnityWebRequest.Post(API_ENDPOINT + "get_leaderboard.php", form))
|
||||
{
|
||||
var operation = request.SendWebRequest();
|
||||
while (!operation.isDone)
|
||||
{
|
||||
await Task.Yield();
|
||||
}
|
||||
Debug.Log("add scores response: " +request.downloadHandler.text);
|
||||
|
||||
if(request.downloadHandler.text.Contains("{")){
|
||||
try{
|
||||
string[] items = request.downloadHandler.text.Split("<td>");
|
||||
Leaderboard = new List<LeaderboardItemData>();
|
||||
foreach(string item in items){
|
||||
LeaderboardItemData newItem = JsonConvert.DeserializeObject<LeaderboardItemData>(item);
|
||||
|
||||
Leaderboard.Add(newItem);
|
||||
}
|
||||
|
||||
Debug.Log("Success parsing userdata");
|
||||
|
||||
|
||||
}catch(Exception e){
|
||||
Debug.Log("Error parsing leaderboard");
|
||||
}
|
||||
}else{
|
||||
|
||||
MessageBox.ShowMessage("Error getting leaderboard, Server said\n" +request.downloadHandler.text);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
@@ -176,3 +218,19 @@ public class UserData{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class LeaderboardItemData{
|
||||
public int position;
|
||||
public string name;
|
||||
public int topScore;
|
||||
|
||||
public string DisplayName{get{
|
||||
string _name= name;
|
||||
if(name.Contains("#0")){
|
||||
_name = _name.Substring(0,name.IndexOf("@gmail"));
|
||||
}
|
||||
|
||||
return _name;
|
||||
}}
|
||||
}
|
||||
|
||||
36
Assets/Scripts/EncryptionTester.cs
Normal file
36
Assets/Scripts/EncryptionTester.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using UnityEngine;
|
||||
|
||||
public class EncryptionTester : MonoBehaviour
|
||||
{
|
||||
public PaddingMode paddingMode;
|
||||
public CipherMode cipherMode;
|
||||
[Header("Encryption")]
|
||||
public string textToEncrypt;
|
||||
public string encryptedText;
|
||||
|
||||
[Header("Decryption")]
|
||||
public string textToDecrypt;
|
||||
public string decryptedText;
|
||||
|
||||
[Header("Numbers")]
|
||||
[Header("Encryption")]
|
||||
public int numberToEncrypt;
|
||||
public string encryptedNumber;
|
||||
[Header("Encryption")]
|
||||
public string numTextToDecrypt;
|
||||
public int decryptedNumber;
|
||||
|
||||
void OnDrawGizmos(){
|
||||
Encryptor.cipherMode = cipherMode;
|
||||
Encryptor.paddingMode = paddingMode;
|
||||
|
||||
encryptedText = Encryptor.encrypt(textToEncrypt);
|
||||
decryptedText = Encryptor.decrypt(textToDecrypt);
|
||||
|
||||
encryptedNumber = Encryptor.intToString(numberToEncrypt);
|
||||
decryptedNumber = Encryptor.stringToInt(numTextToDecrypt);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/EncryptionTester.cs.meta
Normal file
11
Assets/Scripts/EncryptionTester.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f08b67e0ea5507a42a56c6c80c24181c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
102
Assets/Scripts/Encryptor.cs
Normal file
102
Assets/Scripts/Encryptor.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Security.Cryptography;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System;
|
||||
|
||||
public static class Encryptor
|
||||
{
|
||||
private static string hash = "@419$";
|
||||
public static PaddingMode paddingMode = PaddingMode.PKCS7;
|
||||
public static CipherMode cipherMode = CipherMode.ECB;
|
||||
|
||||
private static string charPool = "AKFLDJAHSPIWUROCNMZX";
|
||||
|
||||
public static string encrypt(string input)
|
||||
{
|
||||
byte[] data = UTF8Encoding.UTF8.GetBytes(input);
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] key = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
|
||||
using (TripleDESCryptoServiceProvider tds = new TripleDESCryptoServiceProvider() { Key=key, Mode = cipherMode, Padding = paddingMode })
|
||||
{
|
||||
ICryptoTransform ict = tds.CreateEncryptor();
|
||||
byte[] results = ict.TransformFinalBlock(data, 0, data.Length);
|
||||
return Convert.ToBase64String(results, 0, results.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string decrypt(string input)
|
||||
{
|
||||
byte[] data = Convert.FromBase64String(input);
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] key = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
|
||||
using (TripleDESCryptoServiceProvider tds = new TripleDESCryptoServiceProvider() { Key = key, Mode = cipherMode, Padding = paddingMode })
|
||||
{
|
||||
ICryptoTransform ict = tds.CreateDecryptor();
|
||||
byte[] results = ict.TransformFinalBlock(data, 0, data.Length);
|
||||
return UTF8Encoding.UTF8.GetString(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string intToString(int input){
|
||||
char[] inputBytes = input.ToString().ToCharArray();
|
||||
string output = "";
|
||||
foreach(char c in inputBytes){
|
||||
output += charPool[int.Parse(c.ToString())];
|
||||
}
|
||||
int luckyNumber = GetLuckyNumber(input);
|
||||
|
||||
string lastLetter = charPool.ToCharArray()[luckyNumber].ToString();
|
||||
|
||||
return output+lastLetter;
|
||||
}
|
||||
|
||||
public static int stringToInt(string input){
|
||||
char[] inputBytes = input.Remove(input.Length-1).ToCharArray();
|
||||
string output = "";
|
||||
foreach(char c in inputBytes){
|
||||
for(int i=0; i < charPool.Length; i++){
|
||||
if(charPool.ToCharArray()[i] == c){
|
||||
output += i.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char lastchar = input.ToCharArray()[input.Length-1];
|
||||
|
||||
int outputInt = int.Parse(output);
|
||||
char luckyChar = charPool.ToCharArray()[GetLuckyNumber(outputInt)];
|
||||
bool validated = luckyChar == lastchar;
|
||||
|
||||
|
||||
if(validated){
|
||||
return outputInt;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int GetLuckyNumber(int input){
|
||||
int luckyNumber=input;
|
||||
while(luckyNumber >= 10){
|
||||
int val = 0;
|
||||
for(int i=0; i < luckyNumber.ToString().Length; i++){
|
||||
val += int.Parse(luckyNumber.ToString().ToCharArray()[i].ToString());
|
||||
}
|
||||
|
||||
luckyNumber = val;
|
||||
}
|
||||
|
||||
return luckyNumber;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Encryptor.cs.meta
Normal file
11
Assets/Scripts/Encryptor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8ea67314c0e25f43a9834b0be9797db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -43,11 +43,14 @@ public class GameManager : MonoBehaviour
|
||||
public Text gameOverBestScoreTxt, gameOverTotalScoreTxt;
|
||||
public GameObject GameOverUI;
|
||||
public GameObject PauseMenuUI;
|
||||
public Button muteBtn;
|
||||
public Sprite muteIcon, unmuteIcon;
|
||||
public Animator HoleInOne;
|
||||
public int curHoleIndex;
|
||||
private static int adCounter = 0;
|
||||
void Start()
|
||||
{
|
||||
muteBtn.onClick.AddListener(OnMute);
|
||||
strokesTxtDefaultSize = StrokesTxt.transform.localScale;
|
||||
scoreTxtDefaultSize = ScoreTxt.transform.localScale;
|
||||
camTargetPos = ball.transform.position;
|
||||
@@ -232,6 +235,15 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
ScoreTxt.text = Score.ToString();
|
||||
StrokesTxt.text = CurStrokes.ToString();
|
||||
|
||||
|
||||
muteBtn.transform.GetChild(0).GetComponent<Image>().sprite = AudioManager.isMute ? muteIcon : unmuteIcon;
|
||||
}
|
||||
|
||||
void OnMute(){
|
||||
AudioManager.ToggleMute();
|
||||
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +283,8 @@ public class GameManager : MonoBehaviour
|
||||
}else{
|
||||
LeanTween.scale(PauseMenuUI, Vector3.zero, 0.15f).setEaseOutCirc();
|
||||
}
|
||||
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,12 +97,19 @@ public class LevelGenerator : MonoBehaviour
|
||||
}
|
||||
|
||||
|
||||
float checker = 0;
|
||||
void Update()
|
||||
{
|
||||
if(GameManager.instance == null){return;}
|
||||
if(checker < 30){
|
||||
checker+=Time.deltaTime;
|
||||
}else{
|
||||
checker =0;
|
||||
|
||||
if(GameManager.instance.ball.position.x > lastOffset - 100){
|
||||
GenerateBlock();
|
||||
if(GameManager.instance.ball.position.x > lastOffset - 100){
|
||||
GenerateBlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public class MainMenu : MonoBehaviour
|
||||
|
||||
public GameObject MainMenuPanel;
|
||||
public GameObject SettingsPanel;
|
||||
public GameObject LeaderboarPanel;
|
||||
public Transform LeaderboardItemsParent;
|
||||
public float transitionTime;
|
||||
public LeanTweenType transitionEffect;
|
||||
|
||||
@@ -26,12 +28,16 @@ public class MainMenu : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
defaultCenter = MainMenuPanel.transform.position;
|
||||
SettingsPanel.transform.position = MainMenuPanel.transform.position - new Vector3(3000,0);
|
||||
SettingsPanel.transform.position = MainMenuPanel.transform.position - new Vector3(10000,0);
|
||||
SettingsPanel.SetActive(true);
|
||||
LeaderboarPanel.SetActive(true);
|
||||
LeaderboarPanel.transform.position = MainMenuPanel.transform.position + new Vector3(10000,0);
|
||||
|
||||
muteBtn.onClick.AddListener(ToggleMute);
|
||||
copyBtn.onClick.AddListener(CopyId);
|
||||
signoutBtn.onClick.AddListener(SignOut);
|
||||
|
||||
DataManager.RefreshLeaderboard();
|
||||
}
|
||||
public void Leave(){
|
||||
Application.Quit();
|
||||
@@ -44,7 +50,7 @@ public class MainMenu : MonoBehaviour
|
||||
|
||||
|
||||
void Refresh(){
|
||||
txtUserId.text = DataManager.userData.id.ToString();
|
||||
txtUserId.text = Encryptor.intToString(DataManager.userData.id);
|
||||
if(AudioManager.isMute){
|
||||
muteBtn.transform.GetChild(0).GetComponent<Image>().sprite = muteIcon;
|
||||
}else{
|
||||
@@ -57,13 +63,20 @@ public class MainMenu : MonoBehaviour
|
||||
LeanTween.moveX(SettingsPanel, defaultCenter.x, transitionTime).setEase(transitionEffect);
|
||||
}
|
||||
|
||||
public void LeaderboarPage(){
|
||||
LeanTween.moveX(MainMenuPanel, -10000, transitionTime).setEase(transitionEffect);
|
||||
LeanTween.moveX(LeaderboarPanel, defaultCenter.x, transitionTime).setEase(transitionEffect);
|
||||
RefreshLeaderboard();
|
||||
}
|
||||
|
||||
public void MainPage(){
|
||||
LeanTween.moveX(MainMenuPanel, defaultCenter.x, transitionTime).setEase(transitionEffect);
|
||||
LeanTween.moveX(SettingsPanel, -10000, transitionTime).setEase(transitionEffect);
|
||||
LeanTween.moveX(LeaderboarPanel, 10000, transitionTime).setEase(transitionEffect);
|
||||
}
|
||||
|
||||
public void CopyId(){
|
||||
GUIUtility.systemCopyBuffer = DataManager.userData.id.ToString();
|
||||
GUIUtility.systemCopyBuffer = txtUserId.text;
|
||||
copyBtn.transform.Find("lbl").GetComponent<Text>().text = "Copied";
|
||||
}
|
||||
|
||||
@@ -72,6 +85,29 @@ public class MainMenu : MonoBehaviour
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Info(){
|
||||
MessageBox.ShowMessage(@"This is a game where you can relax while playing,
|
||||
Listen to a podcast or to music while playing this to get the best out of it!
|
||||
|
||||
Any feedback or suggestion can be directed to us via this email
|
||||
sewmina7@gmail.com","About");
|
||||
}
|
||||
|
||||
async void RefreshLeaderboard(){
|
||||
UpdateLeaderboardUI();
|
||||
await DataManager.RefreshLeaderboard();
|
||||
UpdateLeaderboardUI();
|
||||
}
|
||||
|
||||
void UpdateLeaderboardUI(){
|
||||
for(int i =0; i < DataManager.Leaderboard.Count; i++){
|
||||
LeaderboardItemsParent.GetChild(i).GetChild(0).GetComponent<Text>().text = $"{i+1}." + DataManager.Leaderboard[i].DisplayName;
|
||||
// LeaderboardItemsParent.GetChild(i).GetChild(0).GetComponent<Text>().text = $"{i+1}." + DataManager.Leaderboard[i].name;
|
||||
LeaderboardItemsParent.GetChild(i).GetChild(1).GetComponent<Text>().text = DataManager.Leaderboard[i].topScore.ToString();
|
||||
|
||||
LeaderboardItemsParent.GetChild(i).GetComponent<Image>().CrossFadeAlpha((DataManager.Leaderboard[i].name == DataManager.userData.username) ? 0.9f : 0,0.5f,true);
|
||||
}
|
||||
}
|
||||
|
||||
void SignOut(){
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MessageBox : MonoBehaviour
|
||||
for(int i=0; i < message.Length; i++){
|
||||
messageTxt.text += message[i];
|
||||
|
||||
yield return new WaitForSeconds(0.02f);
|
||||
yield return new WaitForSeconds(0.01f);
|
||||
}
|
||||
closeButton.gameObject.SetActive(true);
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 1.0
|
||||
bundleVersion: 1.2
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
@@ -162,9 +162,9 @@ PlayerSettings:
|
||||
iPhone: 0
|
||||
tvOS: 0
|
||||
overrideDefaultApplicationIdentifier: 1
|
||||
AndroidBundleVersionCode: 1
|
||||
AndroidBundleVersionCode: 2
|
||||
AndroidMinSdkVersion: 22
|
||||
AndroidTargetSdkVersion: 0
|
||||
AndroidTargetSdkVersion: 33
|
||||
AndroidPreferredInstallLocation: 1
|
||||
aotOptions:
|
||||
stripEngineCode: 1
|
||||
|
||||
Reference in New Issue
Block a user