public static JSONNode ToJSONObject(Gloggr_PlayEvent e) { JSONNode n = new JSONClass(); n.Add ("time", new JSONData( e.gTime)); n.Add("event", new JSONData(e.gEvent)); n.Add("value", new JSONData(e.gValue)); n.Add("position", new JSONData(e.gPosition)); n.Add("level", new JSONData(e.gLevel)); return n; }
/// <summary> /// Capture event specified by the game. /// </summary> /// <param name="gameEvent">Game event (in period-delimited string).</param> /// <param name="pos">Optional position of event (in 2D space).</param> /// <param name="fValue">Optional value of this event.</param> public void CaptureEvent2D(string gameEvent, Vector2? pos = null, float? fValue = null) { if (!enableTracking) return; Gloggr_PlayEvent gEvent = new Gloggr_PlayEvent(gameEvent, Gloggr.NowTimeString(), pos, fValue); if (trackingPossible) { g.AddEvent(gEvent); } else { StartCaching(); cachedEvents.Add (gEvent); //Debug.Log ("Gloggr not ready. Caching event."); //Debug.LogError("Received tracking data in " + gameObject.name + ", but tracking was not enabled."); } }
public static string ToJSON(Gloggr_PlayEvent e) { // string json = JsonConvert.SerializeObject(e); // json = FormatJSONKeys(json); // return json; JSONNode n = ToJSONObject(e); return n.ToString(); }
public void PostEventNow(Gloggr_PlayEvent g) { /* if (!g.gEvent.Contains(configSessionHeader)) g.gEvent = configSessionHeader + g.gEvent; */ //Debug.Log ("Event posted now: " + Gloggr_PlayEvent.ToJSON(gEvent)); AddCurrentLevelToEvent(ref g); List<Gloggr_PlayEvent> singleEventList = new List<Gloggr_PlayEvent>(); singleEventList.Add (g); PostEvents (singleEventList); }
public void AddSummaryEvent(string summaryEventName, float? fValue = null) { string eventText = "Summary." + summaryEventName; Gloggr_PlayEvent summaryEvent = new Gloggr_PlayEvent(eventText, Gloggr.NowTimeString(), null, fValue); if (Application.isEditor) Debug.Log ("Aggregate Event: " + Gloggr_PlayEvent.ToJSON(summaryEvent)); AddEvent (summaryEvent); }
public void AddConfigurationEvent(string configEventName, float? fValue = null) { string eventText = "Configuration." + configEventName; Gloggr_PlayEvent configEvent = new Gloggr_PlayEvent(eventText, Gloggr.NowTimeString(), null, fValue); if (Application.isEditor) Debug.Log ("Configuration Event: " + Gloggr_PlayEvent.ToJSON(configEvent)); AddEvent (configEvent); }
public void PostSystemEventNow(string systemEventText, float? fValue = null) { string eventText = "GloggrSystem." + systemEventText; Gloggr_PlayEvent systemEvent = new Gloggr_PlayEvent(eventText, Gloggr.NowTimeString(), null, fValue); PostEventNow(systemEvent); }
public void AddCurrentLevelToEvent(ref Gloggr_PlayEvent gEvent) { if (!string.IsNullOrEmpty(currentLevel)) gEvent.AddLevel(currentLevel); }
public void AddEvent(Gloggr_PlayEvent g) { if (!isActive) return; /* if (!g.gEvent.Contains(configSessionHeader)) g.gEvent = configSessionHeader + g.gEvent; */ AddCurrentLevelToEvent(ref g); events.Add (g); if (debugEventCapture) DebugLog(Gloggr_PlayEvent.ToJSON(g)); }