Beispiel #1
0
        //------------------------------------------------------
        // i/o
        //------------------------------------------------------

        public static SceneMenuSettings Load()
        {
            var settings = new SceneMenuSettings();

            settings.Revert();
            return(settings);
        }
Beispiel #2
0
 public SceneMenuSettings(SceneMenuSettings src)
 {
     outputDirectoryPath = src.outputDirectoryPath;
     targets             = new List <string>(src.targets);
     ignores             = new List <string>(src.ignores);
     grouping            = new List <string>(src.grouping);
 }
Beispiel #3
0
        //------------------------------------------------------
        // unity system function
        //------------------------------------------------------

        void OnEnable()
        {
            s_intance = this;             // 表示状態で生成モード切替挟んだ時の対応

            titleContent = new GUIContent("SceneMenu設定");

            m_labelStyle = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene).FindStyle("Hi Label");

            m_origin = SceneMenuSettings.Load();
            Revert();
        }
Beispiel #4
0
        void Revert()
        {
            m_settings = new SceneMenuSettings(m_origin);
            m_current  = GetList();

            if (!string.IsNullOrEmpty(m_settings.outputDirectoryPath))
            {
                m_output = AssetDatabase.LoadAssetAtPath <DefaultAsset>(m_settings.outputDirectoryPath);
            }

            Repaint();
        }
Beispiel #5
0
        //------------------------------------------------------
        // accessor
        //------------------------------------------------------

        public void Generate()
        {
            m_settings = SceneMenuSettings.Load();

            var code = GenerateCode();

            if (string.IsNullOrEmpty(code))
            {
                return;
            }

            if (!WriteCode(code))
            {
                return;
            }

            AssetDatabase.Refresh();
        }
Beispiel #6
0
        //------------------------------------------------------
        // settings
        //------------------------------------------------------

        void Apply()
        {
            if (m_settings.Save())
            {
                if (m_settings.outputDirectoryPath != m_origin.outputDirectoryPath)
                {
                    var filePath = m_origin.GetScriptPath();
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                }

                m_origin = new SceneMenuSettings(m_settings);
            }

            SceneMenuUpdater.UpdateSceneMenu();
        }