Networking bugfixes & optimization
This commit is contained in:
Binary file not shown.
+14
-17
@@ -96,28 +96,25 @@ namespace Launcher
|
|||||||
fileButton.Enabled = (selectedPackage != null);
|
fileButton.Enabled = (selectedPackage != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedPackage == null)
|
|
||||||
|
foreach (ListBox fileBox in fileBoxes)
|
||||||
{
|
{
|
||||||
foreach (ListBox fileBox in fileBoxes)
|
fileBox.Items.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (ListBox fileBox in fileBoxes)
|
||||||
|
{
|
||||||
|
ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
|
||||||
|
|
||||||
|
foreach (ContentFile file in selectedPackage.files)
|
||||||
{
|
{
|
||||||
fileBox.Items.Clear();
|
if (file.type != type) continue;
|
||||||
|
|
||||||
|
fileBox.Items.Add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (ListBox fileBox in fileBoxes)
|
|
||||||
{
|
|
||||||
ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
|
|
||||||
|
|
||||||
foreach (ContentFile file in selectedPackage.files)
|
|
||||||
{
|
|
||||||
if (file.type != type) continue;
|
|
||||||
|
|
||||||
fileBox.Items.Add(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newPackage_Click(object sender, EventArgs e)
|
private void newPackage_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.1.2.0")]
|
[assembly: AssemblyVersion("0.1.3.1")]
|
||||||
[assembly: AssemblyFileVersion("0.1.2.0")]
|
[assembly: AssemblyFileVersion("0.1.3.1")]
|
||||||
|
|||||||
@@ -471,13 +471,20 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
message.Write((byte)state);
|
message.Write((byte)state);
|
||||||
|
|
||||||
message.Write(wallAttackPos.X);
|
bool wallAttack = (wallAttackPos!=Vector2.Zero && state == AiState.Attack);
|
||||||
message.Write(wallAttackPos.Y);
|
|
||||||
|
|
||||||
message.Write(steeringManager.WanderAngle);
|
message.Write(wallAttack);
|
||||||
message.Write(updateTargetsTimer);
|
|
||||||
message.Write(raycastTimer);
|
if (wallAttack)
|
||||||
message.Write(coolDownTimer);
|
{
|
||||||
|
message.Write(wallAttackPos.X);
|
||||||
|
message.Write(wallAttackPos.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
message.Write(MathUtils.AngleToByte(steeringManager.WanderAngle));
|
||||||
|
message.WriteRangedSingle(Math.Max(updateTargetsTimer,0.0f), 0.0f, UpdateTargetsInterval, 8);
|
||||||
|
message.WriteRangedSingle(Math.Max(raycastTimer,0.0f), 0.0f, RaycastInterval, 8);
|
||||||
|
message.WriteRangedSingle(Math.Max(coolDownTimer, 0.0f), 0.0f, attackCoolDown*2.0f, 8);
|
||||||
|
|
||||||
message.Write(targetEntity==null ? -1 : (targetEntity as Entity).ID);
|
message.Write(targetEntity==null ? -1 : (targetEntity as Entity).ID);
|
||||||
}
|
}
|
||||||
@@ -485,7 +492,7 @@ namespace Subsurface
|
|||||||
public override void ReadNetworkData(NetIncomingMessage message)
|
public override void ReadNetworkData(NetIncomingMessage message)
|
||||||
{
|
{
|
||||||
AiState newState = AiState.None;
|
AiState newState = AiState.None;
|
||||||
Vector2 newWallAttackPos;
|
Vector2 newWallAttackPos = Vector2.Zero;
|
||||||
float wanderAngle;
|
float wanderAngle;
|
||||||
float updateTargetsTimer, raycastTimer, coolDownTimer;
|
float updateTargetsTimer, raycastTimer, coolDownTimer;
|
||||||
|
|
||||||
@@ -495,12 +502,18 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
|
|
||||||
newState = (AiState)(message.ReadByte());
|
newState = (AiState)(message.ReadByte());
|
||||||
newWallAttackPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
|
||||||
|
|
||||||
wanderAngle = MathUtils.WrapAngleTwoPi(message.ReadFloat());
|
bool wallAttack = message.ReadBoolean();
|
||||||
updateTargetsTimer = MathHelper.Clamp(message.ReadFloat(), 0.0f, UpdateTargetsInterval);
|
|
||||||
raycastTimer = MathHelper.Clamp(message.ReadFloat(), 0.0f, RaycastInterval);
|
if (wallAttack)
|
||||||
coolDownTimer = MathHelper.Clamp(message.ReadFloat(), 0.0f, attackCoolDown);
|
{
|
||||||
|
newWallAttackPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
||||||
|
}
|
||||||
|
|
||||||
|
wanderAngle = MathUtils.ByteToAngle(message.ReadByte());
|
||||||
|
updateTargetsTimer = message.ReadRangedSingle(0.0f, UpdateTargetsInterval, 8);
|
||||||
|
raycastTimer = message.ReadRangedSingle(0.0f, RaycastInterval, 8);
|
||||||
|
coolDownTimer = message.ReadRangedSingle(0.0f, attackCoolDown*2.0f, 8);
|
||||||
|
|
||||||
targetID = message.ReadInt32();
|
targetID = message.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,6 +426,11 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return (info != null && !string.IsNullOrWhiteSpace(info.Name)) ? info.Name : SpeciesName;
|
||||||
|
}
|
||||||
|
|
||||||
public void GiveJobItems(WayPoint spawnPoint)
|
public void GiveJobItems(WayPoint spawnPoint)
|
||||||
{
|
{
|
||||||
if (info == null || info.Job == null) return;
|
if (info == null || info.Job == null) return;
|
||||||
@@ -1032,13 +1037,16 @@ namespace Subsurface
|
|||||||
message.Write(NetTime.Now);
|
message.Write(NetTime.Now);
|
||||||
|
|
||||||
// Write byte = move direction
|
// Write byte = move direction
|
||||||
message.Write(AnimController.TargetMovement.X);
|
message.WriteRangedSingle(AnimController.TargetMovement.X, -10.0f, 10.0f, 8);
|
||||||
message.Write(AnimController.TargetMovement.Y);
|
message.WriteRangedSingle(AnimController.TargetMovement.Y, -10.0f, 10.0f, 8);
|
||||||
|
|
||||||
message.Write(AnimController.TargetDir==Direction.Right);
|
message.Write(AnimController.TargetDir==Direction.Right);
|
||||||
|
|
||||||
message.Write(cursorPosition.X);
|
if (aiController!=null)
|
||||||
message.Write(cursorPosition.Y);
|
{
|
||||||
|
message.WriteRangedSingle(cursorPosition.X, -1000.0f, 1000.0f, 16);
|
||||||
|
message.WriteRangedSingle(cursorPosition.Y, -1000.0f, 1000.0f, 16);
|
||||||
|
}
|
||||||
|
|
||||||
message.Write(LargeUpdateTimer <= 0);
|
message.Write(LargeUpdateTimer <= 0);
|
||||||
|
|
||||||
@@ -1053,29 +1061,28 @@ namespace Subsurface
|
|||||||
message.Write(limb.body.LinearVelocity.X);
|
message.Write(limb.body.LinearVelocity.X);
|
||||||
message.Write(limb.body.LinearVelocity.Y);
|
message.Write(limb.body.LinearVelocity.Y);
|
||||||
|
|
||||||
message.Write(limb.body.Rotation);
|
message.Write(MathUtils.AngleToByte(limb.body.Rotation));
|
||||||
message.Write(limb.body.AngularVelocity);
|
message.Write(limb.body.AngularVelocity);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.Write(AnimController.StunTimer);
|
message.WriteRangedSingle(AnimController.StunTimer, 0.0f, 60.0f, 8);
|
||||||
message.Write((byte)health);
|
message.Write((byte)health);
|
||||||
|
|
||||||
LargeUpdateTimer = 5;
|
if (aiController != null) aiController.FillNetworkData(message);
|
||||||
|
|
||||||
|
LargeUpdateTimer = 10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Limb torso = AnimController.GetLimb(LimbType.Torso);
|
Limb torso = AnimController.GetLimb(LimbType.Torso);
|
||||||
|
if (torso == null) torso = AnimController.GetLimb(LimbType.Head);
|
||||||
|
|
||||||
message.Write(torso.body.Position.X);
|
message.Write(torso.body.Position.X);
|
||||||
message.Write(torso.body.Position.Y);
|
message.Write(torso.body.Position.Y);
|
||||||
|
|
||||||
LargeUpdateTimer = Math.Max(0, LargeUpdateTimer-1);
|
LargeUpdateTimer = Math.Max(0, LargeUpdateTimer-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (aiController != null) aiController.FillNetworkData(message);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||||
@@ -1127,10 +1134,19 @@ namespace Subsurface
|
|||||||
|
|
||||||
sendingTime = message.ReadDouble();
|
sendingTime = message.ReadDouble();
|
||||||
|
|
||||||
targetMovement = new Vector2 (message.ReadFloat(), message.ReadFloat());
|
targetMovement = new Vector2(message.ReadRangedSingle(-10.0f, 10.0f, 8), message.ReadRangedSingle(-10.0f, 10.0f, 8));
|
||||||
|
targetMovement.X = MathUtils.Round(targetMovement.X, 0.1f);
|
||||||
|
targetMovement.Y = MathUtils.Round(targetMovement.Y, 0.1f);
|
||||||
|
|
||||||
targetDir = message.ReadBoolean();
|
targetDir = message.ReadBoolean();
|
||||||
|
|
||||||
cursorPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
if (aiController!=null)
|
||||||
|
{
|
||||||
|
cursorPos = new Vector2(
|
||||||
|
message.ReadRangedSingle(-1000.0f, 1000.0f, 16),
|
||||||
|
message.ReadRangedSingle(-1000.0f, 1000.0f, 16));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch
|
catch
|
||||||
@@ -1165,7 +1181,7 @@ namespace Subsurface
|
|||||||
vel.X = message.ReadFloat();
|
vel.X = message.ReadFloat();
|
||||||
vel.Y = message.ReadFloat();
|
vel.Y = message.ReadFloat();
|
||||||
|
|
||||||
rotation = message.ReadFloat();
|
rotation = MathUtils.ByteToAngle(message.ReadByte());
|
||||||
angularVel = message.ReadFloat();
|
angularVel = message.ReadFloat();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -1187,7 +1203,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newStunTimer = message.ReadFloat();
|
newStunTimer = message.ReadRangedSingle(0.0f, 60.0f, 8);
|
||||||
newHealth = message.ReadByte();
|
newHealth = message.ReadByte();
|
||||||
}
|
}
|
||||||
catch { return; }
|
catch { return; }
|
||||||
@@ -1196,6 +1212,8 @@ namespace Subsurface
|
|||||||
Health = newHealth;
|
Health = newHealth;
|
||||||
|
|
||||||
LargeUpdateTimer = 1;
|
LargeUpdateTimer = 1;
|
||||||
|
|
||||||
|
if (aiController != null) aiController.ReadNetworkData(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1210,13 +1228,12 @@ namespace Subsurface
|
|||||||
|
|
||||||
|
|
||||||
Limb torso = AnimController.GetLimb(LimbType.Torso);
|
Limb torso = AnimController.GetLimb(LimbType.Torso);
|
||||||
|
if (torso == null) torso = AnimController.GetLimb(LimbType.Head);
|
||||||
torso.body.TargetPosition = pos;
|
torso.body.TargetPosition = pos;
|
||||||
|
|
||||||
LargeUpdateTimer = 0;
|
LargeUpdateTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aiController != null) aiController.ReadNetworkData(message);
|
|
||||||
|
|
||||||
LastNetworkUpdate = sendingTime;
|
LastNetworkUpdate = sendingTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
string endMessage = traitor.character.Info.Name + " was a traitor! ";
|
string endMessage = traitor.character.Info.Name + " was a traitor! ";
|
||||||
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
|
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||||
endMessage += " task was to assassinate " + target.character.Info.Name + ". ";
|
endMessage += " task was to assassinate " + target.character.Info.Name + ", but ";
|
||||||
endMessage += "The task was unsuccessful - the has submarine reached its destination.";
|
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "he" : "she";
|
||||||
|
endMessage += " got " + ((traitor.character.Info.Gender == Gender.Male) ? "himself" : "herself");
|
||||||
|
endMessage += " killed before completing it.";
|
||||||
End(endMessage);
|
End(endMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -72,10 +74,8 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
string endMessage = traitor.character.Info.Name + " was a traitor! ";
|
string endMessage = traitor.character.Info.Name + " was a traitor! ";
|
||||||
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
|
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||||
endMessage += " task was to assassinate " + target.character.Info.Name + ", but ";
|
endMessage += " task was to assassinate " + target.character.Info.Name + ". ";
|
||||||
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "he" : "she";
|
endMessage += "The task was unsuccessful - the has submarine reached its destination.";
|
||||||
endMessage += " got " + ((traitor.character.Info.Gender == Gender.Male) ? "himself" : "herself");
|
|
||||||
endMessage += " killed before completing it.";
|
|
||||||
End(endMessage);
|
End(endMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,21 @@ namespace Subsurface
|
|||||||
GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value);
|
GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value);
|
||||||
|
|
||||||
FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true";
|
FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true";
|
||||||
|
|
||||||
|
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
|
||||||
|
|
||||||
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
|
{
|
||||||
|
switch (subElement.Name.ToString().ToLower())
|
||||||
|
{
|
||||||
|
case "contentpackage":
|
||||||
|
string path = ToolBox.GetAttributeString(subElement, "path", "");
|
||||||
|
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
|
||||||
|
|
||||||
|
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -60,20 +75,7 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
|
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
|
||||||
{
|
|
||||||
switch (subElement.Name.ToString().ToLower())
|
|
||||||
{
|
|
||||||
case "contentpackage":
|
|
||||||
string path = ToolBox.GetAttributeString(subElement, "path", "");
|
|
||||||
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
|
|
||||||
|
|
||||||
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +88,8 @@ namespace Subsurface
|
|||||||
doc.Add(new XElement("config"));
|
doc.Add(new XElement("config"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doc.Root.Add(new XAttribute("masterserverurl", MasterServerUrl));
|
||||||
|
|
||||||
XElement gMode = doc.Root.Element("graphicsmode");
|
XElement gMode = doc.Root.Element("graphicsmode");
|
||||||
if (gMode == null)
|
if (gMode == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,16 +139,17 @@ namespace Subsurface
|
|||||||
if (items[i] != null)
|
if (items[i] != null)
|
||||||
{
|
{
|
||||||
bool combined = false;
|
bool combined = false;
|
||||||
if (item.Combine(items[i]))
|
//if (item.Combine(items[i]))
|
||||||
{
|
|
||||||
//PutItem(item, i, false, false);
|
|
||||||
combined = true;
|
|
||||||
}
|
|
||||||
//else if (items[i].Combine(item))
|
|
||||||
//{
|
//{
|
||||||
// //PutItem(items[i], i, false, false);
|
// //PutItem(item, i, false, false);
|
||||||
// combined = true;
|
// combined = true;
|
||||||
//}
|
//}
|
||||||
|
//else
|
||||||
|
if (items[i].Combine(item))
|
||||||
|
{
|
||||||
|
//PutItem(items[i], i, false, false);
|
||||||
|
combined = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!combined) return false;
|
if (!combined) return false;
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ namespace Subsurface.Items.Components
|
|||||||
{
|
{
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
|
|
||||||
if (character == null || character.SelectedConstruction != item)
|
if (character == null
|
||||||
|
|| character.SelectedConstruction != item
|
||||||
|
|| Vector2.Distance(character.SimPosition, item.SimPosition) > item.PickDistance * 1.5f)
|
||||||
{
|
{
|
||||||
if (character != null)
|
if (character != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -239,24 +239,15 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
new RepairTask(item, 60.0f, "Reactor meltdown!");
|
new RepairTask(item, 60.0f, "Reactor meltdown!");
|
||||||
item.Condition = 0.0f;
|
item.Condition = 0.0f;
|
||||||
//fissionRate = 0.0f;
|
|
||||||
//coolingRate = 0.0f;
|
|
||||||
|
|
||||||
//PlaySound(ActionType.OnFailure, item.Position);
|
var containedItems = item.ContainedItems;
|
||||||
//item.ApplyStatusEffects(ActionType.OnFailure, 1.0f, null);
|
if (containedItems == null) return;
|
||||||
|
|
||||||
//new Explosion(item.SimPosition, 6.0f, 500.0f, 600.0f, 10.0f, 2.0f).Explode();
|
foreach (Item containedItem in item.ContainedItems)
|
||||||
|
|
||||||
if (item.ContainedItems!=null)
|
|
||||||
{
|
{
|
||||||
foreach (Item containedItem in item.ContainedItems)
|
if (containedItem == null) continue;
|
||||||
{
|
containedItem.Condition = 0.0f;
|
||||||
if (containedItem == null) continue;
|
|
||||||
containedItem.Condition = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Pick(Character picker)
|
public override bool Pick(Character picker)
|
||||||
|
|||||||
@@ -173,16 +173,19 @@ namespace Subsurface.Items.Components
|
|||||||
(float)Math.Cos(item.body.Rotation),
|
(float)Math.Cos(item.body.Rotation),
|
||||||
(float)Math.Sin(item.body.Rotation));
|
(float)Math.Sin(item.body.Rotation));
|
||||||
|
|
||||||
if (Vector2.Dot(f1.Body.LinearVelocity, normal)<0 ) return StickToTarget(f2.Body, dir);
|
if (Vector2.Dot(f1.Body.LinearVelocity, normal) < 0.0f) return StickToTarget(f2.Body, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Item contained in item.ContainedItems)
|
|
||||||
|
var containedItems = item.ContainedItems;
|
||||||
|
if (containedItems == null) return true;
|
||||||
|
foreach (Item contained in containedItems)
|
||||||
{
|
{
|
||||||
contained.Condition = 0.0f;
|
|
||||||
if (contained.body != null)
|
if (contained.body != null)
|
||||||
{
|
{
|
||||||
contained.body.SetTransform(item.SimPosition, contained.body.Rotation);
|
contained.SetTransform(item.SimPosition, contained.body.Rotation);
|
||||||
}
|
}
|
||||||
|
contained.Condition = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ namespace Subsurface
|
|||||||
get { return prefab.sprite; }
|
get { return prefab.sprite; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float PickDistance
|
||||||
|
{
|
||||||
|
get { return prefab.PickDistance; }
|
||||||
|
}
|
||||||
|
|
||||||
public float Condition
|
public float Condition
|
||||||
{
|
{
|
||||||
get { return condition; }
|
get { return condition; }
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
private void Translate(Vector2 amount)
|
private void Translate(Vector2 amount)
|
||||||
{
|
{
|
||||||
if (amount == Vector2.Zero) return;
|
if (amount == Vector2.Zero || ! amount.IsValid()) return;
|
||||||
|
|
||||||
Level.Loaded.Move(-amount);
|
Level.Loaded.Move(-amount);
|
||||||
}
|
}
|
||||||
@@ -516,11 +516,6 @@ namespace Subsurface
|
|||||||
speed += force/mass;
|
speed += force/mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void Move(Vector2 amount)
|
|
||||||
//{
|
|
||||||
// speed = Vector2.Lerp(speed, amount, 0.05f);
|
|
||||||
//}
|
|
||||||
|
|
||||||
VoronoiCell collidingCell;
|
VoronoiCell collidingCell;
|
||||||
public bool OnCollision(Fixture f1, Fixture f2, Contact contact)
|
public bool OnCollision(Fixture f1, Fixture f2, Contact contact)
|
||||||
{
|
{
|
||||||
@@ -597,6 +592,8 @@ namespace Subsurface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!speed.IsValid() || targetPosition.IsValid()) return;
|
||||||
|
|
||||||
//newTargetPosition = newTargetPosition + newSpeed * (float)(NetTime.Now - sendingTime);
|
//newTargetPosition = newTargetPosition + newSpeed * (float)(NetTime.Now - sendingTime);
|
||||||
|
|
||||||
targetPosition = newTargetPosition;
|
targetPosition = newTargetPosition;
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ namespace Subsurface.Networking
|
|||||||
// Create new instance of configs. Parameter is "application Id". It has to be same on client and server.
|
// Create new instance of configs. Parameter is "application Id". It has to be same on client and server.
|
||||||
NetPeerConfiguration Config = new NetPeerConfiguration("subsurface");
|
NetPeerConfiguration Config = new NetPeerConfiguration("subsurface");
|
||||||
|
|
||||||
//Config.SimulatedLoss = 0.2f;
|
Config.SimulatedLoss = 0.2f;
|
||||||
//Config.SimulatedMinimumLatency = 0.25f;
|
Config.SimulatedMinimumLatency = 0.5f;
|
||||||
|
|
||||||
// Create new client, with previously created configs
|
// Create new client, with previously created configs
|
||||||
client = new NetClient(Config);
|
client = new NetClient(Config);
|
||||||
@@ -141,7 +141,7 @@ namespace Subsurface.Networking
|
|||||||
// When this is set to true, we are approved and ready to go
|
// When this is set to true, we are approved and ready to go
|
||||||
bool CanStart = false;
|
bool CanStart = false;
|
||||||
|
|
||||||
DateTime timeOut = DateTime.Now + new TimeSpan(0,0,5);
|
DateTime timeOut = DateTime.Now + new TimeSpan(0,0,15);
|
||||||
|
|
||||||
// Loop untill we are approved
|
// Loop untill we are approved
|
||||||
while (!CanStart)
|
while (!CanStart)
|
||||||
@@ -421,6 +421,26 @@ namespace Subsurface.Networking
|
|||||||
gameStarted = false;
|
gameStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (!Game1.DebugDraw) return;
|
||||||
|
|
||||||
|
int width = 200, height = 300;
|
||||||
|
int x = Game1.GraphicsWidth - width, y = (int)(Game1.GraphicsHeight * 0.3f);
|
||||||
|
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black * 0.7f, true);
|
||||||
|
spriteBatch.DrawString(GUI.Font, "Network statistics:", new Vector2(x + 10, y + 10), Color.White);
|
||||||
|
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Received bytes: " + client.Statistics.ReceivedBytes, new Vector2(x + 10, y + 45), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Received packets: " + client.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White);
|
||||||
|
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Sent bytes: " + client.Statistics.SentBytes, new Vector2(x + 10, y + 75), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Sent packets: " + client.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void Disconnect()
|
public override void Disconnect()
|
||||||
{
|
{
|
||||||
NetOutgoingMessage msg = client.CreateMessage();
|
NetOutgoingMessage msg = client.CreateMessage();
|
||||||
@@ -514,7 +534,7 @@ namespace Subsurface.Networking
|
|||||||
msg.Write((byte)type);
|
msg.Write((byte)type);
|
||||||
msg.Write(message);
|
msg.Write(message);
|
||||||
|
|
||||||
client.SendMessage(msg, NetDeliveryMethod.Unreliable);
|
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
config = new NetPeerConfiguration("subsurface");
|
config = new NetPeerConfiguration("subsurface");
|
||||||
|
|
||||||
//config.SimulatedLoss = 0.2f;
|
config.SimulatedLoss = 0.2f;
|
||||||
//config.SimulatedMinimumLatency = 0.25f;
|
config.SimulatedMinimumLatency = 0.5f;
|
||||||
|
|
||||||
config.Port = port;
|
config.Port = port;
|
||||||
Port = port;
|
Port = port;
|
||||||
@@ -222,7 +222,7 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
if (!isClient)
|
if (!isClient)
|
||||||
{
|
{
|
||||||
c.LargeUpdateTimer = 0;
|
//c.LargeUpdateTimer = 0;
|
||||||
new NetworkEvent(c.ID, false);
|
new NetworkEvent(c.ID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,32 +259,38 @@ namespace Subsurface.Networking
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("Connection error - server failed to read your ConnectionApproval message");
|
inc.SenderConnection.Deny("Connection error - server failed to read your ConnectionApproval message");
|
||||||
|
DebugConsole.NewMessage("Connection error - server failed to read the ConnectionApproval message", Color.Red);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userPassword != password)
|
if (userPassword != password)
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("Wrong password!");
|
inc.SenderConnection.Deny("Wrong password!");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (version != Game1.Version.ToString())
|
else if (version != Game1.Version.ToString())
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("Subsurface version " + Game1.Version + " required to connect to the server (Your version: " + version + ")");
|
inc.SenderConnection.Deny("Subsurface version " + Game1.Version + " required to connect to the server (Your version: " + version + ")");
|
||||||
|
DebugConsole.NewMessage("Connection error - wrong game version", Color.Red);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (packageName != Game1.SelectedPackage.Name)
|
else if (packageName != Game1.SelectedPackage.Name)
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("Your content package ("+packageName+") doesn't match the server's version (" + Game1.SelectedPackage.Name + ")");
|
inc.SenderConnection.Deny("Your content package ("+packageName+") doesn't match the server's version (" + Game1.SelectedPackage.Name + ")");
|
||||||
|
DebugConsole.NewMessage("Connection error - wrong content package name", Color.Red);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (packageHash != Game1.SelectedPackage.MD5hash.Hash)
|
else if (packageHash != Game1.SelectedPackage.MD5hash.Hash)
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("Your content package (MD5: " + packageHash + ") doesn't match the server's version (MD5: " + Game1.SelectedPackage.MD5hash.Hash + ")");
|
inc.SenderConnection.Deny("Your content package (MD5: " + packageHash + ") doesn't match the server's version (MD5: " + Game1.SelectedPackage.MD5hash.Hash + ")");
|
||||||
|
DebugConsole.NewMessage("Connection error - wrong content package hash", Color.Red);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (connectedClients.Find(c => c.name.ToLower() == name.ToLower())!=null)
|
else if (connectedClients.Find(c => c.name.ToLower() == name.ToLower())!=null)
|
||||||
{
|
{
|
||||||
inc.SenderConnection.Deny("The name ''" + name + "'' is already in use. Please choose another name.");
|
inc.SenderConnection.Deny("The name ''" + name + "'' is already in use. Please choose another name.");
|
||||||
|
DebugConsole.NewMessage("Connection error - name already in use", Color.Red);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,6 +405,8 @@ namespace Subsurface.Networking
|
|||||||
if (recipients.Count == 0) break;
|
if (recipients.Count == 0) break;
|
||||||
server.SendMessage(outmsg, recipients, inc.DeliveryMethod, 0);
|
server.SendMessage(outmsg, recipients, inc.DeliveryMethod, 0);
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.WriteLine("Sending networkevent (" + outmsg.LengthBytes+" bytes)");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (byte)PacketTypes.Chatmessage:
|
case (byte)PacketTypes.Chatmessage:
|
||||||
ChatMessageType messageType = (ChatMessageType)inc.ReadByte();
|
ChatMessageType messageType = (ChatMessageType)inc.ReadByte();
|
||||||
@@ -451,6 +459,8 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
networkEvent.FillData(message);
|
networkEvent.FillData(message);
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.WriteLine("Sending networkevent " + Entity.FindEntityByID(networkEvent.ID).ToString() + " (" + message.LengthBytes + " bytes)");
|
||||||
|
|
||||||
if (server.ConnectionsCount>0)
|
if (server.ConnectionsCount>0)
|
||||||
{
|
{
|
||||||
server.SendMessage(message, server.Connections,
|
server.SendMessage(message, server.Connections,
|
||||||
@@ -464,13 +474,19 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
public bool StartGame(GUIButton button, object obj)
|
public bool StartGame(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
|
Submarine selectedMap = Game1.NetLobbyScreen.SelectedMap as Submarine;
|
||||||
|
|
||||||
|
if (selectedMap == null)
|
||||||
|
{
|
||||||
|
Game1.NetLobbyScreen.SubList.Flash();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int seed = DateTime.Now.Millisecond;
|
int seed = DateTime.Now.Millisecond;
|
||||||
Rand.SetSyncedSeed(seed);
|
Rand.SetSyncedSeed(seed);
|
||||||
|
|
||||||
AssignJobs();
|
AssignJobs();
|
||||||
|
|
||||||
Submarine selectedMap = Game1.NetLobbyScreen.SelectedMap as Submarine;
|
|
||||||
|
|
||||||
//selectedMap.Load();
|
//selectedMap.Load();
|
||||||
|
|
||||||
Game1.GameSession = new GameSession(selectedMap, "", Game1.NetLobbyScreen.SelectedMode);
|
Game1.GameSession = new GameSession(selectedMap, "", Game1.NetLobbyScreen.SelectedMode);
|
||||||
@@ -654,7 +670,7 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
public void NewTraitor(Client traitor, Client target)
|
public void NewTraitor(Client traitor, Client target)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("New traitor", traitor.name + " is the traitor and the target is " + target+".");
|
new GUIMessageBox("New traitor", traitor.name + " is the traitor and the target is " + target.name+".");
|
||||||
|
|
||||||
NetOutgoingMessage msg = server.CreateMessage();
|
NetOutgoingMessage msg = server.CreateMessage();
|
||||||
msg.Write((byte)PacketTypes.Traitor);
|
msg.Write((byte)PacketTypes.Traitor);
|
||||||
@@ -665,6 +681,38 @@ namespace Subsurface.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (!Game1.DebugDraw) return;
|
||||||
|
|
||||||
|
int width = 200, height = 300;
|
||||||
|
int x = Game1.GraphicsWidth - width, y = (int)(Game1.GraphicsHeight*0.3f);
|
||||||
|
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black*0.7f, true);
|
||||||
|
spriteBatch.DrawString(GUI.Font, "Network statistics:", new Vector2(x+10, y+10), Color.White);
|
||||||
|
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Connections: "+server.ConnectionsCount, new Vector2(x + 10, y + 30), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Received bytes: " + server.Statistics.ReceivedBytes, new Vector2(x + 10, y + 45), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Received packets: " + server.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White);
|
||||||
|
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Sent bytes: " + server.Statistics.SentBytes, new Vector2(x + 10, y + 75), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Sent packets: " + server.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White);
|
||||||
|
|
||||||
|
|
||||||
|
y += 110;
|
||||||
|
foreach (Client c in connectedClients)
|
||||||
|
{
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, c.name + ":", new Vector2(x + 10, y), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "- avg roundtrip " + c.Connection.AverageRoundtripTime+" s", new Vector2(x + 20, y + 15), Color.White);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "- current MTU " + c.Connection.CurrentMTU, new Vector2(x + 20, y + 30), Color.White);
|
||||||
|
y += 50;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateNetLobby(object obj)
|
public bool UpdateNetLobby(object obj)
|
||||||
{
|
{
|
||||||
NetOutgoingMessage msg = server.CreateMessage();
|
NetOutgoingMessage msg = server.CreateMessage();
|
||||||
@@ -699,12 +747,12 @@ namespace Subsurface.Networking
|
|||||||
}
|
}
|
||||||
if (recipients.Count>0)
|
if (recipients.Count>0)
|
||||||
{
|
{
|
||||||
server.SendMessage(msg, recipients, NetDeliveryMethod.Unreliable, 0);
|
server.SendMessage(msg, recipients, NetDeliveryMethod.ReliableUnordered, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server.SendMessage(msg, server.Connections, NetDeliveryMethod.Unreliable, 0);
|
server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ namespace Subsurface.Networking
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.WriteLine("Networkevent entity: "+e.ToString());
|
||||||
|
|
||||||
//System.Diagnostics.Debug.WriteLine("new message: " + eventType +" - "+e);
|
//System.Diagnostics.Debug.WriteLine("new message: " + eventType +" - "+e);
|
||||||
|
|
||||||
e.ReadNetworkData(eventType, message);
|
e.ReadNetworkData(eventType, message);
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
private bool StartShift(GUIButton button, object selection)
|
private bool StartShift(GUIButton button, object selection)
|
||||||
{
|
{
|
||||||
Game1.GameSession.StartShift(TimeSpan.Zero, selectedLevel);
|
Game1.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
|
||||||
Game1.GameScreen.Select();
|
Game1.GameScreen.Select();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ namespace Subsurface
|
|||||||
|
|
||||||
private GUITextBox textBox, seedBox;
|
private GUITextBox textBox, seedBox;
|
||||||
|
|
||||||
//GUIFrame previewPlayer;
|
|
||||||
|
|
||||||
private GUIScrollBar durationBar;
|
private GUIScrollBar durationBar;
|
||||||
|
|
||||||
private GUIFrame playerFrame;
|
private GUIFrame playerFrame;
|
||||||
@@ -36,6 +34,11 @@ namespace Subsurface
|
|||||||
|
|
||||||
private GUITextBox serverMessage;
|
private GUITextBox serverMessage;
|
||||||
|
|
||||||
|
public GUIListBox SubList
|
||||||
|
{
|
||||||
|
get { return subList; }
|
||||||
|
}
|
||||||
|
|
||||||
public Submarine SelectedMap
|
public Submarine SelectedMap
|
||||||
{
|
{
|
||||||
get { return subList.SelectedData as Submarine; }
|
get { return subList.SelectedData as Submarine; }
|
||||||
@@ -275,7 +278,7 @@ namespace Subsurface
|
|||||||
modeList.OnSelected += Game1.Server.UpdateNetLobby;
|
modeList.OnSelected += Game1.Server.UpdateNetLobby;
|
||||||
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
|
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
|
||||||
|
|
||||||
if (subList.CountChildren > 0) subList.Select(0);
|
if (subList.CountChildren > 0) subList.Select(-1);
|
||||||
if (GameModePreset.list.Count > 0) modeList.Select(0);
|
if (GameModePreset.list.Count > 0) modeList.Select(0);
|
||||||
}
|
}
|
||||||
else if (playerFrame.children.Count==0)
|
else if (playerFrame.children.Count==0)
|
||||||
@@ -443,6 +446,7 @@ namespace Subsurface
|
|||||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, color,
|
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, color,
|
||||||
Alignment.Left, GUI.style, null, true);
|
Alignment.Left, GUI.style, null, true);
|
||||||
msg.Font = GUI.SmallFont;
|
msg.Font = GUI.SmallFont;
|
||||||
|
msg.CanBeFocused = false;
|
||||||
|
|
||||||
msg.Padding = new Vector4(20, 0, 0, 0);
|
msg.Padding = new Vector4(20, 0, 0, 0);
|
||||||
chatBox.AddChild(msg);
|
chatBox.AddChild(msg);
|
||||||
@@ -658,57 +662,13 @@ namespace Subsurface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrySelectMap(mapName, md5Hash);
|
if (!string.IsNullOrWhiteSpace(mapName)) TrySelectMap(mapName, md5Hash);
|
||||||
|
|
||||||
modeList.Select(modeIndex);
|
modeList.Select(modeIndex);
|
||||||
|
|
||||||
durationBar.BarScroll = durationScroll;
|
durationBar.BarScroll = durationScroll;
|
||||||
|
|
||||||
LevelSeed = levelSeed;
|
LevelSeed = levelSeed;
|
||||||
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
// int playerCount = msg.ReadInt32();
|
|
||||||
|
|
||||||
// for (int i = 0; i < playerCount; i++)
|
|
||||||
// {
|
|
||||||
// int clientID = msg.ReadInt32();
|
|
||||||
// string jobName = msg.ReadString();
|
|
||||||
|
|
||||||
// Client client = null;
|
|
||||||
// GUITextBlock textBlock = null;
|
|
||||||
// foreach (GUIComponent child in playerList.children)
|
|
||||||
// {
|
|
||||||
// Client tempClient = child.UserData as Client;
|
|
||||||
// if (tempClient == null || tempClient.ID != clientID) continue;
|
|
||||||
|
|
||||||
// client = tempClient;
|
|
||||||
// textBlock = child as GUITextBlock;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if (client == null) continue;
|
|
||||||
|
|
||||||
// client.assignedJob = JobPrefab.List.Find(jp => jp.Name == jobName);
|
|
||||||
|
|
||||||
// textBlock.Text = client.name + ((client.assignedJob==null) ? "" : " (" + client.assignedJob.Name + ")");
|
|
||||||
|
|
||||||
// if (client.assignedJob==null || jobName != client.assignedJob.Name)
|
|
||||||
// {
|
|
||||||
// if (clientID == Game1.Client.ID)
|
|
||||||
// {
|
|
||||||
// Game1.Client.CharacterInfo.Job = new Job(client.assignedJob);
|
|
||||||
// Game1.Client.CharacterInfo.Name = client.name;
|
|
||||||
// UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//catch
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ namespace Subsurface
|
|||||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.style, menu);
|
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.style, menu);
|
||||||
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), GUI.style, menu);
|
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), GUI.style, menu);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int middleX = (int)(width * 0.4f);
|
int middleX = (int)(width * 0.4f);
|
||||||
|
|
||||||
serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.style, menu);
|
serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.style, menu);
|
||||||
@@ -81,6 +76,10 @@ namespace Subsurface
|
|||||||
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, GUI.style, menu);
|
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, GUI.style, menu);
|
||||||
joinButton.OnClicked = JoinServer;
|
joinButton.OnClicked = JoinServer;
|
||||||
|
|
||||||
|
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.style, menu);
|
||||||
|
button.UserData = 0;
|
||||||
|
button.OnClicked = Game1.MainMenuScreen.SelectTab;
|
||||||
|
|
||||||
|
|
||||||
refreshDisableTimer = DateTime.Now;
|
refreshDisableTimer = DateTime.Now;
|
||||||
}
|
}
|
||||||
@@ -286,7 +285,7 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
string selectedPassword = "";
|
string selectedPassword = "";
|
||||||
|
|
||||||
if ((serverList.Selected.GetChild("password") as GUITickBox).Selected)
|
if (serverList.Selected!=null && (serverList.Selected.GetChild("password") as GUITickBox).Selected)
|
||||||
{
|
{
|
||||||
var msgBox = new GUIMessageBox("Password required", "");
|
var msgBox = new GUIMessageBox("Password required", "");
|
||||||
var passwordBox = new GUITextBox(new Rectangle(0,0,150,20), Alignment.BottomCenter, GUI.style, msgBox);
|
var passwordBox = new GUITextBox(new Rectangle(0,0,150,20), Alignment.BottomCenter, GUI.style, msgBox);
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ namespace Subsurface
|
|||||||
|
|
||||||
public static float Round(float value, float div)
|
public static float Round(float value, float div)
|
||||||
{
|
{
|
||||||
return (float)Math.Floor(value / div) * div;
|
return (value < 0.0f) ?
|
||||||
|
(float)Math.Ceiling(value / div) * div :
|
||||||
|
(float)Math.Floor(value / div) * div;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float VectorToAngle(Vector2 vector)
|
public static float VectorToAngle(Vector2 vector)
|
||||||
|
|||||||
@@ -55,11 +55,16 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Error saving gamesession", e);
|
DebugConsole.ThrowError("Error saving gamesession", e);
|
||||||
}
|
}
|
||||||
//Game1.GameSession.crewManager.Save(directory+"\\crew.xml");
|
|
||||||
|
|
||||||
CompressDirectory(tempPath, fileName+".save", null);
|
try
|
||||||
|
{
|
||||||
|
CompressDirectory(tempPath, fileName+".save", null);
|
||||||
|
}
|
||||||
|
|
||||||
//Directory.Delete(tempPath, true);
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error compressing save file", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadGame(string fileName)
|
public static void LoadGame(string fileName)
|
||||||
|
|||||||
@@ -1,3 +1,27 @@
|
|||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
v0.1.3.1
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Multiplayer:
|
||||||
|
- chat messages are sent reliably
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
v0.1.3
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Multiplayer:
|
||||||
|
- fixed master server connection errors in server list screen
|
||||||
|
- fixed a bug that caused other characters to get "stuck" to the railgun controller, causing them
|
||||||
|
to fly back to it as they try to move away
|
||||||
|
|
||||||
|
Items:
|
||||||
|
- putting items inside other items works properly now (i.e. by pulling a spear to the same slot as
|
||||||
|
a harpoon, not the other way around)
|
||||||
|
- C4 blocks loaded inside a railgun shell won't explode inside the submarine when firing the railgun
|
||||||
|
- fixed another game-crashing railgun bug
|
||||||
|
- fixed a bug that caused characters to spawn with an incorrect number of items
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
v0.1.2
|
v0.1.2
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Binary file not shown.
@@ -1,4 +1,6 @@
|
|||||||
Content\SpriteFont1.xnb
|
Content\SpriteFont1.xnb
|
||||||
Content\SmallFont.xnb
|
Content\SmallFont.xnb
|
||||||
|
Content\LargeFont.xnb
|
||||||
Content\SpriteFont1.spritefont
|
Content\SpriteFont1.spritefont
|
||||||
Content\SmallFont.spritefont
|
Content\SmallFont.spritefont
|
||||||
|
Content\LargeFont.spritefont
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Content\SpriteFont1.xnb
|
||||||
|
Content\SmallFont.xnb
|
||||||
|
Content\LargeFont.xnb
|
||||||
|
Content\SpriteFont1.spritefont
|
||||||
|
Content\SmallFont.spritefont
|
||||||
|
Content\LargeFont.spritefont
|
||||||
Binary file not shown.
Binary file not shown.
+2
@@ -1,4 +1,6 @@
|
|||||||
Content\SpriteFont1.xnb
|
Content\SpriteFont1.xnb
|
||||||
Content\SmallFont.xnb
|
Content\SmallFont.xnb
|
||||||
|
Content\LargeFont.xnb
|
||||||
Content\SpriteFont1.spritefont
|
Content\SpriteFont1.spritefont
|
||||||
Content\SmallFont.spritefont
|
Content\SmallFont.spritefont
|
||||||
|
Content\LargeFont.spritefont
|
||||||
|
|||||||
+25
-7
@@ -7,8 +7,26 @@
|
|||||||
<Importer>FontDescriptionImporter</Importer>
|
<Importer>FontDescriptionImporter</Importer>
|
||||||
<Processor>FontDescriptionProcessor</Processor>
|
<Processor>FontDescriptionProcessor</Processor>
|
||||||
<Options>None</Options>
|
<Options>None</Options>
|
||||||
<Output>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows\Content\SpriteFont1.xnb</Output>
|
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\SpriteFont1.xnb</Output>
|
||||||
<Time>2014-08-09T18:03:17.8614245+03:00</Time>
|
<Time>2015-07-19T00:51:29.3427566+03:00</Time>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Source>SmallFont.spritefont</Source>
|
||||||
|
<Name>SmallFont</Name>
|
||||||
|
<Importer>FontDescriptionImporter</Importer>
|
||||||
|
<Processor>FontDescriptionProcessor</Processor>
|
||||||
|
<Options>None</Options>
|
||||||
|
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\SmallFont.xnb</Output>
|
||||||
|
<Time>2015-07-19T00:51:26.3565858+03:00</Time>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Source>LargeFont.spritefont</Source>
|
||||||
|
<Name>LargeFont</Name>
|
||||||
|
<Importer>FontDescriptionImporter</Importer>
|
||||||
|
<Processor>FontDescriptionProcessor</Processor>
|
||||||
|
<Options>None</Options>
|
||||||
|
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\LargeFont.xnb</Output>
|
||||||
|
<Time>2015-08-13T19:53:28.5907374+03:00</Time>
|
||||||
</Item>
|
</Item>
|
||||||
<BuildSuccessful>true</BuildSuccessful>
|
<BuildSuccessful>true</BuildSuccessful>
|
||||||
<Settings>
|
<Settings>
|
||||||
@@ -17,15 +35,15 @@
|
|||||||
<TargetProfile>HiDef</TargetProfile>
|
<TargetProfile>HiDef</TargetProfile>
|
||||||
<BuildConfiguration>Windows</BuildConfiguration>
|
<BuildConfiguration>Windows</BuildConfiguration>
|
||||||
<CompressContent>false</CompressContent>
|
<CompressContent>false</CompressContent>
|
||||||
<RootDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_contentContent\</RootDirectory>
|
<RootDirectory>E:\Subsurface\Subsurface_content\Subsurface_contentContent\</RootDirectory>
|
||||||
<LoggerRootDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\</LoggerRootDirectory>
|
<LoggerRootDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\</LoggerRootDirectory>
|
||||||
<IntermediateDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows\</IntermediateDirectory>
|
<IntermediateDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\obj\Windows\</IntermediateDirectory>
|
||||||
<OutputDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows\Content\</OutputDirectory>
|
<OutputDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\</OutputDirectory>
|
||||||
</Settings>
|
</Settings>
|
||||||
<Assemblies>
|
<Assemblies>
|
||||||
<Assembly>
|
<Assembly>
|
||||||
<Key>C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGameContentProcessors.dll</Key>
|
<Key>C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGameContentProcessors.dll</Key>
|
||||||
<Value>2014-04-06T00:56:18+03:00</Value>
|
<Value>2015-02-12T06:10:24+02:00</Value>
|
||||||
</Assembly>
|
</Assembly>
|
||||||
<Assembly>
|
<Assembly>
|
||||||
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
|
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
+5
@@ -1 +1,6 @@
|
|||||||
Content\SpriteFont1.xnb
|
Content\SpriteFont1.xnb
|
||||||
|
Content\SmallFont.xnb
|
||||||
|
Content\LargeFont.xnb
|
||||||
|
Content\SpriteFont1.spritefont
|
||||||
|
Content\SmallFont.spritefont
|
||||||
|
Content\LargeFont.spritefont
|
||||||
|
|||||||
@@ -65,6 +65,15 @@
|
|||||||
<Processor>FontDescriptionProcessor</Processor>
|
<Processor>FontDescriptionProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="LargeFont.spritefont">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<Name>LargeFont</Name>
|
||||||
|
<Importer>FontDescriptionImporter</Importer>
|
||||||
|
<Processor>FontDescriptionProcessor</Processor>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
||||||
<!--
|
<!--
|
||||||
To modify your build process, add your task inside one of the targets below and uncomment it.
|
To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user