public POModule AddModule(POModuleType type, ProceduralObject obj)
        {
            POModule module = (POModule)Activator.CreateInstance(type.ModuleType);

            module.ModuleType   = type;
            module.parentObject = obj;
            obj.m_modules.Add(module);
            module.enabled = true;
            modules.Add(module);
            enabledModules.Add(module);
            try { module.OnModuleCreated(logic); }
            catch (Exception e) { Debug.LogError("[ProceduralObjects] Error inside module OnModuleCreated() method!\n" + e); }
            return(module);
        }
        private void draw(int id)
        {
            if (GUIUtils.CloseHelpButtons(managerWindow, "Modules"))
            {
                selectedModuleType = null;
                showManagerWindow  = false;
            }
            GUI.DragWindow(new Rect(0, 0, 344, 23));

            GUI.Label(new Rect(10, 25, 380, 25), "<size=13><b>" + LocalizationManager.instance.current["MT_installed"] + "</b> (" + ProceduralObjectsMod.ModuleTypes.Count + ") :</size>");

            GUI.Box(new Rect(10, 52, 355, 200), string.Empty);
            scrollModuleTypes = GUI.BeginScrollView(new Rect(12, 54, 376, 196), scrollModuleTypes, new Rect(0, 0, 354, ProceduralObjectsMod.ModuleTypes.Count * 28 + 2));
            for (int i = 0; i < ProceduralObjectsMod.ModuleTypes.Count; i++)
            {
                var module = ProceduralObjectsMod.ModuleTypes[i];
                if (GUI.Button(new Rect(0, i * 28, 352, 23), "<b>" + module.Name + "</b> " + LocalizationManager.instance.current["made_by"] + " " + module.Author))
                {
                    ProceduralObjectsLogic.PlaySound();
                    selectedModuleType = module;
                    moduleCountMap     = modules.Count(m => m.ModuleType == selectedModuleType);
                }
                GUI.DrawTexture(new Rect(2, i * 28 + 2, 20, 20), ProceduralObjectsMod.Icons[module.hide_all ? 3 : 4]);
            }
            GUI.EndScrollView();

            GUI.BeginGroup(new Rect(10, 258, 380, 130));
            GUI.Box(new Rect(0, 0, 380, 130), string.Empty);
            if (selectedModuleType != null)
            {
                GUI.Label(new Rect(6, 2, 370, 50), "<size=16>" + selectedModuleType.Name + "</size> " + LocalizationManager.instance.current["made_by"] + " " + selectedModuleType.Author + "\n" + LocalizationManager.instance.current["modules_count"] +
                          " : <b>" + moduleCountMap + "</b>" + (selectedModuleType.maxModulesOnMap == 0 ? "" : " /" + selectedModuleType.maxModulesOnMap));

                selectedModuleType.hide_all = GUI.Toggle(new Rect(2, 50, 300, 22), selectedModuleType.hide_all, LocalizationManager.instance.current["disable_all"]);
            }
            GUI.EndGroup();
        }
 public void SetPosition(float x, float y)
 {
     managerWindow.position = new Vector2(x, y);
     selectedModuleType     = null;
 }