Переглянути джерело

Move prop management to separate file and cleanup

habeebweeb 4 роки тому
батько
коміт
32867c5779

+ 4 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/PropsPane.cs

@@ -5,6 +5,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     class PropsPane : BasePane
     {
         private EnvironmentManager environmentManager;
+        private PropManager propManager;
         private Dropdown otherDoguDropdown;
         private Dropdown doguDropdown;
         private Button addDoguButton;
@@ -17,6 +18,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public PropsPane(EnvironmentManager environmentManager)
         {
             this.environmentManager = environmentManager;
+            this.propManager = this.environmentManager.PropManager;
 
             this.doguDropdown = new Dropdown(Translation.GetArray("props1Dropdown", Constants.DoguList));
 
@@ -26,14 +28,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.addOtherDoguButton.ControlEvent += (s, a) =>
             {
                 string assetName = Constants.OtherDoguList[this.otherDoguDropdown.SelectedItemIndex];
-                this.environmentManager.SpawnObject(assetName);
+                this.propManager.SpawnObject(assetName);
             };
 
             this.addDoguButton = new Button("+");
             this.addDoguButton.ControlEvent += (s, a) =>
             {
                 string assetName = Constants.DoguList[this.doguDropdown.SelectedItemIndex];
-                this.environmentManager.SpawnObject(assetName);
+                this.propManager.SpawnObject(assetName);
             };
 
             this.nextDoguButton = new Button(">");

COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MaidSwitcherPane.cs → COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/MaidSwitcherPane.cs


COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/TabsPane.cs → COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/TabsPane.cs


COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MessageWindow.cs → COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/OtherWindows/MessageWindow.cs


+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/DragPointManager.cs

@@ -148,7 +148,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             meido.BodyLoad -= Initialize;
         }
 
-        public void Destroy()
+        public void Deactivate()
         {
             foreach (KeyValuePair<Bone, BaseDrag> dragPoint in DragPoint)
             {

+ 31 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManager.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+namespace COM3D2.MeidoPhotoStudio.Plugin
+{
+    public class EffectManager
+    {
+        public EffectManager()
+        {
+
+        }
+
+        public void Initialize()
+        {
+
+        }
+
+        public void Deactivate()
+        {
+
+        }
+
+        public void Update()
+        {
+
+        }
+
+    }
+}

+ 20 - 203
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs

@@ -1,42 +1,23 @@
-using System;
-using System.Collections.Generic;
 using UnityEngine;
-using UnityEngine.Rendering;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     public class EnvironmentManager
     {
+        public PropManager PropManager { get; private set; }
+        public LightManager LightManager { get; private set; }
+        public EffectManager EffectManager { get; private set; }
         private GameObject cameraObject;
         private Camera subCamera;
         private GameObject bgObject;
         private Transform bg;
         private CameraInfo cameraInfo;
-        private List<DragDogu> doguList = new List<DragDogu>();
-        private DragType dragTypeOld = DragType.None;
-        private DragType currentDragType = DragType.None;
-        enum DragType
-        {
-            None, Move, Rotate, Scale, Delete, Other
-        }
-        private bool showGizmos = false;
 
-        public void ChangeBackground(string assetName, bool creative = false)
+        public EnvironmentManager(PropManager propManager, LightManager lightManager, EffectManager effectManager)
         {
-            if (creative)
-            {
-                GameMain.Instance.BgMgr.ChangeBgMyRoom(assetName);
-            }
-            else
-            {
-                GameMain.Instance.BgMgr.ChangeBg(assetName);
-                if (assetName == "KaraokeRoom")
-                {
-                    bg.transform.position = bgObject.transform.position;
-                    bg.transform.localPosition = new Vector3(1f, 0f, 4f);
-                    bg.transform.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 0f));
-                }
-            }
+            this.PropManager = propManager;
+            this.LightManager = lightManager;
+            this.EffectManager = effectManager;
         }
 
         public void Initialize()
@@ -76,14 +57,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void Update()
         {
-            SetDragType();
-            if (Input.GetKeyDown(KeyCode.Space))
-            {
-                showGizmos = !showGizmos;
-                currentDragType = dragTypeOld = DragType.None;
-                UpdateDragType();
-            }
-
             if (Input.GetKey(KeyCode.Q))
             {
                 if (Input.GetKeyDown(KeyCode.S))
@@ -101,32 +74,26 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     ResetCamera();
                 }
             }
+
+            PropManager.Update();
+            LightManager.Update();
         }
 
-        private void SetDragType()
+        public void ChangeBackground(string assetName, bool creative = false)
         {
-            if (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.X) || Input.GetKey(KeyCode.C)
-                || Input.GetKey(KeyCode.D)
-            )
+            if (creative)
             {
-                currentDragType = DragType.Other;
+                GameMain.Instance.BgMgr.ChangeBgMyRoom(assetName);
             }
             else
             {
-                currentDragType = DragType.None;
-            }
-
-            if (currentDragType != dragTypeOld) UpdateDragType();
-
-            dragTypeOld = currentDragType;
-        }
-
-        private void UpdateDragType()
-        {
-            bool dragPointActive = currentDragType == DragType.Other;
-            foreach (DragDogu dogu in doguList)
-            {
-                dogu.SetDragProp(showGizmos, dragPointActive, dragPointActive);
+                GameMain.Instance.BgMgr.ChangeBg(assetName);
+                if (assetName == "KaraokeRoom")
+                {
+                    bg.transform.position = bgObject.transform.position;
+                    bg.transform.localPosition = new Vector3(1f, 0f, 4f);
+                    bg.transform.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 0f));
+                }
             }
         }
 
