SROptions.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.ComponentModel;
  3. using System.Diagnostics;
  4. using FBInput;
  5. public class SROptions
  6. {
  7. public static SROptions Current
  8. {
  9. get
  10. {
  11. return SROptions._current;
  12. }
  13. }
  14. //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
  15. public event SROptionsPropertyChanged PropertyChanged;
  16. public void OnPropertyChanged(string propertyName)
  17. {
  18. if (this.PropertyChanged != null)
  19. {
  20. this.PropertyChanged(this, propertyName);
  21. }
  22. }
  23. [SROptions.NumberRangeAttribute(0.0, 1.0)]
  24. public int InputSolution
  25. {
  26. get
  27. {
  28. return InputDriver.Solution;
  29. }
  30. set
  31. {
  32. InputDriver.Solution = value;
  33. }
  34. }
  35. [SROptions.NumberRangeAttribute(0.0, 99.0)]
  36. [Category("Go Level")]
  37. public int C { get; set; }
  38. [SROptions.NumberRangeAttribute(1.0, 99.0)]
  39. [Category("Go Level")]
  40. public int L { get; set; }
  41. [Category("Go Level")]
  42. [SROptions.NumberRangeAttribute(1.0, 99.0)]
  43. public int S { get; set; }
  44. [Category("Go Level")]
  45. public bool t { get; set; }
  46. [Category("Go Level")]
  47. public void GoLevel()
  48. {
  49. LevelManager.LoadScene(string.Format("C{0}L{1}S{2}{3}", new object[]
  50. {
  51. this.C,
  52. this.L,
  53. this.S,
  54. (!this.t) ? string.Empty : "_t"
  55. }));
  56. }
  57. [Category("Go Level")]
  58. [SROptions.NumberRangeAttribute(0.0, 7.0)]
  59. public int palaceNum { get; set; }
  60. [Category("Go Level")]
  61. public void GoPalace()
  62. {
  63. LevelManager.LoadScene(string.Format("palace{0}", this.palaceNum));
  64. }
  65. [Category("降低渲染分辨率")]
  66. public bool ReduceResolution
  67. {
  68. get
  69. {
  70. return !(ReduceResolutionAndBlend.Instance == null) && ReduceResolutionAndBlend.Instance.enabled;
  71. }
  72. set
  73. {
  74. if (ReduceResolutionAndBlend.Instance == null)
  75. {
  76. ReduceResolutionAndBlend.Init();
  77. }
  78. if (ReduceResolutionAndBlendUI.Instance == null)
  79. {
  80. ReduceResolutionAndBlendUI.Init();
  81. }
  82. ReduceResolutionAndBlend.Instance.enabled = value;
  83. ReduceResolutionAndBlendUI.Instance.enabled = value;
  84. }
  85. }
  86. public bool DebugUI
  87. {
  88. get
  89. {
  90. return UIDebug.IsVisible;
  91. }
  92. set
  93. {
  94. if (UIDebug.IsVisible)
  95. {
  96. SingletonMono<UIDebug>.Instance.Close();
  97. }
  98. else
  99. {
  100. SingletonMono<UIDebug>.Instance.Open();
  101. }
  102. }
  103. }
  104. private static readonly SROptions _current = new SROptions();
  105. [AttributeUsage(AttributeTargets.Property)]
  106. public sealed class NumberRangeAttribute : Attribute
  107. {
  108. public NumberRangeAttribute(double min, double max)
  109. {
  110. this.Min = min;
  111. this.Max = max;
  112. }
  113. public readonly double Max;
  114. public readonly double Min;
  115. }
  116. [AttributeUsage(AttributeTargets.Property)]
  117. public sealed class IncrementAttribute : Attribute
  118. {
  119. public IncrementAttribute(double increment)
  120. {
  121. this.Increment = increment;
  122. }
  123. public readonly double Increment;
  124. }
  125. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
  126. public sealed class SortAttribute : Attribute
  127. {
  128. public SortAttribute(int priority)
  129. {
  130. this.SortPriority = priority;
  131. }
  132. public readonly int SortPriority;
  133. }
  134. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
  135. public sealed class DisplayNameAttribute : Attribute
  136. {
  137. public DisplayNameAttribute(string name)
  138. {
  139. this.Name = name;
  140. }
  141. public readonly string Name;
  142. }
  143. }