Exemplo n.º 1
0
        public EditPaletteDialog(WorldPalette palette)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditPaletteDialog");

            LoadContents(this, node);
            m_listPanel    = Children.Find <ContainerWidget>("EditPaletteDialog.ListPanel");
            m_okButton     = Children.Find <ButtonWidget>("EditPaletteDialog.OK");
            m_cancelButton = Children.Find <ButtonWidget>("EditPaletteDialog.Cancel");
            for (int i = 0; i < 16; i++)
            {
                StackPanelWidget obj = new StackPanelWidget
                {
                    Direction = LayoutDirection.Horizontal,
                    Children  =
                    {
                        (Widget) new CanvasWidget
                        {
                            Size     = new Vector2(32f, 60f),
                            Children =
                            {
                                (Widget) new LabelWidget
                                {
                                    Text  = (i + 1).ToString() + ".",
                                    Color = Color.Gray,
                                    HorizontalAlignment = WidgetAlignment.Far,
                                    VerticalAlignment   = WidgetAlignment.Center,
                                    Font = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                                }
                            }
                        },
                        (Widget) new CanvasWidget
                        {
                            Size = new Vector2(10f, 0f)
                        }
                    }
                };
                obj.Children.Add(m_labels[i] = new LinkWidget
                {
                    Size = new Vector2(300f, -1f),
                    VerticalAlignment = WidgetAlignment.Center,
                    Font = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                });
                obj.Children.Add(new CanvasWidget
                {
                    Size = new Vector2(10f, 0f)
                });
                obj.Children.Add(m_rectangles[i] = new BevelledButtonWidget
                {
                    Size              = new Vector2(1f / 0f, 60f),
                    BevelSize         = 1f,
                    AmbientLight      = 1f,
                    DirectionalLight  = 0.4f,
                    VerticalAlignment = WidgetAlignment.Center
                });
                obj.Children.Add(new CanvasWidget
                {
                    Size = new Vector2(10f, 0f)
                });
                obj.Children.Add(m_resetButtons[i] = new BevelledButtonWidget
                {
                    Size = new Vector2(160f, 60f),
                    VerticalAlignment = WidgetAlignment.Center,
                    Text = "Reset"
                });
                obj.Children.Add(new CanvasWidget
                {
                    Size = new Vector2(10f, 0f)
                });
                StackPanelWidget widget = obj;
                m_listPanel.Children.Add(widget);
            }
            m_palette    = palette;
            m_tmpPalette = new WorldPalette();
            m_palette.CopyTo(m_tmpPalette);
        }
        public ReportCommunityContentDialog(string address, string displayName, string userId)
        {
            m_address = address;
            m_userId  = userId;
            XElement node = ContentManager.Get <XElement>("Dialogs/ReportCommunityContentDialog");

            LoadContents(this, node);
            m_nameLabel    = Children.Find <LabelWidget>("ReportCommunityContentDialog.Name");
            m_container    = Children.Find <ContainerWidget>("ReportCommunityContentDialog.Container");
            m_reportButton = Children.Find <ButtonWidget>("ReportCommunityContentDialog.Report");
            m_cancelButton = Children.Find <ButtonWidget>("ReportCommunityContentDialog.Cancel");
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Cruelty",
                Tag  = "cruelty"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Dating",
                Tag  = "dating"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Drugs / Alcohol",
                Tag  = "drugs"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Hate Speech",
                Tag  = "hate"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Plagiarism",
                Tag  = "plagiarism"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Racism",
                Tag  = "racism"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Sex / Nudity",
                Tag  = "sex"
            });
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Excessive Swearing",
                Tag  = "swearing"
            });
            Random random = new Random();

            m_reasonWidgetsList.RandomShuffle((int max) => random.Int(0, max - 1));
            m_reasonWidgetsList.Add(new CheckboxWidget
            {
                Text = "Other",
                Tag  = "other"
            });
            foreach (CheckboxWidget reasonWidgets in m_reasonWidgetsList)
            {
                m_container.Children.Add(reasonWidgets);
            }
            m_nameLabel.Text         = displayName;
            m_reportButton.IsEnabled = false;
        }
