示例#1
0
        public MessageDialog(string largeMessage, string smallMessage, string button1Text, string button2Text, Vector2 size, Action <MessageDialogButton> handler)
        {
            m_handler = handler;
            XElement node = ContentManager.Get <XElement>("Dialogs/MessageDialog");

            LoadContents(this, node);
            base.Size                    = new Vector2((size.X >= 0f) ? size.X : base.Size.X, (size.Y >= 0f) ? size.Y : base.Size.Y);
            m_largeLabelWidget           = Children.Find <LabelWidget>("MessageDialog.LargeLabel");
            m_smallLabelWidget           = Children.Find <LabelWidget>("MessageDialog.SmallLabel");
            m_button1Widget              = Children.Find <ButtonWidget>("MessageDialog.Button1");
            m_button2Widget              = Children.Find <ButtonWidget>("MessageDialog.Button2");
            m_largeLabelWidget.IsVisible = !string.IsNullOrEmpty(largeMessage);
            m_largeLabelWidget.Text      = (largeMessage ?? string.Empty);
            m_smallLabelWidget.IsVisible = !string.IsNullOrEmpty(smallMessage);
            m_smallLabelWidget.Text      = (smallMessage ?? string.Empty);
            m_button1Widget.IsVisible    = !string.IsNullOrEmpty(button1Text);
            m_button1Widget.Text         = (button1Text ?? string.Empty);
            m_button2Widget.IsVisible    = !string.IsNullOrEmpty(button2Text);
            m_button2Widget.Text         = (button2Text ?? string.Empty);
            if (!m_button1Widget.IsVisible && !m_button2Widget.IsVisible)
            {
                throw new InvalidOperationException("MessageDialog must have at least one button.");
            }
            AutoHide = true;
        }
        public EditPistonDialog(int data, Action <int> handler)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditPistonDialog");

            LoadContents(this, node);
            m_title               = Children.Find <LabelWidget>("EditPistonDialog.Title");
            m_slider1             = Children.Find <SliderWidget>("EditPistonDialog.Slider1");
            m_panel2              = Children.Find <ContainerWidget>("EditPistonDialog.Panel2");
            m_slider2             = Children.Find <SliderWidget>("EditPistonDialog.Slider2");
            m_slider3             = Children.Find <SliderWidget>("EditPistonDialog.Slider3");
            m_okButton            = Children.Find <ButtonWidget>("EditPistonDialog.OK");
            m_cancelButton        = Children.Find <ButtonWidget>("EditPistonDialog.Cancel");
            m_handler             = handler;
            m_data                = data;
            m_mode                = PistonBlock.GetMode(data);
            m_maxExtension        = PistonBlock.GetMaxExtension(data);
            m_pullCount           = PistonBlock.GetPullCount(data);
            m_speed               = PistonBlock.GetSpeed(data);
            m_title.Text          = "Edit " + BlocksManager.Blocks[237].GetDisplayName(null, Terrain.MakeBlockValue(237, 0, data));
            m_slider1.Granularity = 1f;
            m_slider1.MinValue    = 1f;
            m_slider1.MaxValue    = 8f;
            m_slider2.Granularity = 1f;
            m_slider2.MinValue    = 1f;
            m_slider2.MaxValue    = 8f;
            m_slider3.Granularity = 1f;
            m_slider3.MinValue    = 0f;
            m_slider3.MaxValue    = 3f;
            m_panel2.IsVisible    = (m_mode != PistonMode.Pushing);
            UpdateControls();
        }
示例#3
0
        public PublishCommunityLinkDialog(string user, string address, string name)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/PublishCommunityLinkDialog");

            LoadContents(this, node);
            m_linkTextBoxWidget              = Children.Find <TextBoxWidget>("PublishCommunityLinkDialog.Link");
            m_nameTextBoxWidget              = Children.Find <TextBoxWidget>("PublishCommunityLinkDialog.Name");
            m_typeIconWidget                 = Children.Find <RectangleWidget>("PublishCommunityLinkDialog.TypeIcon");
            m_typeLabelWidget                = Children.Find <LabelWidget>("PublishCommunityLinkDialog.Type");
            m_changeTypeButtonWidget         = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.ChangeType");
            m_publishButtonWidget            = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.Publish");
            m_cancelButtonWidget             = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.Cancel");
            m_linkTextBoxWidget.TextChanged += delegate
            {
                m_nameTextBoxWidget.Text = Storage.GetFileNameWithoutExtension(GetFilenameFromLink(m_linkTextBoxWidget.Text));
            };
            if (!string.IsNullOrEmpty(address))
            {
                m_linkTextBoxWidget.Text = address;
            }
            if (!string.IsNullOrEmpty(name))
            {
                m_nameTextBoxWidget.Text = name;
            }
            m_user = user;
        }
