TestSetup.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using UnityEngine;
  3. public class TestSetup : MonoBehaviour
  4. {
  5. void Awake()
  6. {
  7. // 初始化狗数据用于测试
  8. DogProperty puppy = new DogProperty();
  9. UserProperty.dogs.Clear();
  10. UserProperty.dogs.Add(puppy);
  11. UserProperty.food.Add(new Item("food_00001", 10));
  12. UserProperty.food.Add(new Item("food_00002", 20));
  13. UserProperty.food.Add(new Item("food_00003", 30));
  14. UserProperty.food.Add(new Item("water_00001", 999));
  15. if (EnviromentSetting.languageData == null)
  16. {
  17. EnviromentController.InitialGameEnviroment();
  18. }
  19. }
  20. // Start is called once before the first execution of Update after the MonoBehaviour is created
  21. void Start()
  22. {
  23. }
  24. // todo 删除。测试假数据注入
  25. void TestDataInjection()
  26. {
  27. PlayerPrefs.SetString("LoginToken", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiSlRZTlpQOU8iLCJleHAiOjE3NDAxOTQ2Nzl9.081FF2AwxDTsN1gDWGZuzOxIDbM4M8Dw-mdwLfkxk4A");
  28. DateTime now = DateTime.Now;
  29. DateTime oneHourAgo = now.AddHours(-1);
  30. PlayerPrefs.SetString("LoginTokenTime", oneHourAgo.ToString());
  31. }
  32. // Update is called once per frame
  33. // void Update()
  34. // {
  35. // }
  36. }