ProfileGroupDefinition.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Funly.SkyStudio
  5. {
  6. // This class is used as metadata for creating the inital groups.
  7. public class ProfileGroupDefinition
  8. {
  9. public enum GroupType
  10. {
  11. None,
  12. Color,
  13. Number,
  14. Texture,
  15. SpherePoint,
  16. Boolean
  17. }
  18. public enum FormatStyle
  19. {
  20. None,
  21. Integer,
  22. Float
  23. }
  24. public enum RebuildType
  25. {
  26. None,
  27. Stars
  28. }
  29. public GroupType type;
  30. public FormatStyle formatStyle = FormatStyle.None;
  31. public RebuildType rebuildType;
  32. public string propertyKey;
  33. public string groupName;
  34. public Color color;
  35. public SpherePoint spherePoint;
  36. public float minimumValue = -1.0f;
  37. public float maximumValue = -1.0f;
  38. public float value = -1.0f;
  39. public bool boolValue = false;
  40. public Texture2D texture;
  41. public string tooltip;
  42. public string dependsOnFeature;
  43. public bool dependsOnValue;
  44. public static ProfileGroupDefinition NumberGroupDefinition(
  45. string groupName, string propKey, float minimumValue, float maximumValue, float value, string tooltip)
  46. {
  47. return NumberGroupDefinition(groupName, propKey, minimumValue, maximumValue,
  48. value, RebuildType.None, null, false, tooltip);
  49. }
  50. public static ProfileGroupDefinition NumberGroupDefinition(
  51. string groupName, string propKey, float minimumValue, float maximumValue, float value,
  52. string dependsOnKeyword, bool dependsOnValue, string tooltip)
  53. {
  54. return NumberGroupDefinition(groupName, propKey, minimumValue, maximumValue, value,
  55. RebuildType.None, FormatStyle.Float, dependsOnKeyword, dependsOnValue, tooltip);
  56. }
  57. public static ProfileGroupDefinition NumberGroupDefinition(
  58. string groupName, string propKey, float minimumValue, float maximumValue, float value,
  59. RebuildType rebuildType, string dependsOnKeyword, bool dependsOnValue, string tooltip)
  60. {
  61. return NumberGroupDefinition(groupName, propKey, minimumValue, maximumValue, value,
  62. rebuildType, FormatStyle.Float, dependsOnKeyword, dependsOnValue, tooltip);
  63. }
  64. public static ProfileGroupDefinition NumberGroupDefinition(
  65. string groupName, string propKey, float minimumValue, float maximumValue, float value,
  66. RebuildType rebuildType, FormatStyle formatStyle, string dependsOnKeyword, bool dependsOnValue, string tooltip)
  67. {
  68. ProfileGroupDefinition def = new ProfileGroupDefinition();
  69. def.type = GroupType.Number;
  70. def.formatStyle = formatStyle;
  71. def.groupName = groupName;
  72. def.propertyKey = propKey;
  73. def.value = value;
  74. def.minimumValue = minimumValue;
  75. def.maximumValue = maximumValue;
  76. def.tooltip = tooltip;
  77. def.rebuildType = rebuildType;
  78. def.dependsOnFeature = dependsOnKeyword;
  79. def.dependsOnValue = dependsOnValue;
  80. return def;
  81. }
  82. // Color group info constructor.
  83. public static ProfileGroupDefinition ColorGroupDefinition(string groupName, string propKey, Color color, string tooltip)
  84. {
  85. return ColorGroupDefinition(groupName, propKey, color, RebuildType.None, null, false, tooltip);
  86. }
  87. public static ProfileGroupDefinition ColorGroupDefinition(
  88. string groupName, string propKey, Color color,
  89. string dependsOnFeature, bool dependsOnValue, string tooltip)
  90. {
  91. return ColorGroupDefinition(groupName, propKey, color, RebuildType.None, dependsOnFeature, dependsOnValue, tooltip);
  92. }
  93. public static ProfileGroupDefinition ColorGroupDefinition(
  94. string groupName, string propKey, Color color,
  95. RebuildType rebuildType, string dependsOnKeyword, bool dependsOnValue, string tooltip)
  96. {
  97. ProfileGroupDefinition def = new ProfileGroupDefinition();
  98. def.type = GroupType.Color;
  99. def.propertyKey = propKey;
  100. def.groupName = groupName;
  101. def.color = color;
  102. def.tooltip = tooltip;
  103. def.rebuildType = rebuildType;
  104. def.dependsOnFeature = dependsOnKeyword;
  105. def.dependsOnValue = dependsOnValue;
  106. return def;
  107. }
  108. public static ProfileGroupDefinition SpherePointGroupDefinition(string groupName, string propKey,
  109. float horizontalRotation, float verticalRotation, string tooltip)
  110. {
  111. return SpherePointGroupDefinition(groupName, propKey, horizontalRotation, verticalRotation, RebuildType.None,
  112. null, false, tooltip);
  113. }
  114. public static ProfileGroupDefinition SpherePointGroupDefinition(string groupName, string propKey,
  115. float horizontalRotation, float verticalRotation, RebuildType rebuildType, string dependsOnKeyword, bool dependsOnValue, string tooltip)
  116. {
  117. ProfileGroupDefinition def = new ProfileGroupDefinition();
  118. def.type = GroupType.SpherePoint;
  119. def.propertyKey = propKey;
  120. def.groupName = groupName;
  121. def.tooltip = tooltip;
  122. def.rebuildType = rebuildType;
  123. def.dependsOnFeature = dependsOnKeyword;
  124. def.dependsOnValue = dependsOnValue;
  125. def.spherePoint = new SpherePoint(horizontalRotation, verticalRotation);
  126. return def;
  127. }
  128. // Texture group info constructor
  129. public static ProfileGroupDefinition TextureGroupDefinition(
  130. string groupName, string propKey, Texture2D texture, string tooltip)
  131. {
  132. return TextureGroupDefinition(groupName, propKey, texture,
  133. RebuildType.None, null, false, tooltip);
  134. }
  135. public static ProfileGroupDefinition TextureGroupDefinition(
  136. string groupName, string propKey, Texture2D texture,
  137. string dependsOnKeyword, bool dependsOnValue, string tooltip)
  138. {
  139. return TextureGroupDefinition(groupName, propKey, texture, RebuildType.None,
  140. dependsOnKeyword, dependsOnValue, tooltip);
  141. }
  142. public static ProfileGroupDefinition TextureGroupDefinition(
  143. string groupName, string propKey, Texture2D texture, RebuildType rebuildType,
  144. string dependsOnKeyword, bool dependsOnValue, string tooltip)
  145. {
  146. ProfileGroupDefinition def = new ProfileGroupDefinition();
  147. def.type = GroupType.Texture;
  148. def.groupName = groupName;
  149. def.propertyKey = propKey;
  150. def.texture = texture;
  151. def.tooltip = tooltip;
  152. def.rebuildType = rebuildType;
  153. def.dependsOnFeature = dependsOnKeyword;
  154. def.dependsOnValue = dependsOnValue;
  155. return def;
  156. }
  157. public static ProfileGroupDefinition BoolGroupDefinition(
  158. string groupName, string propKey, bool value, string dependsOnKeyword, bool dependsOnValue, string tooltip)
  159. {
  160. ProfileGroupDefinition def = new ProfileGroupDefinition();
  161. def.type = GroupType.Boolean;
  162. def.groupName = groupName;
  163. def.propertyKey = propKey;
  164. def.dependsOnFeature = dependsOnKeyword;
  165. def.dependsOnValue = dependsOnValue;
  166. def.tooltip = tooltip;
  167. def.boolValue = value;
  168. return def;
  169. }
  170. }
  171. }