ProfileFeatureDefinition.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace Funly.SkyStudio
  6. {
  7. [Serializable]
  8. public class ProfileFeatureDefinition : System.Object
  9. {
  10. public enum FeatureType
  11. {
  12. ShaderKeyword,
  13. BooleanValue,
  14. ShaderKeywordDropdown,
  15. }
  16. public string featureKey;
  17. public string[] featureKeys;
  18. public FeatureType featureType;
  19. public string shaderKeyword;
  20. public string[] shaderKeywords;
  21. public string[] dropdownLabels;
  22. public int dropdownSelectedIndex;
  23. public string name;
  24. public bool value;
  25. public string tooltip;
  26. public string dependsOnFeature;
  27. public bool dependsOnValue;
  28. public bool isShaderKeywordFeature;
  29. // Feature that uses a shader keyword.
  30. public static ProfileFeatureDefinition CreateShaderFeature(
  31. string featureKey, string shaderKeyword, bool value, string name,
  32. string dependsOnFeature, bool dependsOnValue, string tooltip)
  33. {
  34. ProfileFeatureDefinition feature = new ProfileFeatureDefinition();
  35. feature.featureType = FeatureType.ShaderKeyword;
  36. feature.featureKey = featureKey;
  37. feature.shaderKeyword = shaderKeyword;
  38. feature.name = name;
  39. feature.value = value;
  40. feature.tooltip = tooltip;
  41. feature.dependsOnFeature = dependsOnFeature;
  42. feature.dependsOnValue = dependsOnValue;
  43. return feature;
  44. }
  45. // Dropdown to select a mutually exclusive shader feature.
  46. public static ProfileFeatureDefinition CreateShaderFeatureDropdown(
  47. string[] featureKeys, string[] shaderKeywords, string[] labels, int selectedIndex, string name,
  48. string dependsOnFeature, bool dependsOnValue, string tooltip)
  49. {
  50. ProfileFeatureDefinition feature = new ProfileFeatureDefinition();
  51. feature.featureType = FeatureType.ShaderKeywordDropdown;
  52. feature.featureKeys = featureKeys;
  53. feature.shaderKeywords = shaderKeywords;
  54. feature.dropdownLabels = labels;
  55. feature.name = name;
  56. feature.dropdownSelectedIndex = selectedIndex;
  57. feature.tooltip = tooltip;
  58. feature.dependsOnFeature = dependsOnFeature;
  59. feature.dependsOnValue = dependsOnValue;
  60. return feature;
  61. }
  62. // Feature that's just a boolean flag.
  63. public static ProfileFeatureDefinition CreateBooleanFeature(
  64. string featureKey, bool value, string name,
  65. string dependsOnFeature, bool dependsOnValue, string tooltip)
  66. {
  67. ProfileFeatureDefinition feature = new ProfileFeatureDefinition();
  68. feature.featureType = FeatureType.BooleanValue;
  69. feature.featureKey = featureKey;
  70. feature.name = name;
  71. feature.value = value;
  72. feature.tooltip = tooltip;
  73. return feature;
  74. }
  75. }
  76. }