EffectsPane.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections.Generic;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. internal class EffectsPane : BasePane
  5. {
  6. private Dictionary<string, BasePane> effectPanes = new Dictionary<string, BasePane>();
  7. private SelectionGrid effectToggles;
  8. private BasePane currentEffectPane;
  9. private List<string> effectList = new List<string>();
  10. public BasePane this[string effectUI]
  11. {
  12. private get => effectPanes[effectUI];
  13. set
  14. {
  15. effectPanes[effectUI] = value;
  16. effectList.Add(effectUI);
  17. effectToggles.SetItems(Translation.GetArray("effectsPane", effectList), 0);
  18. }
  19. }
  20. public EffectsPane()
  21. {
  22. effectToggles = new SelectionGrid(new[] { "dummy" /* thicc */ });
  23. effectToggles.ControlEvent += (s, a) => SetEffectPane(effectList[effectToggles.SelectedItemIndex]);
  24. }
  25. protected override void ReloadTranslation()
  26. {
  27. effectToggles.SetItems(Translation.GetArray("effectsPane", effectList));
  28. }
  29. private void SetEffectPane(string effectUI)
  30. {
  31. currentEffectPane = effectPanes[effectUI];
  32. currentEffectPane.UpdatePane();
  33. }
  34. public override void UpdatePane()
  35. {
  36. currentEffectPane.UpdatePane();
  37. }
  38. public override void Draw()
  39. {
  40. MiscGUI.Header("Effects");
  41. MiscGUI.WhiteLine();
  42. effectToggles.Draw();
  43. currentEffectPane.Draw();
  44. }
  45. }
  46. }