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); } } }
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(); }
public static void UpdateWidgetsHierarchy(Widget widget, ref bool isMouseCursorVisible) { if (!widget.IsVisible || !widget.IsEnabled) { return; } if (widget.WidgetsHierarchyInput != null) { widget.WidgetsHierarchyInput.Update(); isMouseCursorVisible |= widget.WidgetsHierarchyInput.IsMouseCursorVisible; } ContainerWidget containerWidget = widget as ContainerWidget; if (containerWidget != null) { WidgetsList children = containerWidget.Children; for (int num = children.Count - 1; num >= 0; num--) { if (num < children.Count) { UpdateWidgetsHierarchy(children[num], ref isMouseCursorVisible); } } } widget.Update(); }
public void LoadChildren(object eventsTarget, XElement node) { if (node.HasElements) { ContainerWidget containerWidget = this as ContainerWidget; if (containerWidget == null) { throw new Exception($"Type \"{node.Name.LocalName}\" is not a ContainerWidget, but it contains child widgets."); } foreach (XElement item in node.Elements()) { if (IsNodeIncludedOnCurrentPlatform(item)) { Widget widget = null; string attributeValue = XmlUtils.GetAttributeValue <string>(item, "Name", null); if (attributeValue != null) { widget = containerWidget.Children.Find(attributeValue, throwIfNotFound: false); } if (widget != null) { widget.LoadContents(eventsTarget, item); } else { LoadWidget(eventsTarget, item, containerWidget); } } } } }
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); }); }
public override void ArrangeOverride() { foreach (Widget child in Children) { if (child.IsVisible) { Vector2?widgetPosition = GetWidgetPosition(child); if (widgetPosition.HasValue) { Vector2 zero = Vector2.Zero; if (!float.IsPositiveInfinity(child.ParentDesiredSize.X)) { zero.X = child.ParentDesiredSize.X; } else { zero.X = MathUtils.Max(base.ActualSize.X - widgetPosition.Value.X, 0f); } if (!float.IsPositiveInfinity(child.ParentDesiredSize.Y)) { zero.Y = child.ParentDesiredSize.Y; } else { zero.Y = MathUtils.Max(base.ActualSize.Y - widgetPosition.Value.Y, 0f); } child.Arrange(widgetPosition.Value, zero); } else { ContainerWidget.ArrangeChildWidgetInCell(Vector2.Zero, base.ActualSize, child); } } } }
public static void ShowDialog(ContainerWidget parentWidget, Dialog dialog) { Dispatcher.Dispatch(delegate { if (!m_dialogs.Contains(dialog)) { if (parentWidget == null) { parentWidget = (ScreensManager.CurrentScreen ?? ScreensManager.RootWidget); } dialog.WidgetsHierarchyInput = null; m_dialogs.Add(dialog); AnimationData animationData = new AnimationData { Direction = 1 }; m_animationData[dialog] = animationData; parentWidget.Children.Add(animationData.CoverRectangle); if (dialog.ParentWidget != null) { dialog.ParentWidget.Children.Remove(dialog); } parentWidget.Children.Add(dialog); UpdateDialog(dialog, animationData); dialog.Input.Clear(); } }); }
public GameLoadingScreen() { XElement node = ContentManager.Get <XElement>("Screens/GameLoadingScreen"); LoadContents(this, node); m_stateMachine.AddState("WaitingForFadeIn", null, delegate { if (!ScreensManager.IsAnimating) { if (string.IsNullOrEmpty(m_worldSnapshotName)) { m_stateMachine.TransitionTo("Loading"); } else { m_stateMachine.TransitionTo("RestoringSnapshot"); } } }, null); m_stateMachine.AddState("Loading", null, delegate { ContainerWidget gamesWidget = ScreensManager.FindScreen <GameScreen>("Game").Children.Find <ContainerWidget>("GamesWidget"); GameManager.LoadProject(m_worldInfo, gamesWidget); ScreensManager.SwitchScreen("Game"); }, null); m_stateMachine.AddState("RestoringSnapshot", null, delegate { GameManager.DisposeProject(); WorldsManager.RestoreWorldFromSnapshot(m_worldInfo.DirectoryName, m_worldSnapshotName); m_stateMachine.TransitionTo("Loading"); }, null); }
public override void ArrangeOverride() { foreach (Widget child in Children) { ContainerWidget.ArrangeChildWidgetInCell(Vector2.Zero, base.ActualSize, child); } }
public SettingsGraphicsScreen() { XElement node = ContentManager.Get <XElement>("Screens/SettingsGraphicsScreen"); LoadContents(this, node); m_virtualRealityButton = Children.Find <BevelledButtonWidget>("VirtualRealityButton"); m_brightnessSlider = Children.Find <SliderWidget>("BrightnessSlider"); m_vrPanel = Children.Find <ContainerWidget>("VrPanel"); m_vrPanel.IsVisible = false; }
public override void ChangeParent(ContainerWidget parentWidget) { if (parentWidget is GameWidget) { GameWidget = (GameWidget)parentWidget; m_subsystemDrawing = GameWidget.SubsystemGameWidgets.Project.FindSubsystem <SubsystemDrawing>(throwOnError: true); base.ChangeParent(parentWidget); return; } throw new InvalidOperationException("ViewWidget must be a child of GameWidget."); }
public virtual void ChangeParent(ContainerWidget parentWidget) { if (parentWidget != ParentWidget) { ParentWidget = parentWidget; if (parentWidget == null) { UpdateCeases(); } } }
public void CollateDrawItems(Widget widget, Rectangle scissorRectangle) { if (!widget.IsVisible || !widget.IsDrawEnabled) { return; } bool flag = widget.GlobalBounds.Intersection(new BoundingRectangle(scissorRectangle.Left, scissorRectangle.Top, scissorRectangle.Right, scissorRectangle.Bottom)); Rectangle?scissorRectangle2 = null; if (widget.ClampToBounds && flag) { scissorRectangle2 = scissorRectangle; int num = (int)MathUtils.Floor(widget.GlobalBounds.Min.X - 0.5f); int num2 = (int)MathUtils.Floor(widget.GlobalBounds.Min.Y - 0.5f); int num3 = (int)MathUtils.Ceiling(widget.GlobalBounds.Max.X - 0.5f); int num4 = (int)MathUtils.Ceiling(widget.GlobalBounds.Max.Y - 0.5f); scissorRectangle = Rectangle.Intersection(new Rectangle(num, num2, num3 - num, num4 - num2), scissorRectangle2.Value); DrawItem drawItemFromCache = GetDrawItemFromCache(); drawItemFromCache.ScissorRectangle = scissorRectangle; m_drawItems.Add(drawItemFromCache); } if (widget.IsDrawRequired && flag) { DrawItem drawItemFromCache2 = GetDrawItemFromCache(); drawItemFromCache2.Widget = widget; m_drawItems.Add(drawItemFromCache2); } if (flag || !widget.ClampToBounds) { ContainerWidget containerWidget = widget as ContainerWidget; if (containerWidget != null) { foreach (Widget child in containerWidget.Children) { CollateDrawItems(child, scissorRectangle); } } } if (widget.IsOverdrawRequired && flag) { DrawItem drawItemFromCache3 = GetDrawItemFromCache(); drawItemFromCache3.Widget = widget; drawItemFromCache3.IsOverdraw = true; m_drawItems.Add(drawItemFromCache3); } if (scissorRectangle2.HasValue) { DrawItem drawItemFromCache4 = GetDrawItemFromCache(); drawItemFromCache4.ScissorRectangle = scissorRectangle2; m_drawItems.Add(drawItemFromCache4); } widget.WidgetsHierarchyInput?.Draw(this); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true); m_componentPlayer = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true); ContainerWidget guiWidget = m_componentPlayer.GuiWidget; m_backButtonWidget = guiWidget.Children.Find <ButtonWidget>("BackButton"); m_inventoryButtonWidget = guiWidget.Children.Find <ButtonWidget>("InventoryButton"); m_clothingButtonWidget = guiWidget.Children.Find <ButtonWidget>("ClothingButton"); m_moreButtonWidget = guiWidget.Children.Find <ButtonWidget>("MoreButton"); m_moreContentsWidget = guiWidget.Children.Find <Widget>("MoreContents"); m_helpButtonWidget = guiWidget.Children.Find <ButtonWidget>("HelpButton"); m_photoButtonWidget = guiWidget.Children.Find <ButtonWidget>("PhotoButton"); m_lightningButtonWidget = guiWidget.Children.Find <ButtonWidget>("LightningButton"); m_timeOfDayButtonWidget = guiWidget.Children.Find <ButtonWidget>("TimeOfDayButton"); m_cameraButtonWidget = guiWidget.Children.Find <ButtonWidget>("CameraButton"); m_creativeFlyButtonWidget = guiWidget.Children.Find <ButtonWidget>("CreativeFlyButton"); m_sneakButtonWidget = guiWidget.Children.Find <ButtonWidget>("SneakButton"); m_mountButtonWidget = guiWidget.Children.Find <ButtonWidget>("MountButton"); m_editItemButton = guiWidget.Children.Find <ButtonWidget>("EditItemButton"); MoveWidget = guiWidget.Children.Find <TouchInputWidget>("Move"); MoveRoseWidget = guiWidget.Children.Find <MoveRoseWidget>("MoveRose"); LookWidget = guiWidget.Children.Find <TouchInputWidget>("Look"); ViewWidget = m_componentPlayer.ViewWidget; HealthBarWidget = guiWidget.Children.Find <ValueBarWidget>("HealthBar"); FoodBarWidget = guiWidget.Children.Find <ValueBarWidget>("FoodBar"); TemperatureBarWidget = guiWidget.Children.Find <ValueBarWidget>("TemperatureBar"); LevelLabelWidget = guiWidget.Children.Find <LabelWidget>("LevelLabel"); m_modalPanelContainerWidget = guiWidget.Children.Find <ContainerWidget>("ModalPanelContainer"); ControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("ControlsContainer"); m_leftControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("LeftControlsContainer"); m_rightControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("RightControlsContainer"); m_moveContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveContainer"); m_lookContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookContainer"); m_moveRectangleWidget = guiWidget.Children.Find <RectangleWidget>("MoveRectangle"); m_lookRectangleWidget = guiWidget.Children.Find <RectangleWidget>("LookRectangle"); m_moveRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveRectangleContainer"); m_lookRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookRectangleContainer"); m_moveRectangleWidget = guiWidget.Children.Find <RectangleWidget>("MoveRectangle"); m_lookRectangleWidget = guiWidget.Children.Find <RectangleWidget>("LookRectangle"); m_movePadContainerWidget = guiWidget.Children.Find <ContainerWidget>("MovePadContainer"); m_lookPadContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookPadContainer"); m_moveButtonsContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveButtonsContainer"); ShortInventoryWidget = guiWidget.Children.Find <ShortInventoryWidget>("ShortInventory"); m_largeMessageWidget = guiWidget.Children.Find <ContainerWidget>("LargeMessage"); m_messageWidget = guiWidget.Children.Find <MessageWidget>("Message"); m_keyboardHelpMessageShown = valuesDictionary.GetValue <bool>("KeyboardHelpMessageShown"); m_gamepadHelpMessageShown = valuesDictionary.GetValue <bool>("GamepadHelpMessageShown"); }
public bool IsChildWidgetOf(ContainerWidget containerWidget) { if (containerWidget == ParentWidget) { return(true); } if (ParentWidget == null) { return(false); } return(ParentWidget.IsChildWidgetOf(containerWidget)); }
public EditSignDialog(SubsystemSignBlockBehavior subsystemSignBlockBehavior, Point3 signPoint) { XElement node = ContentManager.Get <XElement>("Dialogs/EditSignDialog"); LoadContents(this, node); m_linesPage = Children.Find <ContainerWidget>("EditSignDialog.LinesPage"); m_urlPage = Children.Find <ContainerWidget>("EditSignDialog.UrlPage"); m_textBox1 = Children.Find <TextBoxWidget>("EditSignDialog.TextBox1"); m_textBox2 = Children.Find <TextBoxWidget>("EditSignDialog.TextBox2"); m_textBox3 = Children.Find <TextBoxWidget>("EditSignDialog.TextBox3"); m_textBox4 = Children.Find <TextBoxWidget>("EditSignDialog.TextBox4"); m_colorButton1 = Children.Find <ButtonWidget>("EditSignDialog.ColorButton1"); m_colorButton2 = Children.Find <ButtonWidget>("EditSignDialog.ColorButton2"); m_colorButton3 = Children.Find <ButtonWidget>("EditSignDialog.ColorButton3"); m_colorButton4 = Children.Find <ButtonWidget>("EditSignDialog.ColorButton4"); m_urlTextBox = Children.Find <TextBoxWidget>("EditSignDialog.UrlTextBox"); m_urlTestButton = Children.Find <ButtonWidget>("EditSignDialog.UrlTestButton"); m_okButton = Children.Find <ButtonWidget>("EditSignDialog.OkButton"); m_cancelButton = Children.Find <ButtonWidget>("EditSignDialog.CancelButton"); m_urlButton = Children.Find <ButtonWidget>("EditSignDialog.UrlButton"); m_linesButton = Children.Find <ButtonWidget>("EditSignDialog.LinesButton"); m_subsystemSignBlockBehavior = subsystemSignBlockBehavior; m_signPoint = signPoint; SignData signData = m_subsystemSignBlockBehavior.GetSignData(m_signPoint); if (signData != null) { m_textBox1.Text = signData.Lines[0]; m_textBox2.Text = signData.Lines[1]; m_textBox3.Text = signData.Lines[2]; m_textBox4.Text = signData.Lines[3]; m_colorButton1.Color = signData.Colors[0]; m_colorButton2.Color = signData.Colors[1]; m_colorButton3.Color = signData.Colors[2]; m_colorButton4.Color = signData.Colors[3]; m_urlTextBox.Text = signData.Url; } else { m_textBox1.Text = string.Empty; m_textBox2.Text = string.Empty; m_textBox3.Text = string.Empty; m_textBox4.Text = string.Empty; m_colorButton1.Color = Color.Black; m_colorButton2.Color = Color.Black; m_colorButton3.Color = Color.Black; m_colorButton4.Color = Color.Black; m_urlTextBox.Text = string.Empty; } m_linesPage.IsVisible = true; m_urlPage.IsVisible = false; UpdateControls(); }
public void EnterText(ContainerWidget parentWidget, string title, string text, int maxLength, Action <string> handler) { Keyboard.ShowKeyboard(title, string.Empty, text, passwordMode : false, delegate(string s) { if (s.Length > maxLength) { s = s.Substring(0, maxLength); } handler(s); }, delegate { handler(null); }); }
public SettingsCompatibilityScreen() { XElement node = ContentManager.Get <XElement>("Screens/SettingsCompatibilityScreen"); LoadContents(this, node); m_singlethreadedTerrainUpdateButton = Children.Find <ButtonWidget>("SinglethreadedTerrainUpdateButton"); m_useAudioTrackCachingButton = Children.Find <ButtonWidget>("UseAudioTrackCachingButton"); m_disableAudioTrackCachingContainer = Children.Find <ContainerWidget>("DisableAudioTrackCachingContainer"); m_useReducedZRangeButton = Children.Find <ButtonWidget>("UseReducedZRangeButton"); m_useReducedZRangeContainer = Children.Find <ContainerWidget>("UseReducedZRangeContainer"); m_viewGameLogButton = Children.Find <ButtonWidget>("ViewGameLogButton"); m_resetDefaultsButton = Children.Find <ButtonWidget>("ResetDefaultsButton"); m_descriptionLabel = Children.Find <LabelWidget>("Description"); m_useAudioTrackCachingButton.IsVisible = true; }
public BestiaryDescriptionScreen() { XElement node = ContentManager.Get <XElement>("Screens/BestiaryDescriptionScreen"); LoadContents(this, node); m_modelWidget = Children.Find <ModelWidget>("Model"); m_nameWidget = Children.Find <LabelWidget>("Name"); m_leftButtonWidget = Children.Find <ButtonWidget>("Left"); m_rightButtonWidget = Children.Find <ButtonWidget>("Right"); m_descriptionWidget = Children.Find <LabelWidget>("Description"); m_propertyNames1Widget = Children.Find <LabelWidget>("PropertyNames1"); m_propertyValues1Widget = Children.Find <LabelWidget>("PropertyValues1"); m_propertyNames2Widget = Children.Find <LabelWidget>("PropertyNames2"); m_propertyValues2Widget = Children.Find <LabelWidget>("PropertyValues2"); m_dropsPanel = Children.Find <ContainerWidget>("Drops"); }
public SelectExternalContentProviderDialog(string title, bool listingSupportRequired, Action <IExternalContentProvider> selectionHandler) : base(title, ExternalContentManager.Providers.Where((IExternalContentProvider p) => !listingSupportRequired || p.SupportsListing), 100f, delegate(object item) { IExternalContentProvider externalContentProvider = (IExternalContentProvider)item; XElement node = ContentManager.Get <XElement>("Widgets/SelectExternalContentProviderItem"); ContainerWidget obj = (ContainerWidget)Widget.LoadWidget(null, node, null); obj.Children.Find <LabelWidget>("SelectExternalContentProvider.Text").Text = externalContentProvider.DisplayName; obj.Children.Find <LabelWidget>("SelectExternalContentProvider.Details").Text = externalContentProvider.Description; return(obj); }, delegate(object item) { selectionHandler((IExternalContentProvider)item); }) { base.ContentSize = new Vector2(700f, base.ContentSize.Y); }
public static Widget LoadWidget(object eventsTarget, XElement node, ContainerWidget parentWidget) { if (node.Name.LocalName.Contains(".")) { throw new NotImplementedException("Node property specification not implemented."); } Widget widget = Activator.CreateInstance(FindTypeFromXmlName(node.Name.LocalName, node.Name.NamespaceName)) as Widget; if (widget == null) { throw new Exception($"Type \"{node.Name.LocalName}\" is not a Widget."); } parentWidget?.Children.Add(widget); widget.LoadContents(eventsTarget, node); return(widget); }
public SettingsUiScreen() { XElement node = ContentManager.Get <XElement>("Screens/SettingsUiScreen"); LoadContents(this, node); m_windowModeContainer = Children.Find <ContainerWidget>("WindowModeContainer"); m_languageButton = Children.Find <ButtonWidget>("LanguageButton"); m_windowModeButton = Children.Find <ButtonWidget>("WindowModeButton"); m_uiSizeButton = Children.Find <ButtonWidget>("UiSizeButton"); m_upsideDownButton = Children.Find <ButtonWidget>("UpsideDownButton"); m_hideMoveLookPadsButton = Children.Find <ButtonWidget>("HideMoveLookPads"); m_showGuiInScreenshotsButton = Children.Find <ButtonWidget>("ShowGuiInScreenshotsButton"); m_showLogoInScreenshotsButton = Children.Find <ButtonWidget>("ShowLogoInScreenshotsButton"); m_screenshotSizeButton = Children.Find <ButtonWidget>("ScreenshotSizeButton"); m_communityContentModeButton = Children.Find <ButtonWidget>("CommunityContentModeButton"); }
public override void ArrangeOverride() { float num = 0f; foreach (Widget child in Children) { if (child.IsVisible) { if (Direction == LayoutDirection.Horizontal) { float num2 = (child.ParentDesiredSize.X == float.PositiveInfinity) ? ((m_fillCount > 0) ? (MathUtils.Max(base.ActualSize.X - m_fixedSize, 0f) / (float)m_fillCount) : 0f) : (child.ParentDesiredSize.X + 2f * child.Margin.X); Vector2 c; Vector2 c2; if (!IsInverted) { c = new Vector2(num, 0f); c2 = new Vector2(num + num2, base.ActualSize.Y); } else { c = new Vector2(base.ActualSize.X - (num + num2), 0f); c2 = new Vector2(base.ActualSize.X - num, base.ActualSize.Y); } ContainerWidget.ArrangeChildWidgetInCell(c, c2, child); num += num2; } else { float num3 = (child.ParentDesiredSize.Y == float.PositiveInfinity) ? ((m_fillCount > 0) ? (MathUtils.Max(base.ActualSize.Y - m_fixedSize, 0f) / (float)m_fillCount) : 0f) : (child.ParentDesiredSize.Y + 2f * child.Margin.Y); Vector2 c3; Vector2 c4; if (!IsInverted) { c3 = new Vector2(0f, num); c4 = new Vector2(base.ActualSize.X, num + num3); } else { c3 = new Vector2(0f, base.ActualSize.Y - (num + num3)); c4 = new Vector2(base.ActualSize.X, base.ActualSize.Y - num); } ContainerWidget.ArrangeChildWidgetInCell(c3, c4, child); num += num3; } } } }
public SelectExternalContentTypeDialog(string title, Action <ExternalContentType> selectionHandler) : base(title, from v in EnumUtils.GetEnumValues(typeof(ExternalContentType)) where ExternalContentManager.IsEntryTypeDownloadSupported((ExternalContentType) v) select v, 64f, delegate(object item) { ExternalContentType type = (ExternalContentType)item; XElement node = ContentManager.Get <XElement>("Widgets/SelectExternalContentTypeItem"); ContainerWidget obj = (ContainerWidget)Widget.LoadWidget(null, node, null); obj.Children.Find <RectangleWidget>("SelectExternalContentType.Icon").Subtexture = ExternalContentManager.GetEntryTypeIcon(type); obj.Children.Find <LabelWidget>("SelectExternalContentType.Text").Text = ExternalContentManager.GetEntryTypeDescription(type); return(obj); }, delegate(object item) { selectionHandler((ExternalContentType)item); }) { }
public override void ArrangeOverride() { foreach (Widget child in Children) { Point2 widgetCell = GetWidgetCell(child); if (IsCellValid(widgetCell)) { Column column = m_columns[widgetCell.X]; Row row = m_rows[widgetCell.Y]; ContainerWidget.ArrangeChildWidgetInCell(new Vector2(column.Position, row.Position), new Vector2(column.Position + column.ActualWidth, row.Position + row.ActualHeight), child); } else { ContainerWidget.ArrangeChildWidgetInCell(Vector2.Zero, base.ActualSize, child); } } }
public void AddStat(ContainerWidget containerWidget, string title, string value1, string value2 = "") { BitmapFont font = ContentManager.Get <BitmapFont>("Fonts/Pericles"); Color white = Color.White; Color gray = Color.Gray; containerWidget.Children.Add(new UniformSpacingPanelWidget { Direction = LayoutDirection.Horizontal, HorizontalAlignment = WidgetAlignment.Center, Children = { (Widget) new LabelWidget { Text = title + ":", HorizontalAlignment = WidgetAlignment.Far, Font = font, Color = gray, Margin = new Vector2(5f, 1f) }, (Widget) new StackPanelWidget { Direction = LayoutDirection.Horizontal, HorizontalAlignment = WidgetAlignment.Near, Children = { (Widget) new LabelWidget { Text = value1, Font = font, Color = white, Margin = new Vector2(5f, 1f) }, (Widget) new LabelWidget { Text = value2, Font = font, Color = gray, Margin = new Vector2(5f, 1f) } } } } }); }
public override void ArrangeOverride() { foreach (Widget child in Children) { Vector2 zero = Vector2.Zero; Vector2 actualSize = base.ActualSize; if (Direction == LayoutDirection.Horizontal) { zero.X -= ScrollPosition; actualSize.X = zero.X + child.ParentDesiredSize.X; } else { zero.Y -= ScrollPosition; actualSize.Y = zero.Y + child.ParentDesiredSize.Y; } ContainerWidget.ArrangeChildWidgetInCell(zero, actualSize, child); } }
public CommunityContentScreen() { XElement node = ContentManager.Get <XElement>("Screens/CommunityContentScreen"); LoadContents(this, node); m_listPanel = Children.Find <ListPanelWidget>("List"); m_orderLabel = Children.Find <LabelWidget>("Order"); m_changeOrderButton = Children.Find <ButtonWidget>("ChangeOrder"); m_filterLabel = Children.Find <LabelWidget>("Filter"); m_changeFilterButton = Children.Find <ButtonWidget>("ChangeFilter"); m_downloadButton = Children.Find <ButtonWidget>("Download"); m_deleteButton = Children.Find <ButtonWidget>("Delete"); m_moreOptionsButton = Children.Find <ButtonWidget>("MoreOptions"); m_listPanel.ItemWidgetFactory = delegate(object item) { CommunityContentEntry communityContentEntry = item as CommunityContentEntry; if (communityContentEntry != null) { XElement node2 = ContentManager.Get <XElement>("Widgets/CommunityContentItem"); ContainerWidget obj = (ContainerWidget)Widget.LoadWidget(this, node2, null); obj.Children.Find <RectangleWidget>("CommunityContentItem.Icon").Subtexture = ExternalContentManager.GetEntryTypeIcon(communityContentEntry.Type); obj.Children.Find <LabelWidget>("CommunityContentItem.Text").Text = communityContentEntry.Name; obj.Children.Find <LabelWidget>("CommunityContentItem.Details").Text = $"{ExternalContentManager.GetEntryTypeDescription(communityContentEntry.Type)} {DataSizeFormatter.Format(communityContentEntry.Size)}"; obj.Children.Find <StarRatingWidget>("CommunityContentItem.Rating").Rating = communityContentEntry.RatingsAverage; obj.Children.Find <StarRatingWidget>("CommunityContentItem.Rating").IsVisible = (communityContentEntry.RatingsAverage > 0f); obj.Children.Find <LabelWidget>("CommunityContentItem.ExtraText").Text = communityContentEntry.ExtraText; return(obj); } XElement node3 = ContentManager.Get <XElement>("Widgets/CommunityContentItemMore"); ContainerWidget containerWidget = (ContainerWidget)Widget.LoadWidget(this, node3, null); m_moreLink = containerWidget.Children.Find <LinkWidget>("CommunityContentItemMore.Link"); m_moreLink.Tag = (item as string); return(containerWidget); }; m_listPanel.SelectionChanged += delegate { if (m_listPanel.SelectedItem != null && !(m_listPanel.SelectedItem is CommunityContentEntry)) { m_listPanel.SelectedItem = null; } }; }
public SettingsControlsScreen() { XElement node = ContentManager.Get <XElement>("Screens/SettingsControlsScreen"); LoadContents(this, node); m_moveControlModeButton = Children.Find <ButtonWidget>("MoveControlMode"); m_lookControlModeButton = Children.Find <ButtonWidget>("LookControlMode"); m_leftHandedLayoutButton = Children.Find <ButtonWidget>("LeftHandedLayout"); m_flipVerticalAxisButton = Children.Find <ButtonWidget>("FlipVerticalAxis"); m_autoJumpButton = Children.Find <ButtonWidget>("AutoJump"); m_horizontalCreativeFlightButton = Children.Find <ButtonWidget>("HorizontalCreativeFlight"); m_horizontalCreativeFlightPanel = Children.Find <ContainerWidget>("HorizontalCreativeFlightPanel"); m_moveSensitivitySlider = Children.Find <SliderWidget>("MoveSensitivitySlider"); m_lookSensitivitySlider = Children.Find <SliderWidget>("LookSensitivitySlider"); m_gamepadCursorSpeedSlider = Children.Find <SliderWidget>("GamepadCursorSpeedSlider"); m_gamepadDeadZoneSlider = Children.Find <SliderWidget>("GamepadDeadZoneSlider"); m_creativeDigTimeSlider = Children.Find <SliderWidget>("CreativeDigTimeSlider"); m_creativeReachSlider = Children.Find <SliderWidget>("CreativeReachSlider"); m_holdDurationSlider = Children.Find <SliderWidget>("HoldDurationSlider"); m_dragDistanceSlider = Children.Find <SliderWidget>("DragDistanceSlider"); m_horizontalCreativeFlightPanel.IsVisible = false; }