Beispiel #1
0
 public void InitUIByData(UIDataParent UIDataParent)
 {
     tipContent = (TipData)UIDataParent;
     for (int i = 1; i < transform.childCount; i++)
     {
         transform.GetChild(i).gameObject.SetActive(i == (int)tipContent.tipBtnType + 1);
     }
     transform.GetChild((int)tipContent.tipBtnType + 1).GetChild(0).GetComponent <Text>().text = tipContent.tipStr;
 }
Beispiel #2
0
        public void RefreshPanel <T>(UIDataParent UIDataParent) where T : UIPanelParent
        {
            string scriptName = typeof(T).ToString();

            if (ScriptsNameToPanel.ContainsKey(scriptName))
            {
                ScriptsNameToPanel[scriptName].RefreshUIByData(UIDataParent);
            }
            else
            {
                AFLogger.e("当前并不存在 : " + scriptName + "面板");
            }
        }
Beispiel #3
0
        protected override void InitUI(UIDataParent UIDataParent = null)
        {
            base.InitUI(UIDataParent);
            AFLogger.d("UIChild InitUI");
            if (UIDataParent == null)
            {
                return;
            }

            UIChildData uIChildData = UIDataParent as UIChildData;

            AFLogger.log(transform);
            indexText.text = "子物体:" + uIChildData.index.ToString();
        }
 public void Open(int UITag, string UIPath, UIDataParent UIDataParent = null, ResFromType resFromType = ResFromType.ABRes,
                  UIPanelParent ParentPanel = null)
 {
     this.UITag       = UITag;
     this.resFromType = resFromType;
     this.ParentPanel = ParentPanel;
     this.UIPath      = UIPath;
     if (!isInit)
     {
         TransformBind();
         InitUI(UIDataParent);
         RegisterUIEvent();
         isInit = true;
     }
     InitUIAll(UIDataParent);
 }
        protected override void InitUI(UIDataParent UIDataParent = null)
        {
            base.InitUI(UIDataParent);
            AFLogger.d("UIABLoadTestPre InitUI");

            UIChildData uIChildData = new UIChildData();

            //初始化子物体
            for (int i = 0; i < 3; i++)
            {
                //TODO : transformPath完成替换
                uIChildData.index = i;
                CreateSubPanel <UIChild>((int)testChildUIEnum.UIChild,
                                         transform.GetChild(1).GetChild(0).GetChild(0), UIDataParent: uIChildData, this);
            }
        }
        protected virtual T CreateSubPanel <T>(int uitag, Transform parentTrans, UIDataParent UIDataParent = null,
                                               bool isClear = false)
            where T : UIPanelParent
        {
            AFUIAttribute uiAttri = UIManager.Instance.GetClassData(uitag).Attribute as AFUIAttribute;
            GameObject    panel   = GetResLoader().InstantiateObjectSync(resFromType, uiAttri.UIPath, parentTrans, isClear);
            T             scripts = panel.GetComponent <T>();

            if (scripts == null)
            {
                scripts = panel.AddComponent <T>();
            }
            scripts.Open(uitag, uiAttri.UIPath, UIDataParent, resFromType, this);
            AddChildPanel(uitag, scripts);
            scriptToUITag[typeof(T).ToString()] = uitag;
            return(scripts);
        }
Beispiel #7
0
 protected override void InitUI(UIDataParent UIDataParent = null)
 {
     if (UIDataParent != null)
     {
         tipContent = (TipData)UIDataParent;
     }
     OneEnsureBtn.onClick.AddListener(() =>
     {
         CloseSelf();
     });
     TwoEnsureBtn.onClick.AddListener(() =>
     {
         CloseSelf();
     });
     TwoCancelBtn.onClick.AddListener(() =>
     {
         CloseSelf();
     });
 }
