Exemplo n.º 1
0
    private void DefineSymbolOnGUI()
    {
        GUILayout.BeginVertical(EditorStyles.toolbar);
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("DefineSymbolSetting", GUILayout.Width(130));

                if (GUILayout.Button("Add", EditorStyles.toolbarButton, GUILayout.Width(50)))
                {
                    saveData.AddDefineSymbol();
                }

                if (GUILayout.Button("Set", EditorStyles.toolbarButton, GUILayout.Width(50)))
                {
                    Setting();
                }

                if (GUILayout.Button("Reset", EditorStyles.toolbarButton, GUILayout.Width(50)))
                {
                    if (EditorUtility.DisplayDialog("DefineSymbolSetting", "Do you want to reset and return to the default settings?", "Yes", "No"))
                    {
                        DefalutSetting();
                    }
                }
            }
            GUILayout.EndHorizontal();

            defineSymbolDataScrollPosition = GUILayout.BeginScrollView(defineSymbolDataScrollPosition, GUILayout.Height(500));
            {
                GUILayout.BeginVertical("box");
                {
                    foreach (var data in saveData.defineSymbolDataList)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            data.flag         = GUILayout.Toggle(data.flag, "", GUILayout.Width(20));
                            data.defineSymbol = GUILayout.TextField(data.defineSymbol);
                            data.isRemove     = GUILayout.Button("Remove", GUILayout.Width(70));
                        }
                        GUILayout.EndHorizontal();
                    }

                    for (int i = saveData.defineSymbolDataList.Count - 1; i >= 0; i--)
                    {
                        var data = saveData.defineSymbolDataList[i];

                        if (data.isRemove)
                        {
                            saveData.RemoveDefineSymbol(data);
                        }
                    }
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndScrollView();
        }
        GUILayout.EndVertical();
    }