InspectableFieldStyle.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Collections.Generic;
  5. using BansheeEngine;
  6. namespace BansheeEditor
  7. {
  8. /// <summary>
  9. /// Contains boolean information about a field style
  10. /// </summary>
  11. public enum InstectableFieldStyleFlags
  12. {
  13. None = 0,
  14. UseSlider = 1,
  15. }
  16. /// <summary>
  17. /// Contains all the information about a field style
  18. /// </summary>
  19. public struct InspectableFieldStyleInfo
  20. {
  21. /// <summary>
  22. /// Information about the field range
  23. /// </summary>
  24. public InspectableFieldRangeStyle RangeStyle;
  25. /// <summary>
  26. /// Information about the field stepping
  27. /// </summary>
  28. public InspectableFieldStepStyle StepStyle;
  29. /// <summary>
  30. /// Boolean information about the field
  31. /// </summary>
  32. public InstectableFieldStyleFlags StyleFlags;
  33. }
  34. /// <summary>
  35. /// Contains style information about inspectable items
  36. /// </summary>
  37. public abstract class InspectableFieldStyle
  38. {
  39. /// <summary>
  40. /// Creates all the relevant style information for a SerializableField
  41. /// </summary>
  42. /// <param name="field">A SerializableField</param>
  43. /// <returns>Style information</returns>
  44. public static InspectableFieldStyleInfo Create(SerializableField field)
  45. {
  46. var styleInfo = new InspectableFieldStyleInfo();
  47. styleInfo.RangeStyle = field.Range? new InspectableFieldRangeStyle(field.RangeMinimum, field.RangeMaximum) : null;
  48. styleInfo.StepStyle = field.Step != 0? new InspectableFieldStepStyle(field.Step) : null;
  49. if (styleInfo.StepStyle != null)
  50. {
  51. Debug.Log(styleInfo.StepStyle.Step);
  52. }
  53. else
  54. {
  55. Debug.Log("Step null");
  56. }
  57. if (styleInfo.RangeStyle != null)
  58. {
  59. Debug.Log(styleInfo.RangeStyle.Max);
  60. Debug.Log(styleInfo.RangeStyle.Min);
  61. }
  62. else
  63. {
  64. Debug.Log("Range null");
  65. }
  66. return styleInfo;
  67. }
  68. }
  69. }