Ejemplo n.º 1
0
    private void OnGUI()
    {
        if (Application.isPlaying || EditorApplication.isPlaying || EditorApplication.isCompiling)
        {
            EditorGUILayout.HelpBox("コンパイル中、実行中は変更できません", MessageType.Warning);
            return;
        }

        EditorGUILayout.BeginScrollView(mScroll, GUI.skin.box);
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                for (int i = 0; i < mDefineLit.Count; i++)
                {
                    var define = mDefineLit[i];

                    define.mIsEnable = EditorGUILayout.Toggle(define.mIsEnable);

                    GUILayout.BeginVertical(GUI.skin.box);
                    {
                        define.mSymbolName = GUILayout.TextField(define.mSymbolName);
                        define.mInfomation = EditorGUILayout.TextField("説明", define.mInfomation);
                    }
                    GUILayout.EndVertical();
                    if (GUILayout.Button("Remove"))
                    {
                        mDefineLit.RemoveAt(i);
                        break;
                    }
                }
            }
            GUILayout.EndVertical();
        }
        EditorGUILayout.EndScrollView();


        if (GUILayout.Button("Add"))
        {
            DefineSymbol.Symbol add = new DefineSymbol.Symbol("Symbol_Name", "", false);
            mDefineLit.Add(add);
        }
        if (GUILayout.Button("Save"))
        {
            SaveDefineSymbol();
        }

        if (mSymbolAsset != null)
        {
            mSymbolAsset.mSymbols = mDefineLit.ToArray();
        }
    }
Ejemplo n.º 2
0
    private void Initialize()
    {
        string symbole = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);

        mSymbols = symbole.Split(SPLIT_STRING);

        mDefineLit = new List <DefineSymbol.Symbol>();

        if (mSymbolAsset == null)
        {
            mSymbolAsset = AssetDatabase.LoadAssetAtPath <DefineSymbol>(DEFINE_SYMBOL_ASSET_PATH);
        }

        for (int i = 0; i < mSymbols.Length; i++)
        {
            DefineSymbol.Symbol symbol = new DefineSymbol.Symbol(mSymbols[i], "", true);
            mDefineLit.Add(symbol);
        }

        if (mSymbolAsset != null)
        {
            var symbols = mSymbolAsset.mSymbols;

            for (int i = 0; i < symbols.Length; i++)
            {
                var symbol = symbols[i];

                for (int j = 0; j < mDefineLit.Count; j++)
                {
                    if (symbol.mSymbolName.Equals(mDefineLit[i].mSymbolName))
                    {
                        mDefineLit[j] = symbol;
                    }
                    else
                    {
                        mDefineLit.Add(symbol);
                    }
                }
            }
        }
    }