public void GetRandomPresident() { if (clickPoints > 999) { System.Random rnd = new System.Random(); byte random = (byte)rnd.Next(1, 7); foreach (var resource in LocalPresidentImage._list) { if (resource.name == LocalRecords.allPresidents.Find(x => x.ID == random).ImageName) { imageFreePresident.sprite = resource; } } if (LocalRecords.records.Any(x => x == random) != true) { #if UNITY_EDITOR string path = Application.dataPath + "/" + "records.txt"; #else string path = Application.persistentDataPath + "/" + "records.txt"; #endif using (StreamWriter writer = File.AppendText(path)) writer.Write(";{0}", random); } LocalRecords.ReadFile(); clickPoints = clickPoints - 1000; GameObject.Find("Canvas/Text_ClickPoint").GetComponent <Text>().text = clickPoints.ToString(); CheckCountClickPoints(); } else { IPStatus status = IPStatus.Unknown; try { status = new System.Net.NetworkInformation.Ping().Send("www.google.com").Status; } catch { } if (status == IPStatus.Success) { //ShowReklama(); GameObject.Find("Canvas/Text_StatusIP").GetComponent <Text>().text = "success"; clickPoints += 1000; CheckCountClickPoints(); GameObject.Find("Canvas/Text_ClickPoint").GetComponent <Text>().text = clickPoints.ToString(); } else { GameObject.Find("Canvas/Text_StatusIP").GetComponent <Text>().text = "нет соединения с интернетом"; } } }
private void DetermineLocalRecords() { LocalRecords = RecordAdapter.GetTopRecordsForChallenge(CurrentChallengeID, Settings.MaxRecordsToReport).ToArray(); Context.ValueStore.SetOrUpdate(GlobalConstants.LOCAL_RECORDS, LocalRecords.ToArray()); Context.ValueStore.SetOrUpdate(GlobalConstants.FIRST_LOCAL_RECORD_TIMEORSCORE, LocalRecords.Length == 0 ? null : (int?)LocalRecords[0].TimeOrScore); }