public void ShowPointer(UControl control, float rot = 90, bool maskOnce = true) { if (control == null) { return; } if (control.RectTrans == null) { return; } Show(true); UIPointer?.Show(true); UIRect?.gameObject.SetActive(false); UICircle?.gameObject.SetActive(false); if (UIPointer) { UIPointer.SetPosAndRot(RectTrans.InverseTransformPoint(control.RectTrans.position), new Vector3(0, 0, rot)); IsMaskOnce = maskOnce; PointedControl = control; if (maskOnce) { control.UIMgr.AddIgnoreBlockClickOnce(control); } } }
void OnClickBnt3(UControl control, PointerEventData data) { Callback_Bnt3?.Invoke(); Show(false); LastNeedDirtyView?.SetDirtyAll(); LastNeedDirtyView = null; }
public void SelectItem(UControl arg1) { if (arg1 == null) { return; } PreSelectIndex = CurSelectIndex; CurSelectIndex = arg1.Index; Data.OnClickSelected?.Invoke(CurSelectIndex); //刷新关联界面 if (LinkControl != null) { if (LinkControl is UScroll) { LinkControl.SetDirtyData(); } else { LinkControl.SetDirtyRefresh(); } } //刷星自生界面 if (IsLinkSelfView) { PUIView?.SetDirtyAll(); } //刷新自生 if (arg1 is UCheckBox) { Refresh(); } }
public void ShowRawRect(UControl control, float x, float y, bool ignoreOnce = true) { if (control == null) { return; } if (control.RectTrans == null) { return; } if (!control.IsActiveSelf) { return; } if (!control.PUIView.IsShow) { CLog.Error("错误!,控件的父节点UIView没有显示"); return; } Show(true); UIPointer?.Show(false); UICircle?.gameObject.SetActive(false); UIRect?.gameObject.SetActive(true); UIRect?.SetCenter(RectTrans.InverseTransformPoint(control.RectTrans.position)); UIRect?.SetRect(x, y); IsMaskOnce = ignoreOnce; MaskedControl = control; if (ignoreOnce) { control.UIMgr.AddIgnoreBlockClickOnce(control); } }
public void AddIgnoreBlockClick(UControl control) { if (IgnoreBlockClick.Contains(control)) { return; } IgnoreBlockClick.Add(control); }
private void OnAlertShow(UControl p, bool arg1) { if (arg1 == false) { p.GO.transform.position = StartPos.position; GOPool.Despawn(p.GO); } }
public override void Init(UControl self) { base.Init(self); if (RectTrans != null) { RectTrans.localScale = Normal; } }
public override void Init(UControl self) { base.Init(self); if (RectTrans != null) { RectTrans.anchoredPosition = Normal; } }
private void OnClickOK(UControl arg1, PointerEventData arg2) { if (InputField.IsHaveText()) { CurData.SetCustomName(InputField.InputText); OnRenamed(CurData); Close(); } }
public void ActiveControlUpdate(UControl control) { if (!control.IsCanBeViewFetch) { CLog.Error("错误:{0},无法作为View的控件", control.GOName); return; } UpdateControls.Add(control); }
public override void Init(UControl self) { base.Init(self); CanvasGroup = Target.GetComponent <CanvasGroup>(); if (CanvasGroup == null) { CanvasGroup = Target.AddComponent <CanvasGroup>(); } }
public override void Init(UControl self) { base.Init(self); animator = Target.GetComponent <Animator>(); if (animator == null) { CLog.Error("必须需要Animator组件:{0}", self.GOName); } }
// 通过showable设置当前的panel public void Show(UControl obj) { if (Controls.Count == 0) { return; } var temp = Controls.FindIndex((x) => { return(x == obj); }); Show(temp); }
public void ShowRect(UControl control, float scale = 1, bool ignoreOnce = true) { if (control == null) { return; } RectTransform rectTrans = control.RectTrans; ShowRawRect(control, rectTrans.sizeDelta.x / 2 * scale, rectTrans.sizeDelta.y / 2 * scale, ignoreOnce); }
public override bool AddStaticChild(UControl child) { bool ret = base.AddStaticChild(child); if (ret) { child.PPanel = this; } return(ret); }
public void SelectItem(UControl arg1) { SelectIndex(arg1.Index); Data?.OnSelectItem?.Invoke(arg1.Index); if (arg1 is UCheckBox) { Refresh(); //SetDirtyRefresh(); } }
public void Add(UControl control) { if (control.PMutexer != null) { CLog.Error("item:{0} 已经被挂在某个Mutexer下面", control.GOName); return; } control.PMutexer = this; Controls.Add(control); control.SetActive(true); }
public virtual bool AddDynamicChild(UControl child) { if (child == this) { return(false); } child.Parent = this; StaticChilds.Remove(child); DynamicChilds.Add(child); return(true); }
public void ShowCircle(UControl control, float scale = 1, bool ignoreOnce = true) { if (control == null) { return; } RectTransform rectTrans = control.RectTrans; float maxVal = Mathf.Max(rectTrans.sizeDelta.x, rectTrans.sizeDelta.y); ShowRawCircle(control, maxVal / 2 * scale, ignoreOnce); }
public override void Init(UControl self) { base.Init(self); if (Image != null) { Image.overrideSprite = Normal; } if (Image == null) { CLog.Error("必须需要Image组件:{0}", self.GOName); } }
protected void AddControl(UControl item) { item.PUIView = this; Controls.Add(item); if (item.NeedFixedUpdate) { ActiveControlFixedUpdate(item); } if (item.NeedUpdate) { ActiveControlUpdate(item); } }
// 添加自对象 public virtual bool AddStaticChild(UControl child) { if (child == this) { return(false); } if (!child.IsIndependent) { CLog.Error("错误! 无法添非独立组件 "); return(false); } child.Parent = this; StaticChilds.Add(child); return(true); }
public virtual bool AddCellChild(UControl child) { if (child == this) { return(false); } if (!child.IsIndependent) { CLog.Error($"错误! 无法添非独立组件,Name:{GOName}"); return(false); } child.Parent = this; CellChilds.Add(child); return(true); }
public void Toggle(UControl obj) { if (Controls.Count == 0) { return; } var temp = Controls.Find((x) => { return(x == obj); }); var tempIndex = Controls.FindIndex((x) => { return(x == obj); }); if (!temp.IsShow) { Show(tempIndex); } else { ShowDefault(); } }
public virtual void Init(UControl self) { SelfControl = self; if (SelfControl == null) { CLog.Error("Presenter 没有"); } if (Target == null) { Target = SelfControl.GO; } if (Target != null) { Graphic = Target.GetComponent <Graphic>(); Effect = Target.GetComponent <BaseMeshEffect>(); } if (Graphic != null) { if (Graphic is Text) { Text = (Text)Graphic; } if (Graphic is Image) { Image = (Image)Graphic; } RectTrans = Graphic.rectTransform; } if (Effect != null) { if (Effect is Shadow) { Shadow = (Shadow)Effect; } if (Effect is Outline) { Outline = (Outline)Effect; } } if (RectTrans == null) { RectTrans = Target.transform as RectTransform; } }
public T GetCustomData <T>(UControl item) where T : class { if (CustomDatas == null) { return(null); } if (item.Index >= CustomDatas.Count) { return(null); } if (item.Index < 0) { return(null); } if (item.Index >= CustomDatas.Count) { return(null); } return(CustomDatas[item.Index] as T); }
public override void Init(UControl self) { base.Init(self); if (!StateColorPreset.IsInv() && StateColorPreset != Const.STR_Custom) { StateColor = UIConfig.Ins.GetStateColor(StateColorPreset); } if (Text != null) { Text.color = StateColor.Normal; } else if (Image != null) { Image.color = StateColor.Normal; } else if (Graphic != null) { Graphic.color = Color.white; } }
public virtual void RefreshCell(UControl control, bool onlyRefreshSelect = false) { if (control is UScrollGroup scrollGroup) { foreach (var item in scrollGroup.Cells) { RefreshSingle(item); } } else { RefreshSingle(control); } void RefreshSingle(UControl single) { single.SetActive(single.DataIndex < CacheCustomData.Count); if (single.GO.activeSelf) { //刷新基类 if (GetIsToggleGroup()) { if (single is UCheckBox checkBox && checkBox.IsToggleGroup) { checkBox.RefreshStateAndActiveEffectBySelect(); } } if (onlyRefreshSelect) { return; } //通过用户自定义方发刷新 var customData = CacheCustomData[single.DataIndex]; single.SetCustomData(customData); Data.OnRefresh?.Invoke(single, customData); } } }
public void ShowRect(UControl control, bool ignoreOnce = true) { ShowRect(control, 1, ignoreOnce); }
public void ShowCircle(UControl control, bool ignoreOnce = true) { ShowCircle(control, 1, ignoreOnce); }