DragPointPane.cs 2.8 KB

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