Beispiel #8
0
 public void InitUIByData(UIDataParent UIDataParent)
 {
     tipContent = (TipData)UIDataParent;
     for (int i = 1; i < transform.childCount; i++)
     {
         transform.GetChild(i).gameObject.SetActive(i == (int)tipContent.tipBtnType + 1);
     }
     transform.GetChild((int)tipContent.tipBtnType + 1).GetChild(0).GetComponent <Text>().text = tipContent.tipStr;
     if (tipContent.EnsureEvent != null)
     {
         OneEnsureBtn.onClick.AddListener(tipContent.EnsureEvent);
         TwoEnsureBtn.onClick.AddListener(tipContent.EnsureEvent);
     }
     if (tipContent.CancelEvent != null)
     {
         TwoCancelBtn.onClick.AddListener(tipContent.CancelEvent);
     }
     gameObject.SetActive(true);
 }
        protected T CreateTipPanel <T>(int uitag, Transform parentTrans, UIDataParent UIDataParent = null,
                                       bool isClear = false)
            where T : UIPanelParent
        {
            AFUIAttribute uiAttri = UIManager.Instance.GetClassData(uitag).Attribute as AFUIAttribute;

            if (resLoader == null)
            {
                resLoader = ResLoader.Allocate();
            }

            GameObject panel   = resLoader.InstantiateObjectSync(UIManager.Instance.GetResFrom(uiAttri.UIPath), uiAttri.UIPath, parentTrans, isClear);
            T          scripts = panel.GetComponent <T>();

            if (scripts == null)
            {
                scripts = panel.AddComponent <T>();
            }
            scripts.Open(uitag, uiAttri.UIPath, UIDataParent, UIManager.Instance.GetResFrom(uiAttri.UIPath), null);
            return(scripts);
        }
Beispiel #10
0
        //此方法可用来创建panel,也可以刷新panel(不能重复创建panel),重复创建一般是子面板,在父面板中调用创建子面板方法即可
        public T OpenUI <T>(int UITag, Transform parent, UIDataParent UIDataParent = null,
                            bool isClear = false) where T : UIPanelParent
        {
            AFUIAttribute uiAttri     = GetClassData(UITag).Attribute as AFUIAttribute;
            string        scriptsName = typeof(T).ToString();

            if (ScriptsNameToPanel.ContainsKey(scriptsName) && ScriptsNameToPanel[scriptsName].JudgePath(uiAttri.UIPath))
            {
                ScriptsNameToPanel[scriptsName].transform.SetParent(parent);
                ScriptsNameToPanel[scriptsName].RefreshUIByData(UIDataParent);
                if (!UITagToScriptsName.ContainsKey(UITag))
                {
                    UITagToScriptsName[UITag] = scriptsName;
                }
                ScriptsNameToPanel[scriptsName].Show();
                //显示
                return(ScriptsNameToPanel[scriptsName] as T);
            }
            ResFromType resFromType = GetResFrom(uiAttri.UIPath);
            GameObject  panel       = resLoader.InstantiateObjectSync(resFromType, uiAttri.UIPath, parent, isClear);
            T           scripts     = panel.GetComponent <T>();

            if (scripts == null)
            {
                scripts = panel.AddComponent <T>();
            }
            scripts.Open(UITag, uiAttri.UIPath, UIDataParent, resFromType);
            if (ScriptsNameToPanel.ContainsKey(scriptsName))
            {
                ScriptsNameToPanel[scriptsName] = scripts as UIPanelParent;
            }
            else
            {
                ScriptsNameToPanel.Add(scriptsName, scripts as UIPanelParent);
            }
            UITagToScriptsName[UITag] = scriptsName;
            return(scripts);
        }
Beispiel #11
0
 public virtual void RefreshUIByData(UIDataParent UIDataParent = null)
 {
 }
Beispiel #12
0
 protected virtual void InitUIAll(UIDataParent UIDataParent = null)
 {
 }
Beispiel #13
0
 public override void RefreshUIByData(UIDataParent UIDataParent = null)
 {
 }
Beispiel #14
0
 protected override void InitUIAll(UIDataParent UIDataParent = null)
 {
 }
 public override void RefreshUIByData(UIDataParent UIDataParent = null)
 {
     base.RefreshUIByData(UIDataParent);
     AFLogger.d("UIABLoadTestPre RefreshUIByData");
 }
 protected override void InitUIAll(UIDataParent UIDataParent = null)
 {
     base.InitUIAll(UIDataParent);
     AFLogger.d("UIABLoadTestPre InitUIAll");
 }
Beispiel #17
0
 public T OpenUI <T>(int UILabel, UIDataParent UIDataParent = null, PanelLayer panelLayer = PanelLayer.Common,
                     bool isClear = false) where T : UIPanelParent
 {
     return(OpenUI <T>(UILabel, GetPanleLayer(panelLayer), UIDataParent, isClear));
 }
Beispiel #18
0
 public override void RefreshUIByData(UIDataParent UIDataParent = null)
 {
     base.RefreshUIByData(UIDataParent);
     AFLogger.d("UIChild RefreshUIByData");
 }
Beispiel #19
0
 protected override void InitUIAll(UIDataParent UIDataParent = null)
 {
     base.InitUIAll(UIDataParent);
     AFLogger.d("UIChild InitUIAll");
 }