BG2WindowPane.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using UnityEngine;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class BG2WindowPane : BaseMainWindowPane
  5. {
  6. private static readonly string[] tabNames = { "props", "myRoom", "mod" };
  7. private readonly MeidoManager meidoManager;
  8. private readonly PropManager propManager;
  9. private readonly AttachPropPane attachPropPane;
  10. private readonly PropManagerPane propManagerPane;
  11. private readonly SelectionGrid propTabs;
  12. private BasePane currentPropsPane;
  13. public BG2WindowPane(MeidoManager meidoManager, PropManager propManager)
  14. {
  15. this.meidoManager = meidoManager;
  16. this.propManager = propManager;
  17. this.propManager.FromPropSelect += (s, a) => propTabs.SelectedItemIndex = 0;
  18. // should be added in this order
  19. AddPane(new PropsPane(propManager));
  20. AddPane(new MyRoomPropsPane(propManager));
  21. AddPane(new ModPropsPane(propManager));
  22. attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
  23. propManagerPane = AddPane(new PropManagerPane(propManager));
  24. propTabs = new SelectionGrid(Translation.GetArray("propsPaneTabs", tabNames));
  25. propTabs.ControlEvent += (s, a) => currentPropsPane = Panes[propTabs.SelectedItemIndex];
  26. currentPropsPane = Panes[0];
  27. }
  28. protected override void ReloadTranslation()
  29. {
  30. propTabs.SetItems(Translation.GetArray("propsPaneTabs", tabNames));
  31. }
  32. public override void Draw()
  33. {
  34. tabsPane.Draw();
  35. propTabs.Draw();
  36. MpsGui.WhiteLine();
  37. currentPropsPane.Draw();
  38. if (propTabs.SelectedItemIndex != 0) return;
  39. propManagerPane.Draw();
  40. scrollPos = GUILayout.BeginScrollView(scrollPos);
  41. attachPropPane.Draw();
  42. GUILayout.EndScrollView();
  43. }
  44. public override void UpdatePanes()
  45. {
  46. if (ActiveWindow) base.UpdatePanes();
  47. }
  48. }
  49. }