DragPointPane.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using UnityEngine;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class DragPointPane : BasePane
  5. {
  6. private string header;
  7. private readonly Toggle propsCubeToggle;
  8. private readonly Toggle smallCubeToggle;
  9. private readonly Toggle maidCubeToggle;
  10. private readonly Toggle bgCubeToggle;
  11. private enum Setting
  12. {
  13. Prop, Maid, Background, Size
  14. }
  15. public DragPointPane()
  16. {
  17. header = Translation.Get("movementCube", "header");
  18. propsCubeToggle = new Toggle(Translation.Get("movementCube", "props"), PropManager.CubeActive);
  19. smallCubeToggle = new Toggle(Translation.Get("movementCube", "small"));
  20. maidCubeToggle = new Toggle(Translation.Get("movementCube", "maid"), MeidoDragPointManager.CubeActive);
  21. bgCubeToggle = new Toggle(Translation.Get("movementCube", "bg"), EnvironmentManager.CubeActive);
  22. propsCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Prop, propsCubeToggle.Value);
  23. smallCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Size, smallCubeToggle.Value);
  24. maidCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Maid, maidCubeToggle.Value);
  25. bgCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Background, bgCubeToggle.Value);
  26. }
  27. protected override void ReloadTranslation()
  28. {
  29. header = Translation.Get("movementCube", "header");
  30. propsCubeToggle.Label = Translation.Get("movementCube", "props");
  31. smallCubeToggle.Label = Translation.Get("movementCube", "small");
  32. maidCubeToggle.Label = Translation.Get("movementCube", "maid");
  33. bgCubeToggle.Label = Translation.Get("movementCube", "bg");
  34. }
  35. public override void Draw()
  36. {
  37. MpsGui.Header(header);
  38. MpsGui.WhiteLine();
  39. GUILayout.BeginHorizontal();
  40. propsCubeToggle.Draw();
  41. smallCubeToggle.Draw();
  42. maidCubeToggle.Draw();
  43. bgCubeToggle.Draw();
  44. GUILayout.EndHorizontal();
  45. }
  46. private void ChangeDragPointSetting(Setting setting, bool value)
  47. {
  48. switch (setting)
  49. {
  50. case Setting.Prop:
  51. PropManager.CubeActive = value;
  52. break;
  53. case Setting.Background:
  54. EnvironmentManager.CubeActive = value;
  55. break;
  56. case Setting.Maid:
  57. MeidoDragPointManager.CubeActive = value;
  58. break;
  59. case Setting.Size:
  60. MeidoDragPointManager.CubeSmall = value;
  61. EnvironmentManager.CubeSmall = value;
  62. PropManager.CubeSmall = value;
  63. break;
  64. }
  65. }
  66. }
  67. }