public BodyPartButton(string slotName) { LimbSlotName = slotName; ActualButton = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new HBoxContainer(); SpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f) }; LimbName = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "N/A", }; hBoxContainer.AddChild(SpriteView); hBoxContainer.AddChild(LimbName); EntityControl = new Control { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public SurgeryButton(int callbackData) { CallbackData = callbackData; Button = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(Button); var hBoxContainer = new HBoxContainer(); SpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f) }; DisplayText = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "N/A", }; hBoxContainer.AddChild(SpriteView); hBoxContainer.AddChild(DisplayText); EntityControl = new Control { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public SurgeryButton(int callbackData) { CallbackData = callbackData; Button = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(Button); AddChild(new HBoxContainer { Children = { (SpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f) }), (DisplayText = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "N/A", }), (new Control { SizeFlagsHorizontal = SizeFlags.FillExpand }) } }); }
public SurgeryButton(int callbackData) { CallbackData = callbackData; Button = new Button { HorizontalExpand = true, VerticalExpand = true, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(Button); AddChild(new HBoxContainer { Children = { (SpriteView = new SpriteView { MinSize = new Vector2(32.0f, 32.0f) }), (DisplayText = new Label { VerticalAlignment = VAlignment.Center, Text = "N/A", }), (new Control { HorizontalExpand = true }) } }); }
public SurgeryButton(int callbackData) { CallbackData = callbackData; Button = new Button { HorizontalExpand = true, VerticalExpand = true, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(Button); AddChild(new BoxContainer { Orientation = LayoutOrientation.Horizontal, Children = { (SpriteView = new SpriteView { MinSize = new Vector2(32.0f, 32.0f) }), (DisplayText = new Label { VerticalAlignment = VAlignment.Center, Text = Loc.GetString("surgery-window-not-available-button-text"), }), (new Control { HorizontalExpand = true }) } }); }
protected override void Initialize() { base.Initialize(); ActualButton = new Button("Button") { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new HBoxContainer("HBoxContainer") { MouseFilter = MouseFilterMode.Ignore }; EntitySpriteView = new SpriteView("SpriteView") { CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore }; EntityName = new Label("Name") { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Backpack", MouseFilter = MouseFilterMode.Ignore }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntityControl = new Control("Control") { SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore }; EntitySize = new Label("Size") { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Size 6", Align = Label.AlignMode.Right, AnchorLeft = 1.0f, AnchorRight = 1.0f, AnchorBottom = 0.5f, AnchorTop = 0.5f, MarginLeft = -38.0f, MarginTop = -7.0f, MarginRight = -5.0f, MarginBottom = 7.0f }; EntityControl.AddChild(EntitySize); hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
void OnEnable() { if (_spriteCollection != null) { SetGenerator(_spriteCollection); } spriteView = new SpriteView(this); settingsView = new SettingsView(this); fontView = new FontView(this); spriteSheetView = new SpriteSheetView(this); }
public ActionMenuItem(ActionsUI actionsUI, ActionType action, Action <ActionMenuItem> onControlFocusExited) { _actionsUI = actionsUI; Action = action; _onControlFocusExited = onControlFocusExited; SetSize = (64, 64); VerticalAlignment = VAlignment.Top; _bigActionIcon = new TextureRect { HorizontalExpand = true, VerticalExpand = true, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _bigItemSpriteView = new SpriteView { HorizontalExpand = true, VerticalExpand = true, Scale = (2, 2), Visible = false, OverrideDirection = Direction.South, }; _smallActionIcon = new TextureRect { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _smallItemSpriteView = new SpriteView { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, OverrideDirection = Direction.South, }; // padding to the left of the small icon var paddingBoxItemIcon = new BoxContainer { Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, VerticalExpand = true, MinSize = (64, 64) }; paddingBoxItemIcon.AddChild(new Control() { MinSize = (32, 32), });
public EntityButton() { ActualButton = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new HBoxContainer { MouseFilter = MouseFilterMode.Ignore }; EntitySpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore }; EntityName = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Backpack", MouseFilter = MouseFilterMode.Ignore }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntityControl = new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore }; EntitySize = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Size 6", Align = Label.AlignMode.Right, /*AnchorLeft = 1.0f, * AnchorRight = 1.0f, * AnchorBottom = 0.5f, * AnchorTop = 0.5f, * MarginLeft = -38.0f, * MarginTop = -7.0f, * MarginRight = -5.0f, * MarginBottom = 7.0f*/ }; EntityControl.AddChild(EntitySize); hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public EntityButton() { ActualButton = new Button { HorizontalExpand = true, VerticalExpand = true, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new HBoxContainer(); EntitySpriteView = new SpriteView { MinSize = new Vector2(32.0f, 32.0f), OverrideDirection = Direction.South }; EntityName = new Label { VerticalAlignment = VAlignment.Center, Text = "Backpack", }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntityControl = new Control { HorizontalExpand = true }; EntitySize = new Label { VerticalAlignment = VAlignment.Center, Text = "Size 6", Align = Label.AlignMode.Right, /*AnchorLeft = 1.0f, * AnchorRight = 1.0f, * AnchorBottom = 0.5f, * AnchorTop = 0.5f, * MarginLeft = -38.0f, * MarginTop = -7.0f, * MarginRight = -5.0f, * MarginBottom = 7.0f*/ }; EntityControl.AddChild(EntitySize); hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public StackContextElement(IEnumerable <IEntity> entities, StackContextElement?pre, ContextMenuPopup?parentMenu) : base(parentMenu) { Pre = pre; ContextEntities = new(entities); _spriteView = new SpriteView { Sprite = ContextEntities.First().GetComponent <ISpriteComponent>() }; _label = new Label { Text = Loc.GetString(ContextEntities.Count.ToString()), StyleClasses = { StyleNano.StyleClassContextMenuCount } }; LayoutContainer.SetAnchorPreset(_label, LayoutContainer.LayoutPreset.BottomRight); LayoutContainer.SetGrowHorizontal(_label, LayoutContainer.GrowDirection.Begin); LayoutContainer.SetGrowVertical(_label, LayoutContainer.GrowDirection.Begin); AddChild( new BoxContainer { Orientation = LayoutOrientation.Horizontal, SeparationOverride = 6, Children = { new LayoutContainer { Children = { _spriteView,_label } }, new BoxContainer { Orientation = LayoutOrientation.Horizontal, SeparationOverride = 6, Children = { new Label { Text = Loc.GetString(ContextEntities.First().Name) }, new TextureRect { Texture = IoCManager.Resolve <IResourceCache>().GetTexture("/Textures/Interface/VerbIcons/group.svg.192dpi.png"), TextureScale = (0.5f, 0.5f), Stretch = TextureRect.StretchMode.KeepCentered, } } } }, Margin = new Thickness(0, 0, 10, 0)
public EntityButton() { ActualButton = new Button { HorizontalExpand = true, VerticalExpand = true, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new BoxContainer { Orientation = LayoutOrientation.Horizontal }; EntitySpriteView = new SpriteView { MinSize = new Vector2(32.0f, 32.0f), OverrideDirection = Direction.South }; EntityName = new Label { VerticalAlignment = VAlignment.Center, HorizontalExpand = true, Margin = new Thickness(0, 0, 6, 0), Text = "Backpack", ClipText = true }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntitySize = new Label { VerticalAlignment = VAlignment.Bottom, Text = "Size 6", Align = Label.AlignMode.Right, }; hBoxContainer.AddChild(EntitySize); AddChild(hBoxContainer); }
private Core.Level CreateLevel() { // -------------------------------------------------------------------------------- // Setup Level // -------------------------------------------------------------------------------- Level = CreateEmptyLevel(); Level.Move(Vector2.zero); var levelSprite = SystemFacade.Resources.LoadSprite(ResourcesMap.Level); var levelView = new SpriteView(this.application, "Level", LayerNames.Level); levelView.SetSprite(levelSprite); Level.AddLevel(levelView, new Vector3(0, 0, 1)); ViewsContainer.AddView(levelView); // -------------------------------------------------------------------------------- // Setup Background // -------------------------------------------------------------------------------- /*var bgPos = new Vector2( * (SystemFacade.Renderer.ScreenWidth / 2 / SystemFacade.Renderer.CurrentResolution) * ,(SystemFacade.Renderer.ScreenHeight / 2 / SystemFacade.Renderer.CurrentResolution));*/ var bgSprite = SystemFacade.Resources.LoadSprite(ResourcesMap.Background); _background = new SpriteView(this.application, "Background", LayerNames.Background); _background.SetSprite(bgSprite); //- duplicate the background to fit the level platform var duplicated = new SpriteView(this.application, "Background", LayerNames.Background); duplicated.SetSprite(bgSprite); _background.AddChild(duplicated); duplicated.SetPosition(new Vector2(_background.GetSize().x, 0)); //apply offset Level.AddBackground(_background, _config.backgroundPosition); ViewsContainer.AddView(_background); return(Level); }
protected override void Initialize() { base.Initialize(); var resMgr = IoCManager.Resolve <IResourceCache>(); var handsBoxTexture = resMgr.GetResource <TextureResource>("/Textures/UserInterface/handsbox.png"); handBox = new StyleBoxTexture() { Texture = handsBoxTexture, }; handBox.SetPatchMargin(StyleBox.Margin.All, 6); inactiveHandBox = new StyleBoxTexture(handBox) { Modulate = _inactiveColor, }; SetMarginsPreset(LayoutPreset.CenterBottom); SetAnchorPreset(LayoutPreset.CenterBottom); _handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE); _handR = _handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0)); MouseFilter = MouseFilterMode.Stop; LeftSpriteView = new SpriteView { MouseFilter = MouseFilterMode.Ignore }; AddChild(LeftSpriteView); LeftSpriteView.Size = _handL.Size; LeftSpriteView.Position = _handL.TopLeft; RightSpriteView = new SpriteView { MouseFilter = MouseFilterMode.Ignore }; AddChild(RightSpriteView); RightSpriteView.Size = _handR.Size; RightSpriteView.Position = _handR.TopLeft; }
private void SpriteRefreshMenuItem_Click(object sender, EventArgs e) { SpriteView.Refresh(); }
private void CopySpriteToClipboardMenuItem_Click(object sender, EventArgs e) { SpriteView.ScreenshotToClipboard(); }
private void SaveSpriteScreenshotMenuItem_Click(object sender, EventArgs e) { SpriteView.Screenshot(); }
private unsafe void Generate(bool now = false) { if (!IsHandleCreated || IsDisposed) { return; } if (Global.Emulator.Frame % RefreshRate.Value == 0 || now) { int b0; int b1; byte value; int cvalue; if (CheckChange()) { _forceChange = false; // Pattern Viewer for (var i = 0; i < 16; i++) { PaletteView.BgPalettesPrev[i].Value = PaletteView.BgPalettes[i].Value; PaletteView.SpritePalettesPrev[i].Value = PaletteView.SpritePalettes[i].Value; PaletteView.BgPalettes[i].Value = _nes.LookupColor(_nes.ppu.PALRAM[PaletteView.BgPalettes[i].Address]); PaletteView.SpritePalettes[i].Value = _nes.LookupColor(_nes.ppu.PALRAM[PaletteView.SpritePalettes[i].Address]); } if (PaletteView.HasChanged()) { PaletteView.Refresh(); } DrawPatternView(PatternView, _ppuBus); } var bmpdata2 = SpriteView.sprites.LockBits(new Rectangle(new Point(0, 0), SpriteView.sprites.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); var framebuf2 = (int *)bmpdata2.Scan0.ToPointer(); int pt_add = _nes.ppu.reg_2000.obj_pattern_hi ? 0x1000 : 0; bool is8x16 = _nes.ppu.reg_2000.obj_size_16; // Sprite Viewer for (int n = 0; n < 4; n++) { for (int r = 0; r < 16; r++) { int BaseAddr = (r << 2) + (n << 6); int TileNum = _nes.ppu.OAM[BaseAddr + 1]; int patternAddr; if (is8x16) { patternAddr = (TileNum >> 1) * 0x20; patternAddr += 0x1000 * (TileNum & 1); } else { patternAddr = TileNum * 0x10; patternAddr += pt_add; } int Attributes = _nes.ppu.OAM[BaseAddr + 2]; int Palette = Attributes & 0x03; for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { int address = patternAddr + y; b0 = (byte)((_ppuBus[address] >> (7 - x)) & 1); b1 = (byte)((_ppuBus[address + 8] >> (7 - x)) & 1); value = (byte)(b0 + (b1 << 1)); cvalue = _nes.LookupColor(_nes.ppu.PALRAM[16 + value + (Palette << 2)]); int adr = (x + (r * 16)) + (y + (n * 24)) * (bmpdata2.Stride >> 2); framebuf2[adr] = cvalue; } if (is8x16) { patternAddr += 0x10; for (int y = 0; y < 8; y++) { int address = patternAddr + y; b0 = (byte)((_ppuBus[address] >> (7 - x)) & 1); b1 = (byte)((_ppuBus[address + 8] >> (7 - x)) & 1); value = (byte)(b0 + (b1 << 1)); cvalue = _nes.LookupColor(_nes.ppu.PALRAM[16 + value + (Palette << 2)]); int adr = (x + (r << 4)) + ((y + 8) + (n * 24)) * (bmpdata2.Stride >> 2); framebuf2[adr] = cvalue; } patternAddr -= 0x10; } } } } SpriteView.sprites.UnlockBits(bmpdata2); SpriteView.Refresh(); HandleSpriteViewMouseMove(SpriteView.PointToClient(MousePosition)); HandlePaletteViewMouseMove(PaletteView.PointToClient(MousePosition)); } }
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; }
/// <summary> /// Creates an action slot for the specified number /// </summary> /// <param name="slotIndex">slot index this corresponds to, 0-9 (0 labeled as 1, 8, labeled "9", 9 labeled as "0".</param> public ActionSlot(ActionsUI actionsUI, ActionMenu actionMenu, byte slotIndex) { _actionsUI = actionsUI; _actionMenu = actionMenu; _gameTiming = IoCManager.Resolve <IGameTiming>(); SlotIndex = slotIndex; MouseFilter = MouseFilterMode.Stop; MinSize = (64, 64); VerticalAlignment = VAlignment.Top; TooltipDelay = CustomTooltipDelay; TooltipSupplier = SupplyTooltip; _number = new RichTextLabel { StyleClasses = { StyleNano.StyleClassHotbarSlotNumber } }; _number.SetMessage(SlotNumberLabel()); _bigActionIcon = new TextureRect { HorizontalExpand = true, VerticalExpand = true, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _bigItemSpriteView = new SpriteView { HorizontalExpand = true, VerticalExpand = true, Scale = (2, 2), Visible = false, OverrideDirection = Direction.South, }; _smallActionIcon = new TextureRect { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _smallItemSpriteView = new SpriteView { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, OverrideDirection = Direction.South, }; _cooldownGraphic = new CooldownGraphic { Progress = 0, Visible = false }; // padding to the left of the number to shift it right var paddingBox = new BoxContainer { Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, VerticalExpand = true, MinSize = (64, 64) }; paddingBox.AddChild(new Control() { MinSize = (4, 4), });