- combined the "crew" and "hire" tabs in the SP lobby

- tooltips that show item descriptions in the store menu
- preventing tooltips from going outside the screen
- medical items can be bought, more expensive railgun/depthcharge shells
This commit is contained in:
Regalis
2016-09-29 18:59:10 +03:00
parent 86c50304dd
commit cbce785078
7 changed files with 113 additions and 103 deletions

View File

@@ -51,7 +51,8 @@
name="Iron Powder"
category="Material"
Tags="smallitem,chem"
pickdistance="150">
pickdistance="150"
price="5">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" color="0.2,0.2,0.2,1.0"/>
@@ -66,7 +67,8 @@
spritecolor="1.0,1.0,0.7,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="A mild stimulant which is used as an incredient in the manufacture of various medicines.">
description="A mild stimulant which is used as an incredient in the manufacture of various medicines."
price="10">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6" />
@@ -91,7 +93,8 @@
Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true"
description="Most commonly used for treating oxygen deprivation.">
description="Most commonly used for treating oxygen deprivation."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" />
@@ -111,7 +114,8 @@
Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true"
description="A hemostatic agent that slows down bleeding.">
description="A hemostatic agent that slows down bleeding."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" />
@@ -136,7 +140,8 @@
Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true"
description="Highly effective at treating various types of physical trauma.">
description="Highly effective at treating various types of physical trauma."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -160,7 +165,8 @@
spritecolor="1.0,1.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="A highly potent corrigodone-based stimulant.">
description="A highly potent corrigodone-based stimulant."
price="150">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -178,7 +184,8 @@
category="Material"
spritecolor="1.0,1.0,1.0,0.6"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -197,7 +204,8 @@
spritecolor="0.0,0.9,0.1,1.0"
Tags="smallitem,chem,medical"
canuseonself="true"
pickdistance="150">
pickdistance="150"
price="20">
<ItemComponent>
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
@@ -220,7 +228,8 @@
category="Material"
spritecolor="0.7,0.7,0.7,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -238,7 +247,8 @@
category="Material"
spritecolor="0.8,0.8,0.8,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -256,7 +266,8 @@
category="Material"
spritecolor="0.1,0.1,0.1,1.0"
Tags="smallitem,chem,explosive"
pickdistance="150">
pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -276,7 +287,8 @@
category="Material"
spritecolor="1.0,1.0,1.0,0.8"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -294,7 +306,8 @@
category="Material"
spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -312,7 +325,8 @@
category="Material"
spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -330,7 +344,8 @@
category="Material"
spritecolor="0.2,0.35,0.06,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -349,7 +364,8 @@
spritecolor="0.8,0.3,0.8,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="A potent muscle stimulant.">
description="A potent muscle stimulant."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -368,7 +384,8 @@
spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="A highly potent neurotoxin.">
description="A highly potent neurotoxin."
price="200">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -387,7 +404,8 @@
spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'.">
description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'."
price="200">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -406,7 +424,8 @@
spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
description="An antiparasitic drug used in the treatment of husk parasite infections.">
description="An antiparasitic drug used in the treatment of husk parasite infections."
price="300">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>

View File

@@ -38,7 +38,7 @@
name="Depth Charge Shell"
category="Misc"
pickdistance="150"
price="50">
price="200">
<Deconstruct time="10">
<Item name="Steel Bar"/>
@@ -66,7 +66,7 @@
name="Nuclear Depth Charge"
category="Misc"
pickdistance="150"
price="50">
price="500">
<Deconstruct time="20">
<Item name="Steel Bar"/>

View File

@@ -66,7 +66,7 @@
name="Railgun Shell"
category="Misc"
pickdistance="200"
price="100">
price="200">
<Deconstruct time="10">
<Item name="Steel Bar"/>
@@ -93,7 +93,7 @@
name="Nuclear Shell"
category="Misc"
pickdistance="200"
price="100">
price="500">
<Deconstruct time="10">
<Item name="Steel Bar"/>

View File

@@ -286,9 +286,15 @@ namespace Barotrauma
toolTipBlock.rect.Height = toolTipBlock.WrappedText.Split('\n').Length * 18;
toolTipBlock.Color = Color.Black * 0.7f;
toolTipBlock.userData = ToolTip;
}
toolTipBlock.rect = new Rectangle(MouseOn.Rect.Center.X, MouseOn.rect.Bottom, toolTipBlock.rect.Width, toolTipBlock.rect.Height);
if (toolTipBlock.rect.Right > GameMain.GraphicsWidth - 10)
{
toolTipBlock.rect.Location -= new Point(toolTipBlock.rect.Right - (GameMain.GraphicsWidth - 10), 0);
}
toolTipBlock.Draw(spriteBatch);
}

View File

@@ -122,7 +122,7 @@ namespace Barotrauma
}
public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null)
: this(rect, null, style, parent)
: this(rect, null, alignment, style, parent, false)
{
}

View File

