Item.Container bugfix (affected at least railguns in MP), merged the "your crew has died" message box with shiftsummary, reliable reactor syncing, prevent artifacts dropping out of the level

This commit is contained in:
Regalis
2016-01-12 01:02:05 +02:00
parent 64e62545a5
commit 5513637fe5
21 changed files with 132 additions and 89 deletions
@@ -52,7 +52,7 @@ namespace Barotrauma
return; return;
} }
if (container.Item.inventory == character.Inventory) if (container.Item.Inventory == character.Inventory)
{ {
var containedItems = container.Inventory.Items; var containedItems = container.Inventory.Items;
//if there's already something in the mask (empty oxygen tank?), drop it //if there's already something in the mask (empty oxygen tank?), drop it
@@ -102,8 +102,8 @@ namespace Barotrauma
currSearchIndex++; currSearchIndex++;
if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue; if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue;
if (IgnoreContainedItems && Item.ItemList[currSearchIndex].container != null) continue; if (IgnoreContainedItems && Item.ItemList[currSearchIndex].Container != null) continue;
if (Item.ItemList[currSearchIndex].inventory is CharacterInventory) continue; if (Item.ItemList[currSearchIndex].Inventory is CharacterInventory) continue;
targetItem = Item.ItemList[currSearchIndex]; targetItem = Item.ItemList[currSearchIndex];
@@ -119,9 +119,9 @@ namespace Barotrauma
private void AddGoToObjective(Item item) private void AddGoToObjective(Item item)
{ {
Item moveToTarget = item; Item moveToTarget = item;
while (moveToTarget.container != null) while (moveToTarget.Container != null)
{ {
moveToTarget = moveToTarget.container; moveToTarget = moveToTarget.Container;
} }
AddSubObjective(new AIObjectiveGoTo(moveToTarget, character)); AddSubObjective(new AIObjectiveGoTo(moveToTarget, character));
+2 -2
View File
@@ -968,7 +968,7 @@ namespace Barotrauma
{ {
if (!Enabled) return; if (!Enabled) return;
Vector2 pos = AnimController.Limbs[0].WorldPosition; Vector2 pos = DrawPosition;
pos.Y = -pos.Y; pos.Y = -pos.Y;
if (this == controlled) return; if (this == controlled) return;
@@ -992,7 +992,7 @@ namespace Barotrauma
if (isDead) return; if (isDead) return;
Vector2 healthBarPos = new Vector2(DrawPosition.X - 50, -DrawPosition.Y - 100.0f); Vector2 healthBarPos = new Vector2(pos.X - 50, pos.Y - 100.0f);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false); GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true); GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
} }
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework; using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System.Xml.Linq; using System.Xml.Linq;
namespace Barotrauma namespace Barotrauma
@@ -29,6 +30,7 @@ namespace Barotrauma
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)]; Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
monster = Character.Create(monsterFile, position); monster = Character.Create(monsterFile, position);
monster.Enabled = false;
radarPosition = monster.Position; radarPosition = monster.Position;
} }
@@ -37,7 +39,14 @@ namespace Barotrauma
switch (state) switch (state)
{ {
case 0: case 0:
if (monster.Enabled) radarPosition = monster.Position; if (monster.Enabled)
{
radarPosition = monster.Position;
}
else
{ Vector2 diff = monster.WorldPosition-Submarine.Loaded.WorldPosition;
monster.Enabled = FarseerPhysics.ConvertUnits.ToSimUnits(diff.Length()) < NetConfig.CharacterIgnoreDistance;
}
if (!monster.IsDead) return; if (!monster.IsDead) return;
ShowMessage(state); ShowMessage(state);
@@ -51,7 +51,7 @@ namespace Barotrauma
ConvertUnits.ToSimUnits(tryPos - Vector2.UnitY*level.Size.Y), ConvertUnits.ToSimUnits(tryPos - Vector2.UnitY*level.Size.Y),
null, Physics.CollisionLevel) != null) null, Physics.CollisionLevel) != null)
{ {
position = tryPos; position = ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition);
break; break;
} }
@@ -67,7 +67,7 @@ namespace Barotrauma
item = new Item(itemPrefab, position, null); item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true; item.MoveWithLevel = true;
item.body.FarseerBody.GravityScale = 0.5f; item.body.FarseerBody.IsKinematic = true;
//item.MoveWithLevel = true; //item.MoveWithLevel = true;
} }
@@ -76,7 +76,10 @@ namespace Barotrauma
switch (state) switch (state)
{ {
case 0: case 0:
//item.body.LinearVelocity = Vector2.Zero;
if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false;
if (item.CurrentHull == null) return; if (item.CurrentHull == null) return;
ShowMessage(state); ShowMessage(state);
state = 1; state = 1;
break; break;
@@ -204,15 +204,39 @@ namespace Barotrauma
} }
else else
{ {
var msgBox = new GUIMessageBox("Game over", "Your entire crew has died!", new string[] { "Load game", "Quit" });
msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
msgBox.Buttons[0].OnClicked += msgBox.Close; // var okButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu; //okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
msgBox.Buttons[1].OnClicked += msgBox.Close;
// var msgBox = new GUIMessageBox("Game over", "Your entire crew has died!", new string[] { "Load game", "Quit" });
// msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
// msgBox.Buttons[0].OnClicked += msgBox.Close;
// msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu;
// msgBox.Buttons[1].OnClicked += msgBox.Close;
} }
GameMain.GameSession.EndShift(""); GameMain.GameSession.EndShift("");
if (!success)
{
var summaryScreen = GUIMessageBox.MessageBoxes.Peek();
if (summaryScreen != null)
{
summaryScreen = summaryScreen.children[0];
summaryScreen.RemoveChild(summaryScreen.children.Find(c => c is GUIButton));
var okButton = new GUIButton(new Rectangle(-120, 0, 100, 30), "Load game", Alignment.BottomRight, GUI.Style, summaryScreen);
okButton.OnClicked += GameMain.GameSession.LoadPrevious;
okButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
var quitButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Quit", Alignment.BottomRight, GUI.Style, summaryScreen);
quitButton.OnClicked += GameMain.LobbyScreen.QuitToMainMenu;
quitButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
}
}
CrewManager.EndShift(); CrewManager.EndShift();
for (int i = Character.CharacterList.Count - 1; i >= 0; i--) for (int i = Character.CharacterList.Count - 1; i >= 0; i--)
{ {
@@ -95,7 +95,7 @@ namespace Barotrauma
int x = 0; int x = 0;
foreach (Character character in gameSession.CrewManager.characters) foreach (Character character in gameSession.CrewManager.characters)
{ {
var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), character.IsDead ? Color.DarkRed * 0.7f : Color.Transparent, GUI.Style, listBox); var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), Color.Transparent, GUI.Style, listBox);
characterFrame.OutlineColor = Color.Transparent; characterFrame.OutlineColor = Color.Transparent;
characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
characterFrame.CanBeFocused = false; characterFrame.CanBeFocused = false;
@@ -162,7 +162,7 @@ namespace Barotrauma
System.Diagnostics.Debug.Assert(false); System.Diagnostics.Debug.Assert(false);
return false; return false;
} }
Inventory otherInventory = Items[index].inventory; Inventory otherInventory = Items[index].Inventory;
if (otherInventory != null && createNetworkEvent) if (otherInventory != null && createNetworkEvent)
{ {
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true); new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true);
@@ -213,7 +213,7 @@ namespace Barotrauma
string toolTip = ""; string toolTip = "";
Rectangle highlightedSlot = Rectangle.Empty; Rectangle highlightedSlot = Rectangle.Empty;
if (doubleClickedItem!=null && doubleClickedItem.inventory!=this) if (doubleClickedItem!=null && doubleClickedItem.Inventory!=this)
{ {
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true); TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
} }
@@ -222,7 +222,7 @@ namespace Barotrauma.Items.Components
IsActive = true; IsActive = true;
if (hideItems || (item.body!=null && !item.body.Enabled)) item.body.Enabled = false; if (hideItems || (item.body!=null && !item.body.Enabled)) item.body.Enabled = false;
item.container = this.item; //item.Container = this.item;
return true; return true;
} }
@@ -10,6 +10,8 @@ namespace Barotrauma.Items.Components
{ {
class Reactor : Powered class Reactor : Powered
{ {
const float NetworkUpdateInterval = 3.0f;
//the rate at which the reactor is being run un //the rate at which the reactor is being run un
//higher rates generate more power (and heat) //higher rates generate more power (and heat)
private float fissionRate; private float fissionRate;
@@ -50,6 +52,9 @@ namespace Barotrauma.Items.Components
private PropertyTask powerUpTask; private PropertyTask powerUpTask;
private bool unsentChanges;
private float sendUpdateTimer;
[Editable, HasDefaultValue(9500.0f, true)] [Editable, HasDefaultValue(9500.0f, true)]
public float MeltDownTemp public float MeltDownTemp
{ {
@@ -248,6 +253,15 @@ namespace Barotrauma.Items.Components
AvailableFuel = 0.0f; AvailableFuel = 0.0f;
item.SendSignal(((int)temperature).ToString(), "temperature_out"); item.SendSignal(((int)temperature).ToString(), "temperature_out");
sendUpdateTimer = Math.Max(sendUpdateTimer - deltaTime, 0.0f);
if (unsentChanges && sendUpdateTimer<= 0.0f)
{
item.NewComponentEvent(this, true, true);
sendUpdateTimer = NetworkUpdateInterval;
unsentChanges = false;
}
} }
public override void UpdateBroken(float deltaTime, Camera cam) public override void UpdateBroken(float deltaTime, Camera cam)
@@ -353,9 +367,7 @@ namespace Barotrauma.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{ {
IsActive = true; IsActive = true;
bool valueChanged = false;
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height; int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X; int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y; int y = GuiFrame.Rect.Y;
@@ -380,12 +392,12 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + shutDownTemp, new Vector2(x + 450, y + 80), Color.White); spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + shutDownTemp, new Vector2(x + 450, y + 80), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 110, 40, 40), "+", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 110, 40, 40), "+", true))
{ {
valueChanged = true; unsentChanges = true;
ShutDownTemp += 100.0f; ShutDownTemp += 100.0f;
} }
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 500, y + 110, 40, 40), "-", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 500, y + 110, 40, 40), "-", true))
{ {
valueChanged = true; unsentChanges = true;
ShutDownTemp -= 100.0f; ShutDownTemp -= 100.0f;
} }
@@ -393,7 +405,7 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White); spriteBatch.DrawString(GUI.Font, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 210, 100, 40), ((autoTemp) ? "TURN OFF" : "TURN ON"))) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 210, 100, 40), ((autoTemp) ? "TURN OFF" : "TURN ON")))
{ {
valueChanged = true; unsentChanges = true;
autoTemp = !autoTemp; autoTemp = !autoTemp;
} }
@@ -407,12 +419,12 @@ namespace Barotrauma.Items.Components
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 30, 40, 40), "+", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 30, 40, 40), "+", true))
{ {
valueChanged = true; unsentChanges = true;
FissionRate += 1.0f; FissionRate += 1.0f;
} }
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 80, 40, 40), "-", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 80, 40, 40), "-", true))
{ {
valueChanged = true; unsentChanges = true;
FissionRate -= 1.0f; FissionRate -= 1.0f;
} }
@@ -422,21 +434,17 @@ namespace Barotrauma.Items.Components
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 30, 40, 40), "+", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 30, 40, 40), "+", true))
{ {
valueChanged = true; unsentChanges = true;
CoolingRate += 1.0f; CoolingRate += 1.0f;
} }
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 80, 40, 40), "-", true)) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 80, 40, 40), "-", true))
{ {
valueChanged = true; unsentChanges = true;
CoolingRate -= 1.0f; CoolingRate -= 1.0f;
} }
//y = y - 260; //y = y - 260;
if (valueChanged)
{
item.NewComponentEvent(this, true, false);
}
} }
static void UpdateGraph<T>(IList<T> graph, T newValue) static void UpdateGraph<T>(IList<T> graph, T newValue)
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
} }
currPowerConsumption = MathHelper.Lerp(currPowerConsumption, rechargeSpeed, 0.05f); currPowerConsumption = MathHelper.Lerp(currPowerConsumption, rechargeSpeed, 0.05f);
charge += currPowerConsumption*voltage / 3600.0f; Charge += currPowerConsumption*voltage / 3600.0f;
} }
//provide power to the grid //provide power to the grid
else if (gridLoad > 0.0f) else if (gridLoad > 0.0f)
@@ -100,7 +100,7 @@ namespace Barotrauma.Items.Components
light.Submarine = item.CurrentHull.Submarine; light.Submarine = item.CurrentHull.Submarine;
} }
if (item.container != null) if (item.Container != null)
{ {
light.Color = Color.Transparent; light.Color = Color.Transparent;
return; return;
@@ -133,7 +133,7 @@ namespace Barotrauma.Items.Components
if (ic == this) continue; if (ic == this) continue;
ic.Drop(null); ic.Drop(null);
} }
if (item.container != null) item.container.RemoveContained(this.item); if (item.Container != null) item.Container.RemoveContained(this.item);
item.body.Enabled = false; item.body.Enabled = false;
+1 -1
View File
@@ -156,7 +156,7 @@ namespace Barotrauma.Items.Components
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation); projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
projectiles[0].Use(deltaTime); projectiles[0].Use(deltaTime);
if (projectile.container != null) projectile.container.RemoveContained(projectile); if (projectile.Container != null) projectile.Container.RemoveContained(projectile);
return true; return true;
} }
+4 -4
View File
@@ -125,11 +125,11 @@ namespace Barotrauma
if (removeItem) if (removeItem)
{ {
item.Drop(null, false); item.Drop(null, false);
if (item.inventory != null) item.inventory.RemoveItem(item); if (item.Inventory != null) item.Inventory.RemoveItem(item);
} }
Items[i] = item; Items[i] = item;
item.inventory = this; item.Inventory = this;
if (item.body != null) if (item.body != null)
{ {
item.body.Enabled = false; item.body.Enabled = false;
@@ -152,7 +152,7 @@ namespace Barotrauma
{ {
if (Items[n] != item) continue; if (Items[n] != item) continue;
Items[n] = null; Items[n] = null;
item.inventory = null; item.Inventory = null;
} }
} }
@@ -201,7 +201,7 @@ namespace Barotrauma
} }
} }
if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition) && draggingItem.container == this.Owner) if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition) && draggingItem.Container == this.Owner)
{ {
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed) if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
{ {
+27 -9
View File
@@ -61,11 +61,29 @@ namespace Barotrauma
private bool inWater; private bool inWater;
//the inventory in which the item is contained in private Inventory inventory;
public Inventory inventory;
//the inventory in which the item is contained in
public Inventory Inventory
{
get
{
return inventory;
}
set
{
inventory = value;
if (inventory != null) Container = inventory.Owner as Item;
}
}
public Item Container
{
get;
private set;
}
public Item container;
public List<FixRequirement> FixRequirements; public List<FixRequirement> FixRequirements;
public override string Name public override string Name
@@ -354,7 +372,7 @@ namespace Barotrauma
if (c == null) return; if (c == null) return;
c.RemoveContained(contained); c.RemoveContained(contained);
contained.container = null; contained.Container = null;
} }
@@ -517,7 +535,7 @@ namespace Barotrauma
//effect.Apply(type, deltaTime, null, Character); //effect.Apply(type, deltaTime, null, Character);
//ApplyStatusEffect(effect, type, deltaTime, null, Character, limb); //ApplyStatusEffect(effect, type, deltaTime, null, Character, limb);
if (container != null && effect.Targets.HasFlag(StatusEffect.TargetType.Parent)) targets.Add(container); if (Container != null && effect.Targets.HasFlag(StatusEffect.TargetType.Parent)) targets.Add(Container);
//{ //{
// effect.Apply(type, deltaTime, container); // effect.Apply(type, deltaTime, container);
// //container.ApplyStatusEffect(effect, type, deltaTime, container); // //container.ApplyStatusEffect(effect, type, deltaTime, container);
@@ -558,7 +576,7 @@ namespace Barotrauma
} }
ic.WasUsed = false; ic.WasUsed = false;
if (container != null) ic.ApplyStatusEffects(ActionType.OnContained, deltaTime); if (Container != null) ic.ApplyStatusEffects(ActionType.OnContained, deltaTime);
if (!ic.IsActive) continue; if (!ic.IsActive) continue;
@@ -1005,7 +1023,7 @@ namespace Barotrauma
} }
} }
if (container!=null) container.RemoveContained(this); if (Container!=null) Container.RemoveContained(this);
return true; return true;
} }
@@ -1079,7 +1097,7 @@ namespace Barotrauma
foreach (ItemComponent ic in components) ic.Drop(dropper); foreach (ItemComponent ic in components) ic.Drop(dropper);
if (container != null) container.RemoveContained(this); if (Container != null) Container.RemoveContained(this);
} }
public void Equip(Character character) public void Equip(Character character)
+1 -1
View File
@@ -57,7 +57,7 @@ namespace Barotrauma
item.Unequip(c); item.Unequip(c);
break; break;
} }
item.container = container.Item; //item.Container = container.Item;
container.IsActive = true; container.IsActive = true;
} }
return wasPut; return wasPut;
+1 -1
View File
@@ -233,7 +233,7 @@ namespace Barotrauma
foreach (Item item in Item.ItemList) foreach (Item item in Item.ItemList)
{ {
if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue; if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue;
if (item.inventory != null) return; if (item.Inventory != null) return;
float range = (float)Math.Sqrt(size.X) * 10.0f; float range = (float)Math.Sqrt(size.X) * 10.0f;
if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue; if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue;
+16 -36
View File
@@ -609,49 +609,29 @@ namespace Barotrauma.Networking
float endPreviewLength = 10.0f; float endPreviewLength = 10.0f;
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength); if (Screen.Selected == GameMain.GameScreen)
float secondsLeft = endPreviewLength;
do
{ {
secondsLeft -= CoroutineManager.DeltaTime; var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength);
//float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi; float secondsLeft = endPreviewLength;
//Vector2 offset = (new Vector2(
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f; do
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime); {
secondsLeft -= CoroutineManager.DeltaTime;
//messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s"; //float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
//Vector2 offset = (new Vector2(
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
yield return CoroutineStatus.Running; //GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
} while (secondsLeft > 0.0f); //Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
//float endPreviewLength = 10.0f; //messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
//DateTime endTime = DateTime.Now + new TimeSpan(0,0,0,0,(int)(1000.0f*endPreviewLength)); yield return CoroutineStatus.Running;
//float secondsLeft = endPreviewLength; } while (secondsLeft > 0.0f);
}
//do
//{
// secondsLeft = (float)(endTime - DateTime.Now).TotalSeconds;
// float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
// Vector2 offset = (new Vector2(
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
// GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.DrawPosition + offset * 0.8f;
// //Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
// messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
// yield return CoroutineStatus.Running;
//} while (secondsLeft > 0.0f);
//messageBox.Close(null,null);
Submarine.Unload(); Submarine.Unload();
@@ -90,6 +90,7 @@ namespace Barotrauma.Networking
GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400,400), null, Alignment.Center, GUI.Style, settingsFrame); GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400,400), null, Alignment.Center, GUI.Style, settingsFrame);
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Randomize level seed", Alignment.Left, innerFrame); var randomizeLevelBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Randomize level seed", Alignment.Left, innerFrame);
randomizeLevelBox.Selected = randomizeSeed;
randomizeLevelBox.OnSelected = ToggleRandomizeSeed; randomizeLevelBox.OnSelected = ToggleRandomizeSeed;
new GUITextBlock(new Rectangle(0, 35, 100, 20), "Submarine selection:", GUI.Style, innerFrame); new GUITextBlock(new Rectangle(0, 35, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
Binary file not shown.