示例#4
0
        public CreativeInventoryWidget(Entity entity)
        {
            m_componentCreativeInventory = entity.FindComponent <ComponentCreativeInventory>(throwOnError: true);
            XElement node = ContentManager.Get <XElement>("Widgets/CreativeInventoryWidget");

            LoadContents(this, node);
            m_categoryLeftButton  = Children.Find <ButtonWidget>("CategoryLeftButton");
            m_categoryRightButton = Children.Find <ButtonWidget>("CategoryRightButton");
            m_categoryButton      = Children.Find <ButtonWidget>("CategoryButton");
            m_pageUpButton        = Children.Find <ButtonWidget>("PageUpButton");
            m_pageDownButton      = Children.Find <ButtonWidget>("PageDownButton");
            m_pageLabel           = Children.Find <LabelWidget>("PageLabel");
            m_panelContainer      = Children.Find <ContainerWidget>("PanelContainer");
            CreativeInventoryPanel creativeInventoryPanel = new CreativeInventoryPanel(this)
            {
                IsVisible = false
            };

            m_panelContainer.Children.Add(creativeInventoryPanel);
            FurnitureInventoryPanel furnitureInventoryPanel = new FurnitureInventoryPanel(this)
            {
                IsVisible = false
            };

            m_panelContainer.Children.Add(furnitureInventoryPanel);
            foreach (string category in BlocksManager.Categories)
            {
                m_categories.Add(new Category
                {
                    Name  = category,
                    Panel = creativeInventoryPanel
                });
            }
            m_categories.Add(new Category
            {
                Name  = LanguageControl.Get(fName, 1),
                Panel = furnitureInventoryPanel
            });
            m_categories.Add(new Category
            {
                Name  = LanguageControl.Get(fName, 2),
                Panel = creativeInventoryPanel
            });

            for (int i = 0; i < m_categories.Count; i++)
            {
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Electrics"))
                {
                    m_categories[i].Color = new Color(128, 140, 255);
                }
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Plants"))
                {
                    m_categories[i].Color = new Color(64, 160, 64);
                }
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Weapons"))
                {
                    m_categories[i].Color = new Color(255, 128, 112);
                }
            }
        }
示例#5
0
        public CrossbowWidget(IInventory inventory, int slotIndex)
        {
            m_inventory = inventory;
            m_slotIndex = slotIndex;
            XElement node = ContentManager.Get <XElement>("Widgets/CrossbowWidget");

            LoadContents(this, node);
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_inventorySlotWidget = Children.Find <InventorySlotWidget>("InventorySlot");
            m_instructionsLabel   = Children.Find <LabelWidget>("InstructionsLabel");
            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(j, i));
                }
            }
            int num = 10;

            foreach (Widget child in m_inventoryGrid.Children)
            {
                (child as InventorySlotWidget)?.AssignInventorySlot(inventory, num++);
            }
            m_inventorySlotWidget.AssignInventorySlot(inventory, slotIndex);
            m_inventorySlotWidget.CustomViewMatrix = Matrix.CreateLookAt(new Vector3(0f, 1f, 0.2f), new Vector3(0f, 0f, 0.2f), -Vector3.UnitZ);
        }