@@ -152,157 +119,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             cameraMain.SetDistance(3f, true);
         }
 
-        private GameObject GetDeploymentObject()
-        {
-            GameObject go = GameObject.Find("Deployment Object Parent");
-            if (go == null) go = new GameObject("Deployment Object Parent");
-            return go;
-        }
-
-        public void SpawnObject(string assetName)
-        {
-            // TODO: Add a couple more things to ignore list
-            GameObject dogu = null;
-            if (assetName.StartsWith("mirror"))
-            {
-                Material mirrorMaterial = new Material(Shader.Find("Mirror"));
-                dogu = GameObject.CreatePrimitive(PrimitiveType.Plane);
-                Renderer mirrorRenderer = dogu.GetComponent<Renderer>();
-                mirrorRenderer.material = mirrorMaterial;
-                mirrorRenderer.enabled = true;
-                MirrorReflection2 mirrorReflection = dogu.AddComponent<MirrorReflection2>();
-                mirrorReflection.m_TextureSize = 2048;
-
-                Vector3 localPosition = new Vector3(0f, 0.96f, 0f);
-                dogu.transform.Rotate(dogu.transform.right, 90f);
-
-                switch (assetName)
-                {
-                    case "mirror1":
-                        dogu.transform.localScale = new Vector3(0.2f, 0.4f, 0.2f);
-                        break;
-                    case "mirror2":
-                        dogu.transform.localScale = new Vector3(0.1f, 0.4f, 0.2f);
-                        break;
-                    case "mirror3":
-                        localPosition.y = 0.85f;
-                        dogu.transform.localScale = new Vector3(0.03f, 0.18f, 0.124f);
-                        break;
-                }
-                dogu.transform.localPosition = localPosition;
-            }
-            else if (assetName.IndexOf(':') >= 0)
-            {
-                string[] assetParts = assetName.Split(':');
-                GameObject obj = GameMain.Instance.BgMgr.CreateAssetBundle(assetParts[0]);
-                if (obj == null)
-                {
-                    obj = Resources.Load("BG/" + assetParts[0]) as GameObject;
-                }
-
-                GameObject bg = GameObject.Instantiate(obj);
-                int num = int.Parse(assetParts[1]);
-                dogu = bg.transform.GetChild(num).gameObject;
-                dogu.transform.SetParent(null);
-                GameObject.Destroy(bg);
-                bg.SetActive(false);
-            }
-            else
-            {
-                GameObject obj = GameMain.Instance.BgMgr.CreateAssetBundle(assetName);
-
-                if (obj == null) obj = Resources.Load("Prefab/" + assetName) as GameObject;
-
-                dogu = GameObject.Instantiate(obj) as GameObject;
-                dogu.transform.localPosition = Vector3.zero;
-
-                MeshRenderer[] meshRenderers = dogu.GetComponentsInChildren<MeshRenderer>();
-                for (int i = 0; i < meshRenderers.Length; i++)
-                {
-                    if (meshRenderers[i] != null)
-                    {
-                        meshRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
-                    }
-                }
-
-                Collider collider = dogu.transform.GetComponent<Collider>();
-                if (collider != null) collider.enabled = false;
-                foreach (Transform transform in dogu.transform)
-                {
-                    collider = transform.GetComponent<Collider>();
-                    if (collider != null)
-                    {
-                        collider.enabled = false;
-                    }
-                }
-                #region particle system experiment
-                // if (asset.StartsWith("Particle/"))
-                // {
-                //     ParticleSystem particleSystem = go.GetComponent<ParticleSystem>();
-                //     if (particleSystem != null)
-                //     {
-                //         ParticleSystem.MainModule main;
-                //         main = particleSystem.main;
-                //         main.loop = true;
-                //         main.duration = Mathf.Infinity;
-
-                //         ParticleSystem[] particleSystems = particleSystem.GetComponents<ParticleSystem>();
-                //         foreach (ParticleSystem part in particleSystems)
-                //         {
-                //             ParticleSystem.EmissionModule emissionModule = part.emission;
-                //             ParticleSystem.Burst[] bursts = new ParticleSystem.Burst[emissionModule.burstCount];
-                //             emissionModule.GetBursts(bursts);
-                //             for (int i = 0; i < bursts.Length; i++)
-                //             {
-                //                 bursts[i].cycleCount = Int32.MaxValue;
-                //             }
-                //             emissionModule.SetBursts(bursts);
-                //             main = part.main;
-                //             main.loop = true;
-                //             main.duration = Mathf.Infinity;
-                //         }
-                //     }
-                // }
-                #endregion
-            }
-
-            if (dogu != null)
-            {
-                // TODO: Figure out why some props aren't centered properly
-                // Doesn't happen in MM but even after copy pasting the code, it doesn't work :/
-                GameObject deploymentObject = GetDeploymentObject();
-                GameObject finalDogu = new GameObject();
-
-                dogu.transform.SetParent(finalDogu.transform, true);
-                finalDogu.transform.SetParent(deploymentObject.transform, false);
 
-                finalDogu.transform.position = new Vector3(0f, 0f, 0.5f);
-
-                GameObject dragPoint = BaseDrag.MakeDragPoint(
-                    PrimitiveType.Cube, Vector3.one * 0.12f, BaseDrag.LightBlue
-                );
-
-                DragDogu dragDogu = dragPoint.AddComponent<DragDogu>();
-                dragDogu.Initialize(finalDogu);
-                dragDogu.Delete += (s, a) => DeleteDogu();
-                dragDogu.SetDragProp(showGizmos, false, false);
-                doguList.Add(dragDogu);
-            }
-        }
-
-        private void DeleteDogu()
-        {
-            doguList.RemoveAll(dragDogu =>
-                {
-                    if (dragDogu.DeleteMe)
-                    {
-                        GameObject.Destroy(dragDogu.gameObject);
-                        return true;
-                    }
-                    return false;
-                }
-            );
-        }
     }
 
     public struct CameraInfo

