-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocalStorage.cs
53 lines (37 loc) · 942 Bytes
/
LocalStorage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LocalStorage : MonoBehaviour {
// Class to store player prefs on device
// set prefs
public void SetPrefLoggedInCustomID() {
PlayerPrefs.SetInt("LoggedInCustomID", 1);
}
public void SetPrefLoggedInCustomIDandEmail() {
PlayerPrefs.SetInt("LoggedInCustomID", 2);
}
public int GetPrefLoggedIn() {
//get player prefs from device
int iLoggedinPref;
iLoggedinPref = PlayerPrefs.GetInt("LoggedInCustomID");
if (iLoggedinPref == null) {
return 0;
}
// see what data is stored
switch (iLoggedinPref)
{
case 1:
Debug.Log ("LocalStorage: Custom ID stored on device.");
return 1;
break;
case 2:
Debug.Log ("LocalStorage: Custom ID stored on device. User has created account.");
return 2;
break;
default:
Debug.Log ("LocalStorage: Return 0");
return 0;
break;
}
}
}