コード例 #1
0
    // If special function is set this tab will work as just button
    public DebugLayout Tab(string name, Action specialFunction = null)
    {
        var tab = factory.Tab();

        tab.name = "Tab" + name;
        tab.transform.SetParent(tabBar);
        tab.Show(name, selectedDebugMenuTab.Map(v => v == name), connectionSink);
        tab.button.ClickStream().Subscribe(() =>
        {
            if (specialFunction != null)
            {
                specialFunction();
            }
            else
            {
                selectedDebugMenuTab.value = name;
            }
        });
        tab.transform.localScale = Vector3.one;

        var element = DebugLayout.NewLayout(factory, LayoutType.Horizontal);

        element.name           = $"Tab{name}Content";
        element.rect.anchorMin = Vector2.zero;
        element.rect.anchorMax = Vector2.one;
        element.rect.offsetMin = Vector2.zero;
        element.rect.offsetMax = Vector2.zero;
        element.transform.SetParent(content, false);
        element.transform.localScale = Vector3.one;
        tabContents[name]            = element.GetComponent <RectTransform>();
        return(element);
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: akinomyoga/ImageArrange
        static void Main()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            log = afh.Application.LogView.Instance.CreateLog("<afh.ImageArrange>");

            //afh.File.Riff.RiffFile riff=afh.File.Riff.RiffFile.FromFile(@"C:\Documents and Settings\koichi\デスクトップ\ANI\IE5.ani");

            /*
             * ThumbsFile file=ThumbsFile.OpenFile(@"C:\IMAGE\Images\test.thm");
             * file.AddFileDirectory(@"C:\IMAGE\Images\sm1278957");
             * file.Save();
             * //*/

            //ThumbsFile file=ThumbsFile.OpenFile(@"C:\IMAGE\Images\test.thm");
            // Main
#if true
            {
                Form1 form1 = new Form1();
                form1.ReadFile(@"F:\IMAGE\東方画像\imgarn.thm");
                //form1.ReadFile(@"C:\IMAGE\東方画像\imgarn.thm");
                //form1.ReadFile(@"C:\IMAGE\Images\test.thm");
                System.Windows.Forms.Application.Run(form1);
            }
#else
            //*/

            // Debug
            {
                DebugLayout form1 = new DebugLayout();
                System.Windows.Forms.Application.Run(form1);
            }
#endif
        }
