void InitControls() { // Create a CheckBox CheckBox checkBox = new CheckBox(); checkBox.Name = "CheckBox"; // Create a Button Button button = new Button(); button.Name = "Button"; button.MinHeight = 24; // Create a LineEdit LineEdit lineEdit = new LineEdit(); lineEdit.Name = "LineEdit"; lineEdit.MinHeight = 24; // Add controls to Window window.AddChild(checkBox); window.AddChild(button); window.AddChild(lineEdit); // Apply previously set default style checkBox.SetStyleAuto(null); button.SetStyleAuto(null); lineEdit.SetStyleAuto(null); }
public ActionMenu(ClientActionsComponent actionsComponent, ActionsUI actionsUI) { _actionsComponent = actionsComponent; _actionsUI = actionsUI; _actionManager = IoCManager.Resolve <ActionManager>(); _gameHud = IoCManager.Resolve <IGameHud>(); Title = Loc.GetString("Actions"); CustomMinimumSize = (300, 300); Contents.AddChild(new VBoxContainer { Children = { new HBoxContainer { Children = { (_searchBar = new LineEdit { StyleClasses ={ StyleNano.StyleClassActionSearchBox }, SizeFlagsHorizontal = SizeFlags.FillExpand, PlaceHolder = Loc.GetString("Search") }), (_filterButton = new MultiselectOptionButton <string>() { Label = Loc.GetString("Filter") }), } }, (_clearButton = new Button { Text = Loc.GetString("Clear"), }), (_filterLabel = new Label()), new ScrollContainer { //TODO: needed? CustomMinimumSize = new Vector2(200.0f, 0.0f), SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { (_resultsGrid = new GridContainer { MaxWidth = 300 }) } } } }); // populate filters from search tags var filterTags = new List <string>(); foreach (var action in _actionManager.EnumerateActions()) { filterTags.AddRange(action.Filters); } // special one to filter to only include item actions filterTags.Add(ItemTag); filterTags.Add(NotItemTag); filterTags.Add(InstantActionTag); filterTags.Add(ToggleActionTag); filterTags.Add(TargetActionTag); filterTags.Add(AllActionsTag); filterTags.Add(GrantedActionsTag); foreach (var tag in filterTags.Distinct().OrderBy(tag => tag)) { _filterButton.AddItem(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tag), tag); } UpdateFilterLabel(); _dragShadow = new TextureRect { CustomMinimumSize = (64, 64), Stretch = TextureRect.StretchMode.Scale, Visible = false }; UserInterfaceManager.PopupRoot.AddChild(_dragShadow); LayoutContainer.SetSize(_dragShadow, (64, 64)); _dragDropHelper = new DragDropHelper <ActionMenuItem>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag); }
public override void OnEnter() { IsInitialized = true; DefaultFont = Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input); MainWindow = new Panel(GUI, GUI.RootComponent) { LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2) }; Layout = new GridLayout(GUI, MainWindow, 10, 3); Label title = new Label(GUI, Layout, "Create a Company", GUI.TitleFont); Layout.SetComponentPosition(title, 0, 0, 1, 1); Label companyNameLabel = new Label(GUI, Layout, "Name", GUI.DefaultFont); Layout.SetComponentPosition(companyNameLabel, 0, 1, 1, 1); CompanyNameEdit = new LineEdit(GUI, Layout, CompanyName); Layout.SetComponentPosition(CompanyNameEdit, 1, 1, 1, 1); Button randomButton = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Randomly generate a name" }; Layout.SetComponentPosition(randomButton, 2, 1, 1, 1); randomButton.OnClicked += randomButton_OnClicked; Label companyMottoLabel = new Label(GUI, Layout, "Motto", GUI.DefaultFont); Layout.SetComponentPosition(companyMottoLabel, 0, 2, 1, 1); CompanyMottoEdit = new LineEdit(GUI, Layout, CompanyMotto); Layout.SetComponentPosition(CompanyMottoEdit, 1, 2, 1, 1); CompanyMottoEdit.OnTextModified += companyMottoEdit_OnTextModified; CompanyNameEdit.OnTextModified += companyNameEdit_OnTextModified; Button randomButton2 = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Randomly generate a motto" }; Layout.SetComponentPosition(randomButton2, 2, 2, 1, 1); randomButton2.OnClicked += randomButton2_OnClicked; Label companyLogoLabel = new Label(GUI, Layout, "Logo", GUI.DefaultFont); Layout.SetComponentPosition(companyLogoLabel, 0, 3, 1, 1); CompanyLogoPanel = new ImagePanel(GUI, Layout, CompanyLogo) { KeepAspectRatio = true, AssetName = CompanyLogo.AssetName }; Layout.SetComponentPosition(CompanyLogoPanel, 1, 3, 1, 1); Button selectorButton = new Button(GUI, Layout, "Select", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Load a custom company logo" }; Layout.SetComponentPosition(selectorButton, 2, 3, 1, 1); selectorButton.OnClicked += selectorButton_OnClicked; Label companyColorLabel = new Label(GUI, Layout, "Color", GUI.DefaultFont); Layout.SetComponentPosition(companyColorLabel, 0, 4, 1, 1); CompanyColorPanel = new ColorPanel(GUI, Layout) { CurrentColor = DefaultColor }; Layout.SetComponentPosition(CompanyColorPanel, 1, 4, 1, 1); CompanyColorPanel.OnClicked += CompanyColorPanel_OnClicked; Button apply = new Button(GUI, Layout, "Continue", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check)); Layout.SetComponentPosition(apply, 2, 9, 1, 1); apply.OnClicked += apply_OnClicked; Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow)); Layout.SetComponentPosition(back, 1, 9, 1, 1); back.OnClicked += back_onClicked; base.OnEnter(); }
protected override Control MakeUI(object?value) { var hBoxContainer = new HBoxContainer { CustomMinimumSize = new Vector2(240, 0), }; var x = new LineEdit { Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand, PlaceHolder = "X", ToolTip = "X" }; hBoxContainer.AddChild(x); var y = new LineEdit { Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand, PlaceHolder = "Y", ToolTip = "Y" }; hBoxContainer.AddChild(y); if (_intVec) { var vec = (Vector2i)value !; x.Text = vec.X.ToString(CultureInfo.InvariantCulture); y.Text = vec.Y.ToString(CultureInfo.InvariantCulture); } else { var vec = (Vector2)value !; x.Text = vec.X.ToString(CultureInfo.InvariantCulture); y.Text = vec.Y.ToString(CultureInfo.InvariantCulture); } void OnEntered(LineEdit.LineEditEventArgs e) { if (_intVec) { var xVal = int.Parse(x.Text, CultureInfo.InvariantCulture); var yVal = int.Parse(y.Text, CultureInfo.InvariantCulture); ValueChanged(new Vector2i(xVal, yVal)); } else { var xVal = float.Parse(x.Text, CultureInfo.InvariantCulture); var yVal = float.Parse(y.Text, CultureInfo.InvariantCulture); ValueChanged(new Vector2(xVal, yVal)); } } if (!ReadOnly) { x.OnTextEntered += OnEntered; y.OnTextEntered += OnEntered; } return(hBoxContainer); }
public ReviewingLineOrderEvent(LineEdit line, MultiLineTextEdit multiLineText, Guid reviewMethodId) : base(line) { AddReviewMethodId(reviewMethodId); AddDetail(HistoryResources.Key_MultiLineTextId, multiLineText.Id); }
private void PerformLayout() { LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); var layout = new LayoutContainer(); AddChild(layout); var vBox = new VBoxContainer { StyleIdentifier = "mainMenuVBox" }; layout.AddChild(vBox); LayoutContainer.SetAnchorPreset(vBox, LayoutContainer.LayoutPreset.TopRight); LayoutContainer.SetMarginRight(vBox, -25); LayoutContainer.SetMarginTop(vBox, 30); LayoutContainer.SetGrowHorizontal(vBox, LayoutContainer.GrowDirection.Begin); var logoTexture = _resourceCache.GetResource <TextureResource>("/Textures/Logo/logo.png"); var logo = new TextureRect { Texture = logoTexture, Stretch = TextureRect.StretchMode.KeepCentered, }; vBox.AddChild(logo); var userNameHBox = new HBoxContainer { SeparationOverride = 4 }; vBox.AddChild(userNameHBox); userNameHBox.AddChild(new Label { Text = "Username:"******"player.name"); UserNameBox = new LineEdit { Text = currentUserName, PlaceHolder = "Username", SizeFlagsHorizontal = SizeFlags.FillExpand }; userNameHBox.AddChild(UserNameBox); JoinPublicServerButton = new Button { Text = "Join Public Server", StyleIdentifier = "mainMenu", TextAlign = Label.AlignMode.Center, #if !FULL_RELEASE Disabled = true, ToolTip = "Cannot connect to public server with a debug build." #endif }; vBox.AddChild(JoinPublicServerButton); // Separator. vBox.AddChild(new Control { CustomMinimumSize = (0, 2) });
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); itemTooltipElements = GetTree().GetNodesInGroup("ItemTooltip"); menu = GetNode <Control>(MenuPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <TextureProgress>(MutationPointsBarPath); mutationPointsSubtractBar = GetNode <TextureProgress>(MutationPointsSubtractBarPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionBar = GetNode <SegmentedBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <SegmentedBar>(ATPConsumptionBarPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchDepth = GetNode <Label>(PatchDepthPath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesList = GetNode <VBoxContainer>(SpeciesListPath); physicalConditionsBox = GetNode <Control>(PhysicalConditionsBoxPath); atmosphericConditionsBox = GetNode <Control>(AtmosphericConditionsBoxPath); compoundsBox = GetNode <Control>(CompoundsBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); physicalConditionsButton = GetNode <Control>(PhysicalConditionsButtonPath); atmosphericConditionsButton = GetNode <Control>(AtmosphericConditionsButtonPath); compoundsButton = GetNode <Control>(CompoundsBoxButtonPath); speciesListButton = GetNode <Control>(SpeciesListButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); invalidBarTexture = GD.Load <Texture>("res://assets/textures/gui/bevel/MpBarInvalid.png"); subractBarTexture = GD.Load <Texture>("res://assets/textures/gui/bevel/MpBarSubtract.png"); mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); }; atpProductionBar.SelectedType = SegmentedBar.Type.ATP; atpProductionBar.IsProduction = true; atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP; // Fade out for that smooth satisfying transition TransitionManager.Instance.AddScreenFade(Fade.FadeType.FadeOut, 0.5f); TransitionManager.Instance.StartTransitions(null, string.Empty); }
private async void PopulateServerComponents(bool request = true) { _serverComponents.DisposeAllChildren(); _serverComponents.AddChild(_serverComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("view-variable-instance-entity-server-components-search-bar-placeholder"), HorizontalExpand = true, }); _serverComponents.AddChild(_serverComponentsAddButton = new Button() { Text = Loc.GetString("view-variable-instance-entity-server-components-add-component-button-placeholder"), HorizontalExpand = true, }); _serverComponentsSearchBar.OnTextChanged += OnServerComponentsSearchBarChanged; _serverComponentsAddButton.OnPressed += OnServerComponentsAddButtonPressed; if (!request || _entitySession == null) { return; } var componentsBlob = await ViewVariablesManager.RequestData <ViewVariablesBlobEntityComponents>(_entitySession, new ViewVariablesRequestEntityComponents()); componentsBlob.ComponentTypes.Sort(); var componentTypes = componentsBlob.ComponentTypes.AsEnumerable(); if (!string.IsNullOrEmpty(_serverComponentsSearchBar.Text)) { componentTypes = componentTypes .Where(t => t.Stringified.Contains(_serverComponentsSearchBar.Text, StringComparison.InvariantCultureIgnoreCase)); } componentTypes = componentTypes.OrderBy(t => t.Stringified); foreach (var componentType in componentTypes) { var button = new Button { Text = componentType.Stringified, TextAlign = Label.AlignMode.Left }; var removeButton = new TextureButton() { StyleClasses = { DefaultWindow.StyleClassWindowCloseButton }, HorizontalAlignment = HAlignment.Right }; button.OnPressed += _ => { ViewVariablesManager.OpenVV( new ViewVariablesComponentSelector(_entity, componentType.FullName)); }; removeButton.OnPressed += _ => { // We send a command to remove the component. IoCManager.Resolve <IClientConsoleHost>().RemoteExecuteCommand(null, $"rmcomp {_entity} {componentType.ComponentName}"); PopulateServerComponents(); }; button.AddChild(removeButton); _serverComponents.AddChild(button); } }
private async void _tabsOnTabChanged(int tab) { if (_serverLoaded || tab != TabServerComponents && tab != TabServerVars) { return; } _serverLoaded = true; if (_entitySession == null) { try { _entitySession = await ViewVariablesManager.RequestSession(new ViewVariablesEntitySelector(_entity.Uid)); } catch (SessionDenyException e) { var text = $"Server denied VV request: {e.Reason}"; _serverVariables.AddChild(new Label { Text = text }); _serverComponents.AddChild(new Label { Text = text }); return; } _membersBlob = await ViewVariablesManager.RequestData <ViewVariablesBlobMembers>(_entitySession, new ViewVariablesRequestMembers()); } var otherStyle = false; var first = true; foreach (var(groupName, groupMembers) in _membersBlob !.MemberGroups) { ViewVariablesTraitMembers.CreateMemberGroupHeader(ref first, groupName, _serverVariables); foreach (var propertyData in groupMembers) { var propertyEdit = new ViewVariablesPropertyControl(ViewVariablesManager, _resourceCache); propertyEdit.SetStyle(otherStyle = !otherStyle); var editor = propertyEdit.SetProperty(propertyData); var selectorChain = new object[] { new ViewVariablesMemberSelector(propertyData.PropertyIndex) }; editor.OnValueChanged += o => ViewVariablesManager.ModifyRemote(_entitySession, selectorChain, o); editor.WireNetworkSelector(_entitySession.SessionId, selectorChain); _serverVariables.AddChild(propertyEdit); } } var componentsBlob = await ViewVariablesManager.RequestData <ViewVariablesBlobEntityComponents>(_entitySession, new ViewVariablesRequestEntityComponents()); _serverComponents.DisposeAllChildren(); _serverComponents.AddChild(_serverComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand }); _serverComponentsSearchBar.OnTextChanged += OnServerComponentsSearchBarChanged; componentsBlob.ComponentTypes.Sort(); var componentTypes = componentsBlob.ComponentTypes.AsEnumerable(); if (!string.IsNullOrEmpty(_serverComponentsSearchBar.Text)) { componentTypes = componentTypes .Where(t => t.Stringified.Contains(_serverComponentsSearchBar.Text, StringComparison.InvariantCultureIgnoreCase)); } componentTypes = componentTypes.OrderBy(t => t.Stringified); foreach (var componentType in componentTypes) { var button = new Button { Text = componentType.Stringified, TextAlign = Label.AlignMode.Left }; button.OnPressed += args => { ViewVariablesManager.OpenVV( new ViewVariablesComponentSelector(_entity.Uid, componentType.FullName)); }; _serverComponents.AddChild(button); } }
void CreateUI() { IsLogoVisible = false; // We need the full rendering window var graphics = Graphics; UIElement root = UI.Root; var cache = ResourceCache; XmlFile uiStyle = cache.GetXmlFile("UI/DefaultStyle.xml"); // Set style to the UI root so that elements will inherit it root.SetDefaultStyle(uiStyle); Font font = cache.GetFont("Fonts/Anonymous Pro.ttf"); chatHistoryText = new Text(); chatHistoryText.SetFont(font, 12); root.AddChild(chatHistoryText); buttonContainer = new UIElement(); root.AddChild(buttonContainer); buttonContainer.SetFixedSize(graphics.Width, 20); buttonContainer.SetPosition(0, graphics.Height - 20); buttonContainer.LayoutMode = LayoutMode.Horizontal; textEdit = new LineEdit(); textEdit.SetStyleAuto(null); buttonContainer.AddChild(textEdit); sendButton = CreateButton("Send", 70); connectButton = CreateButton("Connect", 90); disconnectButton = CreateButton("Disconnect", 100); startServerButton = CreateButton("Start Server", 110); UpdateButtons(); // No viewports or scene is defined. However, the default zone's fog color controls the fill color Renderer.DefaultZone.FogColor = new Color(0.0f, 0.0f, 0.1f); }
public void NEW_EDIT_BEGINSAVE_GET_DELETE_GET() { //INITIALIZE ERRORS TO EXCEPTION, BECAUSE EXPECT THEM TO BE NULL LATER Exception newError = new Exception(); Exception savedError = new Exception(); Exception gottenError = new Exception(); Exception deletedError = new Exception(); //INITIALIZE CONFIRM TO NULL, BECAUSE WE EXPECT THIS TO BE AN ERROR LATER Exception deleteConfirmedError = null; LineEdit newLineEdit = null; LineEdit savedLineEdit = null; LineEdit gottenLineEdit = null; LineEdit deletedLineEdit = null; //INITIALIZE TO EMPTY Line EDIT, BECAUSE WE EXPECT THIS TO BE NULL LATER LineEdit deleteConfirmedLineEdit = new LineEdit(); var isNewed = false; var isSaved = false; var isGotten = false; var isDeleted = false; var isDeleteConfirmed = false; //NEW LineEdit.NewLineEdit((s, r) => { newError = r.Error; if (newError != null) throw newError; newLineEdit = r.Object; isNewed = true; //EDIT newLineEdit.Phrase.Text = "TestLine.PhraseText NEW_EDIT_BEGINSAVE_GET"; newLineEdit.Phrase.Language = _ServerEnglishLang; newLineEdit.LineNumber = 0; Assert.AreEqual(SeedData.Ton.TestValidUsername, newLineEdit.Username); //SAVE newLineEdit.BeginSave((s2, r2) => { savedError = r2.Error; if (savedError != null) throw savedError; savedLineEdit = (LineEdit)r2.NewObject; isSaved = true; //GET (CONFIRM SAVE) LineEdit.GetLineEdit(savedLineEdit.Id, (s3, r3) => { gottenError = r3.Error; if (gottenError != null) throw gottenError; gottenLineEdit = r3.Object; isGotten = true; //DELETE (MARKS DELETE. SAVE INITIATES ACTUAL DELETE IN DB) gottenLineEdit.Delete(); gottenLineEdit.BeginSave((s4, r4) => { deletedError = r4.Error; if (deletedError != null) throw deletedError; deletedLineEdit = (LineEdit)r4.NewObject; LineEdit.GetLineEdit(deletedLineEdit.Id, (s5, r5) => { var debugExecutionLocation = Csla.ApplicationContext.ExecutionLocation; var debugLogicalExecutionLocation = Csla.ApplicationContext.LogicalExecutionLocation; deleteConfirmedError = r5.Error; if (deleteConfirmedError != null) { isDeleteConfirmed = true; throw new ExpectedException(deleteConfirmedError); } deleteConfirmedLineEdit = r5.Object; }); }); }); }); }); EnqueueConditional(() => isNewed); EnqueueConditional(() => isSaved); EnqueueConditional(() => isGotten); EnqueueConditional(() => isDeleted); EnqueueConditional(() => isDeleteConfirmed); EnqueueCallback( () => { Assert.IsNull(newError); }, () => { Assert.IsNull(savedError); }, () => { Assert.IsNull(gottenError); }, () => { Assert.IsNull(deletedError); }, //WE EXPECT AN ERROR, AS WE TRIED A GET ON AN ID THAT SHOULD HAVE BEEN DELETED () => { Assert.IsNotNull(deleteConfirmedError); }, () => { Assert.IsNotNull(newLineEdit); }, () => { Assert.IsNotNull(savedLineEdit); }, () => { Assert.IsNotNull(gottenLineEdit); }, () => { Assert.IsNotNull(deletedLineEdit); }, () => { Assert.IsNull(deleteConfirmedLineEdit); }); EnqueueTestComplete(); }
protected virtual void AddLineDetails(LineEdit line) { AddDetail(HistoryResources.Key_LineId, line.Id); }
public ViewingPhrasePartOfLineOnScreenEvent(PhraseEdit phrase, LineEdit line, TimeSpan duration) : base(phrase, duration) { AddLineDetails(line); }
public ViewingPhrasePartOfLineOnScreenEvent(PhraseEdit phrase, LineEdit line) : base(phrase) { AddLineDetails(line); }
public override void OnEnter() { DefaultFont = Game.Content.Load <SpriteFont>("Default"); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>("Title"), Game.Content.Load <SpriteFont>("Small"), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent); MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2); Layout = new GridLayout(GUI, MainWindow, 10, 4); Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true); Layout.SetComponentPosition(check, 0, 1, 1, 1); Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true); Layout.SetComponentPosition(check2, 0, 2, 1, 1); Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(apply, 2, 9, 1, 1); Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(back, 3, 9, 1, 1); Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont); Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1); sliderLabel.Alignment = Drawer2D.Alignment.Right; Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer); Layout.SetComponentPosition(slider, 1, 3, 1, 1); Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont); comboLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1); ComboBox combo = new ComboBox(GUI, Layout); combo.AddValue("Foo"); combo.AddValue("Bar"); combo.AddValue("Baz"); combo.AddValue("Quz"); combo.CurrentValue = "Foo"; Layout.SetComponentPosition(combo, 1, 4, 1, 1); back.OnClicked += back_OnClicked; GroupBox groupBox = new GroupBox(GUI, Layout, ""); Layout.SetComponentPosition(groupBox, 2, 1, 2, 6); Layout.UpdateSizes(); /* * Texture2D Image = Game.Content.Load<Texture2D>("pine"); * string[] tags = {""}; * DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags)); * image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height); * * Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont); * imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height); * imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left; */ GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2); DragManager dragManager = new DragManager(); DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32); DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32); groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1); groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1); Layout.UpdateSizes(); groupLayout.UpdateSizes(); dragGrid.SetupLayout(); dragGrid2.SetupLayout(); foreach (Resource r in ResourceLibrary.Resources.Values) { GItem gitem = new GItem(r, r.Image, r.Tint, 0, 32, 2, 1); gitem.CurrentAmount = 2; dragGrid.AddItem(gitem); } ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f); Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont); progressLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1); Layout.SetComponentPosition(progress, 1, 5, 1, 1); LineEdit line = new LineEdit(GUI, Layout, ""); Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont); lineLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1); Layout.SetComponentPosition(line, 1, 6, 1, 1); base.OnEnter(); }
public override void Initialize(SS14Window window, object obj) { _entity = (IEntity)obj; var scrollContainer = new ScrollContainer(); //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true); window.Contents.AddChild(scrollContainer); var vBoxContainer = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, }; scrollContainer.AddChild(vBoxContainer); // Handle top bar displaying type and ToString(). { Control top; var stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified); if (typeStringified != "") { //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10); // Custom ToString() implementation. var headBox = new VBoxContainer { SeparationOverride = 0 }; headBox.AddChild(new Label { Text = stringified, ClipText = true }); headBox.AddChild(new Label { Text = typeStringified, // FontOverride = smallFont, FontColorOverride = Color.DarkGray, ClipText = true }); top = headBox; } else { top = new Label { Text = stringified }; } if (_entity.TryGetComponent(out ISpriteComponent? sprite)) { var hBox = new HBoxContainer(); top.SizeFlagsHorizontal = SizeFlags.FillExpand; hBox.AddChild(top); hBox.AddChild(new SpriteView { Sprite = sprite }); vBoxContainer.AddChild(hBox); } else { vBoxContainer.AddChild(top); } } _tabs = new TabContainer(); _tabs.OnTabChanged += _tabsOnTabChanged; vBoxContainer.AddChild(_tabs); var clientVBox = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(clientVBox); _tabs.SetTabTitle(TabClientVars, "Client Variables"); var first = true; foreach (var group in LocalPropertyList(obj, ViewVariablesManager, _resourceCache)) { ViewVariablesTraitMembers.CreateMemberGroupHeader( ref first, TypeAbbreviation.Abbreviate(group.Key), clientVBox); foreach (var control in group) { clientVBox.AddChild(control); } } _clientComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_clientComponents); _tabs.SetTabTitle(TabClientComponents, "Client Components"); _clientComponents.AddChild(_clientComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand }); _clientComponentsSearchBar.OnTextChanged += OnClientComponentsSearchBarChanged; // See engine#636 for why the Distinct() call. var componentList = _entity.GetAllComponents().OrderBy(c => c.GetType().ToString()); foreach (var component in componentList) { var button = new Button { Text = TypeAbbreviation.Abbreviate(component.GetType()), TextAlign = Label.AlignMode.Left }; button.OnPressed += args => { ViewVariablesManager.OpenVV(component); }; _clientComponents.AddChild(button); } if (!_entity.Uid.IsClientSide()) { _serverVariables = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverVariables); _tabs.SetTabTitle(TabServerVars, "Server Variables"); _serverComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverComponents); _tabs.SetTabTitle(TabServerComponents, "Server Components"); _serverComponents.AddChild(_serverComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand }); _serverComponentsSearchBar.OnTextChanged += OnServerComponentsSearchBarChanged; } }
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IEntityManager entityManager) { _random = IoCManager.Resolve <IRobustRandom>(); _preferencesManager = preferencesManager; var hbox = new HBoxContainer(); AddChild(hbox); #region Left var margin = new MarginContainer { MarginTopOverride = 10, MarginBottomOverride = 10, MarginLeftOverride = 10, MarginRightOverride = 10 }; hbox.AddChild(margin); var vBox = new VBoxContainer(); margin.AddChild(vBox); var middleContainer = new HBoxContainer { SeparationOverride = 10 }; vBox.AddChild(middleContainer); var leftColumn = new VBoxContainer(); middleContainer.AddChild(leftColumn); #region Randomize { var panel = HighlightedContainer(); var randomizeEverythingButton = new Button { Text = Loc.GetString("Randomize everything") }; randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); }; panel.AddChild(randomizeEverythingButton); leftColumn.AddChild(panel); } #endregion Randomize #region Name { var panel = HighlightedContainer(); var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; var nameLabel = new Label { Text = Loc.GetString("Name:") }; _nameEdit = new LineEdit { CustomMinimumSize = (270, 0), SizeFlagsVertical = SizeFlags.ShrinkCenter }; _nameEdit.OnTextChanged += args => { SetName(args.Text); }; var nameRandomButton = new Button { Text = Loc.GetString("Randomize"), }; nameRandomButton.OnPressed += args => RandomizeName(); hBox.AddChild(nameLabel); hBox.AddChild(_nameEdit); hBox.AddChild(nameRandomButton); panel.AddChild(hBox); leftColumn.AddChild(panel); } #endregion Name var tabContainer = new TabContainer { SizeFlagsVertical = SizeFlags.FillExpand }; vBox.AddChild(tabContainer); #region Appearance { var appearanceVBox = new VBoxContainer(); tabContainer.AddChild(appearanceVBox); tabContainer.SetTabTitle(0, Loc.GetString("Appearance")); var sexAndAgeRow = new HBoxContainer { SeparationOverride = 10 }; appearanceVBox.AddChild(sexAndAgeRow); #region Sex { var panel = HighlightedContainer(); var hBox = new HBoxContainer(); var sexLabel = new Label { Text = Loc.GetString("Sex:") }; var sexButtonGroup = new ButtonGroup(); _sexMaleButton = new Button { Text = Loc.GetString("Male"), Group = sexButtonGroup }; _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); }; _sexFemaleButton = new Button { Text = Loc.GetString("Female"), Group = sexButtonGroup }; _sexFemaleButton.OnPressed += args => { SetSex(Sex.Female); }; hBox.AddChild(sexLabel); hBox.AddChild(_sexMaleButton); hBox.AddChild(_sexFemaleButton); panel.AddChild(hBox); sexAndAgeRow.AddChild(panel); } #endregion Sex #region Age { var panel = HighlightedContainer(); var hBox = new HBoxContainer(); var ageLabel = new Label { Text = Loc.GetString("Age:") }; _ageEdit = new LineEdit { CustomMinimumSize = (40, 0) }; _ageEdit.OnTextChanged += args => { if (!int.TryParse(args.Text, out var newAge)) { return; } SetAge(newAge); }; hBox.AddChild(ageLabel); hBox.AddChild(_ageEdit); panel.AddChild(hBox); sexAndAgeRow.AddChild(panel); } #endregion Age #region Hair { var panel = HighlightedContainer(); panel.SizeFlagsHorizontal = SizeFlags.None; var hairHBox = new HBoxContainer(); _hairPicker = new HairStylePicker(); _hairPicker.Populate(); _hairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairStyleName(newStyle)); IsDirty = true; }; _hairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairColor(newColor)); IsDirty = true; }; _facialHairPicker = new FacialHairStylePicker(); _facialHairPicker.Populate(); _facialHairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairStyleName(newStyle)); IsDirty = true; }; _facialHairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairColor(newColor)); IsDirty = true; }; hairHBox.AddChild(_hairPicker); hairHBox.AddChild(_facialHairPicker); panel.AddChild(hairHBox); appearanceVBox.AddChild(panel); } #endregion Hair } #endregion #region Jobs { var jobList = new VBoxContainer(); var jobVBox = new VBoxContainer { Children = { (_preferenceUnavailableButton = new OptionButton()), new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, Children = { jobList } } } }; tabContainer.AddChild(jobVBox); tabContainer.SetTabTitle(1, Loc.GetString("Jobs")); _preferenceUnavailableButton.AddItem( Loc.GetString("Stay in lobby if preference unavailable."), (int)PreferenceUnavailableMode.StayInLobby); _preferenceUnavailableButton.AddItem( Loc.GetString("Be an {0} if preference unavailable.", Loc.GetString(SharedGameTicker.OverflowJobName)), (int)PreferenceUnavailableMode.SpawnAsOverflow); _preferenceUnavailableButton.OnItemSelected += args => { _preferenceUnavailableButton.SelectId(args.Id); Profile = Profile.WithPreferenceUnavailable((PreferenceUnavailableMode)args.Id); IsDirty = true; }; _jobPriorities = new List <JobPrioritySelector>(); foreach (var job in prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name)) { var selector = new JobPrioritySelector(job); jobList.AddChild(selector); _jobPriorities.Add(selector); selector.PriorityChanged += priority => { Profile = Profile.WithJobPriority(job.ID, priority); IsDirty = true; if (priority == JobPriority.High) { // Lower any other high priorities to medium. foreach (var jobSelector in _jobPriorities) { if (jobSelector != selector && jobSelector.Priority == JobPriority.High) { jobSelector.Priority = JobPriority.Medium; Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium); } } } }; } } #endregion #region Antags { var antagList = new VBoxContainer(); var antagVBox = new VBoxContainer { Children = { new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, Children = { antagList } } } }; tabContainer.AddChild(antagVBox); tabContainer.SetTabTitle(2, Loc.GetString("Antags")); _antagPreferences = new List <AntagPreferenceSelector>(); foreach (var antag in prototypeManager.EnumeratePrototypes <AntagPrototype>().OrderBy(a => a.Name)) { if (!antag.SetPreference) { continue; } var selector = new AntagPreferenceSelector(antag); antagList.AddChild(selector); _antagPreferences.Add(selector); selector.PreferenceChanged += preference => { Profile = Profile.WithAntagPreference(antag.ID, preference); IsDirty = true; }; } } #endregion var rightColumn = new VBoxContainer(); middleContainer.AddChild(rightColumn); #region Import/Export { var panelContainer = HighlightedContainer(); var hBox = new HBoxContainer(); var importButton = new Button { Text = Loc.GetString("Import"), Disabled = true, ToolTip = "Not yet implemented!" }; var exportButton = new Button { Text = Loc.GetString("Export"), Disabled = true, ToolTip = "Not yet implemented!" }; hBox.AddChild(importButton); hBox.AddChild(exportButton); panelContainer.AddChild(hBox); rightColumn.AddChild(panelContainer); } #endregion Import/Export #region Save { var panel = HighlightedContainer(); _saveButton = new Button { Text = Loc.GetString("Save"), SizeFlagsHorizontal = SizeFlags.ShrinkCenter }; _saveButton.OnPressed += args => { Save(); }; panel.AddChild(_saveButton); rightColumn.AddChild(panel); } #endregion Save #endregion #region Right margin = new MarginContainer { MarginTopOverride = 10, MarginBottomOverride = 10, MarginLeftOverride = 10, MarginRightOverride = 10 }; hbox.AddChild(margin); vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, }; hbox.AddChild(vBox); #region Preview _previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace); var sprite = _previewDummy.GetComponent <SpriteComponent>(); // Front var box = new Control() { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1f, }; vBox.AddChild(box); _previewSprite = new SpriteView { Sprite = sprite, Scale = (6, 6), OverrideDirection = Direction.South, SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsStretchRatio = 1 }; box.AddChild(_previewSprite); // Side box = new Control() { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1f, }; vBox.AddChild(box); _previewSpriteSide = new SpriteView { Sprite = sprite, Scale = (6, 6), OverrideDirection = Direction.East, SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsStretchRatio = 1 }; box.AddChild(_previewSpriteSide); #endregion #endregion if (preferencesManager.ServerDataLoaded) { LoadServerData(); } preferencesManager.OnServerDataLoaded += LoadServerData; IsDirty = false; }
public async Task NEW_EDIT_BEGINSAVE_GET_DELETE_GET() { LineEdit newLineEdit = null; LineEdit savedLineEdit = null; LineEdit gottenLineEdit = null; LineEdit deletedLineEdit = null; //INITIALIZE TO EMPTY Line EDIT, BECAUSE WE EXPECT THIS TO BE NULL LATER LineEdit confirmDeleteLineEdit = new LineEdit(); var deleteIsConfirmed = false; var isAsyncComplete = false; var hasError = false; EnqueueConditional(() => isAsyncComplete); await Setup(); try { //NEW newLineEdit = await LineEdit.NewLineEditAsync(); //EDIT newLineEdit.Phrase.Text = "TestLine.PhraseText NEW_EDIT_BEGINSAVE_GET"; newLineEdit.Phrase.Language = _ServerEnglishLang; newLineEdit.LineNumber = 0; Assert.AreEqual(SeedData.Ton.TestValidUsername, newLineEdit.Username); //SAVE savedLineEdit = await newLineEdit.SaveAsync(); //GET (CONFIRM SAVE) gottenLineEdit = await LineEdit.GetLineEditAsync(savedLineEdit.Id); //DELETE (MARKS DELETE. SAVE INITIATES ACTUAL DELETE IN DB) gottenLineEdit.Delete(); deletedLineEdit = await gottenLineEdit.SaveAsync(); try { confirmDeleteLineEdit = await LineEdit.GetLineEditAsync(deletedLineEdit.Id); var debugExecutionLocation = Csla.ApplicationContext.ExecutionLocation; var debugLogicalExecutionLocation = Csla.ApplicationContext.LogicalExecutionLocation; } catch (Csla.DataPortalException dpex) { if (TestsHelper.IsIdNotFoundException(dpex)) deleteIsConfirmed = true; } } catch { hasError = true; } finally { EnqueueCallback( () => Assert.IsFalse(hasError), () => Assert.IsNotNull(newLineEdit), () => Assert.IsNotNull(savedLineEdit), () => Assert.IsNotNull(gottenLineEdit), () => Assert.IsNotNull(deletedLineEdit), () => Assert.AreEqual(Guid.Empty, confirmDeleteLineEdit.Id), () => Assert.AreEqual(Guid.Empty, confirmDeleteLineEdit.UserId), () => Assert.IsNull(confirmDeleteLineEdit.Phrase), () => Assert.IsNull(confirmDeleteLineEdit.User), () => Assert.IsTrue(deleteIsConfirmed) ); EnqueueTestComplete(); Teardown(); isAsyncComplete = true; } }
public override void _Ready() { // Options control buttons resetButton = GetNode <Button>(ResetButtonPath); saveButton = GetNode <Button>(SaveButtonPath); // Tab selector buttons graphicsButton = GetNode <Button>(GraphicsButtonPath); soundButton = GetNode <Button>(SoundButtonPath); performanceButton = GetNode <Button>(PerformanceButtonPath); inputsButton = GetNode <Button>(InputsButtonPath); miscButton = GetNode <Button>(MiscButtonPath); // Graphics graphicsTab = GetNode <Control>(GraphicsTabPath); vsync = GetNode <CheckBox>(VSyncPath); fullScreen = GetNode <CheckBox>(FullScreenPath); msaaResolution = GetNode <OptionButton>(MSAAResolutionPath); colourblindSetting = GetNode <OptionButton>(ColourblindSettingPath); chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath); chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath); // Sound soundTab = GetNode <Control>(SoundTabPath); masterVolume = GetNode <Slider>(MasterVolumePath); masterMuted = GetNode <CheckBox>(MasterMutedPath); musicVolume = GetNode <Slider>(MusicVolumePath); musicMuted = GetNode <CheckBox>(MusicMutedPath); ambianceVolume = GetNode <Slider>(AmbianceVolumePath); ambianceMuted = GetNode <CheckBox>(AmbianceMutedPath); sfxVolume = GetNode <Slider>(SFXVolumePath); sfxMuted = GetNode <CheckBox>(SFXMutedPath); guiVolume = GetNode <Slider>(GUIVolumePath); guiMuted = GetNode <CheckBox>(GUIMutedPath); languageSelection = GetNode <OptionButton>(LanguageSelectionPath); resetLanguageButton = GetNode <Button>(ResetLanguageButtonPath); LoadLanguages(languageSelection); // Performance performanceTab = GetNode <Control>(PerformanceTabPath); cloudInterval = GetNode <OptionButton>(CloudIntervalPath); cloudResolution = GetNode <OptionButton>(CloudResolutionPath); runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath); // Inputs inputsTab = GetNode <Control>(InputsTabPath); inputGroupList = GetNode <InputGroupList>(InputGroupListPath); inputGroupList.OnControlsChanged += OnControlsChanged; // Misc miscTab = GetNode <Control>(MiscTabPath); playIntro = GetNode <CheckBox>(PlayIntroPath); playMicrobeIntro = GetNode <CheckBox>(PlayMicrobeIntroPath); tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath); cheats = GetNode <CheckBox>(CheatsPath); autoSave = GetNode <CheckBox>(AutoSavePath); maxAutoSaves = GetNode <SpinBox>(MaxAutoSavesPath); maxQuickSaves = GetNode <SpinBox>(MaxQuickSavesPath); tutorialsEnabled = GetNode <CheckBox>(TutorialsEnabledPath); customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath); customUsername = GetNode <LineEdit>(CustomUsernamePath); backConfirmationBox = GetNode <AcceptDialog>(BackConfirmationBoxPath); defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath); errorAcceptBox = GetNode <AcceptDialog>(ErrorAcceptBoxPath); selectedOptionsTab = SelectedOptionsTab.Graphics; // We're only utilizing the AcceptDialog's auto resize functionality, // so hide the default Ok button since it's not needed backConfirmationBox.GetOk().Hide(); }
public ReviewingLineEvent(LineEdit line, Guid reviewMethodId) : base(line) { AddReviewMethodId(reviewMethodId); }
public Menu(AdminAddReagentEui eui) { _eui = eui; Title = Loc.GetString("admin-add-reagent-eui-title"); Contents.AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = { new GridContainer { Columns = 2, Children = { new Label { Text = Loc.GetString("admin-add-reagent-eui-current-volume-label") + " " }, (_volumeLabel = new Label()), new Label { Text = Loc.GetString("admin-add-reagent-eui-reagent-label") + " " }, (_reagentIdEdit = new LineEdit{ PlaceHolder = Loc.GetString("admin-add-reagent-eui-reagent-id-edit") }), new Label { Text = Loc.GetString("admin-add-reagent-eui-amount-label") + " " }, (_amountEdit = new LineEdit { PlaceHolder = Loc.GetString("admin-add-reagent-eui-amount-edit"), HorizontalExpand = true }), }, HorizontalExpand = true, VerticalExpand = true }, new BoxContainer { Orientation = LayoutOrientation.Horizontal, Children = { (_errorLabel = new Label { HorizontalExpand = true, ClipText = true }), (_addButton = new Button { Text = Loc.GetString("admin-add-reagent-eui-add-button") }), (_addCloseButton = new Button { Text = Loc.GetString("admin-add-reagent-eui-add-close-button") }) } } } }); _reagentIdEdit.OnTextChanged += _ => CheckErrors(); _amountEdit.OnTextChanged += _ => CheckErrors(); _addButton.OnPressed += _ => DoAdd(false); _addCloseButton.OnPressed += _ => DoAdd(true); CheckErrors(); }
public override void OnEnter() { IsInitialized = true; DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input); MainWindow = new Panel(GUI, GUI.RootComponent) { LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2) }; Layout = new GridLayout(GUI, MainWindow, 10, 3); Label title = new Label(GUI, Layout, "Create a Company", GUI.TitleFont); Layout.SetComponentPosition(title, 0, 0, 1, 1); Label companyNameLabel = new Label(GUI, Layout, "Name", GUI.DefaultFont); Layout.SetComponentPosition(companyNameLabel, 0, 1, 1, 1); CompanyNameEdit = new LineEdit(GUI, Layout, CompanyName); Layout.SetComponentPosition(CompanyNameEdit, 1, 1, 1, 1); Button randomButton = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Randomly generate a name" }; Layout.SetComponentPosition(randomButton, 2, 1, 1, 1); randomButton.OnClicked += randomButton_OnClicked; Label companyMottoLabel = new Label(GUI, Layout, "Motto", GUI.DefaultFont); Layout.SetComponentPosition(companyMottoLabel, 0, 2, 1, 1); CompanyMottoEdit = new LineEdit(GUI, Layout, CompanyMotto); Layout.SetComponentPosition(CompanyMottoEdit, 1, 2, 1, 1); CompanyMottoEdit.OnTextModified += companyMottoEdit_OnTextModified; CompanyNameEdit.OnTextModified += companyNameEdit_OnTextModified; Button randomButton2 = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Randomly generate a motto" }; Layout.SetComponentPosition(randomButton2, 2, 2, 1, 1); randomButton2.OnClicked += randomButton2_OnClicked; Label companyLogoLabel = new Label(GUI, Layout, "Logo", GUI.DefaultFont); Layout.SetComponentPosition(companyLogoLabel, 0, 3, 1, 1); CompanyLogoPanel = new ImagePanel(GUI, Layout, CompanyLogo) { KeepAspectRatio = true, AssetName = CompanyLogo.AssetName }; Layout.SetComponentPosition(CompanyLogoPanel, 1, 3, 1, 1); Button selectorButton = new Button(GUI, Layout, "Select", GUI.DefaultFont, Button.ButtonMode.PushButton, null) { ToolTip = "Load a custom company logo" }; Layout.SetComponentPosition(selectorButton, 2, 3, 1, 1); selectorButton.OnClicked += selectorButton_OnClicked; Label companyColorLabel = new Label(GUI, Layout, "Color", GUI.DefaultFont); Layout.SetComponentPosition(companyColorLabel, 0, 4, 1, 1); CompanyColorPanel = new ColorPanel(GUI, Layout) {CurrentColor = DefaultColor}; Layout.SetComponentPosition(CompanyColorPanel, 1, 4, 1, 1); CompanyColorPanel.OnClicked += CompanyColorPanel_OnClicked; Button apply = new Button(GUI, Layout, "Continue", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check)); Layout.SetComponentPosition(apply, 2, 9, 1, 1); apply.OnClicked += apply_OnClicked; Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow)); Layout.SetComponentPosition(back, 1, 9, 1, 1); back.OnClicked += back_onClicked; base.OnEnter(); }
public CargoConsoleMenu(CargoConsoleBoundUserInterface owner) { IoCManager.InjectDependencies(this); Owner = owner; if (Owner.RequestOnly) { Title = _loc.GetString("Cargo Request Console"); } else { Title = _loc.GetString("Cargo Shuttle Console"); } var rows = new VBoxContainer(); var accountName = new HBoxContainer(); var accountNameLabel = new Label { Text = _loc.GetString("Account Name: "), StyleClasses = { NanoStyle.StyleClassLabelKeyText } }; _accountNameLabel = new Label { Text = "None" //Owner.Bank.Account.Name }; accountName.AddChild(accountNameLabel); accountName.AddChild(_accountNameLabel); rows.AddChild(accountName); var points = new HBoxContainer(); var pointsLabel = new Label { Text = _loc.GetString("Points: "), StyleClasses = { NanoStyle.StyleClassLabelKeyText } }; _pointsLabel = new Label { Text = "0" //Owner.Bank.Account.Balance.ToString() }; points.AddChild(pointsLabel); points.AddChild(_pointsLabel); rows.AddChild(points); var shuttleStatus = new HBoxContainer(); var shuttleStatusLabel = new Label { Text = _loc.GetString("Shuttle Status: "), StyleClasses = { NanoStyle.StyleClassLabelKeyText } }; _shuttleStatusLabel = new Label { Text = _loc.GetString("Away") // Shuttle.Status }; shuttleStatus.AddChild(shuttleStatusLabel); shuttleStatus.AddChild(_shuttleStatusLabel); rows.AddChild(shuttleStatus); var buttons = new HBoxContainer(); CallShuttleButton = new Button() { Text = _loc.GetString("Call Shuttle"), TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand }; PermissionsButton = new Button() { Text = _loc.GetString("Permissions"), TextAlign = Button.AlignMode.Center }; buttons.AddChild(CallShuttleButton); buttons.AddChild(PermissionsButton); rows.AddChild(buttons); var category = new HBoxContainer(); _categories = new OptionButton { Prefix = _loc.GetString("Categories: "), SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 }; _searchBar = new LineEdit { PlaceHolder = _loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 }; category.AddChild(_categories); category.AddChild(_searchBar); rows.AddChild(category); var products = new ScrollContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 6 }; Products = new VBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand }; products.AddChild(Products); rows.AddChild(products); var requestsAndOrders = new PanelContainer { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 6, PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black } }; var orderScrollBox = new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand }; var rAndOVBox = new VBoxContainer(); var requestsLabel = new Label { Text = _loc.GetString("Requests") }; _requests = new VBoxContainer // replace with scroll box so that approval buttons can be added { StyleClasses = { "transparentItemList" }, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; var ordersLabel = new Label { Text = _loc.GetString("Orders") }; _orders = new VBoxContainer { StyleClasses = { "transparentItemList" }, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; rAndOVBox.AddChild(requestsLabel); rAndOVBox.AddChild(_requests); rAndOVBox.AddChild(ordersLabel); rAndOVBox.AddChild(_orders); orderScrollBox.AddChild(rAndOVBox); requestsAndOrders.AddChild(orderScrollBox); rows.AddChild(requestsAndOrders); rows.AddChild(new TextureButton { SizeFlagsVertical = SizeFlags.FillExpand, }); Contents.AddChild(rows); CallShuttleButton.OnPressed += OnCallShuttleButtonPressed; _searchBar.OnTextChanged += OnSearchBarTextChanged; _categories.OnItemSelected += OnCategoryItemSelected; }
public override void _Ready() { ipField = GetNode("../ip/LineEdit") as LineEdit; portField = GetNode("../port/LineEdit") as LineEdit; nameField = GetNode("../name/LineEdit") as LineEdit; }
protected override void Start() { var ui = UI; ui.Scale = 2f; ui.Root.SetDefaultStyle(CoreAssets.UIs.DefaultStyle); // Create the Window and add it to the UI's root node var window = new Window(); ui.Root.AddChild(window); // Set Window size and layout settings window.SetMinSize(384, 192); window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6)); window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center); window.Name = "Window"; // Create Window 'titlebar' container var titleBar = new UIElement(); titleBar.SetMinSize(0, 24); titleBar.VerticalAlignment = VerticalAlignment.Top; titleBar.LayoutMode = LayoutMode.Horizontal; // Create the Window title Text var windowTitle = new Text { Name = "WindowTitle", Value = "Hello GUI!" }; // Create the Window's close button var buttonClose = new Button { Name = "CloseButton" }; // Add the controls to the title bar titleBar.AddChild(windowTitle); titleBar.AddChild(buttonClose); // Add the title bar to the Window window.AddChild(titleBar); // Apply styles window.SetStyleAuto(null); windowTitle.SetStyleAuto(null); buttonClose.SetStyle("CloseButton", null); buttonClose.Released += args => { window.Visible = false; }; // Subscribe also to all UI mouse clicks just to see where we have clicked UI.UIMouseClick += args => { }; for (int i = 0; i < 4; i++) { // Create a CheckBox var checkBox = new CheckBox { Name = "CheckBox" }; // Add controls to Window window.AddChild(checkBox); // Apply previously set default style checkBox.SetStyleAuto(null); } for (int i = 0; i < 4; i++) { // Create a Button var button = new Button { Name = "Button", MinHeight = 24 }; window.AddChild(button); button.SetStyleAuto(null); } for (int i = 0; i < 8; i++) { // Create a LineEdit var lineEdit = new LineEdit { Name = "LineEdit", MinHeight = 24 }; window.AddChild(lineEdit); lineEdit.SetStyleAuto(null); // TODO //lineEdit.Focused += args => //{ //}; } }
protected override Control MakeUI(object?value) { var coords = (EntityCoordinates)value !; var hBoxContainer = new HBoxContainer { CustomMinimumSize = new Vector2(240, 0), }; hBoxContainer.AddChild(new Label { Text = "grid: " }); var entityManager = IoCManager.Resolve <IEntityManager>(); var gridId = new LineEdit { Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand, PlaceHolder = "Grid ID", ToolTip = "Grid ID", Text = coords.GetGridId(entityManager).ToString() }; hBoxContainer.AddChild(gridId); hBoxContainer.AddChild(new Label { Text = "pos: " }); var x = new LineEdit { Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand, PlaceHolder = "X", ToolTip = "X", Text = coords.X.ToString(CultureInfo.InvariantCulture) }; hBoxContainer.AddChild(x); var y = new LineEdit { Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand, PlaceHolder = "Y", ToolTip = "Y", Text = coords.Y.ToString(CultureInfo.InvariantCulture) }; hBoxContainer.AddChild(y); void OnEntered(LineEdit.LineEditEventArgs e) { var gridVal = int.Parse(gridId.Text, CultureInfo.InvariantCulture); var mapManager = IoCManager.Resolve <IMapManager>(); var xVal = float.Parse(x.Text, CultureInfo.InvariantCulture); var yVal = float.Parse(y.Text, CultureInfo.InvariantCulture); if (!mapManager.TryGetGrid(new GridId(gridVal), out var grid)) { ValueChanged(new EntityCoordinates(EntityUid.Invalid, (xVal, yVal))); return; } ValueChanged(new EntityCoordinates(grid.GridEntityId, (xVal, yVal))); } if (!ReadOnly) { gridId.OnTextEntered += OnEntered; x.OnTextEntered += OnEntered; y.OnTextEntered += OnEntered; } return(hBoxContainer); }
public override void _Ready() { instance = this; inputNode = GetNode <LineEdit>(InputNodePath); consoleContents = GetNode <RichTextLabel>(ConsoleContentsPath); }
public override void _Ready() { _lineEdit = GetNode <LineEdit>("Row/RightCol/TopCol/Row/LineEdit"); _customIcon = GetNode <IconTouchButton>("Row/RightCol/TopCol/Icon"); _lineEdit.Connect("text_changed", this, nameof(UpdateCustomIcon)); }
void InitControls() { var cache = application.ResourceCache; // Create a Button Button button = new Button(); button.Name = "Button"; button.MinHeight = 24; Text text = new Text(); text.Value = "Save"; text.SetFont(cache.GetFont(Assets.Fonts.Font), application.Graphics.Width / 30); text.HorizontalAlignment = HorizontalAlignment.Center; text.VerticalAlignment = VerticalAlignment.Center; button.AddChild(text); var textPrivateKey = new Text(); textPrivateKey.Value = "Private Key"; textPrivateKey.HorizontalAlignment = HorizontalAlignment.Center; textPrivateKey.VerticalAlignment = VerticalAlignment.Center; var textUrl = new Text(); textUrl.Value = "Url"; textUrl.HorizontalAlignment = HorizontalAlignment.Center; textUrl.VerticalAlignment = VerticalAlignment.Center; // Create a LineEdit lineEditPrivateKey = new LineEdit(); lineEditPrivateKey.Name = "lineEditprivateKey"; lineEditPrivateKey.TextCopyable = true; lineEditPrivateKey.Cursor.VerticalAlignment = VerticalAlignment.Center; lineEditPrivateKey.TextElement.VerticalAlignment = VerticalAlignment.Center; lineEditPrivateKey.Text = Ethereum.GameScoreService.PRIVATE_KEY; lineEditUrl = new LineEdit(); lineEditUrl.Name = "lineEditUrl"; lineEditUrl.Cursor.VerticalAlignment = VerticalAlignment.Center; lineEditUrl.TextElement.VerticalAlignment = VerticalAlignment.Center; lineEditUrl.TextCopyable = true; lineEditUrl.Text = Ethereum.GameScoreService.DEFAULT_MORDEN; // Add controls to Window window.AddChild(textPrivateKey); window.AddChild(lineEditPrivateKey); window.AddChild(textUrl); window.AddChild(lineEditUrl); window.AddChild(button); // Apply previously set default style button.SetStyleAuto(null); lineEditPrivateKey.SetStyleAuto(null); lineEditUrl.SetStyleAuto(null); textPrivateKey.SetFont(cache.GetFont(Assets.Fonts.Font), application.Graphics.Width / 30); textUrl.SetFont(cache.GetFont(Assets.Fonts.Font), application.Graphics.Width / 30); lineEditPrivateKey.TextElement.SetFontSize(application.Graphics.Width / 20); lineEditUrl.TextElement.SetFontSize(application.Graphics.Width / 20); lineEditUrl.CursorPosition = 0; lineEditPrivateKey.CursorPosition = 0; button.SubscribeToReleased(_ => Save()); }
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); reportTabButton = GetNode <Button>(ReportTabButtonPath); patchMapButton = GetNode <Button>(PatchMapButtonPath); cellEditorButton = GetNode <Button>(CellEditorButtonPath); structureTab = GetNode <PanelContainer>(StructureTabPath); structureTabButton = GetNode <Button>(StructureTabButtonPath); appearanceTab = GetNode <PanelContainer>(ApperanceTabPath); appearanceTabButton = GetNode <Button>(AppearanceTabButtonPath); statisticsPanel = GetNode <PanelContainer>(OrganismStatisticsPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); hpLabel = GetNode <Label>(HpLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <ProgressBar>(MutationPointsBarPath); mutationPointsSubtractBar = GetNode <ProgressBar>(MutationPointsSubtractBarPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); menuButton = GetNode <TextureButton>(MenuButtonPath); helpButton = GetNode <TextureButton>(HelpButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionLabel = GetNode <Label>(ATPProductionLabelPath); atpConsumptionLabel = GetNode <Label>(ATPConsumptionLabelPath); atpProductionBar = GetNode <SegmentedBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <SegmentedBar>(ATPConsumptionBarPath); timeIndicator = GetNode <Label>(TimeIndicatorPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchDepth = GetNode <Label>(PatchDepthPath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesListBox = GetNode <CollapsibleList>(SpeciesCollapsibleBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); speedIndicator = GetNode <TextureRect>(SpeedIndicatorPath); hpIndicator = GetNode <TextureRect>(HpIndicatorPath); sizeIndicator = GetNode <TextureRect>(SizeIndicatorPath); negativeAtpPopup = GetNode <ConfirmationDialog>(NegativeAtpPopupPath); menu = GetNode <PauseMenu>(MenuPath); mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); }; atpProductionBar.SelectedType = SegmentedBar.Type.ATP; atpProductionBar.IsProduction = true; atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP; RegisterTooltips(); }
public override void _Ready() { saveList = GetNode <SaveList>(SaveListPath); saveNameBox = GetNode <LineEdit>(SaveNameBoxPath); overwriteConfirm = GetNode <ConfirmationDialog>(OverwriteConfirmPath); }
public Menu(AdminAddReagentEui eui) { _eui = eui; Title = Loc.GetString("Add reagent..."); Contents.AddChild(new VBoxContainer { Children = { new GridContainer { Columns = 2, Children = { new Label { Text = Loc.GetString("Cur volume: ") }, (_volumeLabel = new Label()), new Label { Text = Loc.GetString("Reagent: ") }, (_reagentIdEdit = new LineEdit{ PlaceHolder = Loc.GetString("Reagent ID...") }), new Label { Text = Loc.GetString("Amount: ") }, (_amountEdit = new LineEdit { PlaceHolder = Loc.GetString("A number..."), HorizontalExpand = true }), }, HorizontalExpand = true, VerticalExpand = true }, new HBoxContainer { Children = { (_errorLabel = new Label { HorizontalExpand = true, ClipText = true }), (_addButton = new Button { Text = Loc.GetString("Add") }), (_addCloseButton = new Button { Text = Loc.GetString("Add & Close") }) } } } }); _reagentIdEdit.OnTextChanged += _ => CheckErrors(); _amountEdit.OnTextChanged += _ => CheckErrors(); _addButton.OnPressed += _ => DoAdd(false); _addCloseButton.OnPressed += _ => DoAdd(true); CheckErrors(); }
public ConstructionMenu() { IoCManager.InjectDependencies(this); Placement = (PlacementManager)IoCManager.Resolve <IPlacementManager>(); Placement.PlacementCanceled += OnPlacementCanceled; Title = "Construction"; var hSplitContainer = new HSplitContainer(); // Left side var recipes = new VBoxContainer { CustomMinimumSize = new Vector2(150.0f, 0.0f) }; SearchBar = new LineEdit { PlaceHolder = "Search" }; RecipeList = new Tree { SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true }; recipes.AddChild(SearchBar); recipes.AddChild(RecipeList); hSplitContainer.AddChild(recipes); // Right side var guide = new VBoxContainer(); var info = new HBoxContainer(); InfoIcon = new TextureRect(); InfoLabel = new Label { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter }; info.AddChild(InfoIcon); info.AddChild(InfoLabel); guide.AddChild(info); var stepsLabel = new Label { SizeFlagsHorizontal = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Steps" }; guide.AddChild(stepsLabel); StepList = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.None }; guide.AddChild(StepList); var buttonsContainer = new HBoxContainer(); BuildButton = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, TextAlign = Label.AlignMode.Center, Text = "Build!", Disabled = true, ToggleMode = false }; EraseButton = new Button { TextAlign = Label.AlignMode.Center, Text = "Clear Ghosts", ToggleMode = true }; buttonsContainer.AddChild(BuildButton); buttonsContainer.AddChild(EraseButton); guide.AddChild(buttonsContainer); hSplitContainer.AddChild(guide); Contents.AddChild(hSplitContainer); BuildButton.OnPressed += OnBuildPressed; EraseButton.OnToggled += OnEraseToggled; SearchBar.OnTextChanged += OnTextEntered; RecipeList.OnItemSelected += OnItemSelected; PopulatePrototypeList(); PopulateTree(); }
////////////////////////////////////////////////////////////////////////// METODOS public override void _Ready() { //get view references mini panels lblTerrain = GetNode("MainGroup/pDataTerrain/hbc/vbc/hbc/lblTerrain") as Label; lblTerrainDetail = GetNode("MainGroup/pDataTerrain/hbc/vbc/lblTerrainDetail") as Label; pUnitInfo = GetNode("MainGroup/pDataUnit") as Panel; lblUnit = GetNode("MainGroup/pDataUnit/hbc/vbc/lblUnit") as Label; lblUnitDetail = GetNode("MainGroup/pDataUnit/hbc/vbc/lblUnitDetail") as Label; //get view tabs pTaps = GetNode("MainGroup/pTabs") as Panel; pGenEdit = GetNode("MainGroup/pGenEdit") as Panel; pIndiEdit = GetNode("MainGroup/pIndiEdit") as Panel; pUnitEdit = GetNode("MainGroup/pUnitEdit") as Panel; pSaveData = GetNode("MainGroup/pSaveData") as Panel; plLoadData = GetNode("MainGroup/SubPanelLoadTerrainData") as SubPanelLoadTerrainData; //txtName file save data txtNameData = GetNode("MainGroup/pSaveData/panel/vbc/vbc/txtNameData") as LineEdit; //slider idPlayerUnit slPlayerId = GetNode("MainGroup/pUnitEdit/vbc/hbc/slPlayerId") as HSlider; lblPlayerId = GetNode("MainGroup/pUnitEdit/vbc/hbc/lblPlayerId") as Label; //get view tab indi edition lblTerrainEditorSelected = GetNode("MainGroup/pIndiEdit/vbc/lblActualSelected") as Label; lblUnitEditorSelected = GetNode("MainGroup/pUnitEdit/vbc/lblActualSelectedUnit") as Label; //get view tab generation txtSeed = GetNode("MainGroup/pGenEdit/vbc/vbc2/lineG1/txtSeed") as TextEdit; txtSizeMap = GetNode("MainGroup/pGenEdit/vbc/vbc2/lineG2/txtSizeMap") as TextEdit; txtOctaves = GetNode("MainGroup/pGenEdit/vbc/vbc3/lineN1/txtOctaves") as TextEdit; txtPeriod = GetNode("MainGroup/pGenEdit/vbc/vbc3/lineN2/txtPeriod") as TextEdit; txtLacunarity = GetNode("MainGroup/pGenEdit/vbc/vbc3/lineN3/txtLacunarity") as TextEdit; txtPersistence = GetNode("MainGroup/pGenEdit/vbc/vbc3/lineN4/txtPersistence") as TextEdit; slA1 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA1/slA1") as HSlider; slA2 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA2/slA2") as HSlider; slA3 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA3/slA3") as HSlider; slA4 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA4/slA4") as HSlider; slA5 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA5/slA5") as HSlider; slA6 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA6/slA6") as HSlider; slA7 = GetNode("MainGroup/pGenEdit/vbc/vbc4/lineA7/slA7") as HSlider; slR = GetNode("MainGroup/pGenEdit/vbc/lineR/slR") as HSlider; //get terrain views Node parentNode = GetNode("MainGroup/pDataTerrain/hbc/vbc/hbc/imsTerrain"); int count = parentNode.GetChildCount(); imagesTerrain = new Sprite[count]; for (int i = 0; i < count; i++) { imagesTerrain[i] = parentNode.GetChild <Sprite>(i);//get images array } //get units control views parentNode = GetNode("MainGroup/pDataUnit/Control"); count = parentNode.GetChildCount(); unitsViews = new Node2D[count]; for (int i = 0; i < count; i++) { unitsViews[i] = parentNode.GetChild <Node2D>(i);//get images array } //get panel TURN pTurn = GetNode("MainGroup/pTurn") as Panel; lblTurnNum = GetNode("MainGroup/pTurn/hbc/vbc/lblTurnNum") as Label; lblActualPlayer = GetNode("MainGroup/pTurn/hbc/vbc/lblActualPlayer") as Label; lblTime = GetNode("MainGroup/pTurn/hbc/vbc/lblTime") as Label; pbTurnTime = GetNode("MainGroup/pTurn/hbc/vbc/pbTurnTime") as ProgressBar; //Animation change turn animTurn = GetNode("MainGroup/pChangeTurn/animTurn") as AnimationPlayer; lblAnimTurnNum = GetNode("MainGroup/pChangeTurn/lblTurnNum") as Label; lblAnimPlayerName = GetNode("MainGroup/pChangeTurn/lblTurnPlayerName") as Label; //player list pPlayers = GetNode("MainGroup/pPlayers") as Panel; playersListView = GetNode("MainGroup/pPlayers/playerListView") as HBoxContainer; plvElementPrefab = GD.Load <PackedScene>("res://Scenes/MainGui/PlayerListViewElement/PlayerListViewElement.tscn"); //panel units control pUnitsControl = GetNode("MainGroup/pUnitsControl") as Panel; //START GAME pEnterGame = GetNode("MainGroup/pEnterGame") as Panel; lblEnterGameMap = GetNode("MainGroup/pEnterGame/lblCreate") as Label; leIP = GetNode("MainGroup/pEnterGame/leIP") as LineEdit; //LOBBY pLobby = GetNode("MainGroup/pLobby") as Panel; lblTerrainDataSize = GetNode("MainGroup/pLobby/crT/lblSize") as Label; vbcPlayerUnitsCounts = GetNode("MainGroup/pLobby/crP/vbc") as VBoxContainer; vbcPlayerTypeChange = GetNode("MainGroup/pLobby/crP/vbc2") as VBoxContainer; vbcTerrainDatas = GetNode("MainGroup/pLobby/crT/vbc") as VBoxContainer; //INIT pUnitInfo.Visible = false; //OK GD.Print("GUI ready"); }
//private ExceptionCheckCallback _CompletedCallback { get; set; } #endregion #region Methods public void Initialize(LineEdit line, MultiLineTextEdit multiLineText) { HideAnswer(); Line = line; MultiLineText = multiLineText; PopulateQuestionAndAnswer(); }
protected virtual void AddLineDetails(LineEdit line) { AddLineId(line.Id); AddLineText(line.Phrase.Text); AddPhraseId(line.PhraseId); AddLanguageId(line.Phrase.LanguageId); AddLanguageText(line.Phrase.Language.Text); AddLineNumber(line.LineNumber); }
public ChatBox() { MarginLeft = -475.0f; MarginTop = 10.0f; MarginRight = -10.0f; MarginBottom = 235.0f; AnchorLeft = 1.0f; AnchorRight = 1.0f; var outerVBox = new VBoxContainer(); var panelContainer = new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#25252aaa") }, SizeFlagsVertical = SizeFlags.FillExpand }; var vBox = new VBoxContainer(); panelContainer.AddChild(vBox); var hBox = new HBoxContainer(); outerVBox.AddChild(panelContainer); outerVBox.AddChild(hBox); var contentMargin = new MarginContainer { MarginLeftOverride = 4, MarginRightOverride = 4, SizeFlagsVertical = SizeFlags.FillExpand }; Contents = new OutputPanel(); contentMargin.AddChild(Contents); vBox.AddChild(contentMargin); Input = new LineEdit(); Input.OnKeyBindDown += InputKeyBindDown; Input.OnTextEntered += Input_OnTextEntered; vBox.AddChild(Input); AllButton = new Button { Text = localize.GetString("All"), Name = "ALL", SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand, ToggleMode = true, }; LocalButton = new Button { Text = localize.GetString("Local"), Name = "Local", ToggleMode = true, }; OOCButton = new Button { Text = localize.GetString("OOC"), Name = "OOC", ToggleMode = true, }; AllButton.OnToggled += OnFilterToggled; LocalButton.OnToggled += OnFilterToggled; OOCButton.OnToggled += OnFilterToggled; hBox.AddChild(AllButton); hBox.AddChild(LocalButton); hBox.AddChild(OOCButton); AddChild(outerVBox); }
public SingleLineEventBase(LineEdit line) : base(TimeSpan.MinValue) { AddLineDetails(line); }
/// <summary> /// Creates a study item using the line and MLT. /// This prepares the view model so that all that is necessary for the caller is to call /// viewmodel.Show(...); /// </summary> public void Procure(LineEdit line, MultiLineTextEdit multiLineText, AsyncCallback<StudyItemViewModelBase> callback) { //FOR NOW, THIS WILL JUST CREATE ONE OF TWO STUDY ITEM VIEW MODELS: //STUDY LINE ORDER VIEWMODEL (TIMED OR MANUAL). //IT WILL SHOW THE QUESTION AND HIDE THE ANSWER FOR VARIOUS AMOUNTS OF TIME, DEPENDING ON QUESTION //LENGTH, AND OTHER FACTORS. //IN THE FUTURE, THIS WILL BE EXTENSIBILITY POINT WHERE WE CAN SELECT DIFFERENT VARIETIES OF Q AND A //TRANSLATION VIEW MODELS BASED ON HOW SUCCESSFUL THEY ARE. WE CAN ALSO HAVE DIFFERENT CONFIGURATIONS //OF VARIETIES BE SELECTED HERE. var manualViewModel = new StudyLineOrderManualQuestionAnswerViewModel(); var timedViewModel = new StudyLineOrderTimedQuestionAnswerViewModel(); StudyItemViewModelBase dummy = null; var viewModel = RandomPicker.Ton.PickOne<StudyItemViewModelBase>(manualViewModel, timedViewModel, out dummy); if (viewModel is StudyLineOrderManualQuestionAnswerViewModel) manualViewModel.Initialize(line, multiLineText); else timedViewModel.Initialize(line, multiLineText); callback(this, new ResultArgs<StudyItemViewModelBase>(viewModel)); }
public SingleLineEventBase(LineEdit line, TimeSpan duration) : base(duration) { AddLineDetails(line); }
protected override void Initialize() { base.Initialize(); Title = "Entity Spawn Panel"; HSplitContainer = new HSplitContainer { Name = "HSplitContainer", MouseFilter = MouseFilterMode.Pass }; // Left side var prototypeListScroll = new ScrollContainer("PrototypeListScrollContainer") { CustomMinimumSize = new Vector2(200.0f, 0.0f), RectClipContent = true, SizeFlagsHorizontal = SizeFlags.FillExpand, HScrollEnabled = true, VScrollEnabled = true }; PrototypeList = new VBoxContainer("PrototypeList") { MouseFilter = MouseFilterMode.Ignore, SizeFlagsHorizontal = SizeFlags.FillExpand, SeparationOverride = new int?(2), Align = BoxContainer.AlignMode.Begin }; prototypeListScroll.AddChild(PrototypeList); HSplitContainer.AddChild(prototypeListScroll); // Right side var options = new VBoxContainer("Options") { CustomMinimumSize = new Vector2(200.0f, 0.0f), MouseFilter = MouseFilterMode.Ignore }; SearchBar = new LineEdit("SearchBar") { MouseFilter = MouseFilterMode.Stop, PlaceHolder = "Search Entities" }; SearchBar.OnTextChanged += OnSearchBarTextChanged; options.AddChild(SearchBar); var buttons = new HBoxContainer("Buttons!") { MouseFilter = MouseFilterMode.Ignore }; ClearButton = new Button("ClearButton") { SizeFlagsHorizontal = SizeFlags.FillExpand, Disabled = true, ToggleMode = false, Text = "Clear Search", }; ClearButton.OnPressed += OnClearButtonPressed; EraseButton = new Button("EraseButton") { SizeFlagsHorizontal = SizeFlags.FillExpand, ToggleMode = true, Text = "Erase Mode" }; EraseButton.OnToggled += OnEraseButtonToggled; buttons.AddChild(ClearButton); buttons.AddChild(EraseButton); options.AddChild(buttons); var overridePlacementText = new Label("OverridePlacementText") { MouseFilter = MouseFilterMode.Ignore, SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Override Placement:" }; OverrideMenu = new OptionButton("OverrideMenu") { ToggleMode = false }; //, TextAlign = Button.AlignMode.Left}; OverrideMenu.OnItemSelected += OnOverrideMenuItemSelected; for (var i = 0; i < initOpts.Length; i++) { OverrideMenu.AddItem(initOpts[i], i); } options.AddChild(overridePlacementText); options.AddChild(OverrideMenu); HSplitContainer.AddChild(options); Contents.AddChild(HSplitContainer); Size = new Vector2(400.0f, 300.0f); }
public SingleLineEventBase(LineEdit line, params KeyValuePair<string, object>[] details) : base(TimeSpan.MinValue, details) { AddLineDetails(line); }
private void PerformLayout() { MouseFilter = MouseFilterMode.Ignore; SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer { AnchorLeft = 1, AnchorRight = 1, AnchorBottom = 0, AnchorTop = 0, MarginTop = 30, MarginLeft = -350, MarginRight = -25, MarginBottom = 0, StyleIdentifier = "mainMenuVBox", }; AddChild(vBox); var logoTexture = _resourceCache.GetResource <TextureResource>("/Textures/Logo/logo.png"); var logo = new TextureRect { Texture = logoTexture, Stretch = TextureRect.StretchMode.KeepCentered, }; vBox.AddChild(logo); var userNameHBox = new HBoxContainer { SeparationOverride = 4 }; vBox.AddChild(userNameHBox); userNameHBox.AddChild(new Label { Text = "Username:"******"player.name"); UserNameBox = new LineEdit { Text = currentUserName, PlaceHolder = "Username", SizeFlagsHorizontal = SizeFlags.FillExpand }; userNameHBox.AddChild(UserNameBox); JoinPublicServerButton = new Button { Text = "Join Public Server", TextAlign = Button.AlignMode.Center, #if !FULL_RELEASE Disabled = true, ToolTip = "Cannot connect to public server with a debug build." #endif }; vBox.AddChild(JoinPublicServerButton); // Separator. vBox.AddChild(new Control { CustomMinimumSize = (0, 2) });
public SingleLineEventBase(LineEdit line, TimeSpan duration, params KeyValuePair<string, object>[] details) : base(duration, details) { AddLineDetails(line); }
List <Ingredient> IngredientList = new List <Ingredient>(); //using this to store current list of ingredients so we can query the list easily and write it in to JSON // Called when the node enters the scene tree for the first time. public override void _Ready() { //get reference to data files ingredientPath = Options.IngredientPath; volumePath = Options.VolumePath; receiptPath = Options.ReceiptPath; configurationPath = Options.ConfigurationPath; //get reference to controls volumeOption = (OptionButton)GetNode("VolumeOption"); ingredientOption = (OptionButton)GetNode("IngredientOption"); amountOption = (LineEdit)GetNode("AmountOption"); ingredientList = (ItemList)GetNode("Ingredients"); receiptTitle = (LineEdit)GetNode("Title"); receiptDescription = (TextEdit)GetNode("Receipt"); tabContainer = (TabContainer)GetParent(); ingredientsPopup = (PopupMenu)GetNode("Ingredients").GetNode("PopupMenu"); confirmationPopupDialog = (WindowDialog)GetParent().GetParent().GetNode("ConfirmationWindowDialog"); titleLabel = (Label)GetNode("TitleLabel"); receiptLabel = (Label)GetNode("ReceiptLabel"); ingredientsLabel = (Label)GetNode("IngredientsLabel"); ingredientAddButton = (Button)GetNode("AddButton"); saveButton = (Button)GetNode("SaveButton"); deleteButton = (Button)GetNode("Ingredients").GetNode("PopupMenu").GetNode("DeleteButton");; //get language configuration from JSON r = new StreamReader(configurationPath); json = r.ReadToEnd(); r.Close(); rss = JObject.Parse(json); //convert string to object string _language = rss["Language"].ToString(); //now get the language file r = new StreamReader("data/languages/lang.json"); json = r.ReadToEnd(); r.Close(); rss = JObject.Parse(json); string _langFile = rss[_language].ToString(); //now get all the text for the selected language r = new StreamReader($"data/languages/{_langFile}.json"); json = r.ReadToEnd(); r.Close(); rss = JObject.Parse(json); //now change text on all buttons and labels this.SetName(rss["New Receipt"].ToString()); ingredientsLabel.Text = rss["Ingredients"].ToString(); titleLabel.Text = rss["Title"].ToString(); receiptLabel.Text = rss["Description"].ToString(); ingredientAddButton.Text = rss["Add"].ToString(); saveButton.Text = rss["Save"].ToString(); deleteButton.Text = rss["Delete"].ToString(); //now get messages we are going to display in popup dialog receiptAlreadyExistMsg = rss["ReceiptAlreadyExistMsg"].ToString(); ingredientAlreadyExistMsg = rss["IngredientAlreadyExistMsg"].ToString(); receiptSavedToJsonMsg = rss["ReceiptSavedToJsonMsg"].ToString(); //get file dialog title }
public SolarControlWindow(IGameTiming igt) { Title = "Solar Control Window"; var rows = new GridContainer(); rows.Columns = 2; // little secret: the reason I put the values // in the first column is because otherwise the UI // layouter autoresizes the window to be too small rows.AddChild(new Label { Text = "Output Power:" }); rows.AddChild(new Label { Text = "" }); rows.AddChild(OutputPower = new Label { Text = "?" }); rows.AddChild(new Label { Text = "W" }); rows.AddChild(new Label { Text = "Sun Angle:" }); rows.AddChild(new Label { Text = "" }); rows.AddChild(SunAngle = new Label { Text = "?" }); rows.AddChild(new Label { Text = "°" }); rows.AddChild(new Label { Text = "Panel Angle:" }); rows.AddChild(new Label { Text = "" }); rows.AddChild(PanelRotation = new LineEdit()); rows.AddChild(new Label { Text = "°" }); rows.AddChild(new Label { Text = "Panel Angular Velocity:" }); rows.AddChild(new Label { Text = "" }); rows.AddChild(PanelVelocity = new LineEdit()); rows.AddChild(new Label { Text = "°/min." }); rows.AddChild(new Label { Text = "Press Enter to confirm." }); rows.AddChild(new Label { Text = "" }); PanelRotation.SizeFlagsHorizontal = SizeFlags.FillExpand; PanelVelocity.SizeFlagsHorizontal = SizeFlags.FillExpand; rows.SizeFlagsHorizontal = SizeFlags.Fill; rows.SizeFlagsVertical = SizeFlags.Fill; NotARadar = new SolarControlNotARadar(igt); var outerColumns = new HBoxContainer(); outerColumns.AddChild(rows); outerColumns.AddChild(NotARadar); outerColumns.SizeFlagsHorizontal = SizeFlags.Fill; outerColumns.SizeFlagsVertical = SizeFlags.Fill; Contents.AddChild(outerColumns); Resizable = false; }
public LatheMenu(LatheBoundUserInterface owner = null) { IoCManager.InjectDependencies(this); Owner = owner; Title = "Lathe Menu"; var margin = new MarginContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, }; var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; var hBoxButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; QueueButton = new Button() { Text = "Queue", TextAlign = Label.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; ServerConnectButton = new Button() { Text = "Server list", TextAlign = Label.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; ServerSyncButton = new Button() { Text = "Sync", TextAlign = Label.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; var spacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, }; var hBoxFilter = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 }; _searchBar = new LineEdit() { PlaceHolder = "Search Designs", SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; _searchBar.OnTextChanged += Populate; var filterButton = new Button() { Text = "Filter", TextAlign = Label.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, Disabled = true, }; _items = new ItemList() { SizeFlagsStretchRatio = 8, SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.Button, }; _items.OnItemSelected += ItemSelected; _amountLineEdit = new LineEdit() { PlaceHolder = "Amount", Text = "1", SizeFlagsHorizontal = SizeFlags.FillExpand, }; _amountLineEdit.OnTextChanged += PopulateDisabled; _materials = new ItemList() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; hBoxButtons.AddChild(spacer); if (Owner?.Database is ProtolatheDatabaseComponent database) { hBoxButtons.AddChild(ServerConnectButton); hBoxButtons.AddChild(ServerSyncButton); database.OnDatabaseUpdated += Populate; } hBoxButtons.AddChild(QueueButton); hBoxFilter.AddChild(_searchBar); hBoxFilter.AddChild(filterButton); vBox.AddChild(hBoxButtons); vBox.AddChild(hBoxFilter); vBox.AddChild(_items); vBox.AddChild(_amountLineEdit); vBox.AddChild(_materials); margin.AddChild(vBox); Contents.AddChild(margin); }
public override void OnEnter() { DefaultFont = Game.Content.Load<SpriteFont>("Default"); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>("Title"), Game.Content.Load<SpriteFont>("Small"), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent); MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2); Layout = new GridLayout(GUI, MainWindow, 10, 4); Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true); Layout.SetComponentPosition(check, 0, 1, 1, 1); Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true); Layout.SetComponentPosition(check2, 0, 2, 1, 1); Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(apply, 2, 9, 1, 1); Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(back, 3, 9, 1, 1); Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont); Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1); sliderLabel.Alignment = Drawer2D.Alignment.Right; Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer); Layout.SetComponentPosition(slider, 1, 3, 1, 1); Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont); comboLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1); ComboBox combo = new ComboBox(GUI, Layout); combo.AddValue("Foo"); combo.AddValue("Bar"); combo.AddValue("Baz"); combo.AddValue("Quz"); combo.CurrentValue = "Foo"; Layout.SetComponentPosition(combo, 1, 4, 1, 1); back.OnClicked += back_OnClicked; GroupBox groupBox = new GroupBox(GUI, Layout, ""); Layout.SetComponentPosition(groupBox, 2, 1, 2, 6); Layout.UpdateSizes(); /* Texture2D Image = Game.Content.Load<Texture2D>("pine"); string[] tags = {""}; DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags)); image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height); Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont); imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height); imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left; */ GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2); DragManager dragManager = new DragManager(); DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32); DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32); groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1); groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1); Layout.UpdateSizes(); groupLayout.UpdateSizes(); dragGrid.SetupLayout(); dragGrid2.SetupLayout(); foreach(Resource r in ResourceLibrary.Resources.Values) { if(r.ResourceName != "Container") { GItem gitem = new GItem(r.ResourceName, r.Image, 0, 32, 2, 1); gitem.CurrentAmount = 2; dragGrid.AddItem(gitem); } } ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f); Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont); progressLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1); Layout.SetComponentPosition(progress, 1, 5, 1, 1); LineEdit line = new LineEdit(GUI, Layout, ""); Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont); lineLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1); Layout.SetComponentPosition(line, 1, 6, 1, 1); base.OnEnter(); }