WIP item grouping in store screen, endworm event

This commit is contained in:
Regalis11
2016-01-01 22:24:47 +02:00
parent 92d396e6b2
commit 325bf0c66b
8 changed files with 94 additions and 37 deletions
Binary file not shown.
+1 -1
View File
@@ -16,7 +16,7 @@
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
</infotexts>
+12 -1
View File
@@ -46,13 +46,24 @@
<message header="Target terminated" text="The thresher is dead. Navigate the submarine out of the cavern to claim the reward."/>
</MonsterMission>
<MonsterMission
name="Beast from the Abyss"
description="Seismic readings are indicating that something colossal has emerged from the depths of Europa into the passageway between [location1] and [location2]. All transports through the passageway have been canceled for now and a reward of 10,000 has been promised to those who get rid of whatever is causing the seismic activity."
commonness="10"
reward="10000"
radarlabel="Target"
successmessage="The End Worm is dead and the passageway is open for transport again."
monsterfile="Content/Characters/Endworm/endworm.xml">
<message header="Target terminated" text="The beast is dead. Navigate the submarine out of the cavern to claim the reward."/>
</MonsterMission>
<MonsterMission
name="Salvaging an artifact"
description="Researchers of [location1] have picked up an infrasonic signal highly similar to those emitted by alien artifacts previously discovered on Europa. Investigate the signal and retrieve the potential artifact."
commonness="5"
reward="1000"
radarlabel="Infrasonic signal"
successmessage="It turns out the signal was emitted by a Moloch. The researchers of [location1] have agreed to pay you the reward nevertheless for killing the Moloch."
successmessage="It turns out the signal was emitted by a Moloch. The researchers of [location1] have agreed to pay you the reward nevertheless for getting rid of the Moloch."
monsterfile="Content/Characters/Moloch/moloch.xml">
</MonsterMission>
</Missions>
+8
View File
@@ -33,5 +33,13 @@
difficulty="5"
minamount="1" maxamount="1"
musictype="monster"/>
<MonsterEvent name="Under attack" description=""
characterfile="Content/Characters/Endworm/endworm.xml"
spawndeep="true"
commonness="1"
difficulty="5"
minamount="1" maxamount="1"
musictype="deep"/>
</Randomevents>
@@ -340,17 +340,17 @@ namespace Barotrauma
}
}
if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f))
{
//stairs = null;
//return false;
}
//if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f))
//{
// //stairs = null;
// //return false;
//}
Limb limb = f1.Body.UserData as Limb;
if (limb != null)// && (limb.type == LimbType.LeftFoot || limb.type == LimbType.RightFoot))
{
if (contact.Manifold.LocalNormal.Y >= 0.0f)
{
{
if (limb.SimPosition.Y < lowestLimb.SimPosition.Y+0.2f)
{
stairs = structure;
+16 -10
View File
@@ -58,11 +58,12 @@ namespace Barotrauma
startPos = cam.WorldToScreen(startPos);
Vector2 textPos = startPos;
textPos -= new Vector2(GUI.Font.MeasureString(character.ClosestCharacter.Info.Name).X / 2, 20);
float stringWidth = GUI.Font.MeasureString(character.ClosestCharacter.Info.Name).X;
textPos -= new Vector2(stringWidth / 2, 20);
spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos, Color.Black);
spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos + new Vector2(1, -1), Color.Orange);
GUI.DrawString(spriteBatch, textPos, character.ClosestCharacter.Info.Name, Color.Orange, Color.Black, 2);
//spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos, Color.Black);
//spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos + new Vector2(1, -1), Color.Orange);
}
else if (character.SelectedCharacter == null && character.ClosestItem != null && character.SelectedConstruction == null)
{
@@ -71,19 +72,24 @@ namespace Barotrauma
startPos = cam.WorldToScreen(startPos);
Vector2 textPos = startPos;
textPos -= new Vector2(GUI.Font.MeasureString(character.ClosestItem.Name).X / 2, 20);
//spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Black);
//GUI.DrawRectangle(spriteBatch, textPos-Vector2.One*2.0f, textSize+Vector2.One*4.0f, Color.Black * 0.7f, true);
//spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Orange);
GUI.DrawString(spriteBatch, textPos, character.ClosestItem.Name, Color.Orange, Color.Black * 0.7f, 2);
float stringWidth = GUI.Font.MeasureString(character.ClosestItem.Prefab.Name).X;
textPos -= new Vector2(stringWidth / 2, 20);
spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Black);
spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos + new Vector2(1, -1), Color.Orange);
textPos.Y += 50.0f;
foreach (ColoredText coloredText in character.ClosestItem.GetHUDTexts(character))
{
textPos.X = startPos.X - GUI.Font.MeasureString(coloredText.Text).X / 2;
spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, Color.Black);
spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos + new Vector2(1, -1), coloredText.Color);
GUI.DrawString(spriteBatch, textPos, coloredText.Text, coloredText.Color, Color.Black*0.7f, 2);
//spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, Color.Black);
//GUI.DrawRectangle(spriteBatch, textPos - Vector2.One * 2.0f, textSize + Vector2.One * 4.0f, Color.Black * 0.7f, true);
//spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, coloredText.Color);
textPos.Y += 25;
}
+21 -11
View File
@@ -15,7 +15,7 @@ namespace Barotrauma
Center = (CenterX | CenterY),
BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom)
}
public class GUI
{
public static GUIStyle Style;
@@ -42,7 +42,7 @@ namespace Barotrauma
GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", content);
GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", content);
cursor = new Sprite("Content/UI/cursor.png" ,Vector2.Zero);
cursor = new Sprite("Content/UI/cursor.png", Vector2.Zero);
}
public static bool PauseMenuOpen
@@ -63,7 +63,7 @@ namespace Barotrauma
// create 1x1 texture for line drawing
t = new Texture2D(graphicsDevice, 1, 1);
t.SetData(new Color[] { Color.White });// fill the texture with white
Style = new GUIStyle("Content/UI/style.xml");
}
@@ -75,18 +75,18 @@ namespace Barotrauma
if (pauseMenuOpen)
{
pauseMenu = new GUIFrame(new Rectangle(0,0,200,300), null, Alignment.Center, Style);
pauseMenu = new GUIFrame(new Rectangle(0, 0, 200, 300), null, Alignment.Center, Style);
int y = 0;
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked = TogglePauseMenu;
y += 60;
if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession !=null)
if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession != null)
{
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (spMode!=null)
if (spMode != null)
{
button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked += TogglePauseMenu;
@@ -95,7 +95,7 @@ namespace Barotrauma
y += 60;
}
}
if (Screen.Selected == GameMain.LobbyScreen)
{
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
@@ -111,7 +111,7 @@ namespace Barotrauma
}
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
}
@@ -132,7 +132,7 @@ namespace Barotrauma
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
}
if (GameMain.NetworkMember!=null)
if (GameMain.NetworkMember != null)
{
GameMain.NetworkMember.Disconnect();
GameMain.NetworkMember = null;
@@ -149,7 +149,7 @@ namespace Barotrauma
Vector2 edge = end - start;
// calculate angle to rotate line
float angle = (float)Math.Atan2(edge.Y, edge.X);
sb.Draw(t,
new Rectangle(// rectangle defines shape of line and position of start of line
(int)start.X,
@@ -163,6 +163,16 @@ namespace Barotrauma
SpriteEffects.None,
depth);
}
public static void DrawString(SpriteBatch sb, Vector2 pos, string text, Color color, Color? backgroundColor=null, int backgroundPadding=0, SpriteFont font = null)
{
if (font == null) font = GUI.Font;
sb.DrawString(font, text, pos, color);
if (backgroundColor == null) return;
Vector2 textSize = font.MeasureString(text);
DrawRectangle(sb, pos - Vector2.One*backgroundPadding, textSize + Vector2.One * 2.0f * backgroundPadding, (Color)backgroundColor, true);
}
public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f)
{
+30 -8
View File
@@ -19,7 +19,8 @@ namespace Barotrauma
private GUIListBox characterList, hireList;
private GUIListBox selectedItemList, itemList;
private GUIListBox selectedItemList;
private GUIListBox[] storeItemLists;
private SinglePlayerMode gameMode;
@@ -135,18 +136,27 @@ namespace Barotrauma
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(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
itemList = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
itemList.OnSelected = SelectItem;
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
storeItemLists = new GUIListBox[Enum.GetValues(typeof(MapEntityCategory)).Length];
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
if (ep.Price == 0) continue;
storeItemLists[(int)category] = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
storeItemLists[(int)category].OnSelected = SelectItem;
storeItemLists[(int)category].UserData = category;
bottomPanel[(int)PanelTab.Store].RemoveChild(storeItemLists[(int)category]);
CreateItemFrame(ep, itemList);
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
{
if (ep.Price == 0 || ep.Category != category) continue;
CreateItemFrame(ep, storeItemLists[(int)category]);
}
}
}
public override void Select()
@@ -413,6 +423,18 @@ namespace Barotrauma
return true;
}
private bool SelectItemCategory(GUIButton button, object selection)
{
if (!(selection is MapEntityCategory)) return false;
var existingList = bottomPanel[(int)PanelTab.Store].children.Find(c => c.UserData is MapEntityCategory);
if (existingList != null) bottomPanel[(int)PanelTab.Store].RemoveChild(existingList);
bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]);
return true;
}
private string GetMoney()
{
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", CrewManager.Money)) + " credits";