Merge branch 'master' of https://bitbucket.org/Regalis11/repo
Conflicts: Subsurface_Solution.v12.suo
@@ -79,7 +79,7 @@ namespace Subsurface
|
|||||||
protected float soundInterval;
|
protected float soundInterval;
|
||||||
|
|
||||||
private float bleeding;
|
private float bleeding;
|
||||||
private float blood;
|
//private float blood;
|
||||||
|
|
||||||
private Sound[] sounds;
|
private Sound[] sounds;
|
||||||
//which AIstate each sound is for
|
//which AIstate each sound is for
|
||||||
@@ -152,15 +152,15 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Blood
|
//public float Blood
|
||||||
{
|
//{
|
||||||
get { return blood; }
|
// get { return blood; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
blood = MathHelper.Clamp(value, 0.0f, 100.0f);
|
// blood = MathHelper.Clamp(value, 0.0f, 100.0f);
|
||||||
if (blood == 0.0f) Kill();
|
// if (blood == 0.0f) Kill();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public Item[] SelectedItems
|
public Item[] SelectedItems
|
||||||
{
|
{
|
||||||
@@ -286,20 +286,20 @@ namespace Subsurface
|
|||||||
IsNetworkPlayer = isNetworkPlayer;
|
IsNetworkPlayer = isNetworkPlayer;
|
||||||
|
|
||||||
oxygen = 100.0f;
|
oxygen = 100.0f;
|
||||||
blood = 100.0f;
|
//blood = 100.0f;
|
||||||
aiTarget = new AITarget(this);
|
aiTarget = new AITarget(this);
|
||||||
|
|
||||||
properties = ObjectProperty.GetProperties(this);
|
properties = ObjectProperty.GetProperties(this);
|
||||||
|
|
||||||
|
info = characterInfo==null ? new CharacterInfo(file) : characterInfo;
|
||||||
|
|
||||||
XDocument doc = ToolBox.TryLoadXml(file);
|
XDocument doc = ToolBox.TryLoadXml(file);
|
||||||
if (doc == null) return;
|
if (doc == null) return;
|
||||||
|
|
||||||
speciesName = ToolBox.GetAttributeString(doc.Root, "name", "Unknown");
|
speciesName = ToolBox.GetAttributeString(doc.Root, "name", "Unknown");
|
||||||
|
|
||||||
isHumanoid = ToolBox.GetAttributeBool(doc.Root, "humanoid", false);
|
isHumanoid = ToolBox.GetAttributeBool(doc.Root, "humanoid", false);
|
||||||
|
|
||||||
info = characterInfo ?? new CharacterInfo(file);
|
|
||||||
|
|
||||||
if (isHumanoid)
|
if (isHumanoid)
|
||||||
{
|
{
|
||||||
animController = new HumanoidAnimController(this, doc.Root.Element("ragdoll"));
|
animController = new HumanoidAnimController(this, doc.Root.Element("ragdoll"));
|
||||||
@@ -427,7 +427,11 @@ namespace Subsurface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ControlLocalPlayer(Camera cam, bool moveCam = true)
|
public void ControlLocalPlayer(Camera cam, bool moveCam = true)
|
||||||
{
|
{
|
||||||
if (isDead) return;
|
//if (isDead)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
Limb head = animController.GetLimb(LimbType.Head);
|
Limb head = animController.GetLimb(LimbType.Head);
|
||||||
|
|
||||||
@@ -522,7 +526,16 @@ namespace Subsurface
|
|||||||
|
|
||||||
public void Update(Camera cam, float deltaTime)
|
public void Update(Camera cam, float deltaTime)
|
||||||
{
|
{
|
||||||
if (isDead) return;
|
if (isDead)
|
||||||
|
{
|
||||||
|
if (controlled == this)
|
||||||
|
{
|
||||||
|
cam.Zoom = MathHelper.Lerp(cam.Zoom, 1.5f, 0.1f);
|
||||||
|
cam.TargetPos = ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition);
|
||||||
|
cam.OffsetAmount = 0.0f;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (PressureProtection==0.0f &&
|
if (PressureProtection==0.0f &&
|
||||||
(animController.CurrentHull == null || animController.CurrentHull.LethalPressure >= 100.0f))
|
(animController.CurrentHull == null || animController.CurrentHull.LethalPressure >= 100.0f))
|
||||||
@@ -568,7 +581,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
//foreach (Limb limb in animController.limbs)
|
//foreach (Limb limb in animController.limbs)
|
||||||
//{
|
//{
|
||||||
Blood = blood - bleeding * deltaTime;
|
Health = health - bleeding * deltaTime;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (aiController != null) aiController.Update(deltaTime);
|
if (aiController != null) aiController.Update(deltaTime);
|
||||||
@@ -591,18 +604,24 @@ namespace Subsurface
|
|||||||
aiTarget.SightRange += torso.LinearVelocity.Length() * 500.0f;
|
aiTarget.SightRange += torso.LinearVelocity.Length() * 500.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch)
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
animController.Draw(spriteBatch);
|
animController.Draw(spriteBatch);
|
||||||
|
|
||||||
if (IsNetworkPlayer)
|
if (IsNetworkPlayer)
|
||||||
{
|
{
|
||||||
Vector2 pos = new Vector2(Position.X, -Position.Y - 50.0f) - GUI.font.MeasureString(info.name) * 0.5f;
|
Vector2 namePos = new Vector2(Position.X, -Position.Y - 80.0f) - GUI.font.MeasureString(info.name) * 0.5f;
|
||||||
spriteBatch.DrawString(GUI.font, info.name, pos - new Vector2(1.0f, 1.0f), Color.Black);
|
spriteBatch.DrawString(GUI.font, info.name, namePos - new Vector2(1.0f, 1.0f), Color.Black);
|
||||||
spriteBatch.DrawString(GUI.font, info.name, pos, Color.White);
|
spriteBatch.DrawString(GUI.font, info.name, namePos, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this == Character.controlled) return;
|
||||||
|
|
||||||
|
Vector2 healthBarPos = new Vector2(Position.X - 50, -Position.Y - 50.0f);
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X-2, (int)healthBarPos.Y-2, 100+4, 15+4), Color.Black, false);
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f*(health/maxHealth)), 15), Color.Red, true);
|
||||||
|
|
||||||
//spriteBatch.DrawString(GUI.font, ID.ToString(), ConvertUnits.ToDisplayUnits(animController.limbs[0].Position), Color.White);
|
//spriteBatch.DrawString(GUI.font, ID.ToString(), ConvertUnits.ToDisplayUnits(animController.limbs[0].Position), Color.White);
|
||||||
//GUI.DrawLine(spriteBatch, ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y),
|
//GUI.DrawLine(spriteBatch, ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y),
|
||||||
// ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y) +
|
// ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y) +
|
||||||
@@ -610,7 +629,7 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static GUIProgressBar drowningBar, bloodBar;
|
private static GUIProgressBar drowningBar, healthBar;
|
||||||
public void DrawHud(SpriteBatch spriteBatch, Camera cam)
|
public void DrawHud(SpriteBatch spriteBatch, Camera cam)
|
||||||
{
|
{
|
||||||
if (drowningBar==null)
|
if (drowningBar==null)
|
||||||
@@ -618,19 +637,16 @@ namespace Subsurface
|
|||||||
int width = 100, height = 20;
|
int width = 100, height = 20;
|
||||||
drowningBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight/2, width, height), Color.Blue, 1.0f);
|
drowningBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight/2, width, height), Color.Blue, 1.0f);
|
||||||
|
|
||||||
bloodBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight / 2 + 30, width, height), Color.Red, 1.0f);
|
healthBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight / 2 + 30, width, height), Color.Red, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
drowningBar.BarSize = Controlled.Oxygen / 100.0f;
|
drowningBar.BarSize = Controlled.Oxygen / 100.0f;
|
||||||
if (drowningBar.BarSize < 1.0f)
|
if (drowningBar.BarSize < 0.95f) drowningBar.Draw(spriteBatch);
|
||||||
drowningBar.Draw(spriteBatch);
|
|
||||||
|
|
||||||
bloodBar.BarSize = Blood / 100.0f;
|
healthBar.BarSize = health / maxHealth;
|
||||||
if (bloodBar.BarSize < 1.0f)
|
if (healthBar.BarSize < 1.0f) healthBar.Draw(spriteBatch);
|
||||||
bloodBar.Draw(spriteBatch);
|
|
||||||
|
|
||||||
if (Controlled.Inventory != null)
|
if (Controlled.Inventory != null) Controlled.Inventory.Draw(spriteBatch);
|
||||||
Controlled.Inventory.Draw(spriteBatch);
|
|
||||||
|
|
||||||
if (closestItem!=null)
|
if (closestItem!=null)
|
||||||
{
|
{
|
||||||
@@ -773,29 +789,6 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
if (isDead) return;
|
if (isDead) return;
|
||||||
|
|
||||||
//if the game is run by a client, characters are only killed when the server says so
|
|
||||||
if (Game1.Client != null)
|
|
||||||
{
|
|
||||||
if (networkMessage)
|
|
||||||
{
|
|
||||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Game1.Server != null)
|
|
||||||
{
|
|
||||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Game1.GameSession!=null && Game1.GameSession.crewManager != null)
|
|
||||||
{
|
|
||||||
Game1.GameSession.crewManager.KillCharacter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
isDead = true;
|
isDead = true;
|
||||||
animController.movement = Vector2.Zero;
|
animController.movement = Vector2.Zero;
|
||||||
animController.TargetMovement = Vector2.Zero;
|
animController.TargetMovement = Vector2.Zero;
|
||||||
@@ -820,6 +813,30 @@ namespace Subsurface
|
|||||||
joint.MotorEnabled = false;
|
joint.MotorEnabled = false;
|
||||||
joint.MaxMotorTorque = 0.0f;
|
joint.MaxMotorTorque = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//if the game is run by a client, characters are only killed when the server says so
|
||||||
|
if (Game1.Client != null)
|
||||||
|
{
|
||||||
|
if (networkMessage)
|
||||||
|
{
|
||||||
|
new NetworkEvent(NetworkEventType.KillCharacter, ID, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game1.Server != null)
|
||||||
|
{
|
||||||
|
new NetworkEvent(NetworkEventType.KillCharacter, ID, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game1.GameSession != null)
|
||||||
|
{
|
||||||
|
Game1.GameSession.KillCharacter(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||||
|
|||||||
@@ -89,12 +89,16 @@ namespace Subsurface
|
|||||||
|
|
||||||
public CharacterInfo(XElement element)
|
public CharacterInfo(XElement element)
|
||||||
{
|
{
|
||||||
name = element.Name.ToString();
|
name = ToolBox.GetAttributeString(element, "name", "unnamed");
|
||||||
|
|
||||||
string genderStr = ToolBox.GetAttributeString(element, "gender", "male").ToLower();
|
string genderStr = ToolBox.GetAttributeString(element, "gender", "male").ToLower();
|
||||||
gender = (genderStr == "male") ? Gender.Male : Gender.Female;
|
gender = (genderStr == "male") ? Gender.Male : Gender.Female;
|
||||||
|
|
||||||
|
file = ToolBox.GetAttributeString(element, "file", "");
|
||||||
|
|
||||||
salary = ToolBox.GetAttributeInt(element, "salary", 1000);
|
salary = ToolBox.GetAttributeInt(element, "salary", 1000);
|
||||||
|
|
||||||
|
headSpriteId = ToolBox.GetAttributeInt(element, "headspriteid", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual XElement Save(XElement parentElement)
|
public virtual XElement Save(XElement parentElement)
|
||||||
@@ -103,6 +107,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
componentElement.Add(
|
componentElement.Add(
|
||||||
new XAttribute("name", name),
|
new XAttribute("name", name),
|
||||||
|
new XAttribute("file", file),
|
||||||
new XAttribute("gender", gender == Gender.Male ? "male" : "female"),
|
new XAttribute("gender", gender == Gender.Male ? "male" : "female"),
|
||||||
new XAttribute("salary", salary),
|
new XAttribute("salary", salary),
|
||||||
new XAttribute("headspriteid", headSpriteId));
|
new XAttribute("headspriteid", headSpriteId));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true">
|
<limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true">
|
||||||
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
|
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
|
||||||
<attack type="PinchCW" range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="20" structuredamage="50" damagetype="slash"/>
|
<attack type="PinchCW" range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
<limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true">
|
<limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<!-- lower yaw -->
|
<!-- lower yaw -->
|
||||||
<limb id = "1" width="16" height="103">
|
<limb id = "1" width="16" height="103">
|
||||||
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
|
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
|
||||||
<attack type="PinchCCW" range="200" duration="0.5" damage="150" bleedingdamage="50" structuredamage="500" damagetype="slash"/>
|
<attack type="PinchCCW" range="200" duration="0.5" damage="150" bleedingdamage="10" structuredamage="200" damagetype="slash"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
<!-- body -->
|
<!-- body -->
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Items>
|
||||||
|
<Item
|
||||||
|
name="Fabricator"
|
||||||
|
linkable="true"
|
||||||
|
pickdistance="150">
|
||||||
|
|
||||||
|
<Sprite texture ="fabricator.png" depth="0.8"/>
|
||||||
|
|
||||||
|
<Fabricator canbeselected = "true">
|
||||||
|
<fabricableitem name="Harpoon Gun" requireditems="ID Card, Spear"/>
|
||||||
|
<fabricableitem name="Plasma Cutter" requireditems="Wrench, Spear"/>
|
||||||
|
</Fabricator>
|
||||||
|
|
||||||
|
<ConnectionPanel canbeselected = "true">
|
||||||
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
|
<output name="power_in"/>
|
||||||
|
</ConnectionPanel>
|
||||||
|
|
||||||
|
<ItemContainer capacity="5" canbeselected="true" hideitems="true" hudpos="0.2, 0.7" slotsperrow="1"/>
|
||||||
|
<ItemContainer capacity="5" canbeselected="true" hideitems="true" hudpos="0.8, 0.7" slotsperrow="1"/>
|
||||||
|
</Item>
|
||||||
|
|
||||||
|
</Items>
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<Pickable slots="Any"/>
|
<Pickable slots="Any"/>
|
||||||
<Projectile launchimpulse="20.0" doesstick="true">
|
<Projectile launchimpulse="20.0" doesstick="true">
|
||||||
<Attack damage="20" bleedingdamage="30" structuredamage="50" damagetype="Blunt"/>
|
<Attack damage="20" bleedingdamage="2" structuredamage="50" damagetype="Blunt"/>
|
||||||
</Projectile>
|
</Projectile>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,13 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
WayPoint spawnPoint = WayPoint.GetRandom(WayPoint.SpawnType.Human);
|
WayPoint spawnPoint = WayPoint.GetRandom(WayPoint.SpawnType.Human);
|
||||||
Character.Controlled = new Character("Content/Characters/Human/human.xml", (spawnPoint == null) ? Vector2.Zero : spawnPoint.SimPosition);
|
Character.Controlled = new Character("Content/Characters/Human/human.xml", (spawnPoint == null) ? Vector2.Zero : spawnPoint.SimPosition);
|
||||||
if (Game1.GameSession != null) Game1.GameSession.crewManager.AddCharacter(Character.Controlled);
|
if (Game1.GameSession != null)
|
||||||
if (Game1.GameSession != null) Game1.GameSession.crewManager.SelectCharacter(Character.Controlled);
|
{
|
||||||
|
SinglePlayerMode mode = Game1.GameSession.gameMode as SinglePlayerMode;
|
||||||
|
if (mode == null) break;
|
||||||
|
mode.crewManager.AddCharacter(Character.Controlled);
|
||||||
|
mode.crewManager.SelectCharacter(Character.Controlled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,6 +133,16 @@ namespace Subsurface
|
|||||||
keyboardDispatcher = new KeyboardDispatcher(window);
|
keyboardDispatcher = new KeyboardDispatcher(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T GetChild<T>()
|
||||||
|
{
|
||||||
|
foreach (GUIComponent child in children)
|
||||||
|
{
|
||||||
|
if (child is T) return (T)(object)child;
|
||||||
|
}
|
||||||
|
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
|
||||||
public GUIComponent GetChild(object obj)
|
public GUIComponent GetChild(object obj)
|
||||||
{
|
{
|
||||||
foreach (GUIComponent child in children)
|
foreach (GUIComponent child in children)
|
||||||
@@ -242,7 +252,7 @@ namespace Subsurface
|
|||||||
if (children.Contains(child)) children.Remove(child);
|
if (children.Contains(child)) children.Remove(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearChildren()
|
public virtual void ClearChildren()
|
||||||
{
|
{
|
||||||
children.Clear();
|
children.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ namespace Subsurface
|
|||||||
|
|
||||||
public object SelectedData
|
public object SelectedData
|
||||||
{
|
{
|
||||||
get { return (selected == null) ? null : selected.UserData; }
|
get
|
||||||
|
{
|
||||||
|
return (selected == null) ? null : selected.UserData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SelectedIndex
|
public int SelectedIndex
|
||||||
@@ -166,12 +169,19 @@ namespace Subsurface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ClearChildren()
|
||||||
|
{
|
||||||
|
base.ClearChildren();
|
||||||
|
selected = null;
|
||||||
|
}
|
||||||
|
|
||||||
public override void RemoveChild(GUIComponent child)
|
public override void RemoveChild(GUIComponent child)
|
||||||
{
|
{
|
||||||
base.RemoveChild(child);
|
base.RemoveChild(child);
|
||||||
|
|
||||||
UpdateScrollBarSize();
|
if (selected == child) selected = null;
|
||||||
|
|
||||||
|
UpdateScrollBarSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowScrollBar()
|
private void ShowScrollBar()
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ namespace Subsurface
|
|||||||
//public OnClickedHandler OnClicked;
|
//public OnClickedHandler OnClicked;
|
||||||
|
|
||||||
//GUIFrame frame;
|
//GUIFrame frame;
|
||||||
GUIButton[] buttons;
|
public GUIButton[] Buttons;
|
||||||
|
|
||||||
public GUIMessageBox(string header, string text)
|
public GUIMessageBox(string header, string text)
|
||||||
: this(header, text, new string[] {"OK"})
|
: this(header, text, new string[] {"OK"})
|
||||||
{
|
{
|
||||||
this.buttons[0].OnClicked = OkClicked;
|
this.Buttons[0].OnClicked = Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = (Alignment.Left | Alignment.Top))
|
public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = (Alignment.Left | Alignment.Top))
|
||||||
@@ -37,22 +37,21 @@ namespace Subsurface
|
|||||||
new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, this, true);
|
new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, this, true);
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
this.buttons = new GUIButton[buttons.Length];
|
this.Buttons = new GUIButton[buttons.Length];
|
||||||
for (int i = 0; i < buttons.Length; i++)
|
for (int i = 0; i < buttons.Length; i++)
|
||||||
{
|
{
|
||||||
this.buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], GUI.style, Alignment.Left | Alignment.Bottom, this);
|
this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], GUI.style, Alignment.Left | Alignment.Bottom, this);
|
||||||
|
|
||||||
x += this.buttons[i].Rect.Width + 20;
|
x += this.Buttons[i].Rect.Width + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageBoxes.Enqueue(this);
|
messageBoxes.Enqueue(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OkClicked(GUIButton button, object obj)
|
public bool Close(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
messageBoxes.Dequeue();
|
messageBoxes.Dequeue();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,16 +77,16 @@ namespace Subsurface
|
|||||||
characterInfos.Add(character.info);
|
characterInfos.Add(character.info);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUIFrame frame = new GUIFrame(new Rectangle(0,0,0,40), Color.Transparent, listBox);
|
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, listBox);
|
||||||
frame.UserData = character;
|
frame.UserData = character;
|
||||||
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
frame.HoverColor = Color.LightGray * 0.5f;
|
frame.HoverColor = Color.LightGray * 0.5f;
|
||||||
frame.SelectedColor = Color.Gold * 0.5f;
|
frame.SelectedColor = Color.Gold * 0.5f;
|
||||||
|
|
||||||
string name = character.info.name.Replace(' ','\n');
|
string name = character.info.name.Replace(' ', '\n');
|
||||||
|
|
||||||
GUITextBlock textBlock = new GUITextBlock(
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
new Rectangle(40,0,0,25),
|
new Rectangle(40, 0, 0, 25),
|
||||||
name,
|
name,
|
||||||
Color.Transparent, Color.White,
|
Color.Transparent, Color.White,
|
||||||
Alignment.Left,
|
Alignment.Left,
|
||||||
@@ -94,7 +94,7 @@ namespace Subsurface
|
|||||||
frame);
|
frame);
|
||||||
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
||||||
|
|
||||||
new GUIImage(new Rectangle(-10,-10,0,0), character.animController.limbs[0].sprite, Alignment.Left, frame);
|
new GUIImage(new Rectangle(-10, -10, 0, 0), character.animController.limbs[0].sprite, Alignment.Left, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
@@ -106,7 +106,11 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;
|
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;
|
||||||
if (characterBlock != null) characterBlock.Color = Color.DarkRed * 0.5f;
|
if (characterBlock != null) characterBlock.Color = Color.DarkRed * 0.5f;
|
||||||
|
|
||||||
|
if (characters.Find(c => !c.IsDead)==null)
|
||||||
|
{
|
||||||
|
Game1.GameSession.EndShift(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartShift()
|
public void StartShift()
|
||||||
|
|||||||
@@ -1,19 +1,59 @@
|
|||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
|
class GameModePreset
|
||||||
|
{
|
||||||
|
public static List<GameModePreset> list = new List<GameModePreset>();
|
||||||
|
|
||||||
|
public ConstructorInfo Constructor;
|
||||||
|
public string Name;
|
||||||
|
public bool IsSinglePlayer;
|
||||||
|
|
||||||
|
public GameModePreset(string name, Type type, bool isSinglePlayer = false)
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
//Constructor = constructor;
|
||||||
|
|
||||||
|
|
||||||
|
Constructor = type.GetConstructor(new Type[] { typeof(GameModePreset) });
|
||||||
|
|
||||||
|
IsSinglePlayer = isSinglePlayer;
|
||||||
|
|
||||||
|
list.Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameMode Instantiate()
|
||||||
|
{
|
||||||
|
object[] lobject = new object[] { this };
|
||||||
|
return(GameMode)Constructor.Invoke(lobject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GameMode
|
class GameMode
|
||||||
{
|
{
|
||||||
public static List<GameMode> list = new List<GameMode>();
|
public static List<GameModePreset> presetList = new List<GameModePreset>();
|
||||||
|
|
||||||
//TimeSpan duration;
|
TimeSpan duration;
|
||||||
protected DateTime startTime;
|
protected DateTime startTime;
|
||||||
protected DateTime endTime;
|
protected DateTime endTime;
|
||||||
|
|
||||||
|
//public readonly bool IsSinglePlayer;
|
||||||
|
|
||||||
|
private GUIProgressBar timerBar;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected bool isRunning;
|
protected bool isRunning;
|
||||||
|
|
||||||
protected string name;
|
//protected string name;
|
||||||
|
|
||||||
|
protected GameModePreset preset;
|
||||||
|
|
||||||
private string endMessage;
|
private string endMessage;
|
||||||
|
|
||||||
@@ -32,9 +72,14 @@ namespace Subsurface
|
|||||||
get { return isRunning; }
|
get { return isRunning; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSinglePlayer
|
||||||
|
{
|
||||||
|
get { return preset.IsSinglePlayer; }
|
||||||
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return name; }
|
get { return preset.Name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string EndMessage
|
public string EndMessage
|
||||||
@@ -42,34 +87,51 @@ namespace Subsurface
|
|||||||
get { return endMessage; }
|
get { return endMessage; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameMode(string name)
|
public GameMode(GameModePreset preset)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.preset = preset;
|
||||||
|
|
||||||
list.Add(this);
|
|
||||||
|
//list.Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
if (timerBar != null) timerBar.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Start(TimeSpan duration)
|
public virtual void Start(TimeSpan duration)
|
||||||
{
|
{
|
||||||
startTime = DateTime.Now;
|
startTime = DateTime.Now;
|
||||||
endTime = startTime + duration;
|
if (duration!=TimeSpan.Zero)
|
||||||
|
{
|
||||||
|
endTime = startTime + duration;
|
||||||
|
this.duration = duration;
|
||||||
|
|
||||||
|
timerBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, null);
|
||||||
|
}
|
||||||
|
|
||||||
endMessage = "The round has ended!";
|
endMessage = "The round has ended!";
|
||||||
|
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update()
|
public virtual void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (!isRunning) return;
|
if (!isRunning) return;
|
||||||
|
|
||||||
if (DateTime.Now >= endTime)
|
if (duration!=TimeSpan.Zero)
|
||||||
{
|
{
|
||||||
End(endMessage);
|
double elapsedTime = (DateTime.Now - startTime).TotalSeconds;
|
||||||
|
timerBar.BarSize = (float)(elapsedTime / duration.TotalSeconds);
|
||||||
}
|
}
|
||||||
|
//if (DateTime.Now >= endTime)
|
||||||
|
//{
|
||||||
|
// End(endMessage);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void End(string endMessage = "")
|
public virtual void End(string endMessage = "")
|
||||||
{
|
{
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
@@ -77,11 +139,17 @@ namespace Subsurface
|
|||||||
|
|
||||||
Game1.GameSession.EndShift(null, null);
|
Game1.GameSession.EndShift(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
new GameMode("Sandbox");
|
new GameModePreset("Single Player", typeof(SinglePlayerMode), true);
|
||||||
new TraitorMode("Traitor");
|
new GameModePreset("SandBox", typeof(GameMode), false);
|
||||||
|
new GameModePreset("Traitor", typeof(TraitorMode), false);
|
||||||
|
|
||||||
|
|
||||||
|
//new SinglePlayerMode("Single Player", true);
|
||||||
|
//new GameMode("Sandbox");
|
||||||
|
//new TraitorMode("Traitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,10 @@ namespace Subsurface
|
|||||||
class GameSession
|
class GameSession
|
||||||
{
|
{
|
||||||
public readonly TaskManager taskManager;
|
public readonly TaskManager taskManager;
|
||||||
public readonly CrewManager crewManager;
|
|
||||||
public readonly HireManager hireManager;
|
|
||||||
|
|
||||||
protected DateTime startTime;
|
|
||||||
protected DateTime endTime;
|
//protected DateTime startTime;
|
||||||
|
//protected DateTime endTime;
|
||||||
|
|
||||||
public readonly GameMode gameMode;
|
public readonly GameMode gameMode;
|
||||||
|
|
||||||
@@ -26,31 +25,22 @@ namespace Subsurface
|
|||||||
private GUIListBox chatBox;
|
private GUIListBox chatBox;
|
||||||
private GUITextBox textBox;
|
private GUITextBox textBox;
|
||||||
|
|
||||||
private GUIProgressBar timerBar;
|
|
||||||
|
|
||||||
private GUIButton endShiftButton;
|
|
||||||
|
|
||||||
private string savePath;
|
private string savePath;
|
||||||
|
|
||||||
private Map selectedMap;
|
private Map selectedMap;
|
||||||
|
|
||||||
private int day;
|
|
||||||
|
|
||||||
public int Day
|
public GameSession(Map selectedMap, GameModePreset gameModePreset)
|
||||||
|
:this(selectedMap, gameModePreset.Instantiate())
|
||||||
{
|
{
|
||||||
get { return day; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameSession(Map selectedMap, TimeSpan gameDuration, GameMode gameMode = null)
|
public GameSession(Map selectedMap, GameMode gameMode = null)
|
||||||
{
|
{
|
||||||
taskManager = new TaskManager(this);
|
taskManager = new TaskManager(this);
|
||||||
crewManager = new CrewManager();
|
|
||||||
hireManager = new HireManager();
|
|
||||||
|
|
||||||
savePath = SaveUtil.CreateSavePath(SaveUtil.SaveFolder);
|
savePath = SaveUtil.CreateSavePath(SaveUtil.SaveFolder);
|
||||||
|
|
||||||
hireManager.GenerateCharacters("Content/Characters/Human/human.xml", 10);
|
|
||||||
|
|
||||||
guiRoot = new GUIFrame(new Rectangle(0,0,Game1.GraphicsWidth,Game1.GraphicsWidth), Color.Transparent);
|
guiRoot = new GUIFrame(new Rectangle(0,0,Game1.GraphicsWidth,Game1.GraphicsWidth), Color.Transparent);
|
||||||
|
|
||||||
int width = 350, height = 100;
|
int width = 350, height = 100;
|
||||||
@@ -67,74 +57,53 @@ namespace Subsurface
|
|||||||
Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, guiRoot);
|
Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, guiRoot);
|
||||||
textBox.OnEnter = EnterChatMessage;
|
textBox.OnEnter = EnterChatMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game1.Client==null)
|
|
||||||
{
|
|
||||||
endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 240, 20, 100, 25), "End shift", Color.White, Alignment.Left | Alignment.Top, guiRoot);
|
|
||||||
endShiftButton.OnClicked = EndShift;
|
|
||||||
}
|
|
||||||
|
|
||||||
timerBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, guiRoot);
|
|
||||||
|
|
||||||
|
|
||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
if (this.gameMode != null) this.gameMode.Start(Game1.NetLobbyScreen.GameDuration);
|
//if (gameMode != null && !gameMode.IsSinglePlayer)
|
||||||
|
//{
|
||||||
|
// gameMode.Start(Game1.NetLobbyScreen.GameDuration);
|
||||||
|
//}
|
||||||
|
|
||||||
startTime = DateTime.Now;
|
//startTime = DateTime.Now;
|
||||||
endTime = startTime + gameDuration;
|
//endTime = startTime + gameDuration;
|
||||||
|
|
||||||
this.selectedMap = selectedMap;
|
this.selectedMap = selectedMap;
|
||||||
|
|
||||||
//if (!save) return;
|
//if (!save) return;
|
||||||
|
|
||||||
//CreateSaveFile(selectedMapFile);
|
//CreateSaveFile(selectedMapFile);
|
||||||
|
|
||||||
day = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameSession(string filePath)
|
public GameSession(Map selectedMap, string savePath, string filePath)
|
||||||
: this(null, new TimeSpan(0,0,0,0))
|
: this(selectedMap)
|
||||||
{
|
{
|
||||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||||
if (doc == null) return;
|
if (doc == null) return;
|
||||||
|
|
||||||
day = ToolBox.GetAttributeInt(doc.Root,"day",1);
|
//gameMode = GameModePreset.list.Find(gm => gm.Name == "Single Player").Instantiate();
|
||||||
|
|
||||||
|
//day = ToolBox.GetAttributeInt(doc.Root,"day",1);
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
if (subElement.Name.ToString().ToLower()=="crew")
|
if (subElement.Name.ToString().ToLower() != "gamemode") continue;
|
||||||
{
|
|
||||||
crewManager = new CrewManager(subElement);
|
gameMode = new SinglePlayerMode(subElement);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
savePath = filePath;
|
this.savePath = savePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryHireCharacter(CharacterInfo characterInfo)
|
public void StartShift(TimeSpan duration, int scriptedEventCount = 1)
|
||||||
{
|
{
|
||||||
if (crewManager.Money < characterInfo.salary) return false;
|
//if (crewManager.characterInfos.Count == 0) return;
|
||||||
|
|
||||||
hireManager.availableCharacters.Remove(characterInfo);
|
|
||||||
crewManager.characterInfos.Add(characterInfo);
|
|
||||||
|
|
||||||
crewManager.Money -= characterInfo.salary;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetMoney()
|
|
||||||
{
|
|
||||||
return ("Money: " + crewManager.Money);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartShift(int scriptedEventCount = 1)
|
|
||||||
{
|
|
||||||
if (crewManager.characterInfos.Count == 0) return;
|
|
||||||
|
|
||||||
if (Map.Loaded!=selectedMap) selectedMap.Load();
|
if (Map.Loaded!=selectedMap) selectedMap.Load();
|
||||||
|
|
||||||
crewManager.StartShift();
|
if (gameMode!=null) gameMode.Start(duration);
|
||||||
|
|
||||||
|
//crewManager.StartShift();
|
||||||
taskManager.StartShift(scriptedEventCount);
|
taskManager.StartShift(scriptedEventCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,76 +117,30 @@ namespace Subsurface
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (Game1.Client==null)
|
else if (Game1.Client==null)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
List<Character> casualties = crewManager.characters.FindAll(c => c.IsDead);
|
|
||||||
|
|
||||||
if (casualties.Any())
|
|
||||||
{
|
|
||||||
sb.Append("Casualties: \n");
|
|
||||||
foreach (Character c in casualties)
|
|
||||||
{
|
|
||||||
sb.Append(" - " + c.info.name + "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.Append("No casualties!");
|
|
||||||
}
|
|
||||||
|
|
||||||
new GUIMessageBox("Day #" + day + " is over!\n", sb.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
//if (saveFile == null) return false;
|
|
||||||
|
|
||||||
//Map.Loaded.SaveAs(saveFile);
|
|
||||||
|
|
||||||
crewManager.EndShift();
|
|
||||||
|
|
||||||
Game1.LobbyScreen.Select();
|
Game1.LobbyScreen.Select();
|
||||||
|
|
||||||
day++;
|
SaveUtil.SaveGame(savePath);
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = Character.characterList.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
Character.characterList.RemoveAt(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskManager.EndShift();
|
taskManager.EndShift();
|
||||||
|
//gameMode.End();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateSaveFile(string mapName)
|
|
||||||
|
public void KillCharacter(Character character)
|
||||||
{
|
{
|
||||||
//string path = "Content/Data/Saves/";
|
SinglePlayerMode singlePlayerMode = gameMode as SinglePlayerMode;
|
||||||
|
if (singlePlayerMode == null) return;
|
||||||
|
singlePlayerMode.crewManager.KillCharacter(character);
|
||||||
|
}
|
||||||
|
|
||||||
//if (!Directory.Exists(path))
|
public bool LoadPrevious(GUIButton button, object obj)
|
||||||
//{
|
{
|
||||||
// Directory.CreateDirectory(path);
|
SaveUtil.LoadGame(savePath);
|
||||||
//}
|
return true;
|
||||||
|
|
||||||
//string name = Path.GetFileNameWithoutExtension(mapName);
|
|
||||||
//string extension = Path.GetExtension(mapName);
|
|
||||||
|
|
||||||
//int i = 0;
|
|
||||||
//while (File.Exists(path + name + i + extension))
|
|
||||||
//{
|
|
||||||
// i++;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//saveFile = path + name + i+extension;
|
|
||||||
|
|
||||||
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
// File.Copy(mapName, saveFile);
|
|
||||||
//}
|
|
||||||
//catch (Exception e)
|
|
||||||
//{
|
|
||||||
// DebugConsole.ThrowError("Copying map file ''" + mapName + "'' to ''" + saveFile + "'' failed", e);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnterChatMessage(GUITextBox textBox, string message)
|
public bool EnterChatMessage(GUITextBox textBox, string message)
|
||||||
@@ -237,7 +160,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NewChatMessage(string text, Color color)
|
public void NewChatMessage(string text, Color color)
|
||||||
{
|
{
|
||||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), text,
|
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), text,
|
||||||
@@ -252,24 +175,24 @@ namespace Subsurface
|
|||||||
chatBox.RemoveChild(chatBox.children.First());
|
chatBox.RemoveChild(chatBox.children.First());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
taskManager.Update(deltaTime);
|
taskManager.Update(deltaTime);
|
||||||
if (endShiftButton!=null) endShiftButton.Enabled = !taskManager.CriticalTasks;
|
//if (endShiftButton!=null) endShiftButton.Enabled = !taskManager.CriticalTasks;
|
||||||
|
//endShiftButton.Enabled = true;
|
||||||
|
|
||||||
guiRoot.Update(deltaTime);
|
guiRoot.Update(deltaTime);
|
||||||
crewManager.Update(deltaTime);
|
|
||||||
//endShiftButton.Update(deltaTime);
|
//endShiftButton.Update(deltaTime);
|
||||||
|
|
||||||
//textBox.Update(deltaTime);
|
//textBox.Update(deltaTime);
|
||||||
|
|
||||||
if (gameMode != null) gameMode.Update();
|
if (gameMode != null) gameMode.Update(deltaTime);
|
||||||
|
|
||||||
double duration = (endTime - startTime).TotalSeconds;
|
//double duration = (endTime - startTime).TotalSeconds;
|
||||||
double elapsedTime = (DateTime.Now-startTime).TotalSeconds;
|
//double elapsedTime = (DateTime.Now-startTime).TotalSeconds;
|
||||||
timerBar.BarSize = (float)(elapsedTime / Math.Max(duration, 1.0));
|
//timerBar.BarSize = (float)(elapsedTime / Math.Max(duration, 1.0));
|
||||||
|
|
||||||
if (PlayerInput.KeyHit(Keys.Tab))
|
if (PlayerInput.KeyHit(Keys.Tab))
|
||||||
{
|
{
|
||||||
@@ -288,9 +211,11 @@ namespace Subsurface
|
|||||||
public void Draw(SpriteBatch spriteBatch)
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
guiRoot.Draw(spriteBatch);
|
guiRoot.Draw(spriteBatch);
|
||||||
crewManager.Draw(spriteBatch);
|
//crewManager.Draw(spriteBatch);
|
||||||
taskManager.Draw(spriteBatch);
|
taskManager.Draw(spriteBatch);
|
||||||
|
|
||||||
|
gameMode.Draw(spriteBatch);
|
||||||
|
|
||||||
//chatBox.Draw(spriteBatch);
|
//chatBox.Draw(spriteBatch);
|
||||||
//textBox.Draw(spriteBatch);
|
//textBox.Draw(spriteBatch);
|
||||||
|
|
||||||
@@ -304,7 +229,11 @@ namespace Subsurface
|
|||||||
XDocument doc = new XDocument(
|
XDocument doc = new XDocument(
|
||||||
new XElement((XName)"Gamesession"));
|
new XElement((XName)"Gamesession"));
|
||||||
|
|
||||||
doc.Root.Add(new XAttribute("day", day));
|
((SinglePlayerMode)gameMode).Save(doc.Root);
|
||||||
|
|
||||||
|
//doc.Root.Add(new XAttribute("day", day));
|
||||||
|
|
||||||
|
//crewManager.Save(doc.Root);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace Subsurface
|
||||||
|
{
|
||||||
|
class SinglePlayerMode : GameMode
|
||||||
|
{
|
||||||
|
public readonly CrewManager crewManager;
|
||||||
|
public readonly HireManager hireManager;
|
||||||
|
|
||||||
|
private GUIButton endShiftButton;
|
||||||
|
|
||||||
|
private int day;
|
||||||
|
|
||||||
|
public int Day
|
||||||
|
{
|
||||||
|
get { return day; }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool crewDead;
|
||||||
|
private float endTimer;
|
||||||
|
|
||||||
|
public SinglePlayerMode(GameModePreset preset)
|
||||||
|
: base(preset)
|
||||||
|
{
|
||||||
|
crewManager = new CrewManager();
|
||||||
|
hireManager = new HireManager();
|
||||||
|
|
||||||
|
endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 240, 20, 100, 25), "End shift", Color.White, Alignment.Left | Alignment.Top);
|
||||||
|
endShiftButton.OnClicked = EndShift;
|
||||||
|
|
||||||
|
hireManager.GenerateCharacters("Content/Characters/Human/human.xml", 10);
|
||||||
|
|
||||||
|
day = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SinglePlayerMode(XElement element)
|
||||||
|
: this(GameModePreset.list.Find(gm => gm.Name == "Single Player"))
|
||||||
|
{
|
||||||
|
day = ToolBox.GetAttributeInt(element,"day",1);
|
||||||
|
|
||||||
|
foreach (XElement subElement in element.Elements())
|
||||||
|
{
|
||||||
|
if (subElement.Name.ToString().ToLower() != "crew") continue;
|
||||||
|
|
||||||
|
crewManager = new CrewManager(subElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Start(TimeSpan duration)
|
||||||
|
{
|
||||||
|
endTimer = 5.0f;
|
||||||
|
|
||||||
|
crewManager.StartShift();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryHireCharacter(CharacterInfo characterInfo)
|
||||||
|
{
|
||||||
|
if (crewManager.Money < characterInfo.salary) return false;
|
||||||
|
|
||||||
|
hireManager.availableCharacters.Remove(characterInfo);
|
||||||
|
crewManager.characterInfos.Add(characterInfo);
|
||||||
|
|
||||||
|
crewManager.Money -= characterInfo.salary;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetMoney()
|
||||||
|
{
|
||||||
|
return ("Money: " + crewManager.Money);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
|
crewManager.Draw(spriteBatch);
|
||||||
|
|
||||||
|
endShiftButton.Draw(spriteBatch);
|
||||||
|
//chatBox.Draw(spriteBatch);
|
||||||
|
//textBox.Draw(spriteBatch);
|
||||||
|
|
||||||
|
//timerBar.Draw(spriteBatch);
|
||||||
|
|
||||||
|
//if (Game1.Client == null) endShiftButton.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
base.Update(deltaTime);
|
||||||
|
|
||||||
|
crewManager.Update(deltaTime);
|
||||||
|
|
||||||
|
endShiftButton.Update(deltaTime);
|
||||||
|
|
||||||
|
if (!crewDead)
|
||||||
|
{
|
||||||
|
if (crewManager.characters.Find(c => !c.IsDead) == null)
|
||||||
|
{
|
||||||
|
crewDead = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
endTimer -= deltaTime;
|
||||||
|
|
||||||
|
if (endTimer <= 0.0f) End("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool EndShift(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
List<Character> casualties = crewManager.characters.FindAll(c => c.IsDead);
|
||||||
|
|
||||||
|
if (casualties.Count == crewManager.characters.Count)
|
||||||
|
{
|
||||||
|
sb.Append("Your entire crew has died!");
|
||||||
|
|
||||||
|
var msgBox = new GUIMessageBox("GG", sb.ToString(), new string[] { "Load game", "Quit" });
|
||||||
|
msgBox.Buttons[0].OnClicked += Game1.GameSession.LoadPrevious;
|
||||||
|
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||||
|
msgBox.Buttons[1].OnClicked = Game1.LobbyScreen.QuitToMainMenu;
|
||||||
|
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (casualties.Any())
|
||||||
|
{
|
||||||
|
sb.Append("Casualties: \n");
|
||||||
|
foreach (Character c in casualties)
|
||||||
|
{
|
||||||
|
sb.Append(" - " + c.info.name + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append("No casualties!");
|
||||||
|
}
|
||||||
|
|
||||||
|
new GUIMessageBox("Day #" + day + " is over!\n", sb.ToString());
|
||||||
|
|
||||||
|
day++;
|
||||||
|
}
|
||||||
|
|
||||||
|
crewManager.EndShift();
|
||||||
|
for (int i = Character.characterList.Count-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
Character.characterList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
Game1.GameSession.EndShift(null, null);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(XElement element)
|
||||||
|
{
|
||||||
|
element.Add(new XAttribute("day", day));
|
||||||
|
|
||||||
|
crewManager.Save(element);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,8 +9,8 @@ namespace Subsurface
|
|||||||
Client traitor;
|
Client traitor;
|
||||||
Client target;
|
Client target;
|
||||||
|
|
||||||
public TraitorMode(string name)
|
public TraitorMode(GameModePreset preset)
|
||||||
: base(name)
|
: base(preset)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,9 @@ namespace Subsurface
|
|||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
base.Update(deltaTime);
|
||||||
|
|
||||||
if (!isRunning) return;
|
if (!isRunning) return;
|
||||||
|
|
||||||
|
|||||||
@@ -13,25 +13,13 @@ namespace Subsurface.Items.Components
|
|||||||
public ItemInventory inventory;
|
public ItemInventory inventory;
|
||||||
|
|
||||||
//how many items can be contained
|
//how many items can be contained
|
||||||
private int capacity;
|
|
||||||
|
|
||||||
private bool hideItems;
|
|
||||||
private bool drawInventory;
|
|
||||||
|
|
||||||
//the position of the first item in the container
|
|
||||||
private Vector2 itemPos;
|
|
||||||
|
|
||||||
//item[i].Pos = itemPos + itemInterval*i
|
|
||||||
private Vector2 itemInterval;
|
|
||||||
|
|
||||||
private float itemRotation;
|
|
||||||
|
|
||||||
[HasDefaultValue(5, false)]
|
[HasDefaultValue(5, false)]
|
||||||
public int Capacity
|
public int Capacity
|
||||||
{
|
{
|
||||||
get { return capacity; }
|
get { return capacity; }
|
||||||
set { capacity = Math.Max(value, 1); }
|
set { capacity = Math.Max(value, 1); }
|
||||||
}
|
}
|
||||||
|
private int capacity;
|
||||||
|
|
||||||
[HasDefaultValue(true, false)]
|
[HasDefaultValue(true, false)]
|
||||||
public bool HideItems
|
public bool HideItems
|
||||||
@@ -39,6 +27,7 @@ namespace Subsurface.Items.Components
|
|||||||
get { return hideItems; }
|
get { return hideItems; }
|
||||||
set { hideItems = value; }
|
set { hideItems = value; }
|
||||||
}
|
}
|
||||||
|
private bool hideItems;
|
||||||
|
|
||||||
[HasDefaultValue(false, false)]
|
[HasDefaultValue(false, false)]
|
||||||
public bool DrawInventory
|
public bool DrawInventory
|
||||||
@@ -46,6 +35,25 @@ namespace Subsurface.Items.Components
|
|||||||
get { return drawInventory; }
|
get { return drawInventory; }
|
||||||
set { drawInventory = value; }
|
set { drawInventory = value; }
|
||||||
}
|
}
|
||||||
|
private bool drawInventory;
|
||||||
|
|
||||||
|
//the position of the first item in the container
|
||||||
|
[HasDefaultValue("0.0,0.0", false)]
|
||||||
|
public string ItemPos
|
||||||
|
{
|
||||||
|
get { return ToolBox.Vector2ToString(itemPos); }
|
||||||
|
set { itemPos = ToolBox.ParseToVector2(value); }
|
||||||
|
}
|
||||||
|
private Vector2 itemPos;
|
||||||
|
|
||||||
|
//item[i].Pos = itemPos + itemInterval*i
|
||||||
|
[HasDefaultValue("0.0,0.0", false)]
|
||||||
|
public string ItemInterval
|
||||||
|
{
|
||||||
|
get { return ToolBox.Vector2ToString(itemInterval); }
|
||||||
|
set { itemInterval = ToolBox.ParseToVector2(value); }
|
||||||
|
}
|
||||||
|
private Vector2 itemInterval;
|
||||||
|
|
||||||
[HasDefaultValue(0.0f, false)]
|
[HasDefaultValue(0.0f, false)]
|
||||||
public float ItemRotation
|
public float ItemRotation
|
||||||
@@ -53,25 +61,33 @@ namespace Subsurface.Items.Components
|
|||||||
get { return itemRotation; }
|
get { return itemRotation; }
|
||||||
set { itemRotation = value; }
|
set { itemRotation = value; }
|
||||||
}
|
}
|
||||||
|
private float itemRotation;
|
||||||
|
|
||||||
[HasDefaultValue("0.0,0.0", false)]
|
|
||||||
public string ItemPos
|
|
||||||
{
|
|
||||||
get { return ToolBox.Vector2ToString(itemPos); }
|
|
||||||
set { itemPos = ToolBox.ParseToVector2(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
[HasDefaultValue("0.0,0.0", false)]
|
[HasDefaultValue("0.5,0.9", false)]
|
||||||
public string ItemInterval
|
public string HudPos
|
||||||
{
|
{
|
||||||
get { return ToolBox.Vector2ToString(itemInterval); }
|
get { return ToolBox.Vector2ToString(hudPos); }
|
||||||
set { itemInterval = ToolBox.ParseToVector2(value); }
|
set
|
||||||
|
{
|
||||||
|
hudPos = ToolBox.ParseToVector2(value);
|
||||||
|
//inventory.CenterPos = hudPos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
private Vector2 hudPos;
|
||||||
|
|
||||||
|
[HasDefaultValue(5, false)]
|
||||||
|
public int SlotsPerRow
|
||||||
|
{
|
||||||
|
get { return slotsPerRow; }
|
||||||
|
set { slotsPerRow = value; }
|
||||||
|
}
|
||||||
|
private int slotsPerRow;
|
||||||
|
|
||||||
public ItemContainer(Item item, XElement element)
|
public ItemContainer(Item item, XElement element)
|
||||||
: base (item, element)
|
: base (item, element)
|
||||||
{
|
{
|
||||||
inventory = new ItemInventory(this, capacity);
|
inventory = new ItemInventory(this, capacity, hudPos, slotsPerRow);
|
||||||
containableItems = new List<RelatedItem>();
|
containableItems = new List<RelatedItem>();
|
||||||
|
|
||||||
//itemPos = ToolBox.GetAttributeVector2(element, "ItemPos", Vector2.Zero);
|
//itemPos = ToolBox.GetAttributeVector2(element, "ItemPos", Vector2.Zero);
|
||||||
@@ -99,6 +115,7 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
public bool CanBeContained(Item item)
|
public bool CanBeContained(Item item)
|
||||||
{
|
{
|
||||||
|
if (containableItems.Count == 0) return true;
|
||||||
return (containableItems.Find(x => x.MatchesItem(item)) != null);
|
return (containableItems.Find(x => x.MatchesItem(item)) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,10 +199,7 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
public override bool Pick(Character picker)
|
public override bool Pick(Character picker)
|
||||||
{
|
{
|
||||||
if (picker == null) return false;
|
return (picker != null);
|
||||||
//picker.SelectedConstruction = item;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,216 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace Subsurface.Items.Components
|
||||||
|
{
|
||||||
|
class FabricableItem
|
||||||
|
{
|
||||||
|
//public static List<FabricableItem> list = new List<FabricableItem>();
|
||||||
|
|
||||||
|
//public readonly string[] FabricatorTags;
|
||||||
|
|
||||||
|
public readonly ItemPrefab TargetItem;
|
||||||
|
|
||||||
|
public readonly List<ItemPrefab> RequiredItems;
|
||||||
|
|
||||||
|
public readonly float RequiredTime;
|
||||||
|
|
||||||
|
|
||||||
|
//ListOrSomething requiredLevels
|
||||||
|
|
||||||
|
public FabricableItem(XElement element)
|
||||||
|
{
|
||||||
|
string name = ToolBox.GetAttributeString(element, "name", "").ToLower();
|
||||||
|
|
||||||
|
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == name) as ItemPrefab;
|
||||||
|
if (TargetItem == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error in Fabricable Item! Item ''" + element.Name + "'' not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RequiredItems = new List<ItemPrefab>();
|
||||||
|
|
||||||
|
string[] requiredItemNames = ToolBox.GetAttributeString(element, "requireditems", "").Split(',');
|
||||||
|
foreach (string requiredItemName in requiredItemNames)
|
||||||
|
{
|
||||||
|
ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == requiredItemName.Trim().ToLower()) as ItemPrefab;
|
||||||
|
if (requiredItem == null) continue;
|
||||||
|
RequiredItems.Add(requiredItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
RequiredTime = ToolBox.GetAttributeFloat(element, "requiredtime", 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Fabricator : ItemComponent
|
||||||
|
{
|
||||||
|
List<FabricableItem> fabricableItems;
|
||||||
|
|
||||||
|
GUIListBox itemList;
|
||||||
|
|
||||||
|
GUIFrame selectedItemFrame;
|
||||||
|
|
||||||
|
FabricableItem fabricatedItem;
|
||||||
|
float timeUntilReady;
|
||||||
|
|
||||||
|
public Fabricator(Item item, XElement element)
|
||||||
|
: base(item, element)
|
||||||
|
{
|
||||||
|
fabricableItems = new List<FabricableItem>();
|
||||||
|
|
||||||
|
foreach (XElement subElement in element.Elements())
|
||||||
|
{
|
||||||
|
if (subElement.Name.ToString() != "fabricableitem") continue;
|
||||||
|
|
||||||
|
FabricableItem fabricableItem = new FabricableItem(subElement);
|
||||||
|
if (fabricableItem.TargetItem != null) fabricableItems.Add(fabricableItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int width = 400, height = 300;
|
||||||
|
itemList = new GUIListBox(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), Color.White * 0.7f);
|
||||||
|
itemList.OnSelected = SelectItem;
|
||||||
|
//structureList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||||
|
|
||||||
|
foreach (FabricableItem fi in fabricableItems)
|
||||||
|
{
|
||||||
|
Color color = ((itemList.CountChildren % 2) == 0) ? Color.White : Color.LightGray;
|
||||||
|
|
||||||
|
//GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, itemList);
|
||||||
|
//frame.UserData = fi;
|
||||||
|
//frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
|
//frame.Color = color;
|
||||||
|
//frame.HoverColor = Color.Gold * 0.2f;
|
||||||
|
//frame.SelectedColor = Color.Gold * 0.5f;
|
||||||
|
|
||||||
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
|
new Rectangle(0, 0, 0, 25),
|
||||||
|
fi.TargetItem.Name,
|
||||||
|
color, Color.Black,
|
||||||
|
Alignment.Left,
|
||||||
|
Alignment.Left,
|
||||||
|
itemList);
|
||||||
|
textBlock.UserData = fi;
|
||||||
|
textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
|
|
||||||
|
//if (fi.TargetItem.sprite != null)
|
||||||
|
//{
|
||||||
|
// GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), fi.TargetItem.sprite, Alignment.Left, frame);
|
||||||
|
// img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SelectItem(object obj)
|
||||||
|
{
|
||||||
|
FabricableItem targetItem = obj as FabricableItem;
|
||||||
|
if (targetItem == null) return false;
|
||||||
|
|
||||||
|
int width = 200, height = 150;
|
||||||
|
selectedItemFrame = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, itemList.Rect.Bottom+20, width, height), Color.Black*0.8f);
|
||||||
|
selectedItemFrame.Padding = GUI.style.smallPadding;
|
||||||
|
|
||||||
|
if (targetItem.TargetItem.sprite != null)
|
||||||
|
{
|
||||||
|
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), targetItem.TargetItem.sprite, Alignment.CenterX, selectedItemFrame);
|
||||||
|
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
|
||||||
|
|
||||||
|
string text = targetItem.TargetItem.Name + "\n";
|
||||||
|
text += "Required items:\n";
|
||||||
|
foreach (ItemPrefab ip in targetItem.RequiredItems)
|
||||||
|
{
|
||||||
|
text += " - " + ip.Name + "\n";
|
||||||
|
}
|
||||||
|
text += "Required time: "+targetItem.RequiredTime+" s";
|
||||||
|
|
||||||
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
|
new Rectangle(0, 0, 0, 25),
|
||||||
|
text,
|
||||||
|
Color.Transparent, Color.White,
|
||||||
|
Alignment.CenterX | Alignment.CenterY,
|
||||||
|
Alignment.Left,
|
||||||
|
selectedItemFrame);
|
||||||
|
|
||||||
|
GUIButton button = new GUIButton(new Rectangle(0,0,100,20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, selectedItemFrame);
|
||||||
|
button.OnClicked = StartFabricating;
|
||||||
|
button.UserData = targetItem;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Pick(Character picker)
|
||||||
|
{
|
||||||
|
return (picker != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool StartFabricating(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
GUIComponent listElement = itemList.GetChild(obj);
|
||||||
|
|
||||||
|
listElement.Color = Color.Green;
|
||||||
|
itemList.Enabled = false;
|
||||||
|
|
||||||
|
fabricatedItem = obj as FabricableItem;
|
||||||
|
isActive = true;
|
||||||
|
|
||||||
|
timeUntilReady = fabricatedItem.RequiredTime;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(float deltaTime, Camera cam)
|
||||||
|
{
|
||||||
|
timeUntilReady -= deltaTime;
|
||||||
|
|
||||||
|
if (timeUntilReady > 0.0f) return;
|
||||||
|
|
||||||
|
ItemContainer container = item.GetComponent<ItemContainer>();
|
||||||
|
foreach (ItemPrefab ip in fabricatedItem.RequiredItems)
|
||||||
|
{
|
||||||
|
var requiredItem = Array.Find(container.inventory.items, it => it != null && it.Prefab == ip);
|
||||||
|
container.inventory.RemoveItem(requiredItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
new Item(fabricatedItem.TargetItem, item.Position);
|
||||||
|
|
||||||
|
isActive = false;
|
||||||
|
fabricatedItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||||
|
{
|
||||||
|
FabricableItem targetItem = itemList.SelectedData as FabricableItem;
|
||||||
|
if (targetItem != null)
|
||||||
|
{
|
||||||
|
selectedItemFrame.GetChild<GUIButton>().Enabled = true;
|
||||||
|
|
||||||
|
ItemContainer container = item.GetComponent<ItemContainer>();
|
||||||
|
foreach (ItemPrefab ip in targetItem.RequiredItems)
|
||||||
|
{
|
||||||
|
if (Array.Find(container.inventory.items, it => it != null && it.Prefab == ip) != null) continue;
|
||||||
|
selectedItemFrame.GetChild<GUIButton>().Enabled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
itemList.Update(0.016f);
|
||||||
|
itemList.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (selectedItemFrame != null)
|
||||||
|
{
|
||||||
|
selectedItemFrame.Update(0.016f);
|
||||||
|
selectedItemFrame.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -224,10 +224,10 @@ namespace Subsurface.Items.Components
|
|||||||
{
|
{
|
||||||
if (nodes.Count == 0) return;
|
if (nodes.Count == 0) return;
|
||||||
|
|
||||||
for (int i = 0; i < nodes.Count; i++)
|
//for (int i = 0; i < nodes.Count; i++)
|
||||||
{
|
//{
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)nodes[i].X, (int)-nodes[i].Y, 5, 5), Color.DarkGray, true, wireSprite.Depth - 0.01f);
|
// GUI.DrawRectangle(spriteBatch, new Rectangle((int)nodes[i].X, (int)-nodes[i].Y, 5, 5), Color.DarkGray, true, wireSprite.Depth - 0.01f);
|
||||||
}
|
//}
|
||||||
|
|
||||||
for (int i = 1; i < nodes.Count; i++)
|
for (int i = 1; i < nodes.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,20 +10,44 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
class Inventory : Entity
|
class Inventory : Entity
|
||||||
{
|
{
|
||||||
|
public static Item draggingItem;
|
||||||
|
public static Item doubleClickedItem;
|
||||||
|
|
||||||
|
private int slotsPerRow;
|
||||||
|
|
||||||
|
public int SlotsPerRow
|
||||||
|
{
|
||||||
|
set { slotsPerRow = Math.Max(1, value); }
|
||||||
|
}
|
||||||
|
|
||||||
protected int capacity;
|
protected int capacity;
|
||||||
|
|
||||||
public static Item draggingItem;
|
public Vector2 CenterPos
|
||||||
|
{
|
||||||
|
get { return centerPos; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
centerPos = value;
|
||||||
|
centerPos.X *= Game1.GraphicsWidth;
|
||||||
|
centerPos.Y *= Game1.GraphicsHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Item doubleClickedItem;
|
private Vector2 centerPos;
|
||||||
|
|
||||||
protected int selectedSlot;
|
protected int selectedSlot;
|
||||||
|
|
||||||
public Item[] items;
|
public Item[] items;
|
||||||
|
|
||||||
public Inventory(int capacity)
|
public Inventory(int capacity, Vector2? centerPos = null, int slotsPerRow=5)
|
||||||
{
|
{
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
|
|
||||||
|
this.slotsPerRow = slotsPerRow;
|
||||||
|
|
||||||
items = new Item[capacity];
|
items = new Item[capacity];
|
||||||
|
|
||||||
|
CenterPos = (centerPos==null) ? new Vector2(0.5f, 0.5f) : (Vector2)centerPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int FindIndex(Item item)
|
public int FindIndex(Item item)
|
||||||
@@ -132,13 +156,11 @@ namespace Subsurface
|
|||||||
int rectWidth = 40, rectHeight = 40;
|
int rectWidth = 40, rectHeight = 40;
|
||||||
|
|
||||||
int spacing = 10;
|
int spacing = 10;
|
||||||
|
|
||||||
int slotsPerRow = 5;
|
|
||||||
|
|
||||||
int rows = (int)Math.Ceiling((double)capacity / slotsPerRow);
|
int rows = (int)Math.Ceiling((double)capacity / slotsPerRow);
|
||||||
|
|
||||||
int startX = Game1.GraphicsWidth / 2 - (rectWidth * slotsPerRow + spacing * (slotsPerRow - 1)) / 2;
|
int startX = (int)centerPos.X - (rectWidth * slotsPerRow + spacing * (slotsPerRow - 1)) / 2;
|
||||||
int startY = (int)(Game1.GraphicsHeight * 0.9) - rows*(spacing+rectHeight);
|
int startY = (int)centerPos.Y - rows * (spacing + rectHeight);
|
||||||
|
|
||||||
Rectangle slotRect = new Rectangle(startX, startY, rectWidth, rectHeight);
|
Rectangle slotRect = new Rectangle(startX, startY, rectWidth, rectHeight);
|
||||||
Rectangle draggingItemSlot = slotRect;
|
Rectangle draggingItemSlot = slotRect;
|
||||||
|
|||||||
@@ -166,6 +166,12 @@ namespace Subsurface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Item(ItemPrefab itemPrefab, Vector2 position)
|
||||||
|
: this(new Rectangle((int)position.X, (int)position.Y, (int)itemPrefab.sprite.size.X, (int)itemPrefab.sprite.size.Y), itemPrefab)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Item(Rectangle newRect, ItemPrefab itemPrefab)
|
public Item(Rectangle newRect, ItemPrefab itemPrefab)
|
||||||
{
|
{
|
||||||
prefab = itemPrefab;
|
prefab = itemPrefab;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Subsurface.Items.Components;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Subsurface.Items.Components;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
@@ -6,8 +7,8 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
ItemContainer container;
|
ItemContainer container;
|
||||||
|
|
||||||
public ItemInventory(ItemContainer container, int capacity)
|
public ItemInventory(ItemContainer container, int capacity, Vector2? centerPos = null, int slotsPerRow = 5)
|
||||||
: base(capacity)
|
: base(capacity, centerPos, slotsPerRow)
|
||||||
{
|
{
|
||||||
this.container = container;
|
this.container = container;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,8 +275,7 @@ namespace Subsurface
|
|||||||
// DebugConsole.ThrowError("No save file selected");
|
// DebugConsole.ThrowError("No save file selected");
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
XDocument doc = new XDocument(
|
XDocument doc = new XDocument(new XElement((XName)name));
|
||||||
new XElement((XName)name));
|
|
||||||
|
|
||||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||||
{
|
{
|
||||||
@@ -290,9 +289,9 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
SaveUtil.CompressStringToFile(filePath, doc.ToString());
|
SaveUtil.CompressStringToFile(filePath, doc.ToString());
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Saving map ''" + filePath + "'' failed!");
|
DebugConsole.ThrowError("Saving map ''" + filePath + "'' failed!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -505,12 +504,14 @@ namespace Subsurface
|
|||||||
loaded = this;
|
loaded = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Load(string file)
|
public static Map Load(string file)
|
||||||
{
|
{
|
||||||
Unload();
|
Unload();
|
||||||
|
|
||||||
Map map = new Map(file);
|
Map map = new Map(file);
|
||||||
map.Load();
|
map.Load();
|
||||||
|
|
||||||
|
return map;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,14 +524,9 @@ namespace Subsurface
|
|||||||
|
|
||||||
private void Clear()
|
private void Clear()
|
||||||
{
|
{
|
||||||
filePath = "";
|
|
||||||
|
|
||||||
if (Game1.GameScreen.Cam != null) Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
|
if (Game1.GameScreen.Cam != null) Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||||
|
|
||||||
Entity.RemoveAll();
|
Entity.RemoveAll();
|
||||||
|
|
||||||
if (Game1.GameSession!=null)
|
|
||||||
Game1.GameSession.crewManager.EndShift();
|
|
||||||
|
|
||||||
PhysicsBody.list.Clear();
|
PhysicsBody.list.Clear();
|
||||||
|
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ namespace Subsurface.Networking
|
|||||||
TimeSpan duration = new TimeSpan(0,(int)durationMinutes,0);
|
TimeSpan duration = new TimeSpan(0,(int)durationMinutes,0);
|
||||||
|
|
||||||
//int gameModeIndex = inc.ReadInt32();
|
//int gameModeIndex = inc.ReadInt32();
|
||||||
Game1.GameSession = new GameSession(Map.Loaded, duration);
|
Game1.GameSession = new GameSession(Map.Loaded);
|
||||||
Game1.GameSession.StartShift(1);
|
Game1.GameSession.StartShift(duration, 1);
|
||||||
|
|
||||||
myCharacter = ReadCharacterData(inc);
|
myCharacter = ReadCharacterData(inc);
|
||||||
Character.Controlled = myCharacter;
|
Character.Controlled = myCharacter;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ namespace Subsurface.Networking
|
|||||||
{
|
{
|
||||||
class GameServer : NetworkMember
|
class GameServer : NetworkMember
|
||||||
{
|
{
|
||||||
|
|
||||||
// Server object
|
// Server object
|
||||||
NetServer Server;
|
NetServer Server;
|
||||||
// Configuration object
|
// Configuration object
|
||||||
@@ -275,8 +274,8 @@ namespace Subsurface.Networking
|
|||||||
|
|
||||||
//selectedMap.Load();
|
//selectedMap.Load();
|
||||||
|
|
||||||
Game1.GameSession = new GameSession(selectedMap, Game1.NetLobbyScreen.GameDuration, Game1.NetLobbyScreen.SelectedMode);
|
Game1.GameSession = new GameSession(selectedMap, Game1.NetLobbyScreen.SelectedMode);
|
||||||
Game1.GameSession.StartShift(1);
|
Game1.GameSession.StartShift(Game1.NetLobbyScreen.GameDuration, 1);
|
||||||
//EventManager.SelectEvent(Game1.netLobbyScreen.SelectedEvent);
|
//EventManager.SelectEvent(Game1.netLobbyScreen.SelectedEvent);
|
||||||
|
|
||||||
foreach (Client client in connectedClients)
|
foreach (Client client in connectedClients)
|
||||||
|
|||||||
@@ -9,36 +9,40 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
class SaveUtil
|
class SaveUtil
|
||||||
{
|
{
|
||||||
public const string SaveFolder = "Content/SavedMaps/";
|
public const string SaveFolder = "Content/Data/Saves/";
|
||||||
|
|
||||||
public delegate void ProgressDelegate(string sMessage);
|
public delegate void ProgressDelegate(string sMessage);
|
||||||
|
|
||||||
public static void SaveGame(string directory)
|
public static void SaveGame(string savePath)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(directory))
|
string tempPath = Path.GetDirectoryName(savePath) + "\\temp";
|
||||||
|
if (!Directory.Exists(tempPath))
|
||||||
{
|
{
|
||||||
Directory.Delete(directory, true);
|
Directory.CreateDirectory(tempPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(directory);
|
//Directory.CreateDirectory(Path.GetDirectoryName(filePath) + "\\temp");
|
||||||
|
|
||||||
Map.Loaded.SaveAs(directory+"\\map.gz");
|
Map.Loaded.SaveAs(tempPath + "\\map.gz");
|
||||||
|
|
||||||
Game1.GameSession.Save(directory+"\\gamesession.xml");
|
Game1.GameSession.Save(tempPath + "\\gamesession.xml");
|
||||||
//Game1.GameSession.crewManager.Save(directory+"\\crew.xml");
|
//Game1.GameSession.crewManager.Save(directory+"\\crew.xml");
|
||||||
|
|
||||||
CompressDirectory(directory, directory+".save", null);
|
CompressDirectory(tempPath, savePath, null);
|
||||||
|
|
||||||
Directory.Delete(directory, true);
|
Directory.Delete(tempPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadGame(string filePath)
|
public static void LoadGame(string filePath)
|
||||||
{
|
{
|
||||||
DecompressToDirectory(filePath+".save", Path.GetDirectoryName(filePath)+"\\temp", null);
|
string tempPath = Path.GetDirectoryName(filePath) + "\\temp";
|
||||||
|
|
||||||
Map.Load(Path.GetDirectoryName(filePath) + "\\temp\\map.gz");
|
DecompressToDirectory(filePath, tempPath, null);
|
||||||
Game1.GameSession = new GameSession(Path.GetDirectoryName(filePath) + "\\temp\\gamesession.gz");
|
|
||||||
|
|
||||||
|
Map selectedMap = Map.Load(tempPath +"\\map.gz");
|
||||||
|
Game1.GameSession = new GameSession(selectedMap, filePath, tempPath + "\\gamesession.xml");
|
||||||
|
|
||||||
|
Directory.Delete(tempPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CreateSavePath(string saveFolder, string fileName="save")
|
public static string CreateSavePath(string saveFolder, string fileName="save")
|
||||||
@@ -57,7 +61,7 @@ namespace Subsurface
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return saveFolder + fileName + i + extension;
|
return saveFolder + fileName + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CompressStringToFile(string fileName, string value)
|
public static void CompressStringToFile(string fileName, string value)
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using FarseerPhysics;
|
||||||
|
using FarseerPhysics.Dynamics;
|
||||||
|
using FarseerPhysics.Factories;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
@@ -15,6 +19,13 @@ namespace Subsurface
|
|||||||
GUIListBox characterList;
|
GUIListBox characterList;
|
||||||
GUIListBox hireList;
|
GUIListBox hireList;
|
||||||
|
|
||||||
|
SinglePlayerMode gameMode;
|
||||||
|
|
||||||
|
Body previewPlatform;
|
||||||
|
Hull previewHull;
|
||||||
|
|
||||||
|
Character previewCharacter;
|
||||||
|
|
||||||
public LobbyScreen()
|
public LobbyScreen()
|
||||||
{
|
{
|
||||||
Rectangle panelRect = new Rectangle(
|
Rectangle panelRect = new Rectangle(
|
||||||
@@ -81,14 +92,14 @@ namespace Subsurface
|
|||||||
new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, rightPanel[0]);
|
new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, rightPanel[0]);
|
||||||
|
|
||||||
characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, rightPanel[0]);
|
characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, rightPanel[0]);
|
||||||
|
characterList.OnSelected = SelectCharacter;
|
||||||
|
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
||||||
rightPanel[1] = new GUIFrame(panelRect, GUI.style.backGroundColor);
|
rightPanel[1] = new GUIFrame(panelRect, GUI.style.backGroundColor);
|
||||||
rightPanel[1].Padding = GUI.style.smallPadding;
|
rightPanel[1].Padding = GUI.style.smallPadding;
|
||||||
|
|
||||||
hireList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, Alignment.Left, rightPanel[1]);
|
hireList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, Alignment.Left, rightPanel[1]);
|
||||||
|
|
||||||
hireList.OnSelected = HireCharacter;
|
hireList.OnSelected = HireCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,16 +107,74 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
|
|
||||||
|
gameMode = Game1.GameSession.gameMode as SinglePlayerMode;
|
||||||
|
|
||||||
//Map.Unload();
|
//Map.Unload();
|
||||||
|
|
||||||
UpdateCharacterLists();
|
UpdateCharacterLists();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Deselect()
|
||||||
|
{
|
||||||
|
base.Deselect();
|
||||||
|
|
||||||
|
if (previewPlatform != null)
|
||||||
|
{
|
||||||
|
Game1.world.RemoveBody(previewPlatform);
|
||||||
|
previewPlatform = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewHull != null)
|
||||||
|
{
|
||||||
|
previewHull.Remove();
|
||||||
|
previewHull = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewCharacter != null)
|
||||||
|
{
|
||||||
|
previewCharacter.Remove();
|
||||||
|
previewCharacter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreatePreviewCharacter()
|
||||||
|
{
|
||||||
|
if (previewCharacter != null) previewCharacter.Remove();
|
||||||
|
|
||||||
|
Vector2 pos = new Vector2(1000.0f, 1000.0f);
|
||||||
|
|
||||||
|
previewCharacter = new Character(characterList.SelectedData as CharacterInfo, pos);
|
||||||
|
|
||||||
|
previewCharacter.animController.isStanding = true;
|
||||||
|
|
||||||
|
if (previewPlatform == null)
|
||||||
|
{
|
||||||
|
Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f);
|
||||||
|
platform.SetTransform(new Vector2(pos.X, pos.Y - 3.5f), 0.0f);
|
||||||
|
platform.IsStatic = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewHull == null)
|
||||||
|
{
|
||||||
|
pos = ConvertUnits.ToDisplayUnits(pos);
|
||||||
|
previewHull = new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
Physics.Alpha = 1.0f;
|
||||||
|
|
||||||
|
for (int i = 0; i < 500; i++)
|
||||||
|
{
|
||||||
|
previewCharacter.animController.Update((float)Physics.step);
|
||||||
|
previewCharacter.animController.UpdateAnim((float)Physics.step);
|
||||||
|
Game1.world.Step((float)Physics.step);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCharacterLists()
|
private void UpdateCharacterLists()
|
||||||
{
|
{
|
||||||
characterList.ClearChildren();
|
characterList.ClearChildren();
|
||||||
foreach (CharacterInfo c in Game1.GameSession.crewManager.characterInfos)
|
foreach (CharacterInfo c in gameMode.crewManager.characterInfos)
|
||||||
{
|
{
|
||||||
GUITextBlock textBlock = new GUITextBlock(
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
new Rectangle(0, 0, 0, 25),
|
new Rectangle(0, 0, 0, 25),
|
||||||
@@ -114,10 +183,11 @@ namespace Subsurface
|
|||||||
Alignment.Left,
|
Alignment.Left,
|
||||||
characterList);
|
characterList);
|
||||||
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
|
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
textBlock.UserData = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
hireList.ClearChildren();
|
hireList.ClearChildren();
|
||||||
foreach (CharacterInfo c in Game1.GameSession.hireManager.availableCharacters)
|
foreach (CharacterInfo c in gameMode.hireManager.availableCharacters)
|
||||||
{
|
{
|
||||||
GUIFrame frame = new GUIFrame(
|
GUIFrame frame = new GUIFrame(
|
||||||
new Rectangle(0, 0, 0, 25),
|
new Rectangle(0, 0, 0, 25),
|
||||||
@@ -156,8 +226,8 @@ namespace Subsurface
|
|||||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (characterList.CountChildren != Game1.GameSession.crewManager.characterInfos.Count
|
if (characterList.CountChildren != gameMode.crewManager.characterInfos.Count
|
||||||
|| hireList.CountChildren != Game1.GameSession.hireManager.availableCharacters.Count)
|
|| hireList.CountChildren != gameMode.hireManager.availableCharacters.Count)
|
||||||
{
|
{
|
||||||
UpdateCharacterLists();
|
UpdateCharacterLists();
|
||||||
}
|
}
|
||||||
@@ -168,10 +238,6 @@ namespace Subsurface
|
|||||||
|
|
||||||
spriteBatch.Begin();
|
spriteBatch.Begin();
|
||||||
|
|
||||||
|
|
||||||
//ConstructionPrefab.list[5].sprite.Draw(spriteBatch, Vector2.Zero, new Vector2(10.0f, 1.0f), Color.White);
|
|
||||||
|
|
||||||
|
|
||||||
leftPanel.Draw(spriteBatch);
|
leftPanel.Draw(spriteBatch);
|
||||||
shiftPanel.Draw(spriteBatch);
|
shiftPanel.Draw(spriteBatch);
|
||||||
|
|
||||||
@@ -180,6 +246,26 @@ namespace Subsurface
|
|||||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
|
if (characterList.SelectedData != null)
|
||||||
|
{
|
||||||
|
if (previewCharacter != null)
|
||||||
|
{
|
||||||
|
Vector2 position = new Vector2(characterList.Rect.Right + 100, characterList.Rect.Y + 25.0f);
|
||||||
|
|
||||||
|
Vector2 pos = previewCharacter.Position;
|
||||||
|
pos.Y = -pos.Y;
|
||||||
|
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||||
|
previewCharacter.Draw(spriteBatch);
|
||||||
|
spriteBatch.End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreatePreviewCharacter();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SelectRightPanel(GUIButton button, object selection)
|
public bool SelectRightPanel(GUIButton button, object selection)
|
||||||
@@ -189,49 +275,93 @@ namespace Subsurface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private void CreatePreviewCharacter()
|
||||||
|
//{
|
||||||
|
// if (Game1.Client.Character != null) Game1.Client.Character.Remove();
|
||||||
|
|
||||||
|
// Vector2 pos = new Vector2(1000.0f, 1000.0f);
|
||||||
|
|
||||||
|
// Character character = new Character(Game1.Client.CharacterInfo, pos);
|
||||||
|
|
||||||
|
// Game1.Client.Character = character;
|
||||||
|
|
||||||
|
// character.animController.isStanding = true;
|
||||||
|
|
||||||
|
// if (previewPlatform == null)
|
||||||
|
// {
|
||||||
|
// Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f);
|
||||||
|
// platform.SetTransform(new Vector2(pos.X, pos.Y - 2.5f), 0.0f);
|
||||||
|
// platform.IsStatic = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (previewPlatform == null)
|
||||||
|
// {
|
||||||
|
// pos = ConvertUnits.ToDisplayUnits(pos);
|
||||||
|
// new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 200));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Physics.Alpha = 1.0f;
|
||||||
|
|
||||||
|
// for (int i = 0; i < 500; i++)
|
||||||
|
// {
|
||||||
|
// character.animController.Update((float)Physics.step);
|
||||||
|
// character.animController.UpdateAnim((float)Physics.step);
|
||||||
|
// Game1.world.Step((float)Physics.step);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
private string GetMoney()
|
private string GetMoney()
|
||||||
{
|
{
|
||||||
return "Money: " + ((Game1.GameSession == null) ? "" : Game1.GameSession.crewManager.Money.ToString());
|
return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.crewManager.Money.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetDay()
|
private string GetDay()
|
||||||
{
|
{
|
||||||
|
|
||||||
return "Day #" + ((Game1.GameSession == null) ? "" : Game1.GameSession.Day.ToString());
|
return "Day #" + ((Game1.GameSession == null) ? "" : gameMode.Day.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetWeekProgress()
|
private float GetWeekProgress()
|
||||||
{
|
{
|
||||||
if (Game1.GameSession == null) return 0.0f;
|
if (Game1.GameSession == null) return 0.0f;
|
||||||
|
|
||||||
return (float)((Game1.GameSession.Day - 1) % 7) / 7.0f;
|
return (float)((gameMode.Day - 1) % 7) / 7.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SelectCharacter(object selection)
|
||||||
|
{
|
||||||
|
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||||
|
if (characterInfo == null) return false;
|
||||||
|
|
||||||
|
if (Character.Controlled != null && characterInfo == Character.Controlled.info) return false;
|
||||||
|
|
||||||
|
CreatePreviewCharacter();
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HireCharacter(object selection)
|
private bool HireCharacter(object selection)
|
||||||
{
|
{
|
||||||
CharacterInfo characterInfo;
|
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||||
try { characterInfo = (CharacterInfo)selection; }
|
|
||||||
catch { return false; }
|
|
||||||
|
|
||||||
if (characterInfo == null) return false;
|
if (characterInfo == null) return false;
|
||||||
|
|
||||||
Game1.GameSession.TryHireCharacter(characterInfo);
|
gameMode.TryHireCharacter(characterInfo);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool StartShift(GUIButton button, object selection)
|
private bool StartShift(GUIButton button, object selection)
|
||||||
{
|
{
|
||||||
|
Game1.GameSession.StartShift(TimeSpan.Zero);
|
||||||
//Map.Load(Game1.GameSession.SaveFile);
|
|
||||||
|
|
||||||
Game1.GameSession.StartShift();
|
|
||||||
|
|
||||||
//EventManager.StartShift();
|
|
||||||
|
|
||||||
Game1.GameScreen.Select();
|
Game1.GameScreen.Select();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QuitToMainMenu(GUIButton button, object selection)
|
||||||
|
{
|
||||||
|
Game1.MainMenuScreen.Select();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,19 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Subsurface.Networking;
|
using Subsurface.Networking;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
class MainMenuScreen : Screen
|
class MainMenuScreen : Screen
|
||||||
{
|
{
|
||||||
enum Tabs { Main = 0, NewGame = 1, JoinServer = 2}
|
enum Tabs { Main = 0, NewGame = 1, LoadGame = 2, JoinServer = 3 }
|
||||||
|
|
||||||
GUIFrame[] menuTabs;
|
GUIFrame[] menuTabs;
|
||||||
GUIListBox mapList;
|
GUIListBox mapList;
|
||||||
|
|
||||||
|
GUIListBox saveList;
|
||||||
|
|
||||||
GUITextBox nameBox;
|
GUITextBox nameBox;
|
||||||
GUITextBox ipBox;
|
GUITextBox ipBox;
|
||||||
|
|
||||||
@@ -21,7 +24,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
public MainMenuScreen(Game1 game)
|
public MainMenuScreen(Game1 game)
|
||||||
{
|
{
|
||||||
menuTabs = new GUIFrame[3];
|
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tabs)).Length];
|
||||||
|
|
||||||
Rectangle panelRect = new Rectangle(
|
Rectangle panelRect = new Rectangle(
|
||||||
Game1.GraphicsWidth / 2 - 250,
|
Game1.GraphicsWidth / 2 - 250,
|
||||||
@@ -32,17 +35,23 @@ namespace Subsurface
|
|||||||
menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
|
menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "New Game", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "New Game", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
||||||
button.OnClicked = NewGameClicked;
|
button.UserData = (int)Tabs.NewGame;
|
||||||
|
button.OnClicked = SelectTab;
|
||||||
//button.Enabled = false;
|
//button.Enabled = false;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 60, 0, 30), "Join Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
button = new GUIButton(new Rectangle(0, 60, 0, 30), "Load Game", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
||||||
button.OnClicked = JoinServerClicked;
|
button.UserData = (int)Tabs.LoadGame;
|
||||||
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 120, 0, 30), "Host Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
button = new GUIButton(new Rectangle(0, 120, 0, 30), "Join Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
||||||
|
button.UserData = (int)Tabs.JoinServer;
|
||||||
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
|
button = new GUIButton(new Rectangle(0, 180, 0, 30), "Host Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
||||||
button.OnClicked = HostServerClicked;
|
button.OnClicked = HostServerClicked;
|
||||||
//button.Enabled = false;
|
//button.Enabled = false;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 180, 0, 30), "Quit", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
button = new GUIButton(new Rectangle(0, 240, 0, 30), "Quit", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]);
|
||||||
button.OnClicked = QuitClicked;
|
button.OnClicked = QuitClicked;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -53,7 +62,7 @@ namespace Subsurface
|
|||||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "New Game", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.NewGame]);
|
new GUITextBlock(new Rectangle(0, 0, 0, 30), "New Game", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.NewGame]);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
|
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
|
||||||
mapList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, menuTabs[1]);
|
mapList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, menuTabs[(int)Tabs.NewGame]);
|
||||||
|
|
||||||
foreach (Map map in Map.SavedMaps)
|
foreach (Map map in Map.SavedMaps)
|
||||||
{
|
{
|
||||||
@@ -73,6 +82,34 @@ namespace Subsurface
|
|||||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.NewGame]);
|
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.NewGame]);
|
||||||
button.OnClicked = StartGame;
|
button.OnClicked = StartGame;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.style.backGroundColor);
|
||||||
|
menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding;
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Load Game", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.LoadGame]);
|
||||||
|
|
||||||
|
|
||||||
|
string[] saveFiles = Directory.GetFiles(SaveUtil.SaveFolder, "*.save");
|
||||||
|
|
||||||
|
//new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, menuTabs[(int)Tabs.NewGame]);
|
||||||
|
saveList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, menuTabs[(int)Tabs.LoadGame]);
|
||||||
|
|
||||||
|
foreach (string saveFile in saveFiles)
|
||||||
|
{
|
||||||
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
|
new Rectangle(0, 0, 0, 25),
|
||||||
|
saveFile,
|
||||||
|
GUI.style,
|
||||||
|
Alignment.Left,
|
||||||
|
Alignment.Left,
|
||||||
|
saveList);
|
||||||
|
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
textBlock.UserData = saveFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.LoadGame]);
|
||||||
|
button.OnClicked = LoadGame;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -95,18 +132,12 @@ namespace Subsurface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool NewGameClicked(GUIButton button, object obj)
|
private bool SelectTab(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
selectedTab = (int)Tabs.NewGame;
|
selectedTab = (int)obj;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool JoinServerClicked(GUIButton button, object obj)
|
|
||||||
{
|
|
||||||
selectedTab = (int)Tabs.JoinServer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool HostServerClicked(GUIButton button, object obj)
|
private bool HostServerClicked(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
Game1.NetLobbyScreen.isServer = true;
|
Game1.NetLobbyScreen.isServer = true;
|
||||||
@@ -142,18 +173,39 @@ namespace Subsurface
|
|||||||
|
|
||||||
private bool StartGame(GUIButton button, object obj)
|
private bool StartGame(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
Map selectedMap = mapList.SelectedData as Map;
|
Map selectedMap = mapList.SelectedData as Map;
|
||||||
if (selectedMap == null) return false;
|
if (selectedMap == null) return false;
|
||||||
|
|
||||||
|
Game1.GameSession = new GameSession(selectedMap, GameModePreset.list.Find(gm => gm.Name == "Single Player"));
|
||||||
Game1.GameSession = new GameSession(selectedMap, TimeSpan.Zero);
|
|
||||||
|
|
||||||
Game1.LobbyScreen.Select();
|
Game1.LobbyScreen.Select();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool LoadGame(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
|
||||||
|
string saveFile = saveList.SelectedData as string;
|
||||||
|
if (string.IsNullOrWhiteSpace(saveFile)) return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SaveUtil.LoadGame(saveFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Loading map ''"+saveFile+"'' failed", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Game1.LobbyScreen.Select();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool JoinServer(GUIButton button, object obj)
|
private bool JoinServer(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(nameBox.Text)) return false;
|
if (string.IsNullOrEmpty(nameBox.Text)) return false;
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GameMode SelectedMode
|
public GameModePreset SelectedMode
|
||||||
{
|
{
|
||||||
get { return modeList.SelectedData as GameMode; }
|
get { return modeList.SelectedData as GameModePreset; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSpan GameDuration
|
public TimeSpan GameDuration
|
||||||
@@ -161,8 +161,10 @@ namespace Subsurface
|
|||||||
modeList.Enabled = (Game1.Server != null);
|
modeList.Enabled = (Game1.Server != null);
|
||||||
//modeList.OnSelected = new GUIListBox.OnSelectedHandler(SelectEvent);
|
//modeList.OnSelected = new GUIListBox.OnSelectedHandler(SelectEvent);
|
||||||
|
|
||||||
foreach (GameMode mode in GameMode.list)
|
foreach (GameModePreset mode in GameModePreset.list)
|
||||||
{
|
{
|
||||||
|
if (mode.IsSinglePlayer) continue;
|
||||||
|
|
||||||
GUITextBlock textBlock = new GUITextBlock(
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
new Rectangle(0, 0, 0, 25),
|
new Rectangle(0, 0, 0, 25),
|
||||||
mode.Name,
|
mode.Name,
|
||||||
@@ -192,8 +194,8 @@ namespace Subsurface
|
|||||||
modeList.OnSelected = Game1.Server.UpdateNetLobby;
|
modeList.OnSelected = Game1.Server.UpdateNetLobby;
|
||||||
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
|
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
|
||||||
|
|
||||||
if (mapList.CountChildren > 0) mapList.Select(Map.SavedMaps[0]);
|
if (mapList.CountChildren > 0) mapList.Select(0);
|
||||||
if (GameMode.list.Count > 0) modeList.Select(GameMode.list[0]);
|
if (GameModePreset.list.Count > 0) modeList.Select(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -319,9 +321,9 @@ namespace Subsurface
|
|||||||
|
|
||||||
Vector2 pos = Game1.Client.Character.Position;
|
Vector2 pos = Game1.Client.Character.Position;
|
||||||
pos.Y = -pos.Y;
|
pos.Y = -pos.Y;
|
||||||
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos+position, 0.0f));
|
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, null,null,null,null,null,transform);
|
spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||||
Game1.Client.Character.Draw(spriteBatch);
|
Game1.Client.Character.Draw(spriteBatch);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
@@ -386,10 +388,10 @@ namespace Subsurface
|
|||||||
platform.IsStatic = true;
|
platform.IsStatic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previewPlatform==null)
|
if (previewHull==null)
|
||||||
{
|
{
|
||||||
pos = ConvertUnits.ToDisplayUnits(pos);
|
pos = ConvertUnits.ToDisplayUnits(pos);
|
||||||
new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 200));
|
previewHull = new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 200));
|
||||||
}
|
}
|
||||||
|
|
||||||
Physics.Alpha = 1.0f;
|
Physics.Alpha = 1.0f;
|
||||||
@@ -473,7 +475,7 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Write(Path.GetFileName(selectedMap.FilePath));
|
msg.Write(Path.GetFileName(selectedMap.Name));
|
||||||
msg.Write(selectedMap.MapHash.MD5Hash);
|
msg.Write(selectedMap.MapHash.MD5Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,12 +71,14 @@
|
|||||||
<Compile Include="GameSession\GameMode.cs" />
|
<Compile Include="GameSession\GameMode.cs" />
|
||||||
<Compile Include="GameSession\HireManager.cs" />
|
<Compile Include="GameSession\HireManager.cs" />
|
||||||
<Compile Include="Characters\HumanoidAnimController.cs" />
|
<Compile Include="Characters\HumanoidAnimController.cs" />
|
||||||
|
<Compile Include="GameSession\SinglePlayerMode.cs" />
|
||||||
<Compile Include="GameSession\TraitorMode.cs" />
|
<Compile Include="GameSession\TraitorMode.cs" />
|
||||||
<Compile Include="GUI\GUIImage.cs" />
|
<Compile Include="GUI\GUIImage.cs" />
|
||||||
<Compile Include="GUI\GUIMessageBox.cs" />
|
<Compile Include="GUI\GUIMessageBox.cs" />
|
||||||
<Compile Include="GUI\GUITickBox.cs" />
|
<Compile Include="GUI\GUITickBox.cs" />
|
||||||
<Compile Include="IPropertyObject.cs" />
|
<Compile Include="IPropertyObject.cs" />
|
||||||
<Compile Include="Items\CharacterInventory.cs" />
|
<Compile Include="Items\CharacterInventory.cs" />
|
||||||
|
<Compile Include="Items\Components\Fabricator.cs" />
|
||||||
<Compile Include="Items\Components\MiniMap.cs" />
|
<Compile Include="Items\Components\MiniMap.cs" />
|
||||||
<Compile Include="Items\Components\Pump.cs" />
|
<Compile Include="Items\Components\Pump.cs" />
|
||||||
<Compile Include="Items\Components\Signal\OxygenDetector.cs" />
|
<Compile Include="Items\Components\Signal\OxygenDetector.cs" />
|
||||||
@@ -305,6 +307,13 @@
|
|||||||
<Content Include="Content\Items\Door\windowedDoor.png">
|
<Content Include="Content\Items\Door\windowedDoor.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\Items\Fabricators\fabricator.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Content\Items\Fabricators\fabricators.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\Items\Lockers\locker.png">
|
<Content Include="Content\Items\Lockers\locker.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -437,22 +446,22 @@
|
|||||||
<Content Include="Content\Items\poweritems.xml">
|
<Content Include="Content\Items\poweritems.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railgun.xml">
|
<Content Include="Content\Items\Weapons\railgun.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railgunbarrel.png">
|
<Content Include="Content\Items\Weapons\railgunbarrel.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railgunbase.png">
|
<Content Include="Content\Items\Weapons\railgunbase.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railguncontroller.png">
|
<Content Include="Content\Items\Weapons\railguncontroller.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railgunloader.png">
|
<Content Include="Content\Items\Weapons\railgunloader.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\railgunshell.png">
|
<Content Include="Content\Items\Weapons\railgunshell.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\Items\Reactor\reactor.png">
|
<Content Include="Content\Items\Reactor\reactor.png">
|
||||||
@@ -587,7 +596,7 @@
|
|||||||
<None Include="Content\Items\Weapons\harpoon2.ogg">
|
<None Include="Content\Items\Weapons\harpoon2.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Content\Items\railgun.ogg">
|
<None Include="Content\Items\Weapons\railgun.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Content\Items\Weapons\stunGrenade.ogg">
|
<None Include="Content\Items\Weapons\stunGrenade.ogg">
|
||||||
|
|||||||