示例#6
0
        public Musket2Widget(IInventory inventory, int slotIndex)
        {
            m_inventory = inventory;
            m_slotIndex = slotIndex;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/Musket2Widget"));
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_inventorySlotWidget = Children.Find <InventorySlotWidget>("InventorySlot");
            m_instructionsLabel   = Children.Find <LabelWidget>("InstructionsLabel");
            int i = 0, num;

            for (; i < m_inventoryGrid.RowsCount; i++)
            {
                for (num = 0; num < m_inventoryGrid.ColumnsCount; num++)
                {
                    var widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(num, i));
                }
            }
            num = 6;
            i   = 0;
            for (int count = m_inventoryGrid.Children.Count; i < count; i++)
            {
                if (m_inventoryGrid.Children[i] is InventorySlotWidget inventorySlotWidget)
                {
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                }
            }
            m_inventorySlotWidget.AssignInventorySlot(inventory, slotIndex);
            m_inventorySlotWidget.CustomViewMatrix = Matrix.CreateLookAt(new Vector3(1f, 0f, 0f), new Vector3(0f, 0f, 0f), -Vector3.UnitZ);
        }
示例#7
0
        public MessageWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/MessageWidget");

            LoadContents(this, node);
            m_labelWidget = Children.Find <LabelWidget>("Label");
        }
        public VitalStatsWidget(ComponentPlayer componentPlayer)
        {
            m_componentPlayer = componentPlayer;
            XElement node = ContentManager.Get <XElement>("Widgets/VitalStatsWidget");

            LoadContents(this, node);
            m_titleLabel          = Children.Find <LabelWidget>("TitleLabel");
            m_healthLink          = Children.Find <LinkWidget>("HealthLink");
            m_healthValueBar      = Children.Find <ValueBarWidget>("HealthValueBar");
            m_staminaLink         = Children.Find <LinkWidget>("StaminaLink");
            m_staminaValueBar     = Children.Find <ValueBarWidget>("StaminaValueBar");
            m_foodLink            = Children.Find <LinkWidget>("FoodLink");
            m_foodValueBar        = Children.Find <ValueBarWidget>("FoodValueBar");
            m_sleepLink           = Children.Find <LinkWidget>("SleepLink");
            m_sleepValueBar       = Children.Find <ValueBarWidget>("SleepValueBar");
            m_temperatureLink     = Children.Find <LinkWidget>("TemperatureLink");
            m_temperatureValueBar = Children.Find <ValueBarWidget>("TemperatureValueBar");
            m_wetnessLink         = Children.Find <LinkWidget>("WetnessLink");
            m_wetnessValueBar     = Children.Find <ValueBarWidget>("WetnessValueBar");
            m_chokeButton         = Children.Find <ButtonWidget>("ChokeButton");
            m_strengthLink        = Children.Find <LinkWidget>("StrengthLink");
            m_strengthLabel       = Children.Find <LabelWidget>("StrengthLabel");
            m_resilienceLink      = Children.Find <LinkWidget>("ResilienceLink");
            m_resilienceLabel     = Children.Find <LabelWidget>("ResilienceLabel");
            m_speedLink           = Children.Find <LinkWidget>("SpeedLink");
            m_speedLabel          = Children.Find <LabelWidget>("SpeedLabel");
            m_hungerLink          = Children.Find <LinkWidget>("HungerLink");
            m_hungerLabel         = Children.Find <LabelWidget>("HungerLabel");
            m_experienceLink      = Children.Find <LinkWidget>("ExperienceLink");
            m_experienceValueBar  = Children.Find <ValueBarWidget>("ExperienceValueBar");
            m_insulationLink      = Children.Find <LinkWidget>("InsulationLink");
            m_insulationLabel     = Children.Find <LabelWidget>("InsulationLabel");
        }
示例#9
0
        public PlayerScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/PlayerScreen");

            LoadContents(this, node);
            m_playerModel                     = Children.Find <PlayerModelWidget>("Model");
            m_playerClassButton               = Children.Find <ButtonWidget>("PlayerClassButton");
            m_nameTextBox                     = Children.Find <TextBoxWidget>("Name");
            m_characterSkinLabel              = Children.Find <LabelWidget>("CharacterSkinLabel");
            m_characterSkinButton             = Children.Find <ButtonWidget>("CharacterSkinButton");
            m_controlsLabel                   = Children.Find <LabelWidget>("ControlsLabel");
            m_controlsButton                  = Children.Find <ButtonWidget>("ControlsButton");
            m_descriptionLabel                = Children.Find <LabelWidget>("DescriptionLabel");
            m_addButton                       = Children.Find <ButtonWidget>("AddButton");
            m_addAnotherButton                = Children.Find <ButtonWidget>("AddAnotherButton");
            m_deleteButton                    = Children.Find <ButtonWidget>("DeleteButton");
            m_playButton                      = Children.Find <ButtonWidget>("PlayButton");
            m_characterSkinsCache             = new CharacterSkinsCache();
            m_playerModel.CharacterSkinsCache = m_characterSkinsCache;
            m_nameTextBox.FocusLost          += delegate
            {
                if (VerifyName())
                {
                    m_playerData.Name = m_nameTextBox.Text.Trim();
                }
                else
                {
                    m_nameWasInvalid = true;
                }
            };
        }
