/// <summary> /// 添加一个子View /// </summary> /// <param name="view">被添加的view</param> public void AddSubview(UILayout view) { if (view == null) { return; } view.RectTransform.SetParent(RectTransform); if (view.SuperView != null) { view.SuperView.RemoveView(view); } view.SuperView = this; Subviews.Add(view); }
protected AbsAdapterView() { ScrollRect = UIObject.AddComponent <ScrollRect>(); ScrollRect.onValueChanged.AddListener(OnScroll); EventHandler = UIObject.AddComponent <PointerClickHandler>(); EventHandler.AbsAdapterView = this; var contentView = new UILayout { UIObject = { name = "Content View" } }; AddSubview(contentView); ContentTransform = contentView.RectTransform; ContentTransform.pivot = ContentTransform.anchorMin = ContentTransform.anchorMax = new Vector2(0, 1); ContentTransform.anchoredPosition = Vector2.zero; ScrollRect.content = ContentTransform; ScrollOrentation = ScrollOrentation.Vertical; BackgroundColor = Color.black; Mask = UIObject.AddComponent <Mask>(); Mask.showMaskGraphic = true; }
public ButtonView(UILayout layout) : base(layout) { Button = UIObject.AddComponent <Button>(); }
public RadioButtonView(UILayout layout) : base(layout) { }
public static void FrameFill(UILayout layout) { }
public virtual void RemoveView(UILayout view) { Subviews.Remove(view); }
public virtual void MoveToView(UILayout view) { view.RectTransform.SetParent(view.RectTransform); view.SuperView = view; }
public UILayout(UILayout layout) { UIObject = BaseLayout(); RectTransform = UIObject.GetComponent <RectTransform>(); layout.AddSubview(this); }
public UIView(UILayout layout) : base(layout) { CanvasRenderer = UIObject.AddComponent <CanvasRenderer>(); }
public void Append(UILayout layout) { }
public TextView(UILayout layout) : base(layout) { TextComponent = UIObject.AddComponent <Text>(); Font = UIViewManager.GetInstance().Font; }
public ImageView(UILayout layout) : base(layout) { }