예제 #1
0
        private void DrawOneWay(OneWayDataBinding item)
        {
            var fmt = "";

            fmt += "{0}.{1}{7}{5}{3}.{4}{8}{9}{6}  ";

            item.SrcPropertyPath = item.SrcPropertyPath.Replace("--", "");
            item.DstPropertyPath = item.DstPropertyPath.Replace("--", "");

            var bindingStr = string.Format(
                fmt,                                                                                                         // Format
                item.ViewModelName.Color(ViewModelColor),                                                                    // {0}
                item.SrcPropertyName.Color(PropertyColor),                                                                   // {1}
                item.gameObject.name.Color(GameObjectColor),                                                                 // {2}
                item._dstView.GetType().Name.Color(ViewColor),                                                               // {3}
                item.DstPropertyName.Color(PropertyColor),                                                                   // {4}
                (item is TwoWayDataBinding) ? "<->" : "->",                                                                  // {5}
                (item is TwoWayDataBinding) ? "." + (item as TwoWayDataBinding)._dstChangedEventName.Color(EventColor) : "", // {6}
                item.SrcPropertyPath.Length > 0 ? "." + item.SrcPropertyPath.Color(FieldColor) : "",                         // {7}
                item.DstPropertyPath.Length > 0 ? "." + item.DstPropertyPath.Color(FieldColor) : "",                         // {8}
                (item is TwoWayDataBinding) ? " -- " + item._dstView.GetType().Name.Color(ViewColor) : ""                    // {9}
                );

            var goStr = string.Format("<color=white><b>{0}</b></color>", item.gameObject.name);

            bool contains = ignoreCase ? bindingStr.ToLower().Contains(filter.ToLower()) : bindingStr.Contains(filter);

            if (string.IsNullOrEmpty(filter) || contains)
            {
                if (GUILayout.Button("", GUIStyles.BindingButton))
                {
                    Selection.activeGameObject = item.gameObject;
                }


                var btnRect     = GUILayoutUtility.GetLastRect();
                var goLabelRect = new Rect(btnRect);

                goLabelRect.width /= 4;

                GUI.Box(goLabelRect, goStr, GUIStyles.LabelLeft);

                btnRect.x      = goLabelRect.width;
                btnRect.width -= goLabelRect.width;
                GUI.Box(btnRect, bindingStr, GUIStyles.LabelLeft);
            }
        }
 public OneWayDataBindingTestCase(DataBindingBase binder) : base(binder)
 {
     _binder = binder as OneWayDataBinding;
 }