UserProperty.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. /* 本文件中包含2各类文件
  6. * UserProperty用于保存用户游戏中的相关数据
  7. * GameRunningData 保存游戏中全局的数据 */
  8. [System.Serializable]
  9. public static class UserProperty
  10. {
  11. // Start is called before the first frame update
  12. public static string userId;
  13. public static string name = "任天堂";
  14. public static int coin = 1005;
  15. public static string email, mobile, level;
  16. public static bool isRegUser = false;
  17. public static int advWatchTimes = 0; // 记录用户当天一共看过几次广告
  18. //public static List<Item> food = new();
  19. //public static List<Item> toy = new();
  20. //public static List<Item> other = new(); // 这里dict string对应的是物品大类food, toy, other
  21. public static Dictionary<string, int> food = new();
  22. public static Dictionary<string, int> toy = new();
  23. public static Dictionary<string, int> other = new();
  24. public static List<DogProperty> dogs = new();
  25. public static string dogNames()
  26. {
  27. // 获取狗名字列表
  28. List<string> dogNameList = new List<string>();
  29. foreach (var dog in UserProperty.dogs)
  30. {
  31. dogNameList.Add(dog.dog_name);
  32. }
  33. string dogNames = string.Join(", ", dogNameList);
  34. return dogNames;
  35. }
  36. }
  37. // 待删除代码,废弃
  38. // string id 表示具体的物品id,如food_00001
  39. // qty 表示数量
  40. public class Item
  41. {
  42. public string id;
  43. public int qty;
  44. public Item(string id, int qty)
  45. {
  46. this.id = id;
  47. this.qty = qty;
  48. }
  49. }