コード例 #1
0
        bool DrawEditDropdown(DefineSymbolContext.Dropdown dropdown)
        {
            var deleteFlg = DrawEditSymbol(dropdown);

            ++EditorGUI.indentLevel;

            for (int j = 0; j < dropdown.items.Count; ++j)
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    dropdown.items[j] = EditorGUILayout.TextField(dropdown.items[j]);
                    if (GUILayout.Button("削除", EditorStyles.miniButton, GUILayout.Width(kBtnWidth)))
                    {
                        dropdown.items.RemoveAt(j--);
                    }
                }
            }

            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("選択追加"))
                {
                    dropdown.items.Add("ITEM" + dropdown.items.Count);
                }
            }

            --EditorGUI.indentLevel;

            return(deleteFlg);
        }
コード例 #2
0
        DefineSymbolContext.Dropdown CreateDropdown()
        {
            var dropdown = new DefineSymbolContext.Dropdown();

            dropdown.name        = "DROPDOWN" + m_context.dropdowns.Count;
            dropdown.description = string.Empty;
            dropdown.items.Add("ITEM0");
            return(dropdown);
        }
コード例 #3
0
            public Dropdown(DefineSymbolContext.Dropdown context, string[] symbols)
            {
                this.context = context;
                index        = -1;

                var symbolIndex = Array.FindIndex(symbols, i => i.StartsWith(context.name));

                if (symbolIndex >= 0)
                {
                    var itemName = symbols[symbolIndex].Substring(context.name.Length + 1);
                    index = context.items.IndexOf(itemName);
                }
            }