Ejemplo n.º 1
0
        /// <summary>
        /// 初始化UI组件,包含有:Transform,HImage,TextBox,HText,HLine,UIElement
        /// </summary>
        /// <param name="buff">回收站的父物体</param>
        public static void Initial()
        {
            GameBuffer = new UIelementBuffer();
            var imgHelper   = GameBuffer.RegFakeStructHelper <HImageData>();
            var txtHelper   = GameBuffer.RegFakeStructHelper <HTextData>();
            var graphHelper = GameBuffer.RegFakeStructHelper <HGraphicsData>();
            var eleHelper   = GameBuffer.RegFakeStructHelper <UIElementData>();

            GameBuffer.RegFakeStructHelper <TextInputData>();

            var imgLoader = new HImageLoader()
            {
                ImageHelper = imgHelper, GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var txtLoader = new HTextLoader()
            {
                TextHelper = txtHelper, GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var grapLoader = new HGraphicsLoader()
            {
                GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var eleLoader = new UIElementLoader()
            {
                ElementHelper = eleHelper
            };

            GameBuffer.RegDataLoader <UIElement>(eleLoader);
            GameBuffer.RegDataLoader <HImage>(imgLoader);
            GameBuffer.RegDataLoader <HText>(txtLoader);
            GameBuffer.RegDataLoader <TextBox>(txtLoader);
            GameBuffer.RegDataLoader <HLine>(grapLoader);
            GameBuffer.RegDataLoader <HGraphics>(grapLoader);
            GameBuffer.RegDataLoader <HCanvas>(eleLoader);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化UI组件,包含有:Transform,HImage,TextBox,HText,HLine,UIElement
        /// </summary>
        /// <param name="buff">回收站的父物体</param>
        public static void Initial(Transform buff)
        {
            GameBuffer = new GameobjectBuffer(buff);
            var transHleper = GameBuffer.RegFakeStructHelper <UITransfromData>();
            var imgHelper   = GameBuffer.RegFakeStructHelper <HImageData>();
            var txtHelper   = GameBuffer.RegFakeStructHelper <HTextData>();
            var graphHelper = GameBuffer.RegFakeStructHelper <HGraphicsData>();
            var eleHelper   = GameBuffer.RegFakeStructHelper <UIElementData>();

            GameBuffer.RegFakeStructHelper <TextInputData>();

            var transLoader = new UITransfromLoader();
            var imgLoader   = new HImageLoader()
            {
                ImageHelper = imgHelper, GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var txtLoader = new HTextLoader()
            {
                TextHelper = txtHelper, GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var grapLoader = new HGraphicsLoader()
            {
                GraphicsHelper = graphHelper, ElementHelper = eleHelper
            };
            var eleLoader = new UIElementLoader()
            {
                ElementHelper = eleHelper
            };

            GameBuffer.RegComponent(new ComponentInfo <Transform>()
            {
                loader = transLoader
            });
            GameBuffer.RegComponent(new ComponentInfo <HImage>()
            {
                loader = imgLoader
            });
            GameBuffer.RegComponent(new ComponentInfo <TextBox>()
            {
                loader = txtLoader
            });
            GameBuffer.RegComponent(new ComponentInfo <HText>()
            {
                loader = txtLoader
            });
            GameBuffer.RegComponent(new ComponentInfo <HLine>()
            {
                loader = grapLoader
            });
            GameBuffer.RegComponent(new ComponentInfo <UIElement>()
            {
                loader = eleLoader
            });
        }