forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cooler Better and Badder Guidebooks (space-wizards#78)
* A better revised guidebook! * A better revised guidebook! * funny
- Loading branch information
1 parent
b37ac0c
commit 2a5faf1
Showing
14 changed files
with
435 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
Orientation="Vertical" | ||
Margin="5 5 5 5"> | ||
<SpriteView Name="View"/> | ||
<PanelContainer Name="NameBackground" HorizontalExpand="True" VerticalExpand="False"> | ||
<RichTextLabel Name="NameLabel" HorizontalAlignment="Center"/> | ||
</PanelContainer> | ||
</BoxContainer> |
119 changes: 119 additions & 0 deletions
119
Content.Client/Guidebook/Controls/GuideColorLabelBand.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Numerics; | ||
using Content.Client.ContextMenu.UI; | ||
using Content.Client.Examine; | ||
using Content.Client.Guidebook.Richtext; | ||
using Content.Client.Message; | ||
using Content.Client.Verbs; | ||
using Content.Client.Verbs.UI; | ||
using Content.Shared.Input; | ||
using Content.Shared.Tag; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Input; | ||
using Robust.Shared.Map; | ||
using Serilog; | ||
|
||
namespace Content.Client.Guidebook.Controls; | ||
|
||
/// <summary> | ||
/// Adds a singular band of color alongside a caption. | ||
/// </summary> | ||
[GenerateTypedNameReferences] | ||
public sealed partial class GuideColorLabelBand : BoxContainer, IDocumentTag | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly IEntitySystemManager _systemManager = default!; | ||
[Dependency] private readonly IUserInterfaceManager _ui = default!; | ||
|
||
private readonly TagSystem _tagSystem; | ||
private readonly GuidebookSystem _guidebookSystem; | ||
|
||
public SpriteComponent? Sprite | ||
{ | ||
get => View.Sprite; | ||
set => View.Sprite = value; | ||
} | ||
|
||
public Vector2 Scale | ||
{ | ||
get => View.Scale; | ||
set => View.Scale = value; | ||
} | ||
|
||
public GuideColorLabelBand() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
_tagSystem = _systemManager.GetEntitySystem<TagSystem>(); | ||
_guidebookSystem = _systemManager.GetEntitySystem<GuidebookSystem>(); | ||
MouseFilter = MouseFilterMode.Stop; | ||
} | ||
|
||
public GuideColorLabelBand(string caption, Color color, float? height) : this() | ||
{ | ||
NameLabel.SetMarkup(caption); | ||
NameBackground.PanelOverride = new StyleBoxFlat | ||
{ | ||
BackgroundColor = color | ||
}; | ||
if (height.HasValue) | ||
NameBackground.MinHeight = height.Value; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (Sprite is not null) | ||
_entityManager.DeleteEntity(Sprite.Owner); | ||
} | ||
|
||
public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control) | ||
{ | ||
control = null; | ||
if (!args.TryGetValue("Caption", out var caption)) | ||
{ | ||
Logger.Error("Caption doesn't exist!"); | ||
return false; | ||
} | ||
|
||
if (!args.TryGetValue("Color", out var colorString)) | ||
{ | ||
Logger.Error($"Specified color \"{colorString}\" is not a valid color!"); | ||
return false; | ||
} | ||
|
||
if (args.TryGetValue("Height", out var desiredHeight)) | ||
{ | ||
NameBackground.MinHeight = float.Parse(desiredHeight); | ||
} | ||
|
||
// set background | ||
var color = Color.FromHex(colorString); | ||
|
||
NameBackground.PanelOverride = new StyleBoxFlat | ||
{ | ||
BackgroundColor = color | ||
}; | ||
// sssttttttrrrrrrreeeeeeeeeeeeettttttttttcccccccccchhhhhhhhhhh | ||
NameBackground.MinWidth = 10000000f; | ||
NameBackground.HorizontalAlignment = HAlignment.Stretch; | ||
|
||
// center text | ||
NameLabel.HorizontalAlignment = HAlignment.Center; | ||
NameLabel.VerticalAlignment = VAlignment.Center; | ||
|
||
// make text darker if we have a bright background | ||
if ((color.R + color.G + color.B) > 1.5f) | ||
NameLabel.SetMarkup("[color=#000000]" + caption); | ||
else | ||
NameLabel.SetMarkup(caption); | ||
control = this; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
Resources/Prototypes/_FTL/Entities/Guidebook/main_page.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Used for guidebook entities | ||
|
||
- type: entity | ||
id: BaseGuidebookHyperlink | ||
name: hyperlink | ||
abstract: true | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkNavigation | ||
name: navigation | ||
description: This is a hyperlink to the navigation guide! | ||
components: | ||
- type: Sprite | ||
sprite: Structures/Machines/computers.rsi | ||
layers: | ||
- map: ["computerLayerBody"] | ||
state: computer | ||
- map: ["computerLayerKeyboard"] | ||
state: generic_keyboard | ||
- map: ["computerLayerScreen"] | ||
state: shuttle | ||
- map: ["computerLayerKeys"] | ||
state: generic_keys | ||
- type: GuideHelp | ||
guides: | ||
- Navigation | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkCommand | ||
name: command | ||
description: This is a hyperlink to the command guide! | ||
components: | ||
- type: Sprite | ||
sprite: Objects/Misc/id_cards.rsi | ||
layers: | ||
- state: gold | ||
- state: idcaptain | ||
- type: GuideHelp | ||
guides: | ||
- Jobs | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkEngineering | ||
name: engineering | ||
description: This is a hyperlink to the engineering guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- Engineering | ||
- type: Sprite | ||
sprite: Objects/Tools/wrench.rsi | ||
state: icon | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkMedical | ||
name: medical | ||
description: This is a hyperlink to the medical guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- Medical | ||
- type: Sprite | ||
sprite: Objects/Specific/Medical/firstaidkits.rsi | ||
state: firstaid | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkSecurity | ||
name: security | ||
description: This is a hyperlink to the security guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- Medical | ||
- type: Sprite | ||
sprite: Objects/Weapons/Melee/stunbaton.rsi | ||
layers: | ||
- state: stunbaton_on | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkLaw | ||
name: law | ||
description: This is a hyperlink to the law guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- Law | ||
- type: Sprite | ||
sprite: Clothing/Neck/Misc/lawyerbadge.rsi | ||
state: icon | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkLore | ||
name: lore | ||
description: This is a hyperlink to the lore guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- Lore | ||
- type: Sprite | ||
sprite: Objects/Misc/authorbooks.rsi | ||
layers: | ||
- state: book_watched | ||
|
||
- type: entity | ||
parent: BaseGuidebookHyperlink | ||
noSpawn: true | ||
id: GuidebookHyperlinkSOP | ||
name: standard operating procedure | ||
description: This is a hyperlink to the SoP guide! | ||
components: | ||
- type: GuideHelp | ||
guides: | ||
- StandardOperatingProcedure | ||
- type: Sprite | ||
sprite: Objects/Misc/books.rsi | ||
layers: | ||
- state: book0 | ||
map: [ "enum.DamageStateVisualLayers.Base" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- type: guideEntry | ||
id: StandardOperatingProcedure | ||
name: guide-entry-sop | ||
text: "/ServerInfo/Guidebook/SoP/StandardOperatingProcedure.xml" | ||
children: | ||
- TradeStationEtiquette | ||
|
||
- type: guideEntry | ||
id: TradeStationEtiquette | ||
name: guide-entry-tse | ||
text: "/ServerInfo/Guidebook/SoP/TradeStationEtiquette.xml" |
Oops, something went wrong.