Conflicts:
	Subsurface/Subsurface.csproj
	Subsurface_Solution.v12.suo
This commit is contained in:
Regalis11
2015-06-14 18:18:24 +03:00
86 changed files with 1503 additions and 631 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Xml.Linq;
namespace Subsurface
{
@@ -25,7 +26,7 @@ namespace Subsurface
set { money = (int)Math.Max(value, 0.0f); }
}
public CrewManager(GameSession session)
public CrewManager()
{
characters = new List<Character>();
characterInfos = new List<CharacterInfo>();
@@ -39,19 +40,17 @@ namespace Subsurface
money = 10000;
}
private string CreateSaveFile(string mapName)
public CrewManager(XElement element)
: this()
{
string path = "Content/Data/Saves/";
money = ToolBox.GetAttributeInt(element, "money", 0);
string name = Path.GetFileNameWithoutExtension(mapName);
int i = 0;
while (File.Exists(path+name + i))
foreach (XElement subElement in element.Elements())
{
i++;
}
if (subElement.Name.ToString().ToLower()!="character") continue;
return path + name + i;
characterInfos.Add(new CharacterInfo(subElement));
}
}
public bool SelectCharacter(object selection)
@@ -89,7 +88,7 @@ namespace Subsurface
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40,0,0,25),
name,
Color.Transparent, Color.Black,
Color.Transparent, Color.White,
Alignment.Left,
Alignment.Left,
frame);
@@ -98,6 +97,11 @@ namespace Subsurface
new GUIImage(new Rectangle(-10,-10,0,0), character.animController.limbs[0].sprite, Alignment.Left, frame);
}
public void Update(float deltaTime)
{
guiFrame.Update(deltaTime);
}
public void KillCharacter(Character killedCharacter)
{
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;
@@ -138,5 +142,19 @@ namespace Subsurface
{
guiFrame.Draw(spriteBatch);
}
public void Save(XElement parentElement)
{
XElement element = new XElement("crew");
element.Add(new XAttribute("money", money));
foreach (CharacterInfo ci in characterInfos)
{
ci.Save(element);
}
parentElement.Add(element);
}
}
}