gewidgetsmetadata.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. TODO - doxygen formating
  3. */
  4. //! generic metadata class
  5. class GameplayEffectsData extends Managed
  6. {
  7. protected ref array<ref Widget> m_WidgetArray;
  8. int m_Type;
  9. int m_WidgetSetIdentifier;
  10. Widget m_LayoutRoot;
  11. void GameplayEffectsData(array<ref Widget> input, int type, int user_override = -1)
  12. {
  13. m_WidgetArray = input;
  14. m_Type = type;
  15. m_WidgetSetIdentifier = type;
  16. if (user_override != -1)
  17. {
  18. m_WidgetSetIdentifier = user_override;
  19. }
  20. }
  21. void Init(array<ref Widget> input, int type, Widget layout_root, int user_override = -1)
  22. {
  23. m_WidgetArray = input;
  24. m_Type = type;
  25. m_WidgetSetIdentifier = type;
  26. m_LayoutRoot = layout_root;
  27. if (user_override != -1)
  28. {
  29. m_WidgetSetIdentifier = user_override;
  30. }
  31. }
  32. array<ref Widget> GetWidgetSet()
  33. {
  34. return m_WidgetArray;
  35. }
  36. int GetWidgetSetType()
  37. {
  38. return m_Type;
  39. }
  40. int GetWidgetSetID()
  41. {
  42. return m_WidgetSetIdentifier;
  43. }
  44. //! Returns 'true' if this class contains update info
  45. bool HasDefinedHandle()
  46. {
  47. return false;
  48. }
  49. bool DataInitialized()
  50. {
  51. return true;
  52. }
  53. void UpdateVisibility(bool state){}
  54. void RegisterData(Param p){}
  55. void Update(float timeSlice = 0, Param p = null, int handle = -1){}
  56. void ForceStop();
  57. }
  58. class GameplayEffectsDataImage extends GameplayEffectsData
  59. {
  60. ref array<int> m_OriginalColors;
  61. ref array<int> m_CurrentColors;
  62. protected float m_SaturationMultiplier;//TODO ?
  63. void GameplayEffectsDataImage(array<ref Widget> input, int type, int user_override = -1)
  64. {
  65. ImageWidget w;
  66. m_OriginalColors = new array<int>;
  67. m_CurrentColors = new array<int>;
  68. for (int i = 0; i < input.Count(); i++)
  69. {
  70. if ( Class.CastTo(w,input.Get(i)) )
  71. {
  72. m_OriginalColors.Insert(w.GetColor());
  73. }
  74. }
  75. m_CurrentColors.Copy(m_OriginalColors);
  76. }
  77. void SetSaturationMultiplier(float value)
  78. {
  79. m_SaturationMultiplier = value;
  80. }
  81. float GetSaturationMultiplier()
  82. {
  83. return m_SaturationMultiplier;
  84. }
  85. }
  86. typedef map<int,ref GameplayEffectsData> GameplayEffectDataMap;