コード例 #1
0
        private void DrawDataInspector(BtNodeData data)
        {
            EditorGUIUtility.labelWidth = 24;

            if (!string.IsNullOrEmpty(mDelKey))
            {
                data.RemoveData(mDelKey);
                if (mChangeDict.ContainsKey(mDelKey))
                {
                    mChangeDict.Remove(mDelKey);
                }
                mDelKey = null;
            }

            foreach (var key in mChangeDict.Keys)
            {
                data.AddData(key, mChangeDict[key]);
            }

            mChangeDict.Clear();

            if (data.data != null)
            {
                foreach (var kv in data.data)
                {
                    DrawItemInspector(kv);
                }
            }

            EditorGUILayout.BeginHorizontal();
            {
                mKey   = EditorGUILayout.TextField("key:", mKey);
                mValue = EditorGUILayout.TextField("val:", mValue);
                if (GUILayout.Button("+", GUILayout.MaxWidth(20)))
                {
                    if (!string.IsNullOrEmpty(mKey))
                    {
                        data.AddData(mKey, mValue);
                        mKey   = "";
                        mValue = "";
                    }
                }
            }
            EditorGUILayout.EndHorizontal();
        }