UserInfo.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UserInfo {
  5. //设备sn号
  6. public static string Serialno = string.Empty;
  7. //影创账号
  8. public static string Account = string.Empty;
  9. //影创应用号
  10. public static string AppID = string.Empty;
  11. //影创Token
  12. public static string Token = string.Empty;
  13. //应用Token
  14. public static string User_Token = string.Empty;
  15. //应用uid
  16. public static string uid = string.Empty;
  17. public static SystemDatas systemDatas;
  18. /// <summary>
  19. /// 判断是否为游客账号
  20. /// </summary>
  21. /// <returns><c>true</c>, if vistor account was ised, <c>false</c> otherwise.</returns>
  22. public static bool isVistorAccount()
  23. {
  24. return Serialno == Account;
  25. }
  26. /// <summary>
  27. /// 判断用户是否登陆
  28. /// </summary>
  29. /// <returns><c>true</c>, if login was ised, <c>false</c> otherwise.</returns>
  30. public static bool isLogin()
  31. {
  32. return Account != string.Empty;
  33. }
  34. private string _userToken;
  35. private int _userTokenExpireTime;
  36. private int _id;
  37. private string _nickName;
  38. public string _avatar;
  39. public string _devideID;
  40. public string _phone;
  41. public string _email;
  42. private bool _isActivate;
  43. public string UserToken
  44. {
  45. get => _userToken;
  46. }
  47. public int UserTokenExpireTime
  48. {
  49. get => _userTokenExpireTime;
  50. }
  51. public int Id { get => _id;}
  52. public string NickName { get => _nickName; }
  53. public bool IsActivate { get => _isActivate; }
  54. public void SetTokenInfo(string token, int expireTime)
  55. {
  56. _userToken = token;
  57. _userTokenExpireTime = expireTime;
  58. }
  59. public void SetUserInfo(int id, string token = "", int expireTime = 0, string avatar = "", string nickName = "", bool isActivate=false, string phoneNum = "", string email = "", string deviceID = "")
  60. {
  61. this._id = id;
  62. this._avatar = avatar;
  63. this._nickName = nickName;
  64. this._phone = phoneNum;
  65. this._email = email;
  66. this._devideID = deviceID;
  67. this._isActivate = isActivate;
  68. SetTokenInfo(token, expireTime);
  69. }
  70. public void UserClear(int id, string token = "", int expireTime = 0)
  71. {
  72. SetUserInfo(id, token, expireTime);
  73. }
  74. public void SetNickNameAvatar(string avatar, string nickName)
  75. {
  76. this._avatar = avatar;
  77. this._nickName = nickName;
  78. }
  79. }