@@ -25,10 +25,8 @@ namespace Barotrauma
private KeyOrMouse[] keyMapping;
private bool unsavedSettings;
public GUIFrame SettingsFrame
{
get
@@ -287,7 +285,7 @@ namespace Barotrauma
private bool ChangeSoundVolume(GUIScrollBar scrollBar, float barScroll)
{
UnsavedSettings = true;
SoundVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
SoundVolume = barScroll;
return true;
}
@@ -295,22 +293,11 @@ namespace Barotrauma
private bool ChangeMusicVolume(GUIScrollBar scrollBar, float barScroll)
{
UnsavedSettings = true;
MusicVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
MusicVolume = barScroll;
return true;
}
//private bool ToggleFullScreen(object userData)
//{
// UnsavedSettings = true;
// FullScreenEnabled = !FullScreenEnabled;
// GameMain.Graphics.IsFullScreen = FullScreenEnabled;
// GameMain.Graphics.ApplyChanges();
// return true;
//}
public void ResetSettingsFrame()
{
settingsFrame = null;
@@ -363,14 +350,16 @@ namespace Barotrauma
y += 70;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y+20, 150, 20), GUI.Style,0.1f, settingsFrame);
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), GUI.Style, 0.1f, settingsFrame);
soundScrollBar.BarScroll = SoundVolume;
soundScrollBar.OnMoved = ChangeSoundVolume;
soundScrollBar.Step = 0.05f;
new GUITextBlock(new Rectangle(0, y+40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y+60, 150, 20), GUI.Style, 0.1f, settingsFrame);
new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), GUI.Style, 0.1f, settingsFrame);
musicScrollBar.BarScroll = MusicVolume;
musicScrollBar.OnMoved = ChangeMusicVolume;
musicScrollBar.Step = 0.05f;
x = 200;
y = 10;

View File