示例#10
0
        public LevelFactorDialog(string title, string description, IEnumerable <ComponentLevel.Factor> factors, float total)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/LevelFactorDialog");

            LoadContents(this, node);
            m_titleWidget            = Children.Find <LabelWidget>("LevelFactorDialog.Title");
            m_descriptionWidget      = Children.Find <LabelWidget>("LevelFactorDialog.Description");
            m_namesWidget            = Children.Find <LabelWidget>("LevelFactorDialog.Names");
            m_valuesWidget           = Children.Find <LabelWidget>("LevelFactorDialog.Values");
            m_totalNameWidget        = Children.Find <LabelWidget>("LevelFactorDialog.TotalName");
            m_totalValueWidget       = Children.Find <LabelWidget>("LevelFactorDialog.TotalValue");
            m_okWidget               = Children.Find <ButtonWidget>("LevelFactorDialog.OK");
            m_titleWidget.Text       = title;
            m_descriptionWidget.Text = description;
            m_namesWidget.Text       = string.Empty;
            m_valuesWidget.Text      = string.Empty;
            foreach (ComponentLevel.Factor factor in factors)
            {
                m_namesWidget.Text  += string.Format("{0,24}\n", factor.Description);
                m_valuesWidget.Text += string.Format(CultureInfo.InvariantCulture, "x {0:0.00}\n", factor.Value);
            }
            m_namesWidget.Text      = m_namesWidget.Text.TrimEnd();
            m_valuesWidget.Text     = m_valuesWidget.Text.TrimEnd();
            m_totalNameWidget.Text  = string.Format("{0,24}", "TOTAL");
            m_totalValueWidget.Text = string.Format(CultureInfo.InvariantCulture, "x {0:0.00}", total);
        }
