public void CollectableBecameInvisible(string name)
        {
            CollectableScreenTime cst = m_CollectableScreenTimes[name] as CollectableScreenTime;

            if (cst.m_IsVisible)
            {
                cst.m_CumulativeScreenTime += Time.timeSinceLevelLoad - cst.m_LastBecameVisibleAt;
                cst.m_IsVisible             = false;
            }
        }
        public void CollectableBecameVisible(string name)
        {
            if (!m_CollectableScreenTimes.ContainsKey(name))
            {
                m_CollectableScreenTimes.Add(name, new CollectableScreenTime(name, m_CurrentLevel));
            }
            CollectableScreenTime cst = m_CollectableScreenTimes[name] as CollectableScreenTime;

            cst.m_IsVisible           = true;
            cst.m_LastBecameVisibleAt = Time.timeSinceLevelLoad;
        }
 private void LogScreenTimes(int level)
 {
     foreach (string key in m_CollectableScreenTimes.Keys)
     {
         CollectableScreenTime cst = m_CollectableScreenTimes[key] as CollectableScreenTime;
         if (cst.m_Level == level)
         {
             float  time = cst.m_CumulativeScreenTime;
             string url  = String.Format("{0}/levels/{1}/collectables/{2}.json", m_SessionUrl, level, key);
             string body = String.Format("{{ \"screen_time\": {0} }}", time);
             StartCoroutine(RequestAsync(url, body, "PATCH"));
         }
     }
 }