+ 26 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace COM3D2.MeidoPhotoStudio.Plugin
+{
+    public class LightManager
+    {
+        public LightManager()
+        {
+
+        }
+
+        public void Deactivate()
+        {
+
+        }
+
+        public void Update()
+        {
+
+        }
+    }
+}

+ 1 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MeidoManager.cs

@@ -103,7 +103,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             ActiveMeidoList.Clear();
         }
 
-        public void DeactivateMeidos()
+        public void Deactivate()
         {
             foreach (Meido meido in meidos)
             {
@@ -157,7 +157,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             SelectMeido?.Invoke(this, args);
         }
 
-
         private void ChangeMeido(object sender, MeidoChangeEventArgs args)
         {
             SelectedMeido = args.selected;

+ 1 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MessageWindowManager.cs

@@ -11,6 +11,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private UILabel nameLabel;
         private GameObject msgGameObject;
         public bool ShowingMessage { get; private set; }
+
         public MessageWindowManager()
         {
             sysRoot = GameObject.Find("__GameMain__/SystemUI Root");

+ 221 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs

@@ -0,0 +1,221 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+
+namespace COM3D2.MeidoPhotoStudio.Plugin
+{
+    public class PropManager
+    {
+        private List<DragDogu> doguList = new List<DragDogu>();
+        private DragType dragTypeOld = DragType.None;
+        private DragType currentDragType = DragType.None;
+        private bool showGizmos = false;
+        enum DragType
+        {
+            None, Move, Rotate, Scale, Delete, Other
+        }
+
+        public PropManager()
+        {
+
+        }
+
+        public void Deactivate()
+        {
+            foreach (DragDogu dogu in doguList)
+            {
+                GameObject.Destroy(dogu.gameObject);
+            }
+            doguList.Clear();
+        }
+
+        public void Update()
+        {
+            if (Input.GetKeyDown(KeyCode.Space))
+            {
+                showGizmos = !showGizmos;
+                currentDragType = dragTypeOld = DragType.None;
+                UpdateDragType();
+            }
+
+            if (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.X) || Input.GetKey(KeyCode.C)
+                || Input.GetKey(KeyCode.D)
+            )
+            {
+                currentDragType = DragType.Other;
+            }
+            else
+            {
+                currentDragType = DragType.None;
+            }
+
+            if (currentDragType != dragTypeOld) UpdateDragType();
+
+            dragTypeOld = currentDragType;
+        }
+
+        private void UpdateDragType()
+        {
+            bool dragPointActive = currentDragType == DragType.Other;
+            foreach (DragDogu dogu in doguList)
+            {
+                dogu.SetDragProp(showGizmos, dragPointActive, dragPointActive);
+            }
+        }
+
+        private GameObject GetDeploymentObject()
+        {
+            GameObject go = GameObject.Find("Deployment Object Parent");
+            if (go == null) go = new GameObject("Deployment Object Parent");
+            return go;
+        }
+
+        public void SpawnObject(string assetName)
+        {
+            // TODO: Add a couple more things to ignore list
+            GameObject dogu = null;
+            if (assetName.StartsWith("mirror"))
+            {
+                Material mirrorMaterial = new Material(Shader.Find("Mirror"));
+                dogu = GameObject.CreatePrimitive(PrimitiveType.Plane);
+                Renderer mirrorRenderer = dogu.GetComponent<Renderer>();
+                mirrorRenderer.material = mirrorMaterial;
+                mirrorRenderer.enabled = true;
+                MirrorReflection2 mirrorReflection = dogu.AddComponent<MirrorReflection2>();
+                mirrorReflection.m_TextureSize = 2048;
+
+                Vector3 localPosition = new Vector3(0f, 0.96f, 0f);
+                dogu.transform.Rotate(dogu.transform.right, 90f);
+
+                switch (assetName)
+                {
+                    case "mirror1":
+                        dogu.transform.localScale = new Vector3(0.2f, 0.4f, 0.2f);
+                        break;
+                    case "mirror2":
+                        dogu.transform.localScale = new Vector3(0.1f, 0.4f, 0.2f);
+                        break;
+                    case "mirror3":
+                        localPosition.y = 0.85f;
+                        dogu.transform.localScale = new Vector3(0.03f, 0.18f, 0.124f);
+                        break;
+                }
+                dogu.transform.localPosition = localPosition;
+            }
+            else if (assetName.IndexOf(':') >= 0)
+            {
+                string[] assetParts = assetName.Split(':');
+                GameObject obj = GameMain.Instance.BgMgr.CreateAssetBundle(assetParts[0]);
+                if (obj == null)
+                {
+                    obj = Resources.Load("BG/" + assetParts[0]) as GameObject;
+                }
+
+                GameObject bg = GameObject.Instantiate(obj);
+                int num = int.Parse(assetParts[1]);
+                dogu = bg.transform.GetChild(num).gameObject;
+                dogu.transform.SetParent(null);
+                GameObject.Destroy(bg);
+                bg.SetActive(false);
+            }
+            else
+            {
+                GameObject obj = GameMain.Instance.BgMgr.CreateAssetBundle(assetName);
+
+                if (obj == null) obj = Resources.Load("Prefab/" + assetName) as GameObject;
+
+                dogu = GameObject.Instantiate(obj) as GameObject;
+                dogu.transform.localPosition = Vector3.zero;
+
+                MeshRenderer[] meshRenderers = dogu.GetComponentsInChildren<MeshRenderer>();
+                for (int i = 0; i < meshRenderers.Length; i++)
+                {
+                    if (meshRenderers[i] != null)
+                    {
+                        meshRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
+                    }
+                }
+
+                Collider collider = dogu.transform.GetComponent<Collider>();
+                if (collider != null) collider.enabled = false;
+                foreach (Transform transform in dogu.transform)
+                {
+                    collider = transform.GetComponent<Collider>();
+                    if (collider != null)
+                    {
+                        collider.enabled = false;
+                    }
+                }
+                #region particle system experiment
+                // if (asset.StartsWith("Particle/"))
+                // {
+                //     ParticleSystem particleSystem = go.GetComponent<ParticleSystem>();
+                //     if (particleSystem != null)
+                //     {
+                //         ParticleSystem.MainModule main;
+                //         main = particleSystem.main;
+                //         main.loop = true;
+                //         main.duration = Mathf.Infinity;
+
+                //         ParticleSystem[] particleSystems = particleSystem.GetComponents<ParticleSystem>();
+                //         foreach (ParticleSystem part in particleSystems)
+                //         {
+                //             ParticleSystem.EmissionModule emissionModule = part.emission;
+                //             ParticleSystem.Burst[] bursts = new ParticleSystem.Burst[emissionModule.burstCount];
+                //             emissionModule.GetBursts(bursts);
+                //             for (int i = 0; i < bursts.Length; i++)
+                //             {
+                //                 bursts[i].cycleCount = Int32.MaxValue;
+                //             }
+                //             emissionModule.SetBursts(bursts);
+                //             main = part.main;
+                //             main.loop = true;
+                //             main.duration = Mathf.Infinity;
+                //         }
+                //     }
+                // }
+                #endregion
+            }
+
+            if (dogu != null)
+            {
+                // TODO: Figure out why some props aren't centered properly
+                // Doesn't happen in MM but even after copy pasting the code, it doesn't work :/
+                GameObject deploymentObject = GetDeploymentObject();
+                GameObject finalDogu = new GameObject();
+
+                dogu.transform.SetParent(finalDogu.transform, true);
+                finalDogu.transform.SetParent(deploymentObject.transform, false);
+
+                finalDogu.transform.position = new Vector3(0f, 0f, 0.5f);
+
+                GameObject dragPoint = BaseDrag.MakeDragPoint(
+                    PrimitiveType.Cube, Vector3.one * 0.12f, BaseDrag.LightBlue
+                );
+
+                DragDogu dragDogu = dragPoint.AddComponent<DragDogu>();
+                dragDogu.Initialize(finalDogu);
+                dragDogu.Delete += (s, a) => DeleteDogu();
+                dragDogu.SetDragProp(showGizmos, false, false);
+                doguList.Add(dragDogu);
+            }
+        }
+
+        private void DeleteDogu()
+        {
+            doguList.RemoveAll(dragDogu =>
+                {
+                    if (dragDogu.DeleteMe)
+                    {
+                        GameObject.Destroy(dragDogu.gameObject);
+                        return true;
+                    }
+                    return false;
+                }
+            );
+        }
+    }
+}

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

@@ -162,7 +162,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void Deactivate()
         {
             Unload();
-            dragPointManager?.Destroy();
+            dragPointManager?.Deactivate();
             Maid.SetPos(Vector3.zero);
             Maid.SetRot(Vector3.zero);
             Maid.SetPosOffset(Vector3.zero);

+ 13 - 5
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -1,4 +1,4 @@
-using System;
+using System.Linq;
 using System.Collections;
 using System.Collections.Generic;
 using System.IO;
@@ -9,7 +9,7 @@ using UnityInjector.Attributes;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    [PluginName("Meido Photo Studio"), PluginVersion("0.0.0")]
+    [PluginName("COM3D2.MeidoPhotoStudio.Plugin"), PluginVersion("0.0.0")]
     public class MeidoPhotoStudio : PluginBase
     {
         private static MonoBehaviour instance;
@@ -17,6 +17,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private MeidoManager meidoManager;
         private EnvironmentManager environmentManager;
         private MessageWindowManager messageWindowManager;
+        private PropManager propManager;
+        private LightManager lightManager;
+        private EffectManager effectManager;
         private Constants.Scene currentScene;
         private bool initialized = false;
         private bool isActive = false;
@@ -53,7 +56,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     }
                 }
 
-
                 if (isActive)
                 {
                     bool qFlag = Input.GetKey(KeyCode.Q);
@@ -136,7 +138,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void ReturnToMenu()
         {
             if (meidoManager.IsBusy) return;
-            meidoManager.DeactivateMeidos();
+            meidoManager.Deactivate();
             environmentManager.Deactivate();
             messageWindowManager.Deactivate();
 
@@ -166,11 +168,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void Initialize()
         {
+            TabsPane.SelectedTab = Constants.Window.Call;
             initialized = true;
             meidoManager = new MeidoManager();
+
             meidoManager.BeginCallMeidos += (s, a) => this.uiActive = false;
             meidoManager.EndCallMeidos += (s, a) => this.uiActive = true;
-            environmentManager = new EnvironmentManager();
+
+            lightManager = new LightManager();
+            propManager = new PropManager();
+            effectManager = new EffectManager();
+            environmentManager = new EnvironmentManager(propManager, lightManager, effectManager);
             messageWindowManager = new MessageWindowManager();
             windowManager = new WindowManager(meidoManager, environmentManager, messageWindowManager);