diff --git a/Assets/Prefabs/row.prefab b/Assets/Prefabs/row.prefab index 5e35d49d0c85c24b183d663aa993356ffcc35529..c3a90e6b2a6ec49c8c3f9b6ad44aac00cc3986be 100644 --- a/Assets/Prefabs/row.prefab +++ b/Assets/Prefabs/row.prefab @@ -244,6 +244,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4663329718610754680} + - component: {fileID: 1233663338227234169} m_Layer: 5 m_Name: row m_TagString: Untagged @@ -273,3 +274,15 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 49.96161} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1233663338227234169 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4663329718610754681} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 558bb9ab65b38a54f9d0d97bd6f21e2e, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Scenes/Menu.unity b/Assets/Scenes/Menu.unity index 019bb13e60107b44b2dce274c30e401c8630cf68..55e131479ddabf9ac75eae936222ae537aa87f6f 100644 --- a/Assets/Scenes/Menu.unity +++ b/Assets/Scenes/Menu.unity @@ -2607,9 +2607,9 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1891644864} - m_TargetAssemblyTypeName: MenuController, Assembly-CSharp - m_MethodName: backButtonLeaderboard + - m_Target: {fileID: 1136063536} + m_TargetAssemblyTypeName: PlayFabGetLeaderboard, Assembly-CSharp + m_MethodName: RefreshButton m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -2866,7 +2866,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &2071320553 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Platform_spawning.unity b/Assets/Scenes/Platform_spawning.unity index e29bab4c526ff81beca82e12b418f8e683b80433..35097befbbcd26cb2ac4a7be83755eaebf1043a5 100644 --- a/Assets/Scenes/Platform_spawning.unity +++ b/Assets/Scenes/Platform_spawning.unity @@ -131,7 +131,7 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3bc2e633913ded64886a4669a8dc1934, type: 3} + m_Script: {fileID: 11500000, guid: 7e209c2cce12c254fbf93278199b21d6, type: 3} m_Name: m_EditorClassIdentifier: --- !u!114 &207827323 stripped @@ -227,7 +227,7 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2c337c71b0ca81d4cabc0efcf6a32922, type: 3} + m_Script: {fileID: 11500000, guid: 20ba6e5a58c196f46bd2730c6533e92f, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1 &1023807862 @@ -361,7 +361,7 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d67a4f3940499a1459177d175a88673e, type: 3} + m_Script: {fileID: 11500000, guid: d3ef8307452660d489e04484925e0617, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1001 &1495497003 @@ -721,6 +721,10 @@ PrefabInstance: propertyPath: m_FellOffController value: objectReference: {fileID: 913402431} + - target: {fileID: 1739828243584991409, guid: 55d2f14dee4db49449ae72330c148985, type: 3} + propertyPath: onkoltsegController + value: + objectReference: {fileID: 74227777} - target: {fileID: 1739828243584991409, guid: 55d2f14dee4db49449ae72330c148985, type: 3} propertyPath: DeIncreaseOnkoltsegTime value: 0.025 diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 95c6774f74afe1eed4efef148805dc0e9e229eba..95d46d418aaa56fb1c68f99c4a68fb21da1360a7 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -34,7 +34,7 @@ public class GameManager : MonoBehaviour { [SerializeField] private float DeIncreaseOnkoltsegTime = 0.025f; [Header("Instances")] - [SerializeField] private OnkoltsegController OnkoltsegController; + [SerializeField] private OnkoltsegController onkoltsegController; [SerializeField] private Canvas InputCanvas; [SerializeField] private ScoreController scoreController; [SerializeField] private ScoreData _scoreData; @@ -64,7 +64,7 @@ public class GameManager : MonoBehaviour { Instance.spawn_platform(); } - mainCamera.GetComponent<Main_camera>().CameraMoved += () => OnkoltsegController.ResetTimer(); + mainCamera.GetComponent<Main_camera>().CameraMoved += () => onkoltsegController.ResetTimer(); StartCoroutine(WaitForInput()); } @@ -74,7 +74,7 @@ public class GameManager : MonoBehaviour { yield return null; } - OnkoltsegController.Enable = true; + onkoltsegController.Enable = true; Player.PlayerJump.Enable = true; Player.PlayerJump.jump(); InputCanvas.enabled = false; @@ -96,7 +96,7 @@ public class GameManager : MonoBehaviour { public void FellDown() { - OnkoltsegController.GameEnd(); + onkoltsegController.GameEnd(); cameraController.Falling(); } @@ -108,11 +108,11 @@ public class GameManager : MonoBehaviour { if (min_y_offset < max_y_offset - 0.05f) min_y_offset += IncreaseDistance; - OnkoltsegController.RaisingSpeed += IncreaseOnkoltsegSpeed; + onkoltsegController.RaisingSpeed += IncreaseOnkoltsegSpeed; Owl.Speed += IncreaseOwlSpeed; - if (OnkoltsegController.WaitingTime > 0.5) - OnkoltsegController.WaitingTime -= DeIncreaseOnkoltsegTime; + if (onkoltsegController.WaitingTime > 0.5) + onkoltsegController.WaitingTime -= DeIncreaseOnkoltsegTime; } public void SaveScore(){ diff --git a/Assets/Scripts/Platforms/OnkoltsegController.cs b/Assets/Scripts/Platforms/OnkoltsegController.cs index 3cf72bc920094270368747c36abba391eba04738..d1cbb01f997581e7ec1afffa8e7beec1ff77a7f6 100644 --- a/Assets/Scripts/Platforms/OnkoltsegController.cs +++ b/Assets/Scripts/Platforms/OnkoltsegController.cs @@ -41,7 +41,7 @@ public class OnkoltsegController : MonoBehaviour { private bool end = false; // Start is called before the first frame update - void Start(){ + void Start() { Enable = false; tmpWaitingTime = waitingTime; moving = false; diff --git a/Assets/Scripts/PlayFabConn.meta b/Assets/Scripts/PlayFabConn.meta new file mode 100644 index 0000000000000000000000000000000000000000..8f0324aade569acb87dacdab2189651cf50a7d3f --- /dev/null +++ b/Assets/Scripts/PlayFabConn.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e6c6ef4a28e76b4ca62e3ce9aa64af7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs b/Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs index 33c8d616dff821d3990bb4df0c1d273ef1677ca8..e2ebdbf20282565858802dfca43bdf5bcec9845d 100644 --- a/Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs +++ b/Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs @@ -19,6 +19,13 @@ public class PlayFabGetLeaderboard : MonoBehaviour { Login(); StartCoroutine(GetLeaderBoard()); StartCoroutine(GetData()); + StartCoroutine(FillBoard()); + } + public void RefreshButton() { + playerList = new Dictionary<string, Dictionary<string, string>>(); + StartCoroutine(GetLeaderBoard()); + StartCoroutine(GetData()); + StartCoroutine(FillBoard()); } public void Login() { loggedIn = false; @@ -51,6 +58,13 @@ public class PlayFabGetLeaderboard : MonoBehaviour { } GetPlayerDatas(); } + IEnumerator FillBoard() { + while (!loggedIn || !leaderboardGotten || datasRecived < playerList.Keys.Count) { + Debug.Log($"{datasRecived} : {playerList.Count}"); + yield return null; + } + FillLeaderBoard(); + } public void RefreshLeaderBoard() { leaderboardGotten = false; @@ -63,6 +77,7 @@ public class PlayFabGetLeaderboard : MonoBehaviour { result => { foreach (var item in result.Leaderboard) { playerList.Add(item.PlayFabId, new Dictionary<string, string>()); + playerList[item.PlayFabId].Add("Score", item.StatValue.ToString()); } leaderboardGotten = true; @@ -86,7 +101,7 @@ public class PlayFabGetLeaderboard : MonoBehaviour { player.Value.Add("Name", result.Data["name"].Value); player.Value.Add("Color", result.Data["color"].Value); datasRecived++; - Debug.Log($"{player.Value["Name"]} : {player.Value["Color"]}"); + Debug.Log($"{player.Value["Name"]} : {player.Value["Color"]} : {datasRecived}"); } else { Debug.LogError("Player data not full."); } @@ -98,23 +113,36 @@ public class PlayFabGetLeaderboard : MonoBehaviour { } } void FillLeaderBoard() { - Transform[] children = table.GetComponentsInChildren<Transform>(); + rowScript[] children = table.GetComponentsInChildren<rowScript>(); foreach (var child in children) { Destroy(child.gameObject); } - + + foreach (var player in playerList) { + var datas = player.Value; + AppendTableRow(datas["Name"], datas["Color"], datas["Score"]); + } } void AppendTableRow(string playerName, string color, string score) { GameObject row = Instantiate(rowPrefab, table); - UnityEngine.UI.Text[] texts = row.GetComponentsInChildren<Text>(); + Text[] texts = row.GetComponentsInChildren<Text>(); Image image = row.GetComponentInChildren<Image>(); - Text text; + texts[0].text = playerName; + texts[1].text = score; Color tmpColor = Color.magenta; if ("red".Equals(color)) { - - } else if ("red".Equals(color)) { - + tmpColor = Color.red; + } else if ("black".Equals(color)) { + tmpColor = Color.black; + } else if ("white".Equals(color)) { + tmpColor = Color.white; + } else if ("blue".Equals(color)) { + tmpColor = Color.blue; + } else if ("yellow".Equals(color)) { + tmpColor = Color.yellow; } + + image.color = tmpColor; } void Update() { diff --git a/Assets/Scripts/PlayFabConn/rowScript.cs b/Assets/Scripts/PlayFabConn/rowScript.cs new file mode 100644 index 0000000000000000000000000000000000000000..e69e2cd24f538d3f7d0db1ffa025ff821577f79d --- /dev/null +++ b/Assets/Scripts/PlayFabConn/rowScript.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class rowScript : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/PlayFabConn/rowScript.cs.meta b/Assets/Scripts/PlayFabConn/rowScript.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5b0a0a9dd045e26f56a32f3bdb72e5c7e82147c3 --- /dev/null +++ b/Assets/Scripts/PlayFabConn/rowScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 558bb9ab65b38a54f9d0d97bd6f21e2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: