Exemple #1
0
 public void GeneralSet()
 {
     this.cancelButton      = this.Children.Find <ButtonWidget>("取消");
     this.blockID           = this.Children.Find <TextBoxWidget>("方块ID", true);
     this.blockIconWidget   = this.Children.Find <BlockIconWidget>("方块");
     this.SelectBlockButton = this.Children.Find <ButtonWidget>("选择方块");
 }
Exemple #2
0
        public PavageDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/平铺界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.OKButton     = Children.Find <ButtonWidget>("确定", true);
            this.cancelButton = Children.Find <ButtonWidget>("取消", true);
            this.TextBox      = Children.Find <TextBoxWidget>("方块ID", true);
            this.slider       = Children.Find <SliderWidget>("滑条1", true);
        }
        public TransferDialog(CreatorAPI creatorAPI)
        {
            this.player           = creatorAPI.componentMiner.ComponentPlayer;
            this.subsystemTerrain = player.Project.FindSubsystem <SubsystemTerrain>(true);
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/传送设置");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.cancelButton = Children.Find <ButtonWidget>("取消", true);
            this.Transfer     = Children.Find <ButtonWidget>("传送", true);
            this.X            = Children.Find <TextBoxWidget>("X", true);
            this.Y            = Children.Find <TextBoxWidget>("Y", true);
            this.Z            = Children.Find <TextBoxWidget>("Z", true);
        }
Exemple #4
0
        public ReplaceDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/替换界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.cancelButton        = Children.Find <ButtonWidget>("取消", true);
            this.replaceButton       = Children.Find <ButtonWidget>("替换", true);
            this.retainReplaceButton = Children.Find <ButtonWidget>("保留替换");
            this.roughReplaceButton  = Children.Find <ButtonWidget>("粗糙替换");
            this.Blockid             = Children.Find <TextBoxWidget>("方块ID", true);
            this.Blockid2            = Children.Find <TextBoxWidget>("方块ID2", true);
        }
Exemple #5
0
            public DerivedDialog(ComponentPlayer player, Dialog dialog, ListPanelWidget listView)
            {
                this.player   = player;
                this.dialog   = dialog;
                this.listView = listView;
                XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/通用界面3");

                WidgetsManager.LoadWidgetContents(this, this, node);
                Children.Find <LabelWidget>("名称", true).Text = "请输入名称";
                this.cancelButton = Children.Find <ButtonWidget>("取消", true);
                this.OK           = Children.Find <ButtonWidget>("确定", true);
                this.TextBox      = Children.Find <TextBoxWidget>("方块ID", true);
                this.TextBox.Text = "";
                this.Children.Find <BlockIconWidget>("方块").IsVisible = false;
            }
            public PasswordDialog(ComponentPlayer player)
            {
                this.player = player;
                XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/通用界面3");

                WidgetsManager.LoadWidgetContents(this, this, node);
                Children.Find <LabelWidget>("名称", true).Text = "请输入密匙";
                this.cancelButton  = Children.Find <ButtonWidget>("取消", true);
                this.OK            = Children.Find <ButtonWidget>("确定", true);
                this.TextBox       = Children.Find <TextBoxWidget>("方块ID", true);
                this.TextBox.Title = "请输入密匙";
                this.TextBox.Text  = "";
                this.Children.Find <BlockIconWidget>("方块").IsVisible = false;
                this.Children.Find <ButtonWidget>("选择方块").IsVisible  = false;
            }
        public void DrawMethod_Should_Render_Size_XY_Positions_Height_Width_Custom_BackgroundColour_TextContent()
        {
            // Arrange
            var widget = new TextBoxWidget(20, 90)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text", BackgroundColour = "Blue"
            };

            // Act
            var renderedWidget = widget.Draw();

            // Assert
            Assert.NotNull(widget);
            Assert.Equal("TextBox (20, 90) Height= 6 Width=24 Size=144 BackgroundColour=Blue TextContent = Sample text", renderedWidget);
            Assert.DoesNotContain("Red", renderedWidget);
        }
        public void DrawMethod_Should_Render_Size_XY_Positions_Height_Width_Default_BackgroundColour_TextContent()
        {
            // Arrange
            var widget = new TextBoxWidget(30, 150)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text with default colour"
            };

            // Act
            var renderedWidget = widget.Draw();

            // Assert
            Assert.NotNull(widget);
            Assert.Equal("TextBox (30, 150) Height= 6 Width=24 Size=144 BackgroundColour=Red TextContent = Sample text with default colour", renderedWidget);
            Assert.Contains("Red", renderedWidget);
        }
Exemple #9
0
        static void Main(string[] args)
        {
            var requestedWidgets = new List <BaseWidget>();

            var rectangle = new RectangleWidget()
            {
                XCoOrd = 10,
                YCoOrd = 10,
                Height = 30,
                Width  = 40
            };
            var square = new SquareWidget()
            {
                XCoOrd = 15,
                YCoOrd = 30,
                Size   = 35
            };
            var ellipse = new EllipseWidget()
            {
                XCoOrd             = 100,
                YCoOrd             = 150,
                HorizontalDiameter = -300,
                VerticalDiameter   = 200
            };
            var circle = new CircleWidget()
            {
                XCoOrd = 1,
                YCoOrd = 1,
                Size   = 300
            };
            var textBox = new TextBoxWidget()
            {
                XCoOrd = 5,
                YCoOrd = 5,
                Width  = 200,
                Height = 100,
                Text   = "sample text"
            };

            requestedWidgets.Add(rectangle);
            requestedWidgets.Add(square);
            requestedWidgets.Add(ellipse);
            requestedWidgets.Add(circle);
            requestedWidgets.Add(textBox);

            WidgetPrinter.PrintRequestList(requestedWidgets);
        }
Exemple #10
0
        public MountainDialog(CreatorAPI creatorAPI)
        {
            this.creatorAPI = creatorAPI;
            this.player     = creatorAPI.componentMiner.ComponentPlayer;
            XElement node = ContentManager.Get <XElement>("NewWidgets/Dialog/山脉界面");

            WidgetsManager.LoadWidgetContents(this, this, node);
            this.OK           = Children.Find <ButtonWidget>("确定", true);
            this.cancelButton = Children.Find <ButtonWidget>("取消", true);
            this.num_1        = Children.Find <LabelWidget>("滑条1数据", true);
            this.num_2        = Children.Find <LabelWidget>("滑条2数据", true);
            this.num_3        = Children.Find <LabelWidget>("滑条3数据", true);
            this.TextBox      = Children.Find <TextBoxWidget>("方块ID", true);
            this.num1         = Children.Find <SliderWidget>("滑条1", true);
            this.num2         = Children.Find <SliderWidget>("滑条2", true);
            this.num3         = Children.Find <SliderWidget>("滑条3", true);
            num3.Value        = 100f;
            this.restting     = Children.Find <ButtonWidget>("重置", true);
        }
Exemple #11
0
        private static void Main(string[] args)
        {
            var squareWidget = new SquareWidget(10, 10)
            {
                Size = 1600
            };
            var circleWidget = new CircleWidget(100, 100)
            {
                Size = 20
            };
            var ellipseWidget = new EllipseWidget(50, 50)
            {
                HorizontalDiameter = 30, VerticalDiameter = 30, Size = 6283
            };
            var rectangleWidget = new RectangleWidget(70, 30)
            {
                Height = 4, Width = 8, Size = 32
            };
            var textBoxWithBackgroundColourWidget = new TextBoxWidget(20, 90)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text", BackgroundColour = "Blue"
            };
            var textBoxWithDefaultBackgroundColour = new TextBoxWidget(30, 150)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text with default colour"
            };

            var canvas = new Canvas();

            canvas.Add(squareWidget);
            canvas.Add(circleWidget);
            canvas.Add(ellipseWidget);
            canvas.Add(rectangleWidget);
            canvas.Add(textBoxWithBackgroundColourWidget);
            canvas.Add(textBoxWithDefaultBackgroundColour);

            canvas.PrintCanvas();
            Console.ReadKey();
        }