Пример #1
0
        /// <summary>
        /// シンボルを表示.
        /// </summary>
        void DrawSymbol(Rect rect, int index, bool isActive, bool isFocused)
        {
            SymbolCatalog.Symbol currentSymbol = ro.list[index] as SymbolCatalog.Symbol;

            //セパレータの場合、線引くだけ.
            if (currentSymbol.style == SymbolCatalog.SymbolStyle.Separator)
            {
                GUI.Label(new Rect(rect.x + 10, rect.y + 24, rect.width - 20, 16), GUIContent.none, "sv_iconselector_sep");
            }
            //ヘッダーの場合、説明テキストだけ.
            else if (currentSymbol.style == SymbolCatalog.SymbolStyle.Header)
            {
                GUI.contentColor = Color.black;
                string symbolDescriptionId = string.Format("symbol desctription {0}", index);
                GUI.SetNextControlName(symbolDescriptionId);
                styleHeader.richText      = GUI.GetNameOfFocusedControl() != symbolDescriptionId;
                currentSymbol.description = GUI.TextField(new Rect(rect.x - 19, rect.y + rect.height - 24, rect.width + 23, 20), currentSymbol.description, styleHeader);
                GUI.contentColor          = Color.white;
            }
            //通常シンボル.
            else
            {
                DrawDefaultSymbol(rect, index, currentSymbol);
            }

            EditorUtility.SetDirty(catalog);
            GUI.color        = Color.white;
            GUI.contentColor = Color.white;
        }
Пример #2
0
        /// <summary>
        /// 通常シンボルを表示.
        /// </summary>
        /// <param name="rect">描画座標.</param>
        /// <param name="index">シンボルインデックス.</param>
        /// <param name="symbol">表示するシンボル.</param>
        void DrawDefaultSymbol(Rect rect, int index, SymbolCatalog.Symbol symbol)
        {
            //シンボル説明を描画します.
            string symbolDescriptionId = string.Format("symbol desctription {0}", index);

            GUI.SetNextControlName(symbolDescriptionId);
            styleDescription.richText = GUI.GetNameOfFocusedControl() != symbolDescriptionId;
            symbol.description        = GUI.TextArea(new Rect(rect.x, rect.y + 12, rect.width, rect.height - 13), symbol.description, styleDescription);

            //背景を描画します.
            GUI.color = symbol.enabled ? EnableStyleColor : DisableStyleColor;
            GUI.Label(new Rect(rect.x, rect.y, rect.width, 16), GUIContent.none, "ShurikenEffectBg");            //"flow node flow" + (int)symbol.style);
            GUI.color = Color.white;

            //有効トグルを描画します.
            //				bool isGrouped = symbol.style != SymbolCatalog.SymbolStyle.Symbol;
            bool isGrouped = false;
            bool isEnable  = EditorGUI.Toggle(new Rect(rect.x + 5, rect.y, 15, 16), symbol.enabled, isGrouped ? "Radio" : "Toggle");

            if (symbol.enabled != isEnable)
            {
                //グループシンボルの場合、同じグループのシンボルを無効化.
                if (isGrouped)
                {
                    foreach (var style in catalog.list.Where(style => style.style == symbol.style))
                    {
                        style.enabled = false;
                    }
                    symbol.enabled = true;
                }
                else
                {
                    symbol.enabled = isEnable;
                }
            }

            //シンボル名を描画します.
            string symbolNameId = string.Format("symbol neme {0}", index);

            GUI.SetNextControlName(symbolNameId);
            GUI.color = symbol.enabled ? EnableTextColor : DisableTextColor;
            GUIStyle labelStyle = EditorGUIUtility.isProSkin ? EditorStyles.boldLabel : EditorStyles.whiteBoldLabel;

            symbol.name = GUI.TextField(new Rect(rect.x + 21, rect.y, rect.width - 50, 16), symbol.name, labelStyle);
            GUI.color   = Color.white;

            //Addされたら自動でシンボル名の入力開始します.
            if (addIndex == index)
            {
                EditorGUI.FocusTextInControl(symbolNameId);
                addIndex = -1;
            }
        }