Ejemplo n.º 1
0
        public void Init(GUIHost host)
        {
            var scrollFrame = new ScrollFrame(0, this);

            scrollFrame.Init(host);
            scrollFrame.RelativeWidth  = 1f;
            scrollFrame.RelativeHeight = 1f;
            AddChildElement(scrollFrame);
            var imageWidget = new ImageWidget(0, scrollFrame);

            imageWidget.Init(host, "guicontrols", 0.0f, 737f, 128f, 767f, 0.0f, 737f, 128f, 767f, 0.0f, 737f, 128f, 767f);
            imageWidget.Width      = 129;
            imageWidget.Height     = 31;
            imageWidget.Y          = 10;
            imageWidget.X          = 10;
            imageWidget.SandBoxing = false;
            scrollFrame.AddChildElement(imageWidget);
            var versionText = Version.VersionText;
            var textWidget  = new TextWidget(0, scrollFrame)
            {
                Text       = Locale.GlobalLocale.T("T_AboutText") + versionText,
                Size       = FontSize.Medium,
                Alignment  = QFontAlignment.Left,
                VAlignment = TextVerticalAlignment.Top,
                Color      = new Color4(0.5f, 0.5f, 0.5f, 1f)
            };

            textWidget.SetPosition(10, 60);
            textWidget.Height        = 300;
            textWidget.RelativeWidth = 0.8f;
            scrollFrame.AddChildElement(textWidget);
            textWidget.IgnoreMouse = false;
        }
        Texture2D GetScrollFrameTexture()
        {
            // Generate scroll frame texture on first use and cache for subsequent uses
            //int modFrame = frame % scrollFrameCount;
            int modFrame = mod(curScrollIndex, scrollFrameCount);

            if (!scrollFrames[modFrame].texture)
            {
                ScrollFrame scrollFrame = scrollFrames[modFrame];
                scrollFrame.texture = new Texture2D((int)scrollPanelSize.x, (int)scrollPanelSize.y, TextureFormat.ARGB32, false);
                scrollFrame.texture.SetPixels32(scrollFrames[modFrame].colors);
                scrollFrame.texture.Apply();
                scrollFrame.texture.filterMode = DaggerfallUI.Instance.GlobalFilterMode;
                scrollFrames[modFrame]         = scrollFrame;
            }

            return(scrollFrames[modFrame].texture);
        }
Ejemplo n.º 3
0
        private void InitGUIElement(GUIHost gui_host, Element2D parent)
        {
            scroll_frame = new ScrollFrame(1234);
            scroll_frame.Init(gui_host);
            scroll_frame.Width          = 450;
            scroll_frame.RelativeHeight = -1f;
            scroll_frame.Pane_Width     = 400;
            scroll_frame.Pane_Height    = 10;
            scroll_frame.X = -scroll_frame.Width;
            scroll_frame.Y = 64;
            ScrollFrame scrollFrame = scroll_frame;

            scrollFrame.OnControlMsgCallback = scrollFrame.OnControlMsgCallback + new OnControlMsgDelegate(OnControlMsg);
            layout = new VerticalLayout(12345);
            layout.SetSize(400, 10);
            layout.layoutMode = Layout.LayoutMode.ResizeLayoutToFitChildren;
            scroll_frame.AddChildElement(layout);
            scroll_frame.Visible = false;
            parent.ChildList    += scroll_frame;
        }