Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.12 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Analytics;
  5.  
  6. public class AboutResults : MonoBehaviour {
  7.  
  8.     //float to load the scene/case times into
  9.    public int Scene1About, Scene2About, Scene3About, Scene4About, Scene5About;
  10.  
  11.  
  12.     public List<int> Patharray;
  13.  
  14.     Dictionary<string, object> analytics = new Dictionary<string, object>();
  15.  
  16.     // Use this for initialization
  17.     void Start()
  18.     {
  19.  
  20.         //first fill the array with the path
  21.         for (int i = 0; i <= Patharray.Count; i++)
  22.         {
  23.             Patharray.Add(PlayerPrefs.GetInt("Question" + i));
  24.         }
  25.  
  26.         //Loop throgh the Patharray array
  27.         for (int i = 0; i <= Patharray.Count; i++)
  28.         {
  29.             //Add each object to the Dictionary
  30.             analytics.Add("Question" + i, Patharray[i]);
  31.         }
  32.  
  33.         //Send the event with the Dictionary object included
  34.         Analytics.CustomEvent("Path Taken", analytics);
  35.  
  36.  
  37.        
  38.  
  39.         Scene1About = PlayerPrefs.GetInt("AboutClicked1");
  40.         Scene2About = PlayerPrefs.GetInt("AboutClicked2");
  41.         Scene3About = PlayerPrefs.GetInt("AboutClicked3");
  42.         Scene4About = PlayerPrefs.GetInt("AboutClicked4");
  43.         Scene5About = PlayerPrefs.GetInt("AboutClicked5");
  44.  
  45.         Debug.Log("Scene 1 About Clicked: " + Scene1About);
  46.         Debug.Log("Scene 2 About Clicked: " + Scene2About);
  47.         Debug.Log("Scene 3 About Clicked: " + Scene3About);
  48.         Debug.Log("Scene 4 About Clicked: " + Scene4About);
  49.         Debug.Log("Scene 5 About Clicked: " + Scene5About);
  50.  
  51.         //analytics outputing if the about button is pressed.
  52.         Analytics.CustomEvent("About Button Selected?", new Dictionary<string, object>
  53.   {
  54.     { "Case 1", Scene1About },
  55.     { "Case 2", Scene2About },
  56.     { "Case 3", Scene3About },
  57.     { "Case 4", Scene4About },
  58.     { "Case 5", Scene5About },
  59.   });
  60.  
  61.     }
  62.  
  63.     // Update is called once per frame
  64.     void Update()
  65.     {
  66.  
  67.     }
  68.     public void ResetPlayerPrefs()
  69.     {
  70.         PlayerPrefs.DeleteAll();
  71.         Debug.Log("Player Prefs Reset");
  72.     }
  73.    
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement