Merged branch new-netcode into new-netcode

This commit is contained in:
juanjp600
2016-10-08 19:14:52 -03:00
27 changed files with 550 additions and 474 deletions
+1 -1
View File
@@ -148,8 +148,8 @@ namespace Barotrauma
editingHUD = CreateEditingHUD();
}
editingHUD.Update(0.016f);
editingHUD.Draw(spriteBatch);
editingHUD.Update((float)Physics.step);
if (!PlayerInput.LeftButtonClicked() || !PlayerInput.KeyDown(Keys.Space)) return;
+20 -19
View File
@@ -217,26 +217,18 @@ namespace Barotrauma
}
private Location highlightedLocation;
public void Draw(SpriteBatch spriteBatch, Rectangle rect, float scale = 1.0f)
public void Update(float deltaTime, Rectangle rect, float scale = 1.0f)
{
//GUI.DrawRectangle(spriteBatch, rect, Color.DarkBlue, true);
Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y);
Vector2 offset = -currentLocation.MapPosition;
iceTexture.DrawTiled(spriteBatch, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), Vector2.Zero, Color.White*0.8f);
GUI.DrawRectangle(spriteBatch, rect, Color.White);
//spriteBatch.Draw(iceTexture, offset, rect, null, null, 0f, null, Color.White, SpriteEffects.None, 0.0f);
//Vector2 scale = new Vector2((float)rect.Width/ size, (float)rect.Height/size);
float maxDist = 20.0f;
float closestDist = 0.0f;
highlightedLocation = null;
for (int i = 0; i < locations.Count;i++ )
for (int i = 0; i < locations.Count; i++)
{
Location location = locations[i];
Vector2 pos = rectCenter + (location.MapPosition+offset) * scale;
Vector2 pos = rectCenter + (location.MapPosition + offset) * scale;
if (!rect.Contains(pos)) continue;
@@ -251,21 +243,30 @@ namespace Barotrauma
foreach (LocationConnection connection in connections)
{
Color crackColor = Color.White * Math.Max(connection.Difficulty/100.0f, 0.5f);
if (highlightedLocation != currentLocation &&
connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation))
{
crackColor = Color.Red;
if (PlayerInput.LeftButtonClicked()&&
if (PlayerInput.LeftButtonClicked() &&
selectedLocation != highlightedLocation && highlightedLocation != null)
{
selectedConnection = connection;
selectedLocation = highlightedLocation;
GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection);
}
selectedLocation = highlightedLocation;
GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection);
}
}
}
}
public void Draw(SpriteBatch spriteBatch, Rectangle rect, float scale = 1.0f)
{
Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y);
Vector2 offset = -currentLocation.MapPosition;
iceTexture.DrawTiled(spriteBatch, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), Vector2.Zero, Color.White*0.8f);
foreach (LocationConnection connection in connections)
{
Color crackColor = Color.White * Math.Max(connection.Difficulty/100.0f, 1.5f);
if (selectedLocation != currentLocation &&
+1 -1
View File
@@ -325,7 +325,7 @@ namespace Barotrauma
public void UpdateTransform()
{
DrawPosition = Physics.Interpolate(prevPosition, Position);
DrawPosition = Timing.Interpolate(prevPosition, Position);
}
//math/physics stuff ----------------------------------------------------
+1 -1
View File
@@ -178,7 +178,7 @@ namespace Barotrauma
editingHUD = CreateEditingHUD();
}
editingHUD.Update((float)Physics.step);
editingHUD.Update((float)Timing.Step);
editingHUD.Draw(spriteBatch);
if (!PlayerInput.LeftButtonClicked()) return;