Skip to content

Commit 6e1ee2a

Browse files
committed
Integrate user profile data into FeedData class
1 parent b53d5e6 commit 6e1ee2a

File tree

3 files changed

+108
-109
lines changed

3 files changed

+108
-109
lines changed

Assets/_Project/Scenes/tally-viz-master.unity

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

Assets/_Project/Scripts/Data/DataManager.cs

Lines changed: 53 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,21 @@ public void HandleJsonResponse (string text)
325325

326326
// loop through array and add each
327327
foreach (JObject item in a) {
328+
328329
// base class properties
329330
string _username = item.GetValue ("username").ToString ();
330331
string _avatarPath = item.GetValue ("avatarPath").ToString ();
332+
333+
int _level = (int)item.GetValue ("level");
334+
int _clicks = (int)item.GetValue ("clicks");
335+
int _score = (int)item.GetValue ("score");
336+
int _time = (int)item.GetValue ("time");
337+
int _capturedTotal = (int)item.GetValue ("capturedTotal");
338+
int _missedTotal = (int)item.GetValue ("missedTotal");
339+
int _pageActionScrollDistance = (int)item.GetValue ("pageActionScrollDistance");
340+
int _trackersBlocked = (int)item.GetValue ("trackersBlocked");
341+
int _trackersSeen = (int)item.GetValue ("trackersSeen");
342+
331343
string _eventType = item.GetValue ("eventType").ToString ();
332344
string _createdAtStr = item.GetValue ("createdAt").ToString ();
333345
string _monsters = item.GetValue ("monsters").ToString ();
@@ -339,8 +351,6 @@ public void HandleJsonResponse (string text)
339351

340352

341353

342-
343-
344354
// LIVE MODE ONLY - SKIP DUPLICATES
345355

346356
if (selectedMode == ModeType.remoteLive) {
@@ -373,96 +383,68 @@ public void HandleJsonResponse (string text)
373383

374384
if (_eventType == "attack") {
375385
output = new AttackData {
376-
username = _username,
377-
avatarPath = _avatarPath,
378-
eventType = _eventType,
379-
createdAt = _createdAt,
380-
monsters = _monsters,
381-
trackers = _trackers,
382-
383-
name = (string)d ["name"],
384-
type = (string)d ["level"],
385-
selected = (bool)d ["selected"]
386+
_name = (string)d ["name"],
387+
_type = (string)d ["level"],
388+
_selected = (bool)d ["selected"]
386389
};
387390
} else if (_eventType == "badge") {
388391
output = new BadgeData {
389-
username = _username,
390-
avatarPath = _avatarPath,
391-
eventType = _eventType,
392-
createdAt = _createdAt,
393-
monsters = _monsters,
394-
trackers = _trackers,
395-
396-
name = (string)d ["name"],
397-
level = (int)d ["level"]
392+
_name = (string)d ["name"],
393+
_level = (int)d ["level"]
398394
};
399395
} else if (_eventType == "consumable") {
400396
output = new ConsumableData {
401-
username = _username,
402-
avatarPath = _avatarPath,
403-
eventType = _eventType,
404-
createdAt = _createdAt,
405-
monsters = _monsters,
406-
trackers = _trackers,
407-
408-
name = (string)d ["name"],
409-
slug = (string)d ["slug"],
410-
stat = (string)d ["stat"],
411-
type = (string)d ["type"],
412-
value = (int)d ["value"]
397+
_name = (string)d ["name"],
398+
_slug = (string)d ["slug"],
399+
_stat = (string)d ["stat"],
400+
_type = (string)d ["type"],
401+
_value = (int)d ["value"]
413402
};
414403
} else if (_eventType == "disguise") {
415404
output = new DisguiseData {
416-
username = _username,
417-
avatarPath = _avatarPath,
418-
eventType = _eventType,
419-
createdAt = _createdAt,
420-
monsters = _monsters,
421-
trackers = _trackers,
422-
423-
name = (string)d ["name"],
424-
type = (string)d ["type"]
405+
_name = (string)d ["name"],
406+
_type = (string)d ["type"]
425407
};
426408
} else if (_eventType == "monster") {
427409
output = new MonsterData {
428-
username = _username,
429-
avatarPath = _avatarPath,
430-
eventType = _eventType,
431-
createdAt = _createdAt,
432-
monsters = _monsters,
433-
trackers = _trackers,
434-
435-
mid = (int)d ["mid"],
436-
level = (int)d ["level"],
437-
captured = (int)d ["captured"],
410+
_mid = (int)d ["mid"],
411+
_level = (int)d ["level"],
412+
_captured = (int)d ["captured"],
438413
};
439414
} else if (_eventType == "tracker") {
440415
output = new TrackerData {
441-
username = _username,
442-
avatarPath = _avatarPath,
443-
eventType = _eventType,
444-
createdAt = _createdAt,
445-
monsters = _monsters,
446-
trackers = _trackers,
447-
448-
tracker = (string)d ["tracker"],
449-
captured = (int)d ["captured"],
416+
_tracker = (string)d ["tracker"],
417+
_captured = (int)d ["captured"],
450418
};
451419
} else { // if (_eventType == "stream")
452420
output = new StreamData {
453-
username = _username,
454-
avatarPath = _avatarPath,
455-
eventType = _eventType,
456-
createdAt = _createdAt,
457-
monsters = _monsters,
458-
trackers = _trackers,
459-
460-
score = (int)d ["score"],
461-
clicks = (int)d ["clicks"],
462-
likes = (int)d ["likes"],
421+
_score = (int)d ["score"],
422+
_clicks = (int)d ["clicks"],
423+
_likes = (int)d ["likes"],
463424
};
464425
}
465426

427+
output.username = _username;
428+
output.avatarPath = _avatarPath;
429+
430+
output.level = _level;
431+
output.clicks = _clicks;
432+
output.score = _score;
433+
output.time = _time;
434+
output.capturedTotal = _capturedTotal;
435+
output.missedTotal = _missedTotal;
436+
output.pageActionScrollDistance = _pageActionScrollDistance;
437+
output.trackersBlocked = _trackersBlocked;
438+
output.trackersSeen = _trackersSeen;
439+
output.clicks = _clicks;
440+
441+
output.eventType = _eventType;
442+
output.createdAt = _createdAt;
443+
output.monsters = _monsters;
444+
output.trackers = _trackers;
445+
446+
447+
466448
// add to feeds - now adding to buffer in Timeline
467449
//feeds.Add (output);
468450

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
using System;
22

33
[System.Serializable]
4-
public class FeedData
5-
{
4+
public class FeedData {
5+
// "username": "unlikelyscroller68",
6+
// "about": null,
7+
// "avatarPath": "assets/img/avatars/avatar-pattern-glasses-sun-60s.png",
8+
// "level": 12,
9+
// "clicks": 624,
10+
// "score": 1564,
11+
// "time": 36200,
12+
// "capturedTotal": 5,
13+
// "missedTotal": 3,
14+
// "pageActionScrollDistance": 145013,
15+
// "trackersBlocked": 164,
16+
// "trackersSeen": 949
17+
18+
619
public string username { get; set; }
720
public string avatarPath { get; set; }
21+
public int level { get; set; }
22+
public int clicks { get; set; }
23+
public int score { get; set; }
24+
public int time { get; set; }
25+
public int capturedTotal { get; set; }
26+
public int missedTotal { get; set; }
27+
public int pageActionScrollDistance { get; set; }
28+
public int trackersBlocked { get; set; }
29+
public int trackersSeen { get; set; }
30+
31+
832
public string eventType { get; set; }
933
public string eventData { get; set; }
1034
public string monsters { get; set; }
@@ -13,82 +37,75 @@ public class FeedData
1337
}
1438

1539
[System.Serializable]
16-
public class AttackData : FeedData
17-
{
40+
public class AttackData : FeedData {
1841
//"name": "DomainSwipe",
1942
//"type": "defense",
2043
//"selected": 1
2144

22-
public string name { get; set; }
23-
public string type { get; set; }
24-
public bool selected { get; set; }
45+
public string _name { get; set; }
46+
public string _type { get; set; }
47+
public bool _selected { get; set; }
2548
}
2649

2750
[System.Serializable]
28-
public class BadgeData : FeedData
29-
{
51+
public class BadgeData : FeedData {
3052
//"name": "long-distance-scroller",
3153
//"level": 3
3254

33-
public string name { get; set; }
34-
public int level { get; set; }
55+
public string _name { get; set; }
56+
public int _level { get; set; }
3557
}
3658

3759
[System.Serializable]
38-
public class ConsumableData : FeedData
39-
{
60+
public class ConsumableData : FeedData {
4061
//"name": "dont-be-evil",
4162
//"slug": "dont-be-evil-cake",
4263
//"stat": "accuracy",
4364
//"type": "cake",
4465
//"value": 0
4566

46-
public string name { get; set; }
47-
public string slug { get; set; }
48-
public string stat { get; set; }
49-
public string type { get; set; }
50-
public int value { get; set; }
67+
public string _name { get; set; }
68+
public string _slug { get; set; }
69+
public string _stat { get; set; }
70+
public string _type { get; set; }
71+
public int _value { get; set; }
5172
}
5273

5374
[System.Serializable]
54-
public class DisguiseData : FeedData
55-
{
75+
public class DisguiseData : FeedData {
5676
//"name": "mask-carnival-sky",
5777
//"type": "mask"
5878

59-
public string name { get; set; }
60-
public string type { get; set; }
79+
public string _name { get; set; }
80+
public string _type { get; set; }
6181
}
6282

6383
[System.Serializable]
64-
public class MonsterData : FeedData
65-
{
84+
public class MonsterData : FeedData {
6685
//"mid": 625,
6786
//"level": 5,
6887
//"captured": 1
6988

70-
public int mid { get; set; }
71-
public int level { get; set; }
72-
public int captured { get; set; }
89+
public int _mid { get; set; }
90+
public int _level { get; set; }
91+
public int _captured { get; set; }
7392
}
7493

7594
[System.Serializable]
76-
public class TrackerData : FeedData
77-
{
95+
public class TrackerData : FeedData {
7896
//"tracker": "gstatic.com",
7997
//"captured": 1
8098

81-
public string tracker { get; set; }
82-
public int captured { get; set; }
99+
public string _tracker { get; set; }
100+
public int _captured { get; set; }
83101
}
84102

85103
[System.Serializable]
86-
public class StreamData : FeedData
87-
{
104+
public class StreamData : FeedData {
88105
//"tracker": "gstatic.com",
89106
//"captured": 1
90107

91-
public int score { get; set; }
92-
public int clicks { get; set; }
93-
public int likes { get; set; }
108+
public int _score { get; set; }
109+
public int _clicks { get; set; }
110+
public int _likes { get; set; }
94111
}

0 commit comments

Comments
 (0)