void OnClickBnt3(UControl control, PointerEventData data) { Callback_Bnt3?.Invoke(); Show(false); LastNeedDirtyView?.SetDirtyAll(); LastNeedDirtyView = null; }
void OnOpenView(UView view, bool useGroup) { //UI互斥,相同UI组只能有一个UI被打开 if (useGroup && view.Group > 0) { view.MutexPreviews.Clear(); for (int i = 0; i < AllMainViews.Count; ++i) { var otherView = AllMainViews[i]; if (!otherView.IsDragged && otherView != view && otherView.Group != ViewGroup.None && otherView.Group == view.Group && otherView.ViewLevel == view.ViewLevel && otherView.IsExclusive && view.IsExclusive && otherView.IsShow) { view.MutexPreviews.Add(otherView); otherView.Show(false, false); } } } if (view.Group == ViewGroup.Main) { OpenedMainViews.Add(view); } }
void OnOpenSubView(UView view, bool useGroup) { //子界面UI互斥,相同UI组只能有一个UI被打开 if (useGroup && view.Group > 0 && view.ViewLevel == ViewLevel.Sub) { view.MutexPreviews.Clear(); foreach (var item in SubViews) { if ( !item.IsDragged && item != view && item.Group != ViewGroup.None && item.Group == view.Group && item.ViewLevel == view.ViewLevel && item.IsExclusive && view.IsExclusive && item.IsShow) { view.MutexPreviews.Add(item); item.Show(false, false); } } } }
public virtual void Attach(ViewLevel viewLevel, UView beAttchedView) { UIMgr = beAttchedView?.UIMgr; ParentView?.SubViews.Remove(this); if (viewLevel == ViewLevel.Root) { ParentView = beAttchedView; RootView = beAttchedView; ViewLevel = ViewLevel.Main; RectTrans.SetParent(RootView?.CanvasTrans); UIMgr.AddToMainViews(this); UIMgr.AddToGroupViews(this); } else if (viewLevel == ViewLevel.Main) { ParentView = beAttchedView; RootView = beAttchedView.RootView; ViewLevel = ViewLevel.Sub; RectTrans.SetParent(RootView?.CanvasTrans); UIMgr.AddToGroupViews(this); //移动到父节点下面 Trans.SetSiblingIndex(ParentView.Trans.GetSiblingIndex() + ParentView.SubViews.Count + 1); } else { CLog.Error("无法挂载到:" + viewLevel); } ParentView.SubViews.Add(this); }
protected override void OnOpen(UView baseView, bool useGroup) { base.OnOpen(baseView, useGroup); openDelayJob?.Kill(); openDelayJob = Util.Invoke(() => OnOpenDelay(baseView, useGroup), 0.01f); //if (LayoutGroup != null) // Util.Invoke(() => LayoutGroup.RebuildLayout(), 0.01f); }
public sealed override void Attach(ViewLevel viewLevel, UView beAttchedView) { base.Attach(viewLevel, beAttchedView); if (ParentView != null) { Trans.SetParent(ParentView.Trans); } Trans.localPosition = sourceLocalPos; }
public void AddToGroupViews(UView tempUI) { if (GroupViews.ContainsKey(tempUI.Group)) { GroupViews[tempUI.Group].Add(tempUI); } else { GroupViews.Add(tempUI.Group, new List <UView> { tempUI }); } }
void OnCloseSubView(UView view, bool useGroup) { if (useGroup && view.Group > 0) { if (view.IsReturn) { foreach (var item in view.MutexPreviews) { item.Show(true, false); } } } }
void OnCloseView(UView view, bool useGroup) { if (useGroup && view.Group > 0) { if (view.IsReturn) { foreach (var item in view.MutexPreviews) { item.Show(true, false); } } } if (view.Group == ViewGroup.Main) { OpenedMainViews.Remove(view); } }
protected virtual void OnOpen(UView baseView, bool useGroup) { if (GO == null) { return; } if (IsActiveByShow) { GO.SetActive(true); } if (IsRecord) { BaseUIMgr.AddRecordView(this); } IsDragged = false; Callback_OnOpen?.Invoke(baseView, useGroup); }
public void AddToMainViews(UView tempUI) { MainViews.Add(tempUI); AllMainViews.Add(tempUI); }
protected virtual void OnOpenDelay(UView baseView, bool useGroup) { }
// 打开界面,关联一个父界面,当父界面关闭的时候自身也会关闭 public void Show(UView parentView) { Attach(ViewLevel.Main, parentView); Show(true, false, true); }
protected override void OnOpenDelay(UView baseView, bool useGroup) { base.OnOpenDelay(baseView, useGroup); LayoutGroup?.RebuildLayout(); }
// 将界面挂到其他界面下 public sealed override void Attach(ViewLevel viewLevel, UView beAttchedView) { base.Attach(viewLevel, beAttchedView); ResetSourcePosData(); }
public static void AddRecordView(UView view) => LastOpenViews.Add(view);
public static void RemoveRecordView(UView view) => LastOpenViews.Remove(view);
public void SetNeedDirtyView(UView view) { LastNeedDirtyView = view; }