public override void Open(string value) { gameObject.SetActive(true); _orderButtons = new List <OrderButton> { NameButton, ScoreTotButton, TotQuizzButton }; foreach (ScoreLine sl in _lines) { Destroy(sl.gameObject); } _lines = new List <ScoreLine>(); string historyResponse = WebUtility.Instance.Get(LEADERBOARD_REQUEST); StringReader reader = new StringReader(historyResponse); JsonSerializer ser = JsonSerializer.Create(new JsonSerializerSettings()); List <LeaderboardResult> results = new List <LeaderboardResult>(); results = (List <LeaderboardResult>)ser.Deserialize(reader, typeof(List <LeaderboardResult>)); for (int i = 0; i < results.Count; i++) { ScoreLine line = Instantiate(ScoreLinePrefab, SpawnRoot); line.Init(results[i].name, int.Parse(results[i].score), int.Parse(results[i].quiz)); _lines.Add(line); } SelectTab(Tab.Name); }
void AddSignal(ArcadeRanking.Hiscore data, int puesto) { ScoreLine newSignal = Instantiate(scoreLineToInstatiate); newSignal.Init(puesto, data.username, data.hiscore); newSignal.transform.SetParent(hsicoresContainer); newSignal.transform.localScale = Vector3.one; }
void OnMissionStart(int missionID) { if (Data.Instance.isAndroid) { int videoGameID = Data.Instance.videogamesData.actualID; HiscoresByMissions.MissionHiscoreUserData hiscoreData = UserData.Instance.hiscoresByMissions.GetHiscore(videoGameID, missionID); if (hiscoreData == null) { print("no hay hiscore de videoGameID: " + videoGameID + " mission " + missionID); hiscorePanel.gameObject.SetActive(false); } else { hiscorePanel.Init(0, hiscoreData.username, hiscoreData.score); hiscorePanel.SetImage(hiscoreData.userID); } } }
void LoadHiscores(string fileName) { String[] arrLines = File.ReadAllLines(fileName); int num = 1; foreach (string line in arrLines) { string[] lines = line.Split("_"[0]); Hiscore hiscore = new Hiscore(); hiscore.username = lines[0]; hiscore.hiscore = int.Parse(lines[1]); hiscores.Add(hiscore); if (hiscore.hiscore < Data.Instance.score && !yaAgrego) { yaAgrego = true; puesto = num; if (num < 11) { ScoreLine newScoreLine = Instantiate(scoreLineNewHiscore); newScoreLine.Init(num, "XXX", Data.Instance.score); newScoreLine.transform.SetParent(container); newScoreLine.transform.localScale = Vector3.one; num++; } } if (num < 11) { ScoreLine newScoreLine = Instantiate(scoreLine); newScoreLine.Init(num, hiscore.username, hiscore.hiscore); newScoreLine.transform.SetParent(container); newScoreLine.transform.localScale = Vector3.one; } num++; } }
public void OnDone(HiscoresByMissions.MissionHiscoreData data) { int id = 0; if (data == null || data.all.Count == 0) { return; } foreach (HiscoresByMissions.MissionHiscoreUserData m in data.all) { ScoreLine newLine = Instantiate(scoreLine); newLine.transform.SetParent(container); newLine.transform.localPosition = Vector3.zero; newLine.transform.localScale = Vector3.one; newLine.Init(id + 1, m.username, m.score); newLine.SetImage(m.userID); if (m.userID == UserData.Instance.userID) { MyScoreLoaded(m.score); } id++; } }