DebugUI.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace DuckHunter
  6. {
  7. public class DebugUI : MonoBehaviour
  8. {
  9. [SerializeField] Button btnSwitch;
  10. [SerializeField] GameObject debugBox;
  11. [SerializeField] Text textA;
  12. [SerializeField] Slider sliderA;
  13. [SerializeField] Text textB;
  14. [SerializeField] Slider sliderB;
  15. public static DebugUI Instance;
  16. void Awake()
  17. {
  18. if (Instance)
  19. {
  20. Destroy(gameObject);
  21. return;
  22. }
  23. Instance = this;
  24. DontDestroyOnLoad(gameObject);
  25. }
  26. void Start()
  27. {
  28. debugBox.SetActive(false);
  29. btnSwitch.onClick.AddListener(() => debugBox.SetActive(!debugBox.activeSelf));
  30. sliderA.onValueChanged.AddListener((v) =>
  31. {
  32. int finalValue = (int)v;
  33. GameManager.DefaultLevel = finalValue;
  34. textA.text = $"下次从{finalValue}关开始游戏";
  35. });
  36. sliderB.onValueChanged.AddListener((v) =>
  37. {
  38. int finalValue = (int)v;
  39. Time.timeScale = finalValue;
  40. textB.text = $"游戏运行速度:{finalValue}";
  41. });
  42. }
  43. public void Debug9AxisCanNotMove()
  44. {
  45. Debug.Log("9轴动不了时打印");
  46. string accStr = PlayerPrefs.GetString("AccIdentity0", "");
  47. Debug.Log("AccIdentity0:" + accStr);
  48. // Debug.Log("AccIdentity--:" + o0.Bow.o09AxisAfterXiaMenFromDll.AccIdentity);
  49. string magStr = PlayerPrefs.GetString("MagIdentity0", "");
  50. Debug.Log("MagIdentity0:" + magStr);
  51. // Debug.Log("MagIdentity--:" + o0.Bow.o09AxisAfterXiaMenFromDll.MagIdentity);
  52. }
  53. }
  54. }