示例#11
0
        public RecipaediaScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/RecipaediaScreen");

            LoadContents(this, node);
            m_blocksList         = Children.Find <ListPanelWidget>("BlocksList");
            m_categoryLabel      = Children.Find <LabelWidget>("Category");
            m_prevCategoryButton = Children.Find <ButtonWidget>("PreviousCategory");
            m_nextCategoryButton = Children.Find <ButtonWidget>("NextCategory");
            m_detailsButton      = Children.Find <ButtonWidget>("DetailsButton");
            m_recipesButton      = Children.Find <ButtonWidget>("RecipesButton");
            m_categories.Add(null);
            m_categories.AddRange(BlocksManager.Categories);
            m_blocksList.ItemWidgetFactory = delegate(object item)
            {
                int             value = (int)item;
                int             num   = Terrain.ExtractContents(value);
                Block           block = BlocksManager.Blocks[num];
                XElement        node2 = ContentManager.Get <XElement>("Widgets/RecipaediaItem");
                ContainerWidget obj   = (ContainerWidget)Widget.LoadWidget(this, node2, null);
                obj.Children.Find <BlockIconWidget>("RecipaediaItem.Icon").Value = value;
                obj.Children.Find <LabelWidget>("RecipaediaItem.Text").Text      = block.GetDisplayName(null, value);
                obj.Children.Find <LabelWidget>("RecipaediaItem.Details").Text   = block.GetDescription(value);
                return(obj);
            };
            m_blocksList.ItemClicked += delegate(object item)
            {
                if (m_blocksList.SelectedItem == item && item is int)
                {
                    ScreensManager.SwitchScreen("RecipaediaDescription", item, m_blocksList.Items.Cast <int>().ToList());
                }
            };
        }
 public SingleplayerScreen()
 {
     WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/SingleplayerScreen"));
     this.m_worldsListWidget = this.ScreenWidget.Children.Find <ListPanelWidget>("WorldsList", true);
     this.m_worldsListWidget.ItemWidgetFactory += (Func <object, Widget>)(item =>
     {
         WorldInfo worldInfo             = (WorldInfo)item;
         ContainerWidget containerWidget = (ContainerWidget)WidgetsManager.LoadWidget((object)this, ContentManager.Get <XElement>("Widgets/SavedWorldItem"), null);
         LabelWidget labelWidget1        = containerWidget.Children.Find <LabelWidget>("WorldItem.Name", true);
         LabelWidget labelWidget2        = containerWidget.Children.Find <LabelWidget>("WorldItem.Size", true);
         LabelWidget labelWidget3        = containerWidget.Children.Find <LabelWidget>("WorldItem.Date", true);
         LabelWidget labelWidget4        = containerWidget.Children.Find <LabelWidget>("WorldItem.GameMode", true);
         LabelWidget labelWidget5        = containerWidget.Children.Find <LabelWidget>("WorldItem.EnvironmentBehaviorMode", true);
         LabelWidget labelWidget6        = containerWidget.Children.Find <LabelWidget>("WorldItem.Version", true);
         containerWidget.Tag = (object)worldInfo;
         labelWidget1.Text   = worldInfo.Name;
         labelWidget2.Text   = string.Format("{0:0.00MB}", new object[1]
         {
             (object)(float)((double)worldInfo.Size / 1024.0 / 1024.0)
         });
         labelWidget3.Text = string.Format("{0:dd MMM yyyy HH:mm}", new object[1]
         {
             (object)worldInfo.LastSaveTime
         });
         labelWidget4.Text = worldInfo.GameMode.ToString();
         labelWidget5.Text = worldInfo.EnvironmentBehaviorMode.ToString();
         labelWidget6.Text = !(worldInfo.SerializationVersion != VersionsManager.SerializationVersion) ? string.Empty : (string.IsNullOrEmpty(worldInfo.SerializationVersion) ? "(unknown)" : "(" + worldInfo.SerializationVersion + ")");
         return((Widget)containerWidget);
     });
 }
示例#13
0
        public BuildFurnitureDialog(FurnitureDesign design, FurnitureDesign sourceDesign, Action <bool> handler)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/BuildFurnitureDialog");

            LoadContents(this, node);
            m_nameLabel                = Children.Find <LabelWidget>("BuildFurnitureDialog.Name");
            m_statusLabel              = Children.Find <LabelWidget>("BuildFurnitureDialog.Status");
            m_designWidget2d           = Children.Find <FurnitureDesignWidget>("BuildFurnitureDialog.Design2d");
            m_designWidget3d           = Children.Find <FurnitureDesignWidget>("BuildFurnitureDialog.Design3d");
            m_nameButton               = Children.Find <ButtonWidget>("BuildFurnitureDialog.NameButton");
            m_axisButton               = Children.Find <ButtonWidget>("BuildFurnitureDialog.AxisButton");
            m_leftButton               = Children.Find <ButtonWidget>("BuildFurnitureDialog.LeftButton");
            m_rightButton              = Children.Find <ButtonWidget>("BuildFurnitureDialog.RightButton");
            m_upButton                 = Children.Find <ButtonWidget>("BuildFurnitureDialog.UpButton");
            m_downButton               = Children.Find <ButtonWidget>("BuildFurnitureDialog.DownButton");
            m_mirrorButton             = Children.Find <ButtonWidget>("BuildFurnitureDialog.MirrorButton");
            m_turnRightButton          = Children.Find <ButtonWidget>("BuildFurnitureDialog.TurnRightButton");
            m_increaseResolutionButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.IncreaseResolutionButton");
            m_decreaseResolutionButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.DecreaseResolutionButton");
            m_resolutionLabel          = Children.Find <LabelWidget>("BuildFurnitureDialog.ResolutionLabel");
            m_cancelButton             = Children.Find <ButtonWidget>("BuildFurnitureDialog.CancelButton");
            m_buildButton              = Children.Find <ButtonWidget>("BuildFurnitureDialog.BuildButton");
            m_handler      = handler;
            m_design       = design;
            m_sourceDesign = sourceDesign;
            m_axis         = 1;
            int num = 0;

            num                    += m_design.Geometry.SubsetOpaqueByFace.Sum((BlockMesh b) => (b != null) ? (b.Indices.Count / 3) : 0);
            num                    += m_design.Geometry.SubsetAlphaTestByFace.Sum((BlockMesh b) => (b != null) ? (b.Indices.Count / 3) : 0);
            m_isValid               = (num <= 65535);
            m_statusLabel.Text      = string.Format(LanguageControl.Get(fName, 1), num, 65535, m_isValid ? LanguageControl.Get(fName, 2) : LanguageControl.Get(fName, 3));
            m_designWidget2d.Design = m_design;
            m_designWidget3d.Design = m_design;
        }
