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

            Show(temp);
        }
Esempio n. 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);
        }
Esempio n. 15
0
        public override bool AddStaticChild(UControl child)
        {
            bool ret = base.AddStaticChild(child);

            if (ret)
            {
                child.PPanel = this;
            }
            return(ret);
        }
Esempio n. 16
0
 public void SelectItem(UControl arg1)
 {
     SelectIndex(arg1.Index);
     Data?.OnSelectItem?.Invoke(arg1.Index);
     if (arg1 is UCheckBox)
     {
         Refresh();
         //SetDirtyRefresh();
     }
 }
Esempio n. 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);
 }
Esempio n. 18
0
 public virtual bool AddDynamicChild(UControl child)
 {
     if (child == this)
     {
         return(false);
     }
     child.Parent = this;
     StaticChilds.Remove(child);
     DynamicChilds.Add(child);
     return(true);
 }
Esempio n. 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);
        }
Esempio n. 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);
     }
 }
Esempio n. 21
0
 protected void AddControl(UControl item)
 {
     item.PUIView = this;
     Controls.Add(item);
     if (item.NeedFixedUpdate)
     {
         ActiveControlFixedUpdate(item);
     }
     if (item.NeedUpdate)
     {
         ActiveControlUpdate(item);
     }
 }
Esempio n. 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);
 }
Esempio n. 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);
 }
Esempio n. 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();
            }
        }
Esempio n. 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;
     }
 }
Esempio n. 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);
 }
Esempio n. 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;
     }
 }
Esempio n. 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);
                }
            }
        }
Esempio n. 29
0
 public void ShowRect(UControl control, bool ignoreOnce = true)
 {
     ShowRect(control, 1, ignoreOnce);
 }
Esempio n. 30
0
 public void ShowCircle(UControl control, bool ignoreOnce = true)
 {
     ShowCircle(control, 1, ignoreOnce);
 }