Skip to content

Commit 500f74f

Browse files
committed
Clean up JSON tests, mark for deletion
1 parent 0c8795f commit 500f74f

File tree

6 files changed

+195
-2
lines changed

6 files changed

+195
-2
lines changed

Assets/_Project/Scenes/tally-viz.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,7 @@ MonoBehaviour:
23222322
m_HandleRect: {fileID: 489705913}
23232323
m_Direction: 2
23242324
m_Value: 0
2325-
m_Size: 0.9860249
2325+
m_Size: 0.49999985
23262326
m_NumberOfSteps: 0
23272327
m_OnValueChanged:
23282328
m_PersistentCalls:
@@ -4629,7 +4629,7 @@ RectTransform:
46294629
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
46304630
m_AnchorMin: {x: 0, y: 1}
46314631
m_AnchorMax: {x: 1, y: 1}
4632-
m_AnchoredPosition: {x: 0, y: -99.99958}
4632+
m_AnchoredPosition: {x: 0, y: -54.103317}
46334633
m_SizeDelta: {x: 0, y: 0}
46344634
m_Pivot: {x: 0.5, y: 0.5}
46354635
--- !u!114 &1617634874

Assets/_Project/Scripts/Data/NotInUse.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
using UnityEngine;
2+
using Newtonsoft.Json.Linq;
3+
using System.Collections.Generic;
4+
5+
6+
using System.Collections;
7+
using System;
8+
using System.Net;
9+
using System.IO;
10+
11+
12+
//[System.Serializable]
13+
//public class Gradient {
14+
// public int mid;
15+
// public string hex1;
16+
// public string hex2;
17+
// public int tier1;
18+
//}
19+
//[System.Serializable]
20+
//public class Gradients {
21+
// public Gradient gradients;
22+
//}
23+
24+
25+
26+
27+
28+
//[System.Serializable]
29+
//public class GradientDataPoint {
30+
// public int mid { get; set; }
31+
// public string hex1 { get; set; }
32+
// public string hex2 { get; set; }
33+
// public int tier1 { get; set; }
34+
//}
35+
//[System.Serializable]
36+
//public class GradientData {
37+
// public Dictionary<int, GradientDataPoint> data;
38+
//}
39+
40+
41+
42+
43+
44+
//[System.Serializable]
45+
//public class Employee {
46+
// //these variables are case sensitive and must match the strings "firstName" and "lastName" in the JSON.
47+
// public string firstName;
48+
// public string lastName;
49+
//}
50+
51+
//[System.Serializable]
52+
//public class Employees {
53+
// //employees is case sensitive and must match the string "employees" in the JSON.
54+
// public Employee [] employees;
55+
//}
56+
57+
public class JSONReader : MonoBehaviour {
58+
public TextAsset employeesFile;
59+
public TextAsset gradientsFile;
60+
61+
//void Start ()
62+
//{
63+
// //Employees employeesInJson = JsonUtility.FromJson<Employees> (employeesFile.text);
64+
65+
// //foreach (Employee employee in employeesInJson.employees) {
66+
// // Debug.Log ("Found employee: " + employee.firstName + " " + employee.lastName);
67+
// //}
68+
69+
70+
71+
72+
// //Dictionary<int, GradientDataPoint> grads = new Dictionary<int, GradientDataPoint> ();
73+
74+
// //GradientData.data = new Dictionary<int, GradientDataPoint> ();
75+
76+
77+
// GradientData d = JsonUtility.FromJson<GradientData> (gradientsFile.text);
78+
79+
80+
// foreach (int item in d.data) {
81+
// grads.Add (item.mid, item);
82+
83+
// }
84+
85+
// foreach (var item in grads) {
86+
// Debug.Log (item.ToString ());
87+
88+
// }
89+
90+
91+
92+
93+
// //object obj = JsonHelper.Deserialize (gradientsFile.text);
94+
95+
// //foreach (var x in obj) {
96+
// // Debug.Log (obj.ToString ());
97+
// //}
98+
99+
100+
// //return;
101+
102+
// //JObject obj = JObject.Parse (gradientsFile.text);
103+
104+
// ////Debug.Log (obj.ToString ());
105+
106+
// //// loop through array and add each
107+
// //foreach (var item in obj) {
108+
// // //Debug.Log (item.Key.ToString () + "," + item.Value.ToString ());
109+
110+
// // JObject d = JObject.Parse (item.Value.ToString ());
111+
// // Debug.Log (d.Property ("mid").ToString ());
112+
113+
114+
115+
// // //GradientData o = new GradientData {
116+
117+
// // // mid = (int)d ["mid"],
118+
// // // hex1 = (string)d ["hex1"],
119+
// // // hex2 = (string)d ["hex2"],
120+
// // // tier1 = (int)d ["tier1"]
121+
// // //};
122+
123+
// // //int key = d.mid;
124+
125+
126+
127+
// //}
128+
129+
130+
// //Gradients gradientsInJson = JsonUtility.FromJson<Gradients> (gradientsFile.text);
131+
132+
133+
134+
// //foreach (Gradient gradient in gradientsInJson.gradients) {
135+
// // Debug.Log ("Found gradient: " + gradient.mid + " " + gradient.hex1);
136+
// //}
137+
// }
138+
}

Assets/_Project/Scripts/Data/NotInUse/JSONReader.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Linq;
2+
using Newtonsoft.Json.Linq;
3+
4+
public static class JsonHelper {
5+
public static object Deserialize (string json)
6+
{
7+
return ToObject (JToken.Parse (json));
8+
}
9+
10+
private static object ToObject (JToken token)
11+
{
12+
switch (token.Type) {
13+
case JTokenType.Object:
14+
return token.Children<JProperty> ()
15+
.ToDictionary (prop => prop.Name,
16+
prop => ToObject (prop.Value));
17+
18+
case JTokenType.Array:
19+
return token.Select (ToObject).ToList ();
20+
21+
default:
22+
return ((JValue)token).Value;
23+
}
24+
}
25+
}

Assets/_Project/Scripts/Data/NotInUse/JsonHelper.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)