public void OnAwake() { RectTransform.Alignment = Alignment.TopHStretch; _caption = AddComponent <Text> (); _caption.FontStyle = System.Drawing.FontStyle.Bold; _caption.Height = 15; _caption.Offset = new Point(16 + 19, 0); _caption.Alignment = Alignment.TopLeft; _active = SceneObject.Instantiate <CheckBox> (this); _active.RectTransform.Padding = new Padding(16 + 10, 8); _collapseCtrl = AddComponent <CollapseCtrl>(); _collapseCtrl.OnCollapseChanged += OnCollapseChanged; _line = SceneObject.Instantiate <Panel> (this); _line.RectTransform.Size = new Point(0, 1); _line.RectTransform.Alignment = Alignment.BottomHStretch; _line.RectTransform.Padding = new Padding(4, 0, 4, 1); _line.RectTransform.ClampMode = ClampMode.Parent; _line.Background.Color = Color.Gray; RectTransform.LayoutChanged += OnLayoutChanged; }
public ObjectView(SceneObject parent, SceneObject obj, bool active, bool collapsed) { Object = obj; Text = parent.AddComponent <Text> (); Text.Content = obj.Name; Text.Alignment = Alignment.TopLeft; Text.Height = 16; Text.Color = obj.Active ? Color.White : Color.Gray; Text.UpdateContent(); if (obj.Transform.Children.Exists(x => x.Owner.GetType().GetCustomAttributes(typeof(HideFromInspectorAttribute), true).Length == 0)) { CollapseCtrl = parent.AddComponent <CollapseCtrl>(); CollapseCtrl.Collapsed = collapsed; CollapseCtrl.Context = obj; } obj.ActiveChanged += TMActiveChanged; }