Leaderboard
This commit is contained in:
@@ -72,7 +72,7 @@ TrailRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Time: 3.39
|
||||
m_Time: 1
|
||||
m_Parameters:
|
||||
serializedVersion: 3
|
||||
widthMultiplier: 1
|
||||
@@ -330,6 +330,9 @@ MonoBehaviour:
|
||||
syncInterval: 0.1
|
||||
pname:
|
||||
Scores: 0
|
||||
trailTime: 0
|
||||
trailIncrementRate: 0.5
|
||||
dead: 0
|
||||
pnameTxt: {fileID: 1318931860792545326}
|
||||
body: {fileID: 5431987895376475546}
|
||||
trailMgr: {fileID: 5995183602835295541}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
58
Assets/Game/Scripts/Minigame/Leaderboard.cs
Normal file
58
Assets/Game/Scripts/Minigame/Leaderboard.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
public class Leaderboard : MonoBehaviour
|
||||
{
|
||||
public Text[] leaderboardItems;
|
||||
public float updateInterval = 0.5f;
|
||||
float t;
|
||||
void Start()
|
||||
{
|
||||
RefreshLeaderboard();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (t < updateInterval)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshLeaderboard();
|
||||
t = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshLeaderboard()
|
||||
{
|
||||
SpaceshipController[] players = FindObjectsOfType<SpaceshipController>();
|
||||
//Simple bubble sort to sort players by score
|
||||
SpaceshipController temp;
|
||||
for (int j = 0; j <= players.Length - 2; j++)
|
||||
{
|
||||
for (int i = 0; i <= players.Length - 2; i++)
|
||||
{
|
||||
if (players[i].Scores > players[i + 1].Scores)
|
||||
{
|
||||
temp = players[i + 1];
|
||||
players[i + 1] = players[i];
|
||||
players[i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Populate leaderboard
|
||||
for(int i =0; i < leaderboardItems.Length; i++){
|
||||
if(i < players.Length){
|
||||
SpaceshipController thisPlayer = players[players.Length-i-1];
|
||||
leaderboardItems[i].gameObject.SetActive(true);
|
||||
leaderboardItems[i].text = (i+1) + ". " +thisPlayer.pname;
|
||||
leaderboardItems[i].transform.GetChild(0).GetComponent<Text>().text = thisPlayer.Scores.ToString();
|
||||
}else{
|
||||
leaderboardItems[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/Minigame/Leaderboard.cs.meta
Normal file
11
Assets/Game/Scripts/Minigame/Leaderboard.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e79669136fba7a4b946b40cf90800b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
90
upf.sln
90
upf.sln
@@ -1,75 +1,63 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{d2fa7125-b336-b292-eceb-bf1e731b3f48}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleWebTransport", "SimpleWebTransport.csproj", "{f4ef7e8d-99b4-a202-8a27-32dcfce49cfe}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleWebTransport", "SimpleWebTransport.csproj", "{5c2c6f8b-afbb-9cd0-d973-6efba6c32d6d}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Examples", "Mirror.Examples.csproj", "{6f1ac7da-277d-ee44-8547-e218c93f84df}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror", "Mirror.csproj", "{8c789ebf-5061-692d-09a2-395c3f960186}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror", "Mirror.csproj", "{d9448b0f-e456-cf8f-8285-980f3496df94}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Examples", "Mirror.Examples.csproj", "{bd29b6d7-a588-6db2-c4b4-0c3e7050329f}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Whinarn.UnityMeshSimplifier.Runtime", "Whinarn.UnityMeshSimplifier.Runtime.csproj", "{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Components", "Mirror.Components.csproj", "{92ca8eda-4591-6ba7-62fe-23737b4dad83}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Components", "Mirror.Components.csproj", "{0203a8e7-6255-7e0b-3cbf-ecae2398312c}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kcp2k", "kcp2k.csproj", "{c8f5758f-6f4d-6ca3-8672-ff5589388f80}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telepathy", "Telepathy.csproj", "{8c94d811-7988-2ebf-1cc0-26b574688e67}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telepathy", "Telepathy.csproj", "{a36d2e59-4ac3-f799-3987-fc2485d79e1a}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kcp2k", "kcp2k.csproj", "{cf7f2fab-d83d-f366-f3b2-9d9e4eddc3cc}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "where-allocations", "where-allocations.csproj", "{ebda325d-e86f-a93b-6742-1169bded4621}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "where-allocations", "where-allocations.csproj", "{e020c22e-60bb-7a19-f116-ef587d3ae77f}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Authenticators", "Mirror.Authenticators.csproj", "{3eef3b8e-d897-623d-b9c7-d540c823b9a8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Authenticators", "Mirror.Authenticators.csproj", "{520da678-0ed5-7053-5e7f-1a7e3c90b70a}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{11a3099b-b691-e713-f90d-1e4ea21c7a4c}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Mirror.CodeGen", "Unity.Mirror.CodeGen.csproj", "{58b849ad-b7ea-e401-5c5b-0056f4cec462}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Editor", "Mirror.Editor.csproj", "{2c2a6066-189f-5a3f-0f94-acebe3ed3a33}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.Editor", "Mirror.Editor.csproj", "{74cb33d9-aafa-4b6f-1603-b7b7c41edd4c}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Mirror.CodeGen", "Unity.Mirror.CodeGen.csproj", "{0568cbc7-4b38-de37-2cfc-efd6fc69d0df}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.CompilerSymbols", "Mirror.CompilerSymbols.csproj", "{e1d3e786-6173-5f3a-7812-807511d3f547}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.com.consulo.ide.Editor", "Unity.com.consulo.ide.Editor.csproj", "{f3918ae7-b834-5fa8-e000-01833c449c8e}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{20764e99-32a2-613b-c7bd-2b420a48759f}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Whinarn.UnityMeshSimplifier.Editor", "Whinarn.UnityMeshSimplifier.Editor.csproj", "{9c3e4793-780d-e333-1ec5-d5e17feec6f2}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mirror.CompilerSymbols", "Mirror.CompilerSymbols.csproj", "{f12b632e-c0f2-40d4-ee68-81bde8ff4e6e}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{f4ef7e8d-99b4-a202-8a27-32dcfce49cfe}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{f4ef7e8d-99b4-a202-8a27-32dcfce49cfe}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6f1ac7da-277d-ee44-8547-e218c93f84df}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6f1ac7da-277d-ee44-8547-e218c93f84df}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{d9448b0f-e456-cf8f-8285-980f3496df94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{d9448b0f-e456-cf8f-8285-980f3496df94}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0203a8e7-6255-7e0b-3cbf-ecae2398312c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0203a8e7-6255-7e0b-3cbf-ecae2398312c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8c94d811-7988-2ebf-1cc0-26b574688e67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8c94d811-7988-2ebf-1cc0-26b574688e67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{cf7f2fab-d83d-f366-f3b2-9d9e4eddc3cc}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{cf7f2fab-d83d-f366-f3b2-9d9e4eddc3cc}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{e020c22e-60bb-7a19-f116-ef587d3ae77f}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{e020c22e-60bb-7a19-f116-ef587d3ae77f}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{520da678-0ed5-7053-5e7f-1a7e3c90b70a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{520da678-0ed5-7053-5e7f-1a7e3c90b70a}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{58b849ad-b7ea-e401-5c5b-0056f4cec462}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{58b849ad-b7ea-e401-5c5b-0056f4cec462}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74cb33d9-aafa-4b6f-1603-b7b7c41edd4c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74cb33d9-aafa-4b6f-1603-b7b7c41edd4c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{e1d3e786-6173-5f3a-7812-807511d3f547}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{e1d3e786-6173-5f3a-7812-807511d3f547}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20764e99-32a2-613b-c7bd-2b420a48759f}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{20764e99-32a2-613b-c7bd-2b420a48759f}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9c3e4793-780d-e333-1ec5-d5e17feec6f2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9c3e4793-780d-e333-1ec5-d5e17feec6f2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{d2fa7125-b336-b292-eceb-bf1e731b3f48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{d2fa7125-b336-b292-eceb-bf1e731b3f48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5c2c6f8b-afbb-9cd0-d973-6efba6c32d6d}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5c2c6f8b-afbb-9cd0-d973-6efba6c32d6d}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8c789ebf-5061-692d-09a2-395c3f960186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8c789ebf-5061-692d-09a2-395c3f960186}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{bd29b6d7-a588-6db2-c4b4-0c3e7050329f}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{bd29b6d7-a588-6db2-c4b4-0c3e7050329f}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{92ca8eda-4591-6ba7-62fe-23737b4dad83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92ca8eda-4591-6ba7-62fe-23737b4dad83}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{c8f5758f-6f4d-6ca3-8672-ff5589388f80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{c8f5758f-6f4d-6ca3-8672-ff5589388f80}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{a36d2e59-4ac3-f799-3987-fc2485d79e1a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{a36d2e59-4ac3-f799-3987-fc2485d79e1a}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ebda325d-e86f-a93b-6742-1169bded4621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ebda325d-e86f-a93b-6742-1169bded4621}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3eef3b8e-d897-623d-b9c7-d540c823b9a8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3eef3b8e-d897-623d-b9c7-d540c823b9a8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{11a3099b-b691-e713-f90d-1e4ea21c7a4c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{11a3099b-b691-e713-f90d-1e4ea21c7a4c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2c2a6066-189f-5a3f-0f94-acebe3ed3a33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2c2a6066-189f-5a3f-0f94-acebe3ed3a33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0568cbc7-4b38-de37-2cfc-efd6fc69d0df}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0568cbc7-4b38-de37-2cfc-efd6fc69d0df}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{f12b632e-c0f2-40d4-ee68-81bde8ff4e6e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{f12b632e-c0f2-40d4-ee68-81bde8ff4e6e}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user