Liberi
An exergame built for kids with CP!
Study.LogColumnValues.cs
1 using UnityEngine;
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.IO;
6 using System.Linq;
7 using System.Reflection;
8 using System.Text;
9 
13 public partial class Study : MonoBehaviour
14 {
15  static string GetPlayerIDHeaderColumnValue ()
16  {
17  return Game.LocalPlayerID;
18  }
19 
20  static string GetDateHeaderColumnValue ()
21  {
22  return DateTime.Now.ToString(_instance.LogDateFormat);
23  }
24 
25  static string GetTimeHeaderColumnValue ()
26  {
27  return DateTime.Now.ToString(_instance.LogTimeFormat);
28  }
29 
30  static string GetRestingHRHeaderColumnValue()
31  {
32  return Game.LocalPlayerProfile.Health.RestingHeartRate.ToString();
33  }
34 
35  static string GetMaxHRHeaderColumnValue()
36  {
37  return Game.LocalPlayerProfile.Health.MaxHeartRate.ToString();
38  }
39 
40  static string GetTargetHRRatioHeaderColumnValue()
41  {
42  return Game.LocalPlayerProfile.Health.TargetHeartRateRatio.ToString();
43  }
44 
45  static string GetVigorousHRRatioHeaderColumnValue()
46  {
47  return Game.LocalPlayerProfile.Health.VigorousHeartRateRatio.ToString();
48  }
49 
50  static string GetEffortBalanceCadenceCapHeaderColumnValue()
51  {
52  return Game.LocalPlayerProfile.Health.EffortBalanceCadenceCap.ToString();
53  }
54 
55  static string GetGenericeBalanceCadenceCapHeaderColumnValue()
56  {
57  return Game.LocalPlayerProfile.Health.GenericBalanceCadenceCap.ToString();
58  }
59 
60  static string GetServerTimeColumnValue()
61  {
62  if (Minigame.Instance != null && !string.IsNullOrEmpty(Minigame.Instance.ServerTime))
63  return Minigame.Instance.ServerTime;
64  else if (Zone.Instance != null && !string.IsNullOrEmpty(Zone.Instance.ServerTime))
65  return Zone.Instance.ServerTime;
66  else if (Sync.TimelineManager != null)
67  return Sync.TimelineManager.Now.ToString();
68  else
69  return "-";
70  }
71 
72  static string GetClientTimeColumnValue ()
73  {
74  return DateTime.Now.ToString(_instance.LogTimeFormat);
75  }
76 
77  static string GetHeartRateColumnValue ()
78  {
79  return Heart.Rate.ToString();
80  }
81 
82  static string GetHeartTierColumnValue ()
83  {
84  return Heart.Tier.ToString();
85  }
86 
87  static string GetPersonaColumnValue ()
88  {
89  var localAvatar = Game.LocalAvatar;
90 
91  if (localAvatar == null || localAvatar.GetComponent<Character>() == null)
92  return "";
93 
94  string activePersonaId = localAvatar.GetComponent<Character>().ActivePersonaID;
95 
96  if (activePersonaId == null)
97  return "";
98 
99  return activePersonaId;
100  }
101 
102  static string GetTurboColumnValue ()
103  {
104  var localAvatar = Game.LocalAvatar;
105 
106  if (localAvatar == null || localAvatar.GetComponent<Character>() == null)
107  return "";
108 
109  return localAvatar.GetComponent<Character>().IsTurbo.ToString();
110  }
111 
112  static string GetPowerColumnValue ()
113  {
114  return Controls.Power.ToString();
115  }
116 
117  static string GetDirectionColumnValue ()
118  {
119  return Controls.Direction.ToSimpleString();
120  }
121 
122  static string GetAvatarPositionColumnValue ()
123  {
124  var localAvatar = Game.LocalAvatar;
125 
126  if (localAvatar == null)
127  return "";
128 
129  return localAvatar.transform.position.ToSimpleString();
130  }
131 
132  static string GetAvatarDirectionColumnValue ()
133  {
134  var localAvatar = Game.LocalAvatar;
135 
136  if (localAvatar == null)
137  return "";
138 
139  return localAvatar.transform.GetDirection().ToSimpleString();
140  }
141 
142  static string GetCadenceColumnValue ()
143  {
144  return Controls.RawCadence.ToString();
145  }
146 
147  static string GetBalanceConditionColumnValue ()
148  {
149  return GameClient.Instance.Config.Study.BalanceAlgorithm.ToString();
150  }
151 
152  static string GetFireAntHRColumnValue ()
153  {
154  return Heart.FireAntHR.ToString();
155  }
156 
157  static string GetPolarHRColumnValue()
158  {
159  return Heart.PolarHR.ToString();
160  }
161 
162  // TODO: Fill in more column value providers.
163 }
static float Power
Returns an abstract power value in the range [0 ... 1].
Definition: Controls.cs:47
string LogDateFormat
Formatting for dates in logs.
Definition: Study.cs:32
static Zone Instance
Gets the sole instance of the zone.
Definition: Zone.cs:41
static Minigame Instance
Gets the sole instance of this minigame.
Definition: Minigame.cs:30
Heart class. Allows for heart rate queries and heart rate injection from devices. ...
Definition: Heart.cs:20
static float RawCadence
Returns the raw pedaling cadence for logging use or other study reasons.
Definition: Controls.cs:63
string LogTimeFormat
Formatting for times in logs.
Definition: Study.cs:36
static Vector3 Direction
Returns a normalized, abstract direction. Could also be zero.
Definition: Controls.cs:55
Avatar character management component. In charge of personas, skills and buffs.
Definition: Character.cs:12
ClientConfig Config
Gets the configuration for this client.
Definition: GameClient.cs:176
Zone manager.
Definition: Zone.cs:30
static GameClient Instance
Gets the sole instance of the game client.
Definition: GameClient.cs:136
Main game client class.
Definition: GameClient.cs:16
Class for managing study-related game components.
Definition: Study.cs:13
static HeartTier Tier
Gets the current heart tier.
Definition: Heart.cs:49
Class for general minigame management.
Definition: Minigame.cs:12
static float Rate
Gets the current heart rate.
Definition: Heart.cs:31
static TimelineManager TimelineManager
Gets the Janus timeline manager on this peer.
Definition: Sync.Static.cs:21
This class server two main functions: 1) As a MonoBehaviour, it allows for network synchronization of...
Definition: Sync.cs:13
Controls class. Allows for controls queries and controls injection from devices.
Definition: Controls.cs:41