Lobbyscreen store fixes, sub name textbox & save button in sub editor, transitioncinematic on crew death, saving reactor state, radar marker position fix, minimap fix, button sounds, artifact positioning fix, better LegUp prevention method, some music clips when round ends
This commit is contained in:
@@ -14,6 +14,8 @@ namespace Barotrauma
|
||||
private GUIComponent[] GUItabs;
|
||||
private int selectedTab;
|
||||
|
||||
private GUITextBox nameBox;
|
||||
|
||||
//a Character used for picking up and manipulating items
|
||||
private Character dummyCharacter;
|
||||
|
||||
@@ -58,13 +60,19 @@ namespace Barotrauma
|
||||
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
|
||||
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||
|
||||
GUITextBlock nameBlock = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, GUIpanel, true, GUI.LargeFont);
|
||||
nameBlock.TextGetter = GetSubName;
|
||||
|
||||
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 80, 0, 20), "", GUI.Style, GUIpanel);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 20, 0, 20), "Submarine:", GUI.Style, GUIpanel);
|
||||
nameBox = new GUITextBox(new Rectangle(0, 40, 0, 20), GUI.Style, GUIpanel);
|
||||
//nameBlock.TextGetter = GetSubName;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(0,70,0,20), "Save", GUI.Style, GUIpanel);
|
||||
button.OnClicked = SaveSub;
|
||||
|
||||
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel);
|
||||
itemCount.TextGetter = GetItemCount;
|
||||
|
||||
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel);
|
||||
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
|
||||
structureCount.TextGetter = GetStructureCount;
|
||||
|
||||
//GUITextBlock physicsBodyCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
|
||||
@@ -79,7 +87,7 @@ namespace Barotrauma
|
||||
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
|
||||
|
||||
int width = 400, height = 400;
|
||||
int y = 150;
|
||||
int y = 160;
|
||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||
{
|
||||
|
||||
@@ -135,7 +143,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
|
||||
var button = new GUIButton(new Rectangle(0, y+50, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button = new GUIButton(new Rectangle(0, y+50, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
||||
button.OnClicked = ToggleCharacterMode;
|
||||
|
||||
@@ -165,7 +173,11 @@ namespace Barotrauma
|
||||
GUIComponent.MouseOn = null;
|
||||
characterMode = false;
|
||||
|
||||
if (Submarine.Loaded != null) cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
|
||||
if (Submarine.Loaded != null)
|
||||
{
|
||||
cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
|
||||
nameBox.Text = Submarine.Loaded.Name;
|
||||
}
|
||||
//CreateDummyCharacter();
|
||||
}
|
||||
|
||||
@@ -194,6 +206,32 @@ namespace Barotrauma
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
|
||||
private bool SaveSub(GUIButton button, object obj)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nameBox.Text))
|
||||
{
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nameBox.Text.Contains("../"))
|
||||
{
|
||||
DebugConsole.ThrowError("Illegal symbols in filename (../)");
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Submarine.Loaded!=null)
|
||||
{
|
||||
Submarine.Loaded.Name = nameBox.Text;
|
||||
}
|
||||
|
||||
Submarine.SaveCurrent(nameBox.Text + ".sub");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SelectTab(GUIButton button, object obj)
|
||||
{
|
||||
selectedTab = (int)obj;
|
||||
|
||||
@@ -140,6 +140,9 @@ namespace Barotrauma
|
||||
buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 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]);
|
||||
storeItemList.OnSelected = SelectItem;
|
||||
|
||||
int x = selectedItemList.Rect.Width + 40;
|
||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||
{
|
||||
@@ -149,14 +152,15 @@ namespace Barotrauma
|
||||
var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]);
|
||||
categoryButton.UserData = category;
|
||||
categoryButton.OnClicked = SelectItemCategory;
|
||||
|
||||
if (category==MapEntityCategory.Equipment)
|
||||
{
|
||||
SelectItemCategory(categoryButton, category);
|
||||
}
|
||||
x += 110;
|
||||
|
||||
storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
|
||||
storeItemList.OnSelected = SelectItem;
|
||||
storeItemList.UserData = category;
|
||||
}
|
||||
|
||||
SelectItemCategory(null, MapEntityCategory.Item);
|
||||
|
||||
}
|
||||
|
||||
@@ -184,6 +188,8 @@ namespace Barotrauma
|
||||
{
|
||||
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";
|
||||
@@ -263,7 +269,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateItemFrame(MapEntityPrefab ep, GUIListBox listBox)
|
||||
private void CreateItemFrame(MapEntityPrefab ep, GUIListBox listBox, int width)
|
||||
{
|
||||
Color color = ((listBox.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
|
||||
|
||||
@@ -277,27 +283,28 @@ namespace Barotrauma
|
||||
SpriteFont font = listBox.Rect.Width < 280 ? GUI.SmallFont : GUI.Font;
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(
|
||||
new Rectangle(40, 0, 0, 25),
|
||||
new Rectangle(50, 0, 0, 25),
|
||||
ep.Name,
|
||||
Color.Transparent, Color.White,
|
||||
Alignment.Left, Alignment.Left,
|
||||
Alignment.Left, Alignment.CenterX | Alignment.Left,
|
||||
null, frame);
|
||||
textBlock.Font = font;
|
||||
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
||||
|
||||
textBlock = new GUITextBlock(
|
||||
new Rectangle(0, 0, 0, 25),
|
||||
ep.Price.ToString(),
|
||||
null, null,
|
||||
Alignment.TopRight, GUI.Style, textBlock);
|
||||
textBlock.Font = font;
|
||||
|
||||
if (ep.sprite != null)
|
||||
{
|
||||
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
|
||||
img.Color = ep.SpriteColor;
|
||||
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
|
||||
}
|
||||
|
||||
textBlock = new GUITextBlock(
|
||||
new Rectangle(width - 80, 0, 80, 25),
|
||||
ep.Price.ToString(),
|
||||
null, null, Alignment.TopLeft,
|
||||
Alignment.TopLeft, GUI.Style, frame);
|
||||
textBlock.Font = font;
|
||||
|
||||
}
|
||||
|
||||
private bool SelectItem(GUIComponent component, object obj)
|
||||
@@ -305,7 +312,7 @@ namespace Barotrauma
|
||||
MapEntityPrefab prefab = obj as MapEntityPrefab;
|
||||
if (prefab == null) return false;
|
||||
|
||||
CreateItemFrame(prefab, selectedItemList);
|
||||
CreateItemFrame(prefab, selectedItemList, selectedItemList.Rect.Width);
|
||||
|
||||
buyButton.Enabled = CrewManager.Money >= selectedItemCost;
|
||||
|
||||
@@ -388,8 +395,8 @@ namespace Barotrauma
|
||||
bottomPanel[selectedRightPanel].Rect.Width - 310,
|
||||
bottomPanel[selectedRightPanel].Rect.Height - 40), mapZoom);
|
||||
}
|
||||
|
||||
if (bottomPanel[(int)selectedRightPanel].UserData as Location != GameMain.GameSession.Map.CurrentLocation)
|
||||
|
||||
if (topPanel.UserData as Location != GameMain.GameSession.Map.CurrentLocation)
|
||||
{
|
||||
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
|
||||
}
|
||||
@@ -438,13 +445,25 @@ namespace Barotrauma
|
||||
MapEntityCategory category = (MapEntityCategory)selection;
|
||||
var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category == category);
|
||||
|
||||
int width = storeItemList.Rect.Width;
|
||||
|
||||
foreach (MapEntityPrefab ep in items)
|
||||
{
|
||||
CreateItemFrame(ep, storeItemList);
|
||||
CreateItemFrame(ep, storeItemList, width);
|
||||
}
|
||||
|
||||
storeItemList.children.Sort((x, y) => (x.UserData as MapEntityPrefab).Name.CompareTo((y.UserData as MapEntityPrefab).Name));
|
||||
|
||||
foreach (GUIComponent child in button.Parent.children)
|
||||
{
|
||||
var otherButton = child as GUIButton;
|
||||
if (child.UserData is MapEntityCategory && otherButton != button)
|
||||
{
|
||||
otherButton.Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
button.Selected = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,13 +233,15 @@ namespace Barotrauma
|
||||
private bool ApplySettings(GUIButton button, object obj)
|
||||
{
|
||||
GameMain.Config.Save("config.xml");
|
||||
selectedTab = (int)obj;
|
||||
selectedTab = 0;
|
||||
|
||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||
{
|
||||
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user