// Use this for initialization public void Init() { playerName1 = PlayerPrefs.GetString("playerName1"); playerName2 = PlayerPrefs.GetString("playerName2"); playerName3 = PlayerPrefs.GetString("playerName3"); playerName4 = PlayerPrefs.GetString("playerName4"); for (int i = 0; i < Data.Instance.levels.levels.Length; i++) { HiscoreLevel hiscoreLevel = new HiscoreLevel(); hiscoreLevels.Add(hiscoreLevel); hiscoreLevel.hiscores = new List <HiscoresData>(); // hiscoreLevel.hiscores = new List<HiscoresData>(); //for (int a = 0; a < 3; a++) //{ // HiscoresData hiscoresData = new HiscoresData(); // hiscoreLevel.hiscores.Add( hiscoresData ); //} } LeadPlayerPrefs(); }
void OnAddMultiplayerScore(int levelID, float score, int playerID, string username) { //print("OnAddMultiplayerScore: " + levelID + " score:" + score + " playerID:" + playerID + " username:" + username); HiscoreLevel hiscoreLevel = hiscoreLevels[levelID]; hiscoreLevel.lastWinner = playerID; int num = 1; HiscoresData hiscoresData = new HiscoresData(); hiscoresData.levelID = levelID; hiscoresData.score = score; hiscoresData.username = username; hiscoresData.playerID = playerID; hiscoreLevel.hiscores.Add(hiscoresData); ArrengeListByScore(levelID); SavePlayerPrefs(); }