예제 #1
0
        public static NumberBox CreateSampleObject(Transform parent)
        {
            var rectTransform = UnityExtension.CreateObject <RectTransform>("NumberBox", parent);
            var component     = rectTransform.gameObject.AddComponent <NumberBox>();

            component.CachedRectTransform.sizeDelta = new Vector2(100, 100);
            component.EditorResetAlignBase(UnityExtension.CreateObject <RectTransform>("Align", component.CachedRectTransform));
            component.EditorResetElements(new List <UICache>());
            for (int n = 0; n < 3; ++n)
            {
                Image img = UIExtension.CreateUIObject <Image>(n.ToString(), component.AlignBase, Vector3.zero, new Vector2(20, 20));
                component.Elements.Add(new UICache(img.gameObject));
            }
            component.Align = ALIGN.LeftOrBottom;
            component.EditorSetting();
            return(component);
        }