Ejemplo n.º 1
0
        void OnEnable()
        {
            current       = target as ScriptSymbolDefine;
            currentDefine = string.Empty;

            contentApply = new GUIContent("Apply", EditorGUIUtility.FindTexture("vcs_check"), "Apply script symbols");

            ro = new ReorderableList(new List <ScriptSymbolDefine> (), typeof(ScriptSymbolDefine));
            ro.drawElementCallback = DrawSymbol;
            ro.drawHeaderCallback  = _ => GUI.Label(_, "Available Script Symbols");
            ro.onAddCallback       = _ => {
                current.list.Add(new ScriptSymbolDefine.ScriptSymbol());
                addIndex = current.list.Count - 1;
                EditorUtility.SetDirty(current);
            };
            ro.onRemoveCallback = _ => {
                current.list.RemoveAt(_.index);
                if (0 < _.index)
                {
                    _.index--;
                }
            };
            ro.onCanRemoveCallback = _ => (0 <= _.index && _.index < current.list.Count);
            ro.elementHeight       = 50;
        }
Ejemplo n.º 2
0
        /// <summary>新しいDefineSymbolsアセットを生成します.</summary>
        static ScriptSymbolDefine Create()
        {
            if (!Directory.Exists("Assets/Editor"))
            {
                AssetDatabase.CreateFolder("Assets", "Editor");
            }

            //DefineSymbolsアセット生成して保存.
            ScriptSymbolDefine symbols = ScriptableObject.CreateInstance(typeof(ScriptSymbolDefine)) as ScriptSymbolDefine;

            AssetDatabase.CreateAsset(symbols, "Assets/Editor/ScriptSymbolDefine.asset");
            AssetDatabase.SaveAssets();
            return(symbols);
        }