protected override void Draw(DrawingHandleBase handle) { var screenHandle = (DrawingHandleScreen)handle; var mousePos = IoCManager.Resolve <IInputManager>().MouseScreenPosition; if (_system.UseOrAttackIsDown && _system._timeHeld > AttackTimeThreshold) { var tex = ResC.GetTexture($"/Textures/Objects/Tools/toolbox_r.png"); screenHandle.DrawTextureRect(tex, UIBox2.FromDimensions(mousePos, tex.Size * 2)); } }
public StatusControl(BallisticMagazineWeaponComponent parent) { _parent = parent; SizeFlagsHorizontal = SizeFlags.FillExpand; SizeFlagsVertical = SizeFlags.ShrinkCenter; AddChild(new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter, SeparationOverride = 0, Children = { (_bulletsListTop = new HBoxContainer { SeparationOverride = 0 }), new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { (_bulletsListBottom = new HBoxContainer { SizeFlagsVertical = SizeFlags.ShrinkCenter, SeparationOverride = 0 }), (_noMagazineLabel = new Label { Text = "No Magazine!", StyleClasses ={ NanoStyle.StyleClassItemStatus } }) } }, (_chamberedBullet = new TextureRect { Texture = ResC.GetTexture("/Textures/UserInterface/status/bullets/chambered.png"), SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill, }) } } } }); }
public void Update() { _chamberedBullet.ModulateSelfOverride = _parent.Chambered ? Color.FromHex("#d7df60") : Color.Black; _bulletsListTop.RemoveAllChildren(); _bulletsListBottom.RemoveAllChildren(); if (_parent.MagazineCount == null) { _noMagazineLabel.Visible = true; return; } var(count, capacity) = _parent.MagazineCount.Value; _noMagazineLabel.Visible = false; string texturePath; if (capacity <= 20) { texturePath = "/Textures/UserInterface/status/bullets/normal.png"; } else if (capacity <= 30) { texturePath = "/Textures/UserInterface/status/bullets/small.png"; } else { texturePath = "/Textures/UserInterface/status/bullets/tiny.png"; } var texture = ResC.GetTexture(texturePath); const int tinyMaxRow = 60; if (capacity > tinyMaxRow) { FillBulletRow(_bulletsListBottom, Math.Min(tinyMaxRow, count), tinyMaxRow, texture); FillBulletRow(_bulletsListTop, Math.Max(0, count - tinyMaxRow), capacity - tinyMaxRow, texture); } else { FillBulletRow(_bulletsListBottom, count, capacity, texture); } }
public override void Startup() { var panelTex = ResC.GetTexture("/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { Texture = panelTex, Modulate = new Color(32, 32, 48), }; back.SetPatchMargin(StyleBox.Margin.All, 10); Button exitButton; Button reconnectButton; Button retryButton; var address = _gameController.LaunchState.Ss14Address ?? _gameController.LaunchState.ConnectAddress; _control = new Control { Stylesheet = _stylesheetManager.SheetSpace, Children = { new PanelContainer { PanelOverride = back }, new VBoxContainer { SeparationOverride = 0, CustomMinimumSize = (300, 200), Children = { new HBoxContainer { Children = { new MarginContainer { MarginLeftOverride = 8, Children = { new Label { Text = Loc.GetString("Space Station 14"), StyleClasses ={ StyleBase.StyleClassLabelHeading }, VAlign = Label.VAlignMode.Center }, } }, (exitButton = new Button { Text = Loc.GetString("Exit"), SizeFlagsHorizontal = Control.SizeFlags.ShrinkEnd | Control.SizeFlags.Expand }), } }, // Line new HighDivider(), new MarginContainer { SizeFlagsVertical = Control.SizeFlags.FillExpand, MarginLeftOverride = 4, MarginRightOverride = 4, MarginTopOverride = 4, Children = { new VBoxContainer { SeparationOverride = 0, Children = { new Control { SizeFlagsVertical = Control.SizeFlags.FillExpand, Children = { (_connectingStatus = new VBoxContainer { SeparationOverride = 0, Children = { new Label { Text = Loc.GetString("Connecting to server..."), Align = Label.AlignMode.Center, }, (_connectStatus = new Label { StyleClasses ={ StyleBase.StyleClassLabelSubText }, Align = Label.AlignMode.Center, }), } }), (_connectFail = new VBoxContainer { Visible = false, SeparationOverride = 0, Children = { (_connectFailReason = new Label { Align = Label.AlignMode.Center }), (retryButton = new Button { Text = "Retry", SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter, SizeFlagsVertical = Control.SizeFlags.Expand | Control.SizeFlags.ShrinkEnd }) } }), (_disconnected = new VBoxContainer { SeparationOverride = 0, Children = { new Label { Text = "Disconnected from server:", Align = Label.AlignMode.Center }, new Label { Text = _baseClient.LastDisconnectReason, Align = Label.AlignMode.Center }, (reconnectButton = new Button { Text = "Reconnect", SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter, SizeFlagsVertical = Control.SizeFlags.Expand | Control.SizeFlags.ShrinkEnd }) } }) } }, // Padding. new Control { CustomMinimumSize = (0, 8) },