AchievementDebugGUI.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using UnityEngine;
  3. public class AchievementDebugGUI : DebugGuiBase
  4. {
  5. protected override string UIDebugButtonName
  6. {
  7. get
  8. {
  9. return "成就系统";
  10. }
  11. }
  12. protected override void GUIStart()
  13. {
  14. this._guiArea = new Rect((float)(Screen.width / 2 - 320), 20f, 640f, 500f);
  15. }
  16. public override void OnDebugGUI()
  17. {
  18. GUILayout.BeginArea(this._guiArea);
  19. this._scrollPosition = GUILayout.BeginScrollView(this._scrollPosition, new GUILayoutOption[0]);
  20. for (int i = 0; i < 34; i++)
  21. {
  22. AchievementManager.AchievementInfo achievementInfo = SingletonMono<AchievementManager>.Instance.GetAchievementInfo(i);
  23. bool achievementUnlockState = SingletonMono<AchievementManager>.Instance.GetAchievementUnlockState(i);
  24. GUILayout.BeginVertical(new GUILayoutOption[0]);
  25. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  26. GUILayout.Label(achievementInfo.Name, new GUILayoutOption[0]);
  27. if (!achievementUnlockState && i != 0 && GUILayout.Button("Unlock", new GUILayoutOption[]
  28. {
  29. GUILayout.Height(20f),
  30. GUILayout.Width(80f)
  31. }))
  32. {
  33. R.Trophy.AwardTrophy(i);
  34. }
  35. GUILayout.EndHorizontal();
  36. GUILayout.Label(achievementInfo.Detail, new GUILayoutOption[0]);
  37. GUILayout.EndVertical();
  38. }
  39. GUILayout.EndScrollView();
  40. GUILayout.EndArea();
  41. }
  42. private Rect _guiArea;
  43. private Vector2 _scrollPosition;
  44. }