Merge branch 'new-netcode' of https://gitlab.com/poe.regalis/barotrauma into new-netcode

This commit is contained in:
juanjp600
2017-01-09 15:06:32 -03:00
7 changed files with 15 additions and 32 deletions

View File

@@ -2444,6 +2444,9 @@ namespace Barotrauma
{
GameMain.Client.Character = character;
Controlled = character;
GameMain.LightManager.LosEnabled = true;
character.memInput.Clear();
character.memPos.Clear();
character.memLocalPos.Clear();

View File

@@ -293,36 +293,6 @@ namespace Barotrauma
{
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed / 500.0f) * BarSize;
}
for (int i = 0; i < children.Count; i++)
{
GUIComponent child = children[i];
if (child == frame || !child.Visible) continue;
if (enabled && child.CanBeFocused &&
(MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
{
child.State = ComponentState.Hover;
if (PlayerInput.LeftButtonClicked())
{
Debug.WriteLine("clicked");
Select(i);
}
}
else if (selected.Contains(child))
{
child.State = ComponentState.Selected;
if (CheckSelected != null)
{
if (CheckSelected() != child.UserData) selected.Remove(child);
}
}
else
{
child.State = ComponentState.None;
}
}
}
public void Select(int childIndex, bool force = false)

View File

@@ -170,7 +170,7 @@ namespace Barotrauma
public void StartShift(Level level, bool reloadSub = true, bool loadSecondSub = false)
{
GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null);
GameMain.LightManager.LosEnabled = GameMain.NetworkMember == null || GameMain.NetworkMember.CharacterInfo != null;
this.level = level;

View File

@@ -577,6 +577,8 @@ namespace Barotrauma.Networking
if (Character != null) Character.Remove();
Entity.Spawner.Clear();
entityEventManager.Clear();
LastSentEntityEventID = 0;
endVoteTickBox.Selected = false;

View File

@@ -906,6 +906,12 @@ namespace Barotrauma.Networking
List<CharacterInfo> characterInfos = new List<CharacterInfo>();
foreach (Client client in connectedClients)
{
client.lastRecvEntitySpawnID = 0;
client.entityEventLastSent.Clear();
client.lastSentEntityEventID = 0;
client.lastRecvEntityEventID = 0;
if (client.characterInfo == null)
{
client.characterInfo = new CharacterInfo(Character.HumanConfigFile, client.name);

View File

@@ -120,6 +120,8 @@ namespace Barotrauma.Networking
{
ID = 0;
lastReceivedID = 0;
events.Clear();
eventLastSent.Clear();
}

View File

@@ -31,7 +31,6 @@ namespace Barotrauma.Networking
//write into a temporary buffer so we can write the length before the actual data
NetBuffer tempBuffer = new NetBuffer();
WriteEvent(tempBuffer, e, recipient);
tempBuffer.WritePadBits();
Debug.Assert(
tempBuffer.LengthBytes < 256,
@@ -40,6 +39,7 @@ namespace Barotrauma.Networking
msg.Write((UInt16)e.Entity.ID);
msg.Write((byte)tempBuffer.LengthBytes);
msg.Write(tempBuffer);
msg.WritePadBits();
}
}