示例#14
0
 public ClickTextWidget(Vector2 vector2, string text, Action click, bool box = false)
 {
     Size = vector2;
     HorizontalAlignment = WidgetAlignment.Center;
     VerticalAlignment   = WidgetAlignment.Center;
     labelWidget         = new LabelWidget()
     {
         Text = text, FontScale = 0.8f, HorizontalAlignment = WidgetAlignment.Center, VerticalAlignment = WidgetAlignment.Center
     };
     if (click == null)
     {
         Children.Add(labelWidget);
     }
     else
     {
         clickidget      = new ClickableWidget();
         rectangleWidget = new RectangleWidget()
         {
             OutlineThickness = 0
         };
         if (box)
         {
             BackGround = Color.Gray;
             rectangleWidget.FillColor        = BackGround;
             rectangleWidget.OutlineColor     = Color.Transparent;
             rectangleWidget.OutlineThickness = 1;
         }
         Children.Add(rectangleWidget);
         Children.Add(clickidget);
         Children.Add(labelWidget);
         this.click = click;
     }
 }
示例#15
0
        public StackPanelWidget matchColor(string str)
        {
            StackPanelWidget stackPanel = new StackPanelWidget()
            {
                Direction = LayoutDirection.Horizontal
            };

            string[] ll = str.Split(new string[] { "[color=", "]", "[/color]" }, System.StringSplitOptions.None);
            if (ll[0] == str)
            {
                LabelWidget labelWidget = new LabelWidget()
                {
                    Text = str, FontScale = 0.6f, WordWrap = true
                };
                labelWidget.Margin = new Vector2(2, 0);
                labelWidget.Size   = new Vector2(XjJeiLibrary.caculateWidth(labelWidget, labelWidget.FontScale, str, canvasmain.Size.X), XjJeiLibrary.caculateHeight(labelWidget, 1, labelWidget.FontScale));
                stackPanel.Children.Add(labelWidget);
            }
            else
            {
                bool isColor = false; Color cc = Color.White;
                foreach (string ain in ll)
                {
                    if (!isColor)
                    {
                        cc = colorTable(ain);
                        if (cc != Color.Transparent)
                        {
                            isColor = true;
                        }
                        else
                        {
                            LabelWidget labelWidget = new LabelWidget()
                            {
                                Text = ain, FontScale = 0.6f, WordWrap = true
                            };
                            float wid = XjJeiLibrary.caculateWidth(labelWidget, labelWidget.FontScale, ain, canvasmain.Size.X);
                            labelWidget.Size   = new Vector2(XjJeiLibrary.caculateWidth(labelWidget, labelWidget.FontScale, ain, canvasmain.Size.X), XjJeiLibrary.caculateHeight(labelWidget, 1, labelWidget.FontScale));
                            labelWidget.Margin = new Vector2(2, 0);
                            stackPanel.Children.Add(labelWidget);
                        }
                    }
                    else
                    {
                        LabelWidget labelWidget = new LabelWidget()
                        {
                            Text = ain, FontScale = 0.6f, Color = cc, WordWrap = true
                        };
                        labelWidget.Size   = new Vector2(XjJeiLibrary.caculateWidth(labelWidget, labelWidget.FontScale, ain, canvasmain.Size.X), XjJeiLibrary.caculateHeight(labelWidget, 1, labelWidget.FontScale));
                        labelWidget.Margin = new Vector2(2, 0);
                        stackPanel.Children.Add(labelWidget);
                        isColor = false;
                    }
                }
            }


            return(stackPanel);
        }
