UserProperty.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 List<DogProperty> dogs = new();
  22. public static string dogNames()
  23. {
  24. // 获取狗名字列表
  25. List<string> dogNameList = new List<string>();
  26. foreach (var dog in UserProperty.dogs)
  27. {
  28. dogNameList.Add(dog.dog_name);
  29. }
  30. string dogNames = string.Join(", ", dogNameList);
  31. return dogNames;
  32. }
  33. }
  34. // 待删除代码,废弃
  35. // string id 表示具体的物品id,如food_00001
  36. // qty 表示数量
  37. public class Item
  38. {
  39. public string id;
  40. public int qty;
  41. public Item(string id, int qty)
  42. {
  43. this.id = id;
  44. this.qty = qty;
  45. }
  46. }