Exemplo n.º 3
0
        public EditColorDialog(Color color, Action <Color?> handler)
        {
            WidgetsList  children = Children;
            CanvasWidget obj      = new CanvasWidget
            {
                Size = new Vector2(660f, 420f),
                HorizontalAlignment = WidgetAlignment.Center,
                VerticalAlignment   = WidgetAlignment.Center,
                Children            =
                {
                    (Widget) new RectangleWidget
                    {
                        FillColor        = new Color(0, 0, 0, 255),
                        OutlineColor     = new Color(128, 128, 128, 128),
                        OutlineThickness = 2f
                    }
                }
            };
            WidgetsList      children2 = obj.Children;
            StackPanelWidget obj2      = new StackPanelWidget
            {
                Direction           = LayoutDirection.Vertical,
                Margin              = new Vector2(15f),
                HorizontalAlignment = WidgetAlignment.Center,
                Children            =
                {
                    (Widget) new LabelWidget
                    {
                        Text = "Edit Color",
                        HorizontalAlignment = WidgetAlignment.Center
                    },
                    (Widget) new CanvasWidget
                    {
                        Size = new Vector2(0f, float.PositiveInfinity)
                    }
                }
            };
            WidgetsList      children3 = obj2.Children;
            StackPanelWidget obj3      = new StackPanelWidget
            {
                Direction = LayoutDirection.Horizontal
            };
            WidgetsList      children4 = obj3.Children;
            StackPanelWidget obj4      = new StackPanelWidget
            {
                Direction         = LayoutDirection.Vertical,
                VerticalAlignment = WidgetAlignment.Center
            };
            WidgetsList      children5 = obj4.Children;
            StackPanelWidget obj5      = new StackPanelWidget
            {
                Direction           = LayoutDirection.Horizontal,
                HorizontalAlignment = WidgetAlignment.Far,
                Margin   = new Vector2(0f, 10f),
                Children =
                {
                    (Widget) new LabelWidget
                    {
                        Text              = "Red:",
                        Color             = Color.Gray,
                        VerticalAlignment = WidgetAlignment.Center,
                        Font              = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                    },
                    (Widget) new CanvasWidget
                    {
                        Size = new Vector2(10f, 0f)
                    }
                }
            };
            WidgetsList  children6 = obj5.Children;
            SliderWidget obj6      = new SliderWidget
            {
                Size           = new Vector2(300f, 50f),
                IsLabelVisible = false,
                MinValue       = 0f,
                MaxValue       = 255f,
                Granularity    = 1f,
                SoundName      = ""
            };
            SliderWidget widget = obj6;

            m_sliderR = obj6;
            children6.Add(widget);
            children5.Add(obj5);
            WidgetsList      children7 = obj4.Children;
            StackPanelWidget obj7      = new StackPanelWidget
            {
                Direction           = LayoutDirection.Horizontal,
                HorizontalAlignment = WidgetAlignment.Far,
                Margin   = new Vector2(0f, 10f),
                Children =
                {
                    (Widget) new LabelWidget
                    {
                        Text              = "Green:",
                        Color             = Color.Gray,
                        VerticalAlignment = WidgetAlignment.Center,
                        Font              = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                    },
                    (Widget) new CanvasWidget
                    {
                        Size = new Vector2(10f, 0f)
                    }
                }
            };
            WidgetsList  children8 = obj7.Children;
            SliderWidget obj8      = new SliderWidget
            {
                Size           = new Vector2(300f, 50f),
                IsLabelVisible = false,
                MinValue       = 0f,
                MaxValue       = 255f,
                Granularity    = 1f,
                SoundName      = ""
            };

            widget    = obj8;
            m_sliderG = obj8;
            children8.Add(widget);
            children7.Add(obj7);
            WidgetsList      children9 = obj4.Children;
            StackPanelWidget obj9      = new StackPanelWidget
            {
                Direction           = LayoutDirection.Horizontal,
                HorizontalAlignment = WidgetAlignment.Far,
                Margin   = new Vector2(0f, 10f),
                Children =
                {
                    (Widget) new LabelWidget
                    {
                        Text              = "Blue:",
                        Color             = Color.Gray,
                        VerticalAlignment = WidgetAlignment.Center,
                        Font              = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                    },
                    (Widget) new CanvasWidget
                    {
                        Size = new Vector2(10f, 0f)
                    }
                }
            };
            WidgetsList  children10 = obj9.Children;
            SliderWidget obj10      = new SliderWidget
            {
                Size           = new Vector2(300f, 50f),
                IsLabelVisible = false,
                MinValue       = 0f,
                MaxValue       = 255f,
                Granularity    = 1f,
                SoundName      = ""
            };

            widget    = obj10;
            m_sliderB = obj10;
            children10.Add(widget);
            children9.Add(obj9);
            children4.Add(obj4);
            obj3.Children.Add(new CanvasWidget
            {
                Size = new Vector2(20f, 0f)
            });
            WidgetsList          children11   = obj3.Children;
            CanvasWidget         canvasWidget = new CanvasWidget();
            WidgetsList          children12   = canvasWidget.Children;
            BevelledButtonWidget obj11        = new BevelledButtonWidget
            {
                Size                = new Vector2(200f, 240f),
                AmbientLight        = 1f,
                HorizontalAlignment = WidgetAlignment.Center,
                VerticalAlignment   = WidgetAlignment.Center
            };
            BevelledButtonWidget widget2 = obj11;

            m_rectangle = obj11;
            children12.Add(widget2);
            WidgetsList children13 = canvasWidget.Children;
            LabelWidget obj12      = new LabelWidget
            {
                HorizontalAlignment = WidgetAlignment.Center,
                VerticalAlignment   = WidgetAlignment.Center,
                Font = ContentManager.Get <BitmapFont>("Fonts/Pericles")
            };
            LabelWidget widget3 = obj12;

            m_label = obj12;
            children13.Add(widget3);
            children11.Add(canvasWidget);
            children3.Add(obj3);
            obj2.Children.Add(new CanvasWidget
            {
                Size = new Vector2(0f, float.PositiveInfinity)
            });
            WidgetsList      children14 = obj2.Children;
            StackPanelWidget obj13      = new StackPanelWidget
            {
                Direction           = LayoutDirection.Horizontal,
                HorizontalAlignment = WidgetAlignment.Center
            };
            WidgetsList          children15 = obj13.Children;
            BevelledButtonWidget obj14      = new BevelledButtonWidget
            {
                Size = new Vector2(160f, 60f),
                Text = LanguageControl.Get("Usual", "ok")
            };
            ButtonWidget widget4 = obj14;

            m_okButton = obj14;
            children15.Add(widget4);
            obj13.Children.Add(new CanvasWidget
            {
                Size = new Vector2(50f, 0f)
            });
            WidgetsList          children16 = obj13.Children;
            BevelledButtonWidget obj15      = new BevelledButtonWidget
            {
                Size = new Vector2(160f, 60f),
                Text = "Cancel"
            };

            widget4        = obj15;
            m_cancelButton = obj15;
            children16.Add(widget4);
            children14.Add(obj13);
            children2.Add(obj2);
            children.Add(obj);
            m_handler = handler;
            m_color   = color;
            UpdateControls();
        }