I'm going for a comic book style for my dialog lines. For this I'd like to create a black border around my white dialog background textures. But how can I do it?
A uniform black border will be fine, as long as I can have the same border thickness even if the dialog gets resized.
P.S. Sorry that I confused you with the hand drawn look in my previous screenshots. Ideally I'd like that look but I understand that it gets complicated with automatic sizing. So I will just start with a uniform border for now.
Comments
Whenever a Menu is turned on, the MenuSystem's OnMenuEnable function is called, with a parameter to get the name of the Menu in question. This is a one-time call only (not every frame the menu is active), so it's used to reposition / resize / hide elements. You'll have to make sure your subtitle text doesn't scroll (so that the size of the label is determined beforehand), but try this:
Split your "speech bubble" background into two: the first containing the top, left and right edges; the second just the bottom. Make the first graphic extend deep enough to cover any possible text lengths.
Put these into two Label elements, in the order TopBubble, SubtitleText, BottomBubble. Set the position of the TopBubble and Subtitle Text to absolute 0,0. The ordering should make sure you can still see the SubtitleText above the TopBubble graphic. Set the position of the BottomBubble to Relative to Menu Size, and place it at the bottom edge.
Then resize the TopBubble so that it extends beyond the size of the menu, so that you can only see the top bit of it. The idea in the script is then to resize the menu's height dynamically. As it gets deeper, more of the TopBubble graphic will be revealed, while the BottomGraphic will remain at the bottom.
In your MenuSystem script, do a check for your menu, and then adjust it's manualSize.y property based on the size of the label. (You can get an element with the PlayerMenus.GetElementWithName function). You'll have to call the Menu's "Recalculate" function afterwards.
Hope that makes more sense when you play around with it!
Dialog dialog = GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>();
if (dialog.GetLine () != "")
{
GUIContent content = new GUIContent (dialog.GetLine ());
relativeRect.height = _style.CalcHeight (content, relativeRect.width);
}