// Start is called before the first frame update void Start() { Text rankText = GetComponent <Text>(); try { StreamReader file = new StreamReader(Path.Combine(Application.persistentDataPath, "RecordState")); string loadJson = file.ReadToEnd(); loadJson = loadJson.Remove(loadJson.Length - 1); loadJson = "{\"Items\":[" + loadJson + "]}"; file.Close(); RecordArray loadData = new RecordArray(); loadData = JsonUtility.FromJson <RecordArray>(loadJson); rankText.text = "Rank\t\tTime\t\tCoin\n"; Array.Sort(loadData.Items, delegate(RecordState x, RecordState y) { return(x.time.CompareTo(y.time)); }); for (int i = 0; i < loadData.Items.Length; i++) { rankText.text += ((i + 1) + "\t\t\t" + loadData.Items[i].time.ToString("f2") + "\t\t" + loadData.Items[i].coin + "\n"); } } catch (FileNotFoundException) { } }
public void SetValue() { var dict = new RecordArray <int, string>(); dict[20] = "Hello"; CollectionAssert.AreEqual( new (int, string)[] { (20, "Hello") },
public DefineShape() : base(2) { this.LineStyles = new LineStyleArray(); this.nFillBits = 0; this.nLineBits = 0; this.hasBounds = false; this.Records = new RecordArray(this); this.FillStyles = new FillStyleArray(this); }
public void ResetPendingActions() { PendingAction = ChildPendingAction.None; // Set a new array without all the deleted records. RecordArray = RecordArray.Where( r => r.PendingAction != ChildPendingAction.Delete).ToArray();; RecordArray.ToList().ForEach(r => r.PendingAction = ChildPendingAction.None); }
public void GetEmptyValue() { var dict = new RecordArray <int, string>(); Assert.AreEqual(null, dict[20]); }