コード例 #3
0
        private void WriteHtml(IHtmlWriter html, DebugLayout layout, int depth)
        {
            if (layout.Element != null)
            {
                html.WriteElementLine("p", "Layout element '" + layout.Element.Name + "'");
                if (depth != 1)
                {
                    StartIndent(html, false);
                    WriteDebugInfo(html, layout.Element.GetDebugInfo(), 2);
                    EndIndent(html);
                }
            }

            if (layout.Children != null && layout.Children.Count > 0)
            {
                html.WriteElementLine("p", "Layout has regions " + string.Join(", ", layout.Children.Select(r => "'" + r.Name + "'")));
                foreach (var layoutRegion in layout.Children.Cast <DebugLayoutRegion>())
                {
                    if (layoutRegion.Region == null)
                    {
                        html.WriteElementLine("p", "zone '" + layoutRegion.Name + "' has default region for the layout");
                        if (layout.Element != null)
                        {
                            var layoutInstance   = layout.Element.GetDebugInfo <DebugLayout>();
                            var inheritedRegions = layoutInstance == null ? null : layoutInstance.Children;
                            if (inheritedRegions != null)
                            {
                                var inheritedRegion = inheritedRegions.FirstOrDefault(r => r.Name == layoutRegion.Name) as DebugLayoutRegion;
                                if (inheritedRegion != null && depth != 1)
                                {
                                    StartIndent(html, true);
                                    WriteDebugInfo(html, inheritedRegion.Region, depth - 1);
                                    EndIndent(html);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (depth == 1)
                        {
                            html.WriteElementLine("p", "zone '" + layoutRegion.Name + "' contains '" + layoutRegion.Region.Name + "'");
                        }
                        else
                        {
                            html.WriteElementLine("p", "zone '" + layoutRegion.Name + "' contents");
                            StartIndent(html, true);
                            WriteDebugInfo(html, layoutRegion.Region, depth - 1);
                            EndIndent(html);
                        }
                    }
                }
            }
        }
コード例 #4
0
        protected override void Draw(GameTime gameTime)
        {
            drawMarker.Begin();

            GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.CornflowerBlue, 1, 0);

            // ゲームオブジェクトの描画
            DrawGameObjects();

            // ステータス表示
            float   margin = font.LineSpacing * 0.2f;
            Vector2 size   = font.MeasureString(statusString);

            size.Y += margin * 2.0f;

            var layout = new DebugLayout();

            layout.ContainerBounds     = GraphicsDevice.Viewport.Bounds;
            layout.Width               = (int)size.X;
            layout.Height              = (int)size.Y;
            layout.HorizontalAlignment = DebugHorizontalAlignment.Left;
            layout.VerticalAlignment   = DebugVerticalAlignment.Top;
            layout.HorizontalMargin    = 8;
            layout.VerticalMargin      = 8;
            layout.Arrange();

            spriteBatch.Begin();
            spriteBatch.Draw(fillTexture, layout.ArrangedBounds, new Color(0, 0, 0, 200));
            spriteBatch.DrawString(
                font, statusString, new Vector2(layout.ArrangedBounds.X, layout.ArrangedBounds.Y + margin), Color.White);
            spriteBatch.End();

            drawMarker.End();

            base.Draw(gameTime);
        }
コード例 #5
0
ファイル: MainGame.cs プロジェクト: willcraftia/TestBlocks
        void DrawHelp()
        {
            if (!helpVisible)
            {
                return;
            }

            spriteBatch.Begin();

            var layout = new DebugLayout();

            int informationWidth = 380;

            // calculate the background area for information.
            layout.ContainerBounds     = GraphicsDevice.Viewport.TitleSafeArea;
            layout.Width               = informationWidth + 4;
            layout.Height              = (int)informationTextFontSize.Y + 2;
            layout.HorizontalMargin    = 8;
            layout.VerticalMargin      = 8;
            layout.HorizontalAlignment = DebugHorizontalAlignment.Left;
            layout.VerticalAlignment   = DebugVerticalAlignment.Top;
            layout.Arrange();
            // draw the rectangle.
            spriteBatch.Draw(fillTexture, layout.ArrangedBounds, Color.Black * 0.5f);

            // calculate the text area for information.
            layout.ContainerBounds     = layout.ArrangedBounds;
            layout.Width               = informationWidth;
            layout.Height              = (int)informationTextFontSize.Y;
            layout.HorizontalMargin    = 2;
            layout.VerticalMargin      = 0;
            layout.HorizontalAlignment = DebugHorizontalAlignment.Center;
            layout.VerticalAlignment   = DebugVerticalAlignment.Center;
            layout.Arrange();
            // draw the text.
            BuildInfoMessage();
            spriteBatch.DrawString(font, stringBuilder, new Vector2(layout.ArrangedBounds.X, layout.ArrangedBounds.Y), Color.Yellow);

            // calculate the background area for help messages.
            layout.ContainerBounds     = GraphicsDevice.Viewport.TitleSafeArea;
            layout.Width               = (int)helpMessageFontSize.X + 4;
            layout.Height              = (int)helpMessageFontSize.Y + 2;
            layout.HorizontalMargin    = 8;
            layout.VerticalMargin      = 8;
            layout.HorizontalAlignment = DebugHorizontalAlignment.Left;
            layout.VerticalAlignment   = DebugVerticalAlignment.Bottom;
            layout.Arrange();
            // draw the rectangle.
            spriteBatch.Draw(fillTexture, layout.ArrangedBounds, Color.Black * 0.5f);

            // calculate the text area for help messages.
            layout.ContainerBounds     = layout.ArrangedBounds;
            layout.Width               = (int)helpMessageFontSize.X;
            layout.Height              = (int)helpMessageFontSize.Y;
            layout.HorizontalMargin    = 2;
            layout.VerticalMargin      = 0;
            layout.HorizontalAlignment = DebugHorizontalAlignment.Center;
            layout.VerticalAlignment   = DebugVerticalAlignment.Center;
            layout.Arrange();
            // draw the text.
            spriteBatch.DrawString(font, helpMessage, new Vector2(layout.ArrangedBounds.X, layout.ArrangedBounds.Y), Color.Yellow);

            spriteBatch.End();
        }
コード例 #6
0
        public LayoutDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugLayout debugLayout,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "Layout '" + debugLayout.Name + "'",
                headingLevel)
        {
            LeftMargin   = 15f;
            RightMargin  = 15f;
            TopMargin    = 15f;
            BottomMargin = 15f;

            ChildSpacing = 15f;

            CssClass = "layout";

            var details = new List <string>();

            AddDebugInfo(details, debugLayout);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (showButtons && !ReferenceEquals(debugLayout.Element, null))
            {
                var elementDebugInfo = debugLayout.Element.GetDebugInfo <DebugLayout>();
                if (elementDebugInfo != null)
                {
                    AddHeaderButton(page, "Definition")
                    .AddChild(new LayoutDrawing(
                                  drawing,
                                  page,
                                  elementDebugInfo,
                                  headingLevel + 1,
                                  false));
                }
            }

            if (debugLayout.Children != null)
            {
                foreach (var debugRegion in debugLayout.Children)
                {
                    AddChild(new LayoutRegionDrawing(
                                 drawing,
                                 page,
                                 debugRegion as DebugLayoutRegion,
                                 headingLevel,
                                 showButtons));
                }
            }
        }