Пример #1
0
 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);
         }
     }
 }
Пример #2
0
 void OnClickBnt3(UControl control, PointerEventData data)
 {
     Callback_Bnt3?.Invoke();
     Show(false);
     LastNeedDirtyView?.SetDirtyAll();
     LastNeedDirtyView = null;
 }
Пример #3
0
        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();
            }
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
 public void AddIgnoreBlockClick(UControl control)
 {
     if (IgnoreBlockClick.Contains(control))
     {
         return;
     }
     IgnoreBlockClick.Add(control);
 }
Пример #6
0
 private void OnAlertShow(UControl p, bool arg1)
 {
     if (arg1 == false)
     {
         p.GO.transform.position = StartPos.position;
         GOPool.Despawn(p.GO);
     }
 }
Пример #7
0
 public override void Init(UControl self)
 {
     base.Init(self);
     if (RectTrans != null)
     {
         RectTrans.localScale = Normal;
     }
 }
Пример #8
0
 public override void Init(UControl self)
 {
     base.Init(self);
     if (RectTrans != null)
     {
         RectTrans.anchoredPosition = Normal;
     }
 }
Пример #9
0
 private void OnClickOK(UControl arg1, PointerEventData arg2)
 {
     if (InputField.IsHaveText())
     {
         CurData.SetCustomName(InputField.InputText);
         OnRenamed(CurData);
         Close();
     }
 }
Пример #10
0
 public void ActiveControlUpdate(UControl control)
 {
     if (!control.IsCanBeViewFetch)
     {
         CLog.Error("错误:{0},无法作为View的控件", control.GOName);
         return;
     }
     UpdateControls.Add(control);
 }
Пример #11
0
 public override void Init(UControl self)
 {
     base.Init(self);
     CanvasGroup = Target.GetComponent <CanvasGroup>();
     if (CanvasGroup == null)
     {
         CanvasGroup = Target.AddComponent <CanvasGroup>();
     }
 }
Пример #12
0
 public override void Init(UControl self)
 {
     base.Init(self);
     animator = Target.GetComponent <Animator>();
     if (animator == null)
     {
         CLog.Error("必须需要Animator组件:{0}", self.GOName);
     }
 }
Пример #13
0
        // 通过showable设置当前的panel
        public void Show(UControl obj)
        {
            if (Controls.Count == 0)
            {
                return;
            }
            var temp = Controls.FindIndex((x) => { return(x == obj); });

            Show(temp);
        }
Пример #14
0
        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);
        }
Пример #15
0
        public override bool AddStaticChild(UControl child)
        {
            bool ret = base.AddStaticChild(child);

            if (ret)
            {
                child.PPanel = this;
            }
            return(ret);
        }
Пример #16
0
 public void SelectItem(UControl arg1)
 {
     SelectIndex(arg1.Index);
     Data?.OnSelectItem?.Invoke(arg1.Index);
     if (arg1 is UCheckBox)
     {
         Refresh();
         //SetDirtyRefresh();
     }
 }
Пример #17
0
 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);
 }
Пример #18
0
 public virtual bool AddDynamicChild(UControl child)
 {
     if (child == this)
     {
         return(false);
     }
     child.Parent = this;
     StaticChilds.Remove(child);
     DynamicChilds.Add(child);
     return(true);
 }
Пример #19
0
        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);
        }
Пример #20
0
 public override void Init(UControl self)
 {
     base.Init(self);
     if (Image != null)
     {
         Image.overrideSprite = Normal;
     }
     if (Image == null)
     {
         CLog.Error("必须需要Image组件:{0}", self.GOName);
     }
 }
Пример #21
0
 protected void AddControl(UControl item)
 {
     item.PUIView = this;
     Controls.Add(item);
     if (item.NeedFixedUpdate)
     {
         ActiveControlFixedUpdate(item);
     }
     if (item.NeedUpdate)
     {
         ActiveControlUpdate(item);
     }
 }
Пример #22
0
 // 添加自对象
 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);
 }
Пример #23
0
 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);
 }
Пример #24
0
        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();
            }
        }
Пример #25
0
 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;
     }
 }
Пример #26
0
 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);
 }
Пример #27
0
 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;
     }
 }
Пример #28
0
        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);
                }
            }
        }
Пример #29
0
 public void ShowRect(UControl control, bool ignoreOnce = true)
 {
     ShowRect(control, 1, ignoreOnce);
 }
Пример #30
0
 public void ShowCircle(UControl control, bool ignoreOnce = true)
 {
     ShowCircle(control, 1, ignoreOnce);
 }