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; }
public Widget makeTextBox(Action <TextBoxWidget> ac, string text = "") { CanvasWidget canvasWidget = new CanvasWidget() { HorizontalAlignment = WidgetAlignment.Center }; RectangleWidget rectangleWidget = new RectangleWidget() { FillColor = Color.Black, OutlineColor = Color.White, Size = new Vector2(120, 30) }; StackPanelWidget stack = new StackPanelWidget() { Direction = LayoutDirection.Vertical }; TextBoxWidget textBox = new TextBoxWidget() { VerticalAlignment = WidgetAlignment.Center, Color = new Color(255, 255, 255), Margin = new Vector2(4f, 0f), Size = new Vector2(120, 30), MaximumLength = 256 }; textBox.FontScale = 0.7f; textBox.Text = text; textBox.TextChanged += ac; stack.Children.Add(textBox); canvasWidget.Children.Add(rectangleWidget); canvasWidget.Children.Add(stack); return(canvasWidget); }
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; } }
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"); }
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); }
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 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 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); }
public override void Update() { Keyboard.BackButtonQuitsApp = !MarketplaceManager.IsTrialMode; if (string.IsNullOrEmpty(m_versionString) || MarketplaceManager.IsTrialMode != m_versionStringTrial) { m_versionString = string.Format("Version {0}{1}", VersionsManager.Version, MarketplaceManager.IsTrialMode ? " (Day One)" : string.Empty); m_versionStringTrial = MarketplaceManager.IsTrialMode; } Children.Find("Buy").IsVisible = MarketplaceManager.IsTrialMode; Children.Find <LabelWidget>("Version").Text = m_versionString; RectangleWidget rectangleWidget = Children.Find <RectangleWidget>("Logo"); float num = 1f + 0.02f * MathUtils.Sin(1.5f * (float)MathUtils.Remainder(Time.FrameStartTime, 10000.0)); rectangleWidget.RenderTransform = Matrix.CreateTranslation((0f - rectangleWidget.ActualSize.X) / 2f, (0f - rectangleWidget.ActualSize.Y) / 2f, 0f) * Matrix.CreateScale(num, num, 1f) * Matrix.CreateTranslation(rectangleWidget.ActualSize.X / 2f, rectangleWidget.ActualSize.Y / 2f, 0f); if (Children.Find <ButtonWidget>("Play").IsClicked) { ScreensManager.SwitchScreen("Play"); } if (Children.Find <ButtonWidget>("Help").IsClicked) { ScreensManager.SwitchScreen("Help"); } if (Children.Find <ButtonWidget>("Content").IsClicked) { ScreensManager.SwitchScreen("Content"); } if (Children.Find <ButtonWidget>("Settings").IsClicked) { ScreensManager.SwitchScreen("Settings"); } if (Children.Find <ButtonWidget>("Buy").IsClicked) { AnalyticsManager.LogEvent("[MainMenuScreen] Clicked buy button"); MarketplaceManager.ShowMarketplace(); } if ((base.Input.Back && !Keyboard.BackButtonQuitsApp) || base.Input.IsKeyDownOnce(Key.Escape)) { if (MarketplaceManager.IsTrialMode) { ScreensManager.SwitchScreen("Nag"); } else { Window.Close(); } } }
public WorldOptionsScreen() { XElement node = ContentManager.Get <XElement>("Screens/WorldOptionsScreen"); LoadContents(this, node); m_creativeModePanel = Children.Find <Widget>("CreativeModePanel"); m_newWorldOnlyPanel = Children.Find <Widget>("NewWorldOnlyPanel"); m_continentTerrainPanel = Children.Find <Widget>("ContinentTerrainPanel"); m_islandTerrainPanel = Children.Find <Widget>("IslandTerrainPanel"); m_islandSizeNS = Children.Find <SliderWidget>("IslandSizeNS"); m_islandSizeEW = Children.Find <SliderWidget>("IslandSizeEW"); m_flatTerrainPanel = Children.Find <Widget>("FlatTerrainPanel"); m_blocksTextureIcon = Children.Find <RectangleWidget>("BlocksTextureIcon"); m_blocksTextureLabel = Children.Find <LabelWidget>("BlocksTextureLabel"); m_blocksTextureDetails = Children.Find <LabelWidget>("BlocksTextureDetails"); m_blocksTextureButton = Children.Find <ButtonWidget>("BlocksTextureButton"); m_seaLevelOffsetSlider = Children.Find <SliderWidget>("SeaLevelOffset"); m_temperatureOffsetSlider = Children.Find <SliderWidget>("TemperatureOffset"); m_humidityOffsetSlider = Children.Find <SliderWidget>("HumidityOffset"); m_biomeSizeSlider = Children.Find <SliderWidget>("BiomeSize"); m_paletteButton = Children.Find <ButtonWidget>("Palette"); m_supernaturalCreaturesButton = Children.Find <ButtonWidget>("SupernaturalCreatures"); m_friendlyFireButton = Children.Find <ButtonWidget>("FriendlyFire"); m_environmentBehaviorButton = Children.Find <ButtonWidget>("EnvironmentBehavior"); m_timeOfDayButton = Children.Find <ButtonWidget>("TimeOfDay"); m_weatherEffectsButton = Children.Find <ButtonWidget>("WeatherEffects"); m_adventureRespawnButton = Children.Find <ButtonWidget>("AdventureRespawn"); m_adventureSurvivalMechanicsButton = Children.Find <ButtonWidget>("AdventureSurvivalMechanics"); m_terrainGenerationButton = Children.Find <ButtonWidget>("TerrainGeneration"); m_flatTerrainLevelSlider = Children.Find <SliderWidget>("FlatTerrainLevel"); m_flatTerrainShoreRoughnessSlider = Children.Find <SliderWidget>("FlatTerrainShoreRoughness"); m_flatTerrainBlock = Children.Find <BlockIconWidget>("FlatTerrainBlock"); m_flatTerrainBlockLabel = Children.Find <LabelWidget>("FlatTerrainBlockLabel"); m_flatTerrainBlockButton = Children.Find <ButtonWidget>("FlatTerrainBlockButton"); m_flatTerrainMagmaOceanCheckbox = Children.Find <CheckboxWidget>("MagmaOcean"); m_descriptionLabel = Children.Find <LabelWidget>("Description"); m_islandSizeEW.MinValue = 0f; m_islandSizeEW.MaxValue = m_islandSizes.Length - 1; m_islandSizeEW.Granularity = 1f; m_islandSizeNS.MinValue = 0f; m_islandSizeNS.MaxValue = m_islandSizes.Length - 1; m_islandSizeNS.Granularity = 1f; m_biomeSizeSlider.MinValue = 0f; m_biomeSizeSlider.MaxValue = m_biomeSizes.Length - 1; m_biomeSizeSlider.Granularity = 1f; }
public DownloadContentFromLinkDialog() { XElement node = ContentManager.Get <XElement>("Dialogs/DownloadContentFromLinkDialog"); LoadContents(this, node); m_linkTextBoxWidget = Children.Find <TextBoxWidget>("DownloadContentFromLinkDialog.Link"); m_nameTextBoxWidget = Children.Find <TextBoxWidget>("DownloadContentFromLinkDialog.Name"); m_typeIconWidget = Children.Find <RectangleWidget>("DownloadContentFromLinkDialog.TypeIcon"); m_typeLabelWidget = Children.Find <LabelWidget>("DownloadContentFromLinkDialog.Type"); m_changeTypeButtonWidget = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.ChangeType"); m_downloadButtonWidget = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.Download"); m_cancelButtonWidget = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.Cancel"); m_linkTextBoxWidget.TextChanged += delegate { m_updateContentName = true; m_updateContentType = true; }; }
public Widget makeTextBox(string title) { CanvasWidget canvasWidget = new CanvasWidget() { Margin = new Vector2(10, 0) }; RectangleWidget rectangleWidget = new RectangleWidget() { FillColor = Color.Black, OutlineColor = Color.White, Size = new Vector2(float.PositiveInfinity, 80) }; StackPanelWidget stack = new StackPanelWidget() { Direction = LayoutDirection.Horizontal }; LabelWidget label = new LabelWidget() { HorizontalAlignment = WidgetAlignment.Near, VerticalAlignment = WidgetAlignment.Near, Text = title, Margin = new Vector2(1f, 1f) }; TextBoxWidget textBox = new TextBoxWidget() { VerticalAlignment = WidgetAlignment.Center, HorizontalAlignment = WidgetAlignment.Stretch, Color = new Color(255, 255, 255), Margin = new Vector2(4f, 0f), Size = new Vector2(float.PositiveInfinity, 80) }; if (title == "用户名:") { txa = textBox; } if (title == "密 码:") { txb = textBox; } stack.Children.Add(label); stack.Children.Add(textBox); canvasWidget.Children.Add(rectangleWidget); canvasWidget.Children.Add(stack); return(canvasWidget); }
public EditMemeryDialogB(MemoryBankData memoryBankData, Action onCancel) { memory = memoryBankData; Data.Clear(); Data.AddRange(memory.Data); CanvasWidget canvasWidget = new CanvasWidget() { Size = new Vector2(600f, float.PositiveInfinity), HorizontalAlignment = WidgetAlignment.Center, VerticalAlignment = WidgetAlignment.Center }; RectangleWidget rectangleWidget = new RectangleWidget() { FillColor = new Color(0, 0, 0, 255), OutlineColor = new Color(128, 128, 128, 128), OutlineThickness = 2 }; StackPanelWidget stackPanel = new StackPanelWidget() { Direction = LayoutDirection.Vertical }; LabelWidget labelWidget = new LabelWidget() { Text = "M 板编辑器", HorizontalAlignment = WidgetAlignment.Center, Margin = new Vector2(0, 10) }; StackPanelWidget stackPanelWidget = new StackPanelWidget() { Direction = LayoutDirection.Horizontal, HorizontalAlignment = WidgetAlignment.Near, VerticalAlignment = WidgetAlignment.Near, Margin = new Vector2(10f, 10f) }; Children.Add(canvasWidget); canvasWidget.Children.Add(rectangleWidget); canvasWidget.Children.Add(stackPanel); stackPanel.Children.Add(labelWidget); stackPanel.Children.Add(stackPanelWidget); stackPanelWidget.Children.Add(initData()); stackPanelWidget.Children.Add(initButton()); MainView = stackPanel; this.onCancel = onCancel; lastvalue = memory.Read(0); }
public LoginDialog() { CanvasWidget canvasWidget = new CanvasWidget() { Size = new Vector2(600f, 240f), HorizontalAlignment = WidgetAlignment.Center, VerticalAlignment = WidgetAlignment.Center }; RectangleWidget rectangleWidget = new RectangleWidget() { FillColor = new Color(0, 0, 0, 255), OutlineColor = new Color(128, 128, 128, 128), OutlineThickness = 2 }; StackPanelWidget stackPanelWidget = new StackPanelWidget() { Direction = LayoutDirection.Vertical, HorizontalAlignment = WidgetAlignment.Center, VerticalAlignment = WidgetAlignment.Near, Margin = new Vector2(10f, 10f) }; Children.Add(canvasWidget); canvasWidget.Children.Add(rectangleWidget); canvasWidget.Children.Add(stackPanelWidget); MainView = stackPanelWidget; MainView.Children.Add(tip); MainView.Children.Add(makeTextBox("用户名:")); MainView.Children.Add(makeTextBox("密 码:")); MainView.Children.Add(makeButton()); }
public InventorySlotWidget() { base.Size = new Vector2(72f, 72f); WidgetsList children = Children; Widget[] array = new Widget[7]; BevelledRectangleWidget obj = new BevelledRectangleWidget { BevelSize = -2f, DirectionalLight = 0.15f, CenterColor = Color.Transparent }; BevelledRectangleWidget bevelledRectangleWidget = obj; m_rectangleWidget = obj; array[0] = bevelledRectangleWidget; RectangleWidget obj2 = new RectangleWidget { FillColor = Color.Transparent, OutlineColor = Color.Transparent }; RectangleWidget rectangleWidget = obj2; m_highlightWidget = obj2; array[1] = rectangleWidget; BlockIconWidget obj3 = new BlockIconWidget { HorizontalAlignment = WidgetAlignment.Center, VerticalAlignment = WidgetAlignment.Center, Margin = new Vector2(2f, 2f) }; BlockIconWidget blockIconWidget = obj3; m_blockIconWidget = obj3; array[2] = blockIconWidget; LabelWidget obj4 = new LabelWidget { Font = ContentManager.Get <BitmapFont>("Fonts/Pericles"), FontScale = 1f, HorizontalAlignment = WidgetAlignment.Far, VerticalAlignment = WidgetAlignment.Far, Margin = new Vector2(6f, 2f) }; LabelWidget labelWidget = obj4; m_countWidget = obj4; array[3] = labelWidget; ValueBarWidget obj5 = new ValueBarWidget { LayoutDirection = LayoutDirection.Vertical, HorizontalAlignment = WidgetAlignment.Near, VerticalAlignment = WidgetAlignment.Far, BarsCount = 3, FlipDirection = true, LitBarColor = new Color(32, 128, 0), UnlitBarColor = new Color(24, 24, 24, 64), BarSize = new Vector2(12f, 12f), BarSubtexture = ContentManager.Get <Subtexture>("Textures/Atlas/ProgressBar"), Margin = new Vector2(4f, 4f) }; ValueBarWidget valueBarWidget = obj5; m_healthBarWidget = obj5; array[4] = valueBarWidget; StackPanelWidget obj6 = new StackPanelWidget { Direction = LayoutDirection.Horizontal, HorizontalAlignment = WidgetAlignment.Far, Margin = new Vector2(3f, 3f) }; WidgetsList children2 = obj6.Children; RectangleWidget obj7 = new RectangleWidget { Subtexture = ContentManager.Get <Subtexture>("Textures/Atlas/InteractiveItemOverlay"), Size = new Vector2(13f, 14f), FillColor = new Color(160, 160, 160), OutlineColor = Color.Transparent }; rectangleWidget = obj7; m_interactiveOverlayWidget = obj7; children2.Add(rectangleWidget); WidgetsList children3 = obj6.Children; RectangleWidget obj8 = new RectangleWidget { Subtexture = ContentManager.Get <Subtexture>("Textures/Atlas/EditItemOverlay"), Size = new Vector2(12f, 14f), FillColor = new Color(160, 160, 160), OutlineColor = Color.Transparent }; rectangleWidget = obj8; m_editOverlayWidget = obj8; children3.Add(rectangleWidget); WidgetsList children4 = obj6.Children; RectangleWidget obj9 = new RectangleWidget { Subtexture = ContentManager.Get <Subtexture>("Textures/Atlas/FoodItemOverlay"), Size = new Vector2(11f, 14f), FillColor = new Color(160, 160, 160), OutlineColor = Color.Transparent }; rectangleWidget = obj9; m_foodOverlayWidget = obj9; children4.Add(rectangleWidget); array[5] = obj6; LabelWidget obj10 = new LabelWidget { Text = "Split", Font = ContentManager.Get <BitmapFont>("Fonts/Pericles"), Color = new Color(255, 64, 0), HorizontalAlignment = WidgetAlignment.Near, VerticalAlignment = WidgetAlignment.Near, Margin = new Vector2(2f, 0f) }; labelWidget = obj10; m_splitLabelWidget = obj10; array[6] = labelWidget; children.Add(array); }