hitdirectionimagesbase.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class HitDirectionImagesBase
  2. {
  3. int m_ImageIndex;
  4. void HitDirectionImagesBase()
  5. {
  6. if ( (!GetTypeLayoutPathArray() && !GetTypeImagePathArray()) )
  7. {
  8. PerformRegisterImages();
  9. }
  10. RandomizeImageIdx();
  11. }
  12. protected void PerformRegisterImages()
  13. {
  14. /*
  15. RegisterImage("gui/layouts/gameplay/HitDirectionIndication.layout","Single_indicator_Splash_1");
  16. RegisterImage("gui/layouts/gameplay/HitDirectionIndication.layout","Single_indicator_Splash_2");
  17. ...
  18. */
  19. }
  20. protected void RegisterImage(string layout_path, string image_name)
  21. {
  22. GetTypeLayoutPathArray().Insert(layout_path);
  23. GetTypeImagePathArray().Insert(image_name);
  24. }
  25. protected void RandomizeImageIdx()
  26. {
  27. m_ImageIndex = Math.RandomIntInclusive(0,GetTypeImagePathArray().Count() - 1);
  28. }
  29. protected array<string> GetTypeLayoutPathArray(){}
  30. protected array<string> GetTypeImagePathArray(){}
  31. //! Layout should be sufficient for generic manipulation of the hit image
  32. void GetCurrentImageData(out Widget layout, out Widget image)
  33. {
  34. layout = GetGame().GetWorkspace().CreateWidgets(GetTypeLayoutPathArray()[m_ImageIndex]);
  35. image = layout.FindAnyWidget(GetTypeImagePathArray()[m_ImageIndex]);
  36. }
  37. }