public static void Expression(Binding binding, int i)
        {
            bool toggle = false;
            int  key    = binding.GetHashCode() + i;

            toggleDic.TryGetValue(key, out toggle);

            GUILayout.Label(string.Format(".{0}=>", binding.propertyName), GUILayout.MinWidth(60));
            GUILayout.BeginHorizontal();
            if (toggle = GUILayout.Toggle(toggle, "", GUILayout.MaxWidth(20)))
            {
                GUILayout.EndHorizontal();
                GUILayout.BeginVertical();
                binding.path      = BindalbeEditorUtilty.DrawEditorLabl("path", binding.path, GUILayout.MinWidth(100));
                binding.format    = BindalbeEditorUtilty.DrawEditorLabl("format", binding.format, GUILayout.MinWidth(100));
                binding.mode      = BindalbeEditorUtilty.DrawEume("mode", binding.mode, GUILayout.MinWidth(100));//DrawPopup ("mode", binding.mode, GUILayout.MinWidth (100));
                binding.converter = BindalbeEditorUtilty.DrawEditorLabl("converter", binding.converter, GUILayout.MinWidth(100));
                binding.source    = BindalbeEditorUtilty.DrawPopUpComponents("source", binding.source, GUILayout.MinWidth(100));
                GUILayout.EndHorizontal();
            }
            else
            {
                sb.Clear();
                sb.Append("{");
                if (!string.IsNullOrEmpty(binding.path))
                {
                    sb.AppendFormat("path={0},", binding.path);
                }
                if (!string.IsNullOrEmpty(binding.format))
                {
                    sb.AppendFormat("format={0},", binding.format);
                }
                if (binding.mode != BindingMode.OneWay)
                {
                    sb.AppendFormat("mode={0},", binding.mode);
                }
                if (!string.IsNullOrEmpty(binding.converter))
                {
                    sb.AppendFormat("converter={0},", binding.converter);
                }
                if (binding.source)
                {
                    sb.AppendFormat("source={0},", binding.source);
                }
                if (sb.Length > 2)
                {
                    sb.Length = sb.Length - 1;
                }
                sb.Append("}");
                EditorGUILayout.LabelField(sb.ToString(), GUILayout.MaxWidth(500));
                GUILayout.EndHorizontal();
            }

            toggleDic[key] = toggle;
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Separator();
            var temp = target as CustomBinder;

            // base.OnInspectorGUI();
            GUILayout.BeginHorizontal();

            temp.target = (Component)BindalbeEditorUtilty.DrawPopUpComponents("Binder Target", temp.target, GUILayout.MinWidth(150));
            GUILayout.EndHorizontal();
            BindalbeObjectUtilty.BindableObjectField(temp, 0);
        }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            // base.OnInspectorGUI ();
            EditorGUILayout.Separator();
            var temp = target as CustomBinder;

            // base.OnInspectorGUI();
            GUILayout.BeginHorizontal();

            // GUILayout.Label(new GUIContent("Binder Target"), GUILayout.MinWidth(60));
            // content = GUILayout.TextField(content, options);
            // GUILayout.EndHorizontal();
            // if (!string.IsNullOrEmpty(content)) content = content.Replace(",", "").Replace("=", "");
            // temp.binderTarget = (Component)EditorGUILayout.ObjectField(temp.binderTarget, typeof(Component), false, GUILayout.MaxWidth(150)); //显示绑定对象
            temp.target = (Component)BindalbeEditorUtilty.DrawPopUpComponents("Binder Target", temp.target, GUILayout.MinWidth(150));
            GUILayout.EndHorizontal();
            BindalbeObjectUtilty.BindableObjectField(temp, 0);
        }