Spawnpoints for different jobs, spawning crew members with job-specific items, fixed issues with non-matching entity IDs between client and server, Unity-like coroutine system (connecting to server doesn't freeze the game anymore), map drawing improvements
This commit is contained in:
@@ -117,17 +117,26 @@ namespace Subsurface
|
||||
listBox.ClearChildren();
|
||||
characters.Clear();
|
||||
|
||||
foreach (CharacterInfo ci in characterInfos)
|
||||
WayPoint[] waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos);
|
||||
|
||||
for (int i = 0; i < waypoints.Length; i++)
|
||||
{
|
||||
WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Human);
|
||||
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition;
|
||||
|
||||
Character character = new Character(ci.File, position, ci);
|
||||
|
||||
Character character = new Character(characterInfos[i], waypoints[i]);
|
||||
Character.Controlled = character;
|
||||
|
||||
if (!character.Info.StartItemsGiven)
|
||||
{
|
||||
character.GiveJobItems();
|
||||
character.Info.StartItemsGiven = true;
|
||||
}
|
||||
|
||||
AddCharacter(character);
|
||||
}
|
||||
|
||||
if (characters.Count>0) SelectCharacter(characters[0]);
|
||||
if (characters.Count > 0) SelectCharacter(characters[0]);
|
||||
}
|
||||
|
||||
public void EndShift()
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Subsurface
|
||||
|
||||
private GUIFrame guiRoot;
|
||||
|
||||
private GUIListBox chatBox;
|
||||
//private GUIListBox chatBox;
|
||||
private GUITextBox textBox;
|
||||
|
||||
private string savePath;
|
||||
@@ -59,20 +59,20 @@ namespace Subsurface
|
||||
|
||||
map = new Map(Rand.Int(), 500);
|
||||
|
||||
int width = 350, height = 100;
|
||||
if (Game1.NetworkMember!=null)
|
||||
{
|
||||
chatBox = new GUIListBox(new Rectangle(
|
||||
Game1.GraphicsWidth - 20 - width,
|
||||
Game1.GraphicsHeight - 40 - 25 - height,
|
||||
width, height),
|
||||
Color.White * 0.5f, GUI.style, guiRoot);
|
||||
//int width = 350, height = 100;
|
||||
//if (Game1.NetworkMember!=null)
|
||||
//{
|
||||
// chatBox = new GUIListBox(new Rectangle(
|
||||
// Game1.GraphicsWidth - 20 - width,
|
||||
// Game1.GraphicsHeight - 40 - 25 - height,
|
||||
// width, height),
|
||||
// Color.White * 0.5f, GUI.style, guiRoot);
|
||||
|
||||
textBox = new GUITextBox(
|
||||
new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
|
||||
Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, GUI.style, guiRoot);
|
||||
textBox.OnEnter = EnterChatMessage;
|
||||
}
|
||||
// textBox = new GUITextBox(
|
||||
// new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
|
||||
// Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, GUI.style, guiRoot);
|
||||
// textBox.OnEnter = EnterChatMessage;
|
||||
//}
|
||||
|
||||
this.gameMode = gameMode;
|
||||
//if (gameMode != null && !gameMode.IsSinglePlayer)
|
||||
@@ -124,7 +124,7 @@ namespace Subsurface
|
||||
|
||||
this.level = level;
|
||||
|
||||
if (Submarine.Loaded!=submarine) submarine.Load();
|
||||
if (Submarine.Loaded != submarine) submarine.Load();
|
||||
|
||||
if (gameMode!=null) gameMode.Start(duration);
|
||||
|
||||
@@ -172,34 +172,35 @@ namespace Subsurface
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool EnterChatMessage(GUITextBox textBox, string message)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(message)) return false;
|
||||
//public bool EnterChatMessage(GUITextBox textBox, string message)
|
||||
//{
|
||||
// if (string.IsNullOrWhiteSpace(message)) return false;
|
||||
|
||||
else if (Game1.NetworkMember != null)
|
||||
{
|
||||
Game1.NetworkMember.SendChatMessage(Game1.NetworkMember.Name + ": " + message);
|
||||
}
|
||||
// else if (Game1.NetworkMember != null)
|
||||
// {
|
||||
// Game1.NetworkMember.SendChatMessage(Game1.NetworkMember.Name + ": " + message);
|
||||
// }
|
||||
|
||||
textBox.Deselect();
|
||||
// textBox.Deselect();
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
//}
|
||||
|
||||
public void NewChatMessage(string text, Color color)
|
||||
{
|
||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), text,
|
||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, color,
|
||||
Alignment.Left, null, null, true);
|
||||
//public void NewChatMessage(string text, Color color)
|
||||
//{
|
||||
// GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), text,
|
||||
|
||||
msg.Padding = new Vector4(20.0f, 0, 0, 0);
|
||||
chatBox.AddChild(msg);
|
||||
// ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, color,
|
||||
// Alignment.Left, null, null, true);
|
||||
|
||||
while (chatBox.CountChildren > 20)
|
||||
{
|
||||
chatBox.RemoveChild(chatBox.children.First());
|
||||
}
|
||||
}
|
||||
// msg.Padding = new Vector4(20.0f, 0, 0, 0);
|
||||
// chatBox.AddChild(msg);
|
||||
|
||||
// while (chatBox.CountChildren > 20)
|
||||
// {
|
||||
// chatBox.RemoveChild(chatBox.children.First());
|
||||
// }
|
||||
//}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace Subsurface
|
||||
|
||||
private GUIButton endShiftButton;
|
||||
|
||||
private int day;
|
||||
//private int day;
|
||||
|
||||
public int Day
|
||||
{
|
||||
get { return day; }
|
||||
}
|
||||
//public int Day
|
||||
//{
|
||||
// get { return day; }
|
||||
//}
|
||||
|
||||
bool crewDead;
|
||||
private float endTimer;
|
||||
@@ -36,13 +36,13 @@ namespace Subsurface
|
||||
|
||||
hireManager.GenerateCharacters("Content/Characters/Human/human.xml", 10);
|
||||
|
||||
day = 1;
|
||||
//day = 1;
|
||||
}
|
||||
|
||||
public SinglePlayerMode(XElement element)
|
||||
: this(GameModePreset.list.Find(gm => gm.Name == "Single Player"))
|
||||
{
|
||||
day = ToolBox.GetAttributeInt(element,"day",1);
|
||||
//day = ToolBox.GetAttributeInt(element,"day",1);
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
@@ -145,15 +145,17 @@ namespace Subsurface
|
||||
sb.Append("No casualties!");
|
||||
}
|
||||
|
||||
new GUIMessageBox("Day #" + day + " is over!\n", sb.ToString());
|
||||
Game1.GameSession.map.MoveToNextLocation();
|
||||
|
||||
day++;
|
||||
//new GUIMessageBox("Day #" + day + " is over!\n", sb.ToString());
|
||||
|
||||
//day++;
|
||||
}
|
||||
|
||||
crewManager.EndShift();
|
||||
for (int i = Character.CharacterList.Count-1; i>=0; i--)
|
||||
for (int i = Character.CharacterList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Character.CharacterList.RemoveAt(i);
|
||||
Character.CharacterList[i].Remove();
|
||||
}
|
||||
|
||||
Game1.GameSession.EndShift("");
|
||||
@@ -163,7 +165,7 @@ namespace Subsurface
|
||||
|
||||
public void Save(XElement element)
|
||||
{
|
||||
element.Add(new XAttribute("day", day));
|
||||
//element.Add(new XAttribute("day", day));
|
||||
|
||||
crewManager.Save(element);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user