示例#16
0
        public CraftingRecipeSlotWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/CraftingRecipeSlot");

            LoadContents(this, node);
            m_blockIconWidget = Children.Find <BlockIconWidget>("CraftingRecipeSlotWidget.Icon");
            m_labelWidget     = Children.Find <LabelWidget>("CraftingRecipeSlotWidget.Count");
        }
示例#17
0
        public LinkWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/LinkContents");

            LoadChildren(this, node);
            m_labelWidget     = Children.Find <LabelWidget>("Label");
            m_clickableWidget = Children.Find <ClickableWidget>("Clickable");
            LoadProperties(this, node);
        }
示例#18
0
        public HelpTopicScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/HelpTopicScreen");

            LoadContents(this, node);
            m_titleLabel  = Children.Find <LabelWidget>("Title");
            m_textLabel   = Children.Find <LabelWidget>("Text");
            m_scrollPanel = Children.Find <ScrollPanelWidget>("ScrollPanel");
        }
示例#19
0
        public SpawnDialog()
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/SpawnDialog");

            LoadContents(this, node);
            m_largeLabelWidget = Children.Find <LabelWidget>("SpawnDialog.LargeLabel");
            m_smallLabelWidget = Children.Find <LabelWidget>("SpawnDialog.SmallLabel");
            m_progressWidget   = Children.Find <ValueBarWidget>("SpawnDialog.Progress");
        }
示例#20
0
        public BusyDialog(string largeMessage, string smallMessage)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/BusyDialog");

            LoadContents(this, node);
            m_largeLabelWidget = Children.Find <LabelWidget>("BusyDialog.LargeLabel");
            m_smallLabelWidget = Children.Find <LabelWidget>("BusyDialog.SmallLabel");
            LargeMessage       = largeMessage;
            SmallMessage       = smallMessage;
        }
示例#21
0
        public XjBitmapClickWidget()
        {
            Color = Color.White;
            XElement node = ContentManager.Get <XElement>("JEIWidgets/xjbitmapclickwidget");

            LoadContents(this, node);
            m_rectangleWidget = Children.Find <XjBitmapWidget>("Button.Xjwidget");
            m_imageWidget     = Children.Find <RectangleWidget>("Button.Image");
            m_labelWidget     = Children.Find <LabelWidget>("Button.Label");
            m_clickableWidget = Children.Find <ClickableWidget>("Button.Clickable");
        }
示例#22
0
        public SliderWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/SliderContents");

            LoadChildren(this, node);
            m_canvasWidget      = Children.Find <CanvasWidget>("Slider.Canvas");
            m_labelCanvasWidget = Children.Find <CanvasWidget>("Slider.LabelCanvas");
            m_tabWidget         = Children.Find <Widget>("Slider.Tab");
            m_labelWidget       = Children.Find <LabelWidget>("Slider.Label");
            LoadProperties(this, node);
        }
示例#23
0
        public BitmapButtonWidget()
        {
            Color = Color.White;
            XElement node = ContentManager.Get <XElement>("Widgets/BitmapButtonContents");

            LoadChildren(this, node);
            m_rectangleWidget = Children.Find <RectangleWidget>("Button.Rectangle");
            m_imageWidget     = Children.Find <RectangleWidget>("Button.Image");
            m_labelWidget     = Children.Find <LabelWidget>("Button.Label");
            m_clickableWidget = Children.Find <ClickableWidget>("Button.Clickable");
            LoadProperties(this, node);
        }
