Forráskód Böngészése

Add method to add panes to pane list

habeebweeb 4 éve
szülő
commit
c87d8d0a19

+ 5 - 10
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BG2WindowPane.cs

@@ -17,14 +17,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.meidoManager = meidoManager;
 
             PropManager propManager = this.environmentManager.PropManager;
-            this.propsPane = new PropsPane(propManager);
-            this.myRoomPropsPane = new MyRoomPropsPane(propManager);
-            this.modPropsPane = new ModPropsPane(propManager);
-            this.attachPropPane = new AttachPropPane(this.meidoManager, propManager);
-
-            this.Panes.Add(propsPane);
-            this.Panes.Add(myRoomPropsPane);
-            this.Panes.Add(modPropsPane);
+            this.propsPane = AddPane(new PropsPane(propManager));
+            this.myRoomPropsPane = AddPane(new MyRoomPropsPane(propManager));
+            this.modPropsPane = AddPane(new ModPropsPane(propManager));
+            this.attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
 
             this.propTabs = new SelectionGrid(Translation.GetArray("propTabs", new[] { "Props", "MyRoom", "Mod" }));
             this.propTabs.ControlEvent += (s, a) =>
@@ -46,8 +42,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (ActiveWindow)
             {
-                this.propsPane.UpdatePane();
-                this.attachPropPane.UpdatePane();
+                base.UpdatePanes();
             }
         }
     }

+ 6 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BGWindowPane.cs

@@ -11,19 +11,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public BGWindowPane(EnvironmentManager environmentManager)
         {
-            this.backgroundSelectorPane = new BackgroundSelectorPane(environmentManager);
-            this.dragPointPane = new DragPointPane();
-            this.lightsPane = new LightsPane(environmentManager);
+            this.backgroundSelectorPane = AddPane(new BackgroundSelectorPane(environmentManager));
+            this.dragPointPane = AddPane(new DragPointPane());
+            this.lightsPane = AddPane(new LightsPane(environmentManager));
 
             EffectManager effectManager = environmentManager.EffectManager;
 
-            this.effectsPane = new EffectsPane()
+            this.effectsPane = AddPane(new EffectsPane()
             {
                 ["bloom"] = new BloomPane(effectManager),
                 ["dof"] = new DepthOfFieldPane(effectManager),
                 ["vignette"] = new VignettePane(effectManager),
                 ["fog"] = new FogPane(effectManager)
-            };
+            });
         }
 
         public override void Draw()
@@ -40,8 +40,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (ActiveWindow)
             {
-                this.lightsPane.UpdatePane();
-                this.effectsPane.UpdatePane();
+                base.UpdatePanes();
             }
         }
     }

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/CallWindowPane.cs

@@ -20,7 +20,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             placementOKButton.ControlEvent += (o, a) => Debug.Log("Placement changed");
             Controls.Add(placementOKButton);
 
-            maidSelectorPane = new MaidSelectorPane(meidoManager);
+            maidSelectorPane = AddPane(new MaidSelectorPane(meidoManager));
         }
 
         protected override void ReloadTranslation()
@@ -31,7 +31,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void UpdatePanes()
         {
-            maidSelectorPane.UpdatePane();
+            base.UpdatePanes();
         }
 
         public override void Draw()

+ 3 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/FaceWindowPane.cs

@@ -15,8 +15,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             this.maidSwitcherPane = maidSwitcherPane;
 
-            this.maidFaceSliderPane = new MaidFaceSliderPane(this.meidoManager);
-            this.maidFaceBlendPane = new MaidFaceBlendPane(this.meidoManager);
+            this.maidFaceSliderPane = AddPane(new MaidFaceSliderPane(this.meidoManager));
+            this.maidFaceBlendPane = AddPane(new MaidFaceBlendPane(this.meidoManager));
         }
 
         public override void Draw()
@@ -39,8 +39,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 this.meidoManager.ActiveMeido.Maid.boMabataki = false;
                 this.meidoManager.ActiveMeido.Maid.body0.Face.morph.EyeMabataki = 0f;
-                this.maidFaceSliderPane.UpdatePane();
-                this.maidFaceBlendPane.UpdatePane();
+                base.UpdatePanes();
             }
         }
     }

+ 6 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/BaseWindowPane.cs

@@ -9,6 +9,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         protected Vector2 scrollPos;
         public bool ActiveWindow { get; set; }
 
+        public T AddPane<T>(T pane) where T : BasePane
+        {
+            this.Panes.Add(pane);
+            return pane;
+        }
+
         public virtual void UpdatePanes()
         {
             foreach (BasePane pane in Panes) pane.UpdatePane();