Пример #1
0
            public GlobalObjectiver()
            {
                Enum <TEnum> .ForIndex(x =>
                {
                    int enumIndex = x;
                    Targets.Add(enumIndex, new HashSet <TTarget>());
                });

                BaseGlobal.AddToClearWhenUnload(this);
            }
Пример #2
0
        protected override void Awake()
        {
            SelfBaseGlobal = BaseGlobal.Ins;
            base.Awake();

            RectTrans                = transform as RectTransform;
            SourceAnchorMax          = RectTrans.anchorMax;
            SourceAnchorMin          = RectTrans.anchorMin;
            SourceLocalScale         = RectTrans.localScale;
            SourceSizeData           = RectTrans.sizeDelta;
            SourceAnchoredPosition   = RectTrans.anchoredPosition;
            SourceAnchoredPosition3D = RectTrans.anchoredPosition3D;

            Trans = transform;
            GO    = gameObject;
            if (RectTrans.localScale == Vector3.zero)
            {
                CLog.Error("错误:scale 是 0 error presenter:" + name);
            }
            GO.layer = (int)BaseConstMgr.Layer_UI;
            //作为顶级Pressenter可以获取自身层级下面的子对象,子对象随着父对象自动刷新
            var childPresenters = GO.GetComponentsInChildren <BasePresenter>();

            if (childPresenters != null)
            {
                foreach (var item in childPresenters)
                {
                    AddChild(item);
                }
            }
            Transitions     = GO.GetComponentsInChildren <UITransition>(true);
            ShowTransitions = GO.GetComponentsInChildren <UIShowTransition>(true);
            Texts           = GO.GetComponentsInChildren <Text>(true);
            if (Texts != null && UIConfig.EnableSharpText && SelfBaseGlobal != null)
            {
                foreach (var item in Texts)
                {
                    if (item != null)
                    {
                        item.material = SelfBaseGlobal.GRMgr.FontRendering;
                    }
                }
            }
            ShowDefault();
        }