示例#24
0
        public PlayerWidget(PlayerData playerData, CharacterSkinsCache characterSkinsCache)
        {
            XElement node = ContentManager.Get <XElement>("Widgets/PlayerWidget");

            LoadContents(this, node);
            m_playerModel  = Children.Find <PlayerModelWidget>("PlayerModel");
            m_nameLabel    = Children.Find <LabelWidget>("Name");
            m_detailsLabel = Children.Find <LabelWidget>("Details");
            m_editButton   = Children.Find <ButtonWidget>("EditButton");
            m_playerModel.CharacterSkinsCache = characterSkinsCache;
            m_playerData = playerData;
        }
        public CancellableBusyDialog(string largeMessage, bool autoHideOnCancel)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/CancellableBusyDialog");

            LoadContents(this, node);
            m_largeLabelWidget   = Children.Find <LabelWidget>("CancellableBusyDialog.LargeLabel");
            m_smallLabelWidget   = Children.Find <LabelWidget>("CancellableBusyDialog.SmallLabel");
            m_cancelButtonWidget = Children.Find <ButtonWidget>("CancellableBusyDialog.CancelButton");
            Progress             = new CancellableProgress();
            m_autoHideOnCancel   = autoHideOnCancel;
            LargeMessage         = largeMessage;
        }
示例#26
0
        public CheckboxWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/CheckboxContents");

            LoadChildren(this, node);
            m_canvasWidget    = Children.Find <CanvasWidget>("Checkbox.Canvas");
            m_rectangleWidget = Children.Find <RectangleWidget>("Checkbox.Rectangle");
            m_tickWidget      = Children.Find <RectangleWidget>("Checkbox.Tick");
            m_labelWidget     = Children.Find <LabelWidget>("Checkbox.Label");
            m_clickableWidget = Children.Find <ClickableWidget>("Checkbox.Clickable");
            LoadProperties(this, node);
        }
        public MoreCommunityLinkDialog()
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/MoreCommunityLinkDialog");

            LoadContents(this, node);
            m_userLabel        = Children.Find <LabelWidget>("MoreCommunityLinkDialog.User");
            m_changeUserButton = Children.Find <ButtonWidget>("MoreCommunityLinkDialog.ChangeUser");
            m_userIdLabel      = Children.Find <LabelWidget>("MoreCommunityLinkDialog.UserId");
            m_copyUserIdButton = Children.Find <ButtonWidget>("MoreCommunityLinkDialog.CopyUserId");
            m_publishButton    = Children.Find <ButtonWidget>("MoreCommunityLinkDialog.Publish");
            m_closeButton      = Children.Find <ButtonWidget>("MoreCommunityLinkDialog.Close");
        }
示例#28
0
        public FurnitureSetItemWidget(FurnitureInventoryPanel furnitureInventoryWidget, FurnitureSet furnitureSet)
        {
            m_furnitureInventoryPanel = furnitureInventoryWidget;
            m_furnitureSet            = furnitureSet;
            XElement node = ContentManager.Get <XElement>("Widgets/FurnitureSetItemWidget");

            LoadContents(this, node);
            LabelWidget labelWidget  = Children.Find <LabelWidget>("FurnitureSetItem.Name");
            LabelWidget labelWidget2 = Children.Find <LabelWidget>("FurnitureSetItem.DesignsCount");

            labelWidget.Text  = ((furnitureSet == null) ? "Uncategorized" : furnitureSet.Name);
            labelWidget2.Text = $"{CountFurnitureDesigns()} design(s)";
        }
示例#29
0
        public static float caculateWidth(LabelWidget labelWidget, float scale, string str, float maxwidth)
        {
            float width = 0;

            foreach (char c in str)
            {
                width += (labelWidget.Font.GetGlyph(c).Width + labelWidget.Font.GetGlyph(c).Offset.X) * scale;
                if (width > maxwidth)
                {
                    width = maxwidth;
                }
            }
            return(width);
        }
        public BevelledButtonWidget()
        {
            Color     = Color.White;
            BevelSize = 2f;
            XElement node = ContentManager.Get <XElement>("Widgets/BevelledButtonContents");

            LoadChildren(this, node);
            m_rectangleWidget = Children.Find <BevelledRectangleWidget>("BevelledButton.Rectangle");
            m_imageWidget     = Children.Find <RectangleWidget>("BevelledButton.Image");
            m_labelWidget     = Children.Find <LabelWidget>("BevelledButton.Label");
            m_clickableWidget = Children.Find <ClickableWidget>("BevelledButton.Clickable");
            m_labelWidget.VerticalAlignment = WidgetAlignment.Center;
            LoadProperties(this, node);
        }