@@ -9,7 +9,7 @@ namespace Barotrauma
{
class LobbyScreen : Screen
{
enum PanelTab { Crew = 0, Map = 1, CurrentLocation = 2, Store = 3 }
enum PanelTab { Crew = 0, Map = 1, Store = 3 }
private GUIFrame topPanel;
private GUIFrame[] bottomPanel;
@@ -72,19 +72,15 @@ namespace Barotrauma
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
moneyText.TextGetter = GetMoney;
GUIButton button = new GUIButton(new Rectangle(-360, 0, 100, 30), "Map", null, Alignment.BottomRight, GUI.Style, topPanel);
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Map;
button.OnClicked = SelectRightPanel;
SelectRightPanel(button, button.UserData);
button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Crew", null, Alignment.BottomRight, GUI.Style, topPanel);
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Crew;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Hire", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.CurrentLocation;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Store;
button.OnClicked = SelectRightPanel;
@@ -106,7 +102,9 @@ namespace Barotrauma
//new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.Style, bottomPanel[(int)PanelTab.Crew]);
int crewColumnWidth = Math.Min(300, (panelRect.Width - 40) / 2);
characterList = new GUIListBox(new Rectangle(0, 0, crewColumnWidth, 0), GUI.Style, bottomPanel[(int)PanelTab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", GUI.Style, bottomPanel[(int)PanelTab.Crew], GUI.LargeFont);
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), GUI.Style, bottomPanel[(int)PanelTab.Crew]);
characterList.OnSelected = SelectCharacter;
//---------------------------------------
@@ -118,12 +116,7 @@ namespace Barotrauma
Alignment.BottomRight, GUI.Style, bottomPanel[(int)PanelTab.Map]);
startButton.OnClicked = StartShift;
startButton.Enabled = false;
//---------------------------------------
bottomPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(panelRect, GUI.Style);
bottomPanel[(int)PanelTab.CurrentLocation].Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
//---------------------------------------
bottomPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.Style);
@@ -131,13 +124,13 @@ namespace Barotrauma
int sellColumnWidth = (panelRect.Width - 40) / 2 - 20;
selectedItemList = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, GUI.Style, bottomPanel[(int)PanelTab.Store]);
selectedItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, GUI.Style, bottomPanel[(int)PanelTab.Store]);
selectedItemList.OnSelected = DeselectItem;
var costText = new GUITextBlock(new Rectangle(0, 0, 100, 25), "Cost: ", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, bottomPanel[(int)PanelTab.Store]);
costText.TextGetter = CostTextGetter;
buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton = new GUIButton(new Rectangle(selectedItemList.Rect.Width - 100, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
@@ -158,10 +151,7 @@ namespace Barotrauma
SelectItemCategory(categoryButton, category);
}
x += 110;
}
}
}
public override void Select()
@@ -170,49 +160,51 @@ namespace Barotrauma
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
foreach (GUIComponent component in topPanel.children)
{
var button = component as GUIButton;
if (button == null || button.Text != "Hire") continue;
button.Enabled = GameMain.GameSession.Map.CurrentLocation.Type.HasHireableCharacters;
break;
}
UpdateCharacterLists();
}
private void UpdateLocationTab(Location location)
{
topPanel.RemoveChild(topPanel.FindChild("locationtitle"));
topPanel.UserData = location;
var locationTitle = new GUITextBlock(new Rectangle(0, 0, 200, 25),
"Location: "+location.Name, Color.Transparent, Color.White, Alignment.TopLeft, GUI.Style, topPanel);
locationTitle.UserData = "locationtitle";
locationTitle.Font = GUI.LargeFont;
bottomPanel[(int)PanelTab.CurrentLocation].ClearChildren();
bottomPanel[(int)PanelTab.CurrentLocation].UserData = location;
if (location.HireManager != null)
if (hireList == null)
{
hireList = new GUIListBox(new Rectangle(0, 0, 300, 0), GUI.Style, Alignment.Left, bottomPanel[(int)PanelTab.CurrentLocation]);
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), GUI.Style, Alignment.Right, bottomPanel[(int)PanelTab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", GUI.Style, Alignment.Right, Alignment.Left, bottomPanel[(int)PanelTab.Crew], false, GUI.LargeFont);
hireList.OnSelected = SelectCharacter;
hireList.ClearChildren();
foreach (CharacterInfo c in location.HireManager.availableCharacters)
{
var frame = c.CreateCharacterFrame(hireList, c.Name + " (" + c.Job.Name + ")", c);
new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
Alignment.TopRight, GUI.Style, frame);
}
}
if (location.HireManager == null)
{
hireList.ClearChildren();
hireList.Enabled = false;
new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, GUI.Style, hireList);
return;
}
hireList.Enabled = true;
hireList.ClearChildren();
foreach (CharacterInfo c in location.HireManager.availableCharacters)
{
var frame = c.CreateCharacterFrame(hireList, c.Name + " (" + c.Job.Name + ")", c);
new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
Alignment.TopRight, GUI.Style, frame);
}
}
@@ -273,6 +265,8 @@ namespace Barotrauma
frame.HoverColor = Color.Gold * 0.2f;
frame.SelectedColor = Color.Gold * 0.5f;
frame.ToolTip = ep.Description;
SpriteFont font = listBox.Rect.Width < 280 ? GUI.SmallFont : GUI.Font;
GUITextBlock textBlock = new GUITextBlock(
@@ -283,6 +277,7 @@ namespace Barotrauma
null, frame);
textBlock.Font = font;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
textBlock.ToolTip = ep.Description;
if (ep.sprite != null)
{
@@ -297,6 +292,7 @@ namespace Barotrauma
null, null, Alignment.TopLeft,
Alignment.TopLeft, GUI.Style, frame);
textBlock.Font = font;
textBlock.ToolTip = ep.Description;
}
@@ -342,7 +338,6 @@ namespace Barotrauma
selectedItemList.RemoveChild(child);
}
return false;
}
@@ -360,7 +355,6 @@ namespace Barotrauma
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{
if (characterList.CountChildren != CrewManager.characterInfos.Count)
{
UpdateCharacterLists();
@@ -426,12 +420,7 @@ namespace Barotrauma
private bool SelectItemCategory(GUIButton button, object selection)
{
if (!(selection is MapEntityCategory)) return false;
//var existingList = bottomPanel[(int)PanelTab.Store].children.Find(c => c is GUIListBox && c.UserData is MapEntityCategory);
//if (existingList != null) bottomPanel[(int)PanelTab.Store].RemoveChild(existingList);
//bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]);
storeItemList.ClearChildren();
@@ -480,27 +469,32 @@ namespace Barotrauma
CharacterInfo characterInfo = selection as CharacterInfo;
if (characterInfo == null) return false;
characterList.Deselect();
hireList.Deselect();
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) return false;
if (previewFrame == null || previewFrame.UserData != characterInfo)
{
previewFrame = new GUIFrame(new Rectangle(bottomPanel[(int)PanelTab.Crew].Rect.Width/2, 60, Math.Min(300,bottomPanel[(int)PanelTab.Crew].Rect.Width/2 - 40), 300),
int width = Math.Min(300, bottomPanel[(int)PanelTab.Crew].Rect.Width - hireList.Rect.Width - characterList.Rect.Width - 50);
previewFrame = new GUIFrame(new Rectangle(0, 60, width, 300),
new Color(0.0f, 0.0f, 0.0f, 0.8f),
Alignment.Top, GUI.Style, bottomPanel[selectedRightPanel]);
Alignment.TopCenter, GUI.Style, bottomPanel[selectedRightPanel]);
previewFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
previewFrame.UserData = characterInfo;
characterInfo.CreateInfoFrame(previewFrame);
}
if (selectedRightPanel == (int)PanelTab.CurrentLocation)
if (component.Parent == hireList)
{
GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, GUI.Style, previewFrame);
hireButton.UserData = characterInfo;
hireButton.OnClicked = HireCharacter;
}
return false;
return true;
}
private bool HireCharacter(GUIButton button, object selection)
@@ -511,6 +505,8 @@ namespace Barotrauma
if (gameMode.TryHireCharacter(GameMain.GameSession.Map.CurrentLocation.HireManager, characterInfo))
{
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
SelectCharacter(null,null);
}