Conflicts:
	Subsurface/Subsurface.csproj
	Subsurface_Solution.v12.suo
This commit is contained in:
Regalis11
2015-06-14 18:18:24 +03:00
86 changed files with 1503 additions and 631 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ namespace Subsurface
if (physicsEnabled)
{
editingCharacter.Control(cam);
editingCharacter.Control(1.0f, cam);
}
else
{
+2 -2
View File
@@ -94,7 +94,7 @@ namespace Subsurface
public override void Select()
{
base.Select();
GUIComponent.MouseOn = null;
characterMode = false;
//CreateDummyCharacter();
@@ -197,7 +197,7 @@ namespace Subsurface
}
dummyCharacter.ControlLocalPlayer(cam, false);
dummyCharacter.Control(cam);
dummyCharacter.Control((float)deltaTime, cam);
}
else
{
+14 -3
View File
@@ -38,7 +38,7 @@ namespace Subsurface
{
base.Select();
if (Game1.gameSession == null) Game1.gameSession = new GameSession("",false, TimeSpan.Zero);
//if (Game1.gameSession == null) Game1.gameSession = new GameSession("",false, TimeSpan.Zero);
foreach (MapEntity entity in MapEntity.mapEntityList)
entity.IsHighlighted = false;
@@ -57,7 +57,18 @@ namespace Subsurface
AmbientSoundManager.Update();
Game1.gameSession.Update((float)deltaTime);
//Vector2 targetMovement = Vector2.Zero;
//if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f;
//if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f;
//if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f;
//if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f;
//foreach (MapEntity e in Structure.mapEntityList)
//{
// e.Move(targetMovement);
//}
if (Game1.GameSession!=null) Game1.GameSession.Update((float)deltaTime);
//EventManager.Update(gameTime);
Character.UpdateAll(cam, (float)deltaTime);
@@ -107,7 +118,7 @@ namespace Subsurface
//----------------------------------------------------------------------------------------
spriteBatch.Begin();
if (Game1.gameSession != null) Game1.gameSession.Draw(spriteBatch);
if (Game1.GameSession != null) Game1.GameSession.Draw(spriteBatch);
//EventManager.DrawInfo(spriteBatch);
+24 -14
View File
@@ -96,7 +96,7 @@ namespace Subsurface
{
base.Select();
Map.Unload();
//Map.Unload();
UpdateCharacterLists();
@@ -105,7 +105,7 @@ namespace Subsurface
private void UpdateCharacterLists()
{
characterList.ClearChildren();
foreach (CharacterInfo c in Game1.gameSession.crewManager.characterInfos)
foreach (CharacterInfo c in Game1.GameSession.crewManager.characterInfos)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
@@ -117,7 +117,7 @@ namespace Subsurface
}
hireList.ClearChildren();
foreach (CharacterInfo c in Game1.gameSession.hireManager.availableCharacters)
foreach (CharacterInfo c in Game1.GameSession.hireManager.availableCharacters)
{
GUIFrame frame = new GUIFrame(
new Rectangle(0, 0, 0, 25),
@@ -144,18 +144,27 @@ namespace Subsurface
}
}
public override void Update(double deltaTime)
{
base.Update(deltaTime);
leftPanel.Update((float)deltaTime);
rightPanel[selectedRightPanel].Update((float)deltaTime);
shiftPanel.Update((float)deltaTime);
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{
if (characterList.CountChildren != Game1.gameSession.crewManager.characterInfos.Count
|| hireList.CountChildren != Game1.gameSession.hireManager.availableCharacters.Count)
if (characterList.CountChildren != Game1.GameSession.crewManager.characterInfos.Count
|| hireList.CountChildren != Game1.GameSession.hireManager.availableCharacters.Count)
{
UpdateCharacterLists();
}
graphics.Clear(Color.CornflowerBlue);
Game1.gameScreen.DrawMap(graphics, spriteBatch);
Game1.GameScreen.DrawMap(graphics, spriteBatch);
spriteBatch.Begin();
@@ -182,20 +191,20 @@ namespace Subsurface
private string GetMoney()
{
return "Money: " + ((Game1.gameSession == null) ? "" : Game1.gameSession.crewManager.Money.ToString());
return "Money: " + ((Game1.GameSession == null) ? "" : Game1.GameSession.crewManager.Money.ToString());
}
private string GetDay()
{
return "Day #" + ((Game1.gameSession == null) ? "" : Game1.gameSession.Day.ToString());
return "Day #" + ((Game1.GameSession == null) ? "" : Game1.GameSession.Day.ToString());
}
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)((Game1.GameSession.Day - 1) % 7) / 7.0f;
}
private bool HireCharacter(object selection)
@@ -206,20 +215,21 @@ namespace Subsurface
if (characterInfo == null) return false;
Game1.gameSession.TryHireCharacter(characterInfo);
Game1.GameSession.TryHireCharacter(characterInfo);
return false;
}
private bool StartShift(GUIButton button, object selection)
{
Map.Load(Game1.gameSession.SaveFile);
//Map.Load(Game1.GameSession.SaveFile);
Game1.gameSession.StartShift();
Game1.GameSession.StartShift();
//EventManager.StartShift();
Game1.gameScreen.Select();
Game1.GameScreen.Select();
return true;
}
+23 -26
View File
@@ -55,23 +55,20 @@ namespace Subsurface
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]);
//string[] mapFilePaths = Map.GetMapFilePaths();
//if (mapFilePaths!=null)
//{
foreach (Map map in Map.SavedMaps)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
map.Name,
GUI.style,
Alignment.Left,
Alignment.Left,
mapList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = map;
}
if (Map.SavedMaps.Count > 0) mapList.Select(Map.SavedMaps[0]);
//}
foreach (Map map in Map.SavedMaps)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
map.Name,
GUI.style,
Alignment.Left,
Alignment.Left,
mapList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = map;
}
if (Map.SavedMaps.Count > 0) mapList.Select(Map.SavedMaps[0]);
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.NewGame]);
button.OnClicked = StartGame;
@@ -112,8 +109,8 @@ namespace Subsurface
private bool HostServerClicked(GUIButton button, object obj)
{
Game1.netLobbyScreen.isServer = true;
Game1.netLobbyScreen.Select();
Game1.NetLobbyScreen.isServer = true;
Game1.NetLobbyScreen.Select();
return true;
}
@@ -132,7 +129,7 @@ namespace Subsurface
{
graphics.Clear(Color.CornflowerBlue);
Game1.gameScreen.DrawMap(graphics, spriteBatch);
Game1.GameScreen.DrawMap(graphics, spriteBatch);
spriteBatch.Begin();
@@ -150,9 +147,9 @@ namespace Subsurface
if (selectedMap == null) return false;
Game1.gameSession = new GameSession(selectedMap.FilePath, true, TimeSpan.Zero);
Game1.GameSession = new GameSession(selectedMap, TimeSpan.Zero);
Game1.lobbyScreen.Select();
Game1.LobbyScreen.Select();
return true;
}
@@ -162,15 +159,15 @@ namespace Subsurface
if (string.IsNullOrEmpty(nameBox.Text)) return false;
if (string.IsNullOrEmpty(ipBox.Text)) return false;
Game1.client = new GameClient(nameBox.Text);
if (Game1.client.ConnectToServer(ipBox.Text))
Game1.Client = new GameClient(nameBox.Text);
if (Game1.Client.ConnectToServer(ipBox.Text))
{
Game1.netLobbyScreen.Select();
Game1.NetLobbyScreen.Select();
return true;
}
else
{
Game1.client = null;
Game1.Client = null;
return false;
}
}
+31 -30
View File
@@ -6,6 +6,7 @@ using Subsurface.Networking;
using FarseerPhysics;
using FarseerPhysics.Factories;
using FarseerPhysics.Dynamics;
using System.IO;
namespace Subsurface
{
@@ -122,7 +123,7 @@ namespace Subsurface
{
infoFrame.ClearChildren();
if (isServer && Game1.server == null) Game1.server = new GameServer();
if (isServer && Game1.Server == null) Game1.Server = new GameServer();
textBox.Select();
@@ -132,7 +133,7 @@ namespace Subsurface
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, infoFrame);
mapList = new GUIListBox(new Rectangle(0, 60, 200, 200), Color.White, infoFrame);
mapList.OnSelected = SelectMap;
mapList.Enabled = (Game1.server!=null);
mapList.Enabled = (Game1.Server!=null);
if (Map.SavedMaps.Count>0)
{
@@ -157,7 +158,7 @@ namespace Subsurface
new GUITextBlock(new Rectangle(220, 30, 0, 30), "Selected game mode: ", Color.Transparent, Color.Black, Alignment.Left, infoFrame);
modeList = new GUIListBox(new Rectangle(220, 60, 200, 200), Color.White, infoFrame);
modeList.Enabled = (Game1.server != null);
modeList.Enabled = (Game1.Server != null);
//modeList.OnSelected = new GUIListBox.OnSelectedHandler(SelectEvent);
foreach (GameMode mode in GameMode.list)
@@ -180,16 +181,16 @@ namespace Subsurface
durationBar = new GUIScrollBar(new Rectangle((int)(modeList.Rect.X + modeList.Rect.Width + GUI.style.smallPadding.X), modeList.Rect.Y + 30, 100, 20),
Color.Gold, 0.1f, Alignment.Left, infoFrame);
durationBar.BarSize = 0.1f;
durationBar.Enabled = (Game1.server != null);
durationBar.Enabled = (Game1.Server != null);
if (isServer && Game1.server!=null)
if (isServer && Game1.Server!=null)
{
GUIButton startButton = new GUIButton(new Rectangle(0,0,200,30), "Start", Color.White, Alignment.Right | Alignment.Bottom, infoFrame);
startButton.OnClicked = Game1.server.StartGame;
startButton.OnClicked = Game1.Server.StartGame;
//mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby);
modeList.OnSelected = Game1.server.UpdateNetLobby;
durationBar.OnMoved = Game1.server.UpdateNetLobby;
modeList.OnSelected = Game1.Server.UpdateNetLobby;
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
if (mapList.CountChildren > 0) mapList.Select(Map.SavedMaps[0]);
if (GameMode.list.Count > 0) modeList.Select(GameMode.list[0]);
@@ -199,7 +200,7 @@ namespace Subsurface
int x = playerFrame.Rect.Width / 2;
GUITextBox playerName = new GUITextBox(new Rectangle(x, 0, 0, 20), Color.White, Color.Black,
Alignment.Left | Alignment.Top, Alignment.Left, playerFrame);
playerName.Text = Game1.client.CharacterInfo.name;
playerName.Text = Game1.Client.CharacterInfo.name;
playerName.OnEnter += ChangeCharacterName;
new GUITextBlock(new Rectangle(x,40,200, 30), "Gender: ", Color.Transparent, Color.Black,
@@ -240,7 +241,7 @@ namespace Subsurface
private bool SelectMap(object obj)
{
if (Game1.server != null) Game1.server.UpdateNetLobby(obj);
if (Game1.Server != null) Game1.Server.UpdateNetLobby(obj);
Map map = (Map)obj;
@@ -275,7 +276,7 @@ namespace Subsurface
{
base.Update(deltaTime);
Game1.gameScreen.Cam.MoveCamera((float)deltaTime);
Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
Vector2 pos = new Vector2(
Map.Borders.X + Map.Borders.Width / 2,
@@ -288,7 +289,7 @@ namespace Subsurface
pos += offset * 0.8f;
Game1.gameScreen.Cam.TargetPos = pos;
Game1.GameScreen.Cam.TargetPos = pos;
menu.Update((float)deltaTime);
@@ -299,7 +300,7 @@ namespace Subsurface
{
graphics.Clear(Color.CornflowerBlue);
Game1.gameScreen.DrawMap(graphics, spriteBatch);
Game1.GameScreen.DrawMap(graphics, spriteBatch);
spriteBatch.Begin();
@@ -310,18 +311,18 @@ namespace Subsurface
spriteBatch.End();
if (Game1.client != null)
if (Game1.Client != null)
{
if (Game1.client.Character != null)
if (Game1.Client.Character != null)
{
Vector2 position = new Vector2(playerFrame.Rect.X + playerFrame.Rect.Width * 0.25f, playerFrame.Rect.Y + 25.0f);
Vector2 pos = Game1.client.Character.Position;
Vector2 pos = Game1.Client.Character.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);
Game1.client.Character.Draw(spriteBatch);
Game1.Client.Character.Draw(spriteBatch);
spriteBatch.End();
}
else
@@ -346,7 +347,7 @@ namespace Subsurface
public bool StartGame(object obj)
{
Game1.server.StartGame(null, obj);
Game1.Server.StartGame(null, obj);
return true;
}
@@ -356,11 +357,11 @@ namespace Subsurface
if (isServer)
{
Game1.server.SendChatMessage("Server: " + message);
Game1.Server.SendChatMessage("Server: " + message);
}
else
{
Game1.client.SendChatMessage(Game1.client.Name + ": " + message);
Game1.Client.SendChatMessage(Game1.Client.Name + ": " + message);
}
return true;
@@ -368,13 +369,13 @@ namespace Subsurface
private void CreatePreviewCharacter()
{
if (Game1.client.Character != null) Game1.client.Character.Remove();
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);
Character character = new Character(Game1.Client.CharacterInfo, pos);
Game1.client.Character = character;
Game1.Client.Character = character;
character.animController.isStanding = true;
@@ -406,8 +407,8 @@ namespace Subsurface
try
{
Gender gender = (Gender)obj;
Game1.client.CharacterInfo.gender = gender;
Game1.client.SendCharacterData();
Game1.Client.CharacterInfo.gender = gender;
Game1.Client.SendCharacterData();
CreatePreviewCharacter();
}
catch
@@ -421,9 +422,9 @@ namespace Subsurface
{
if (string.IsNullOrEmpty(newName)) return false;
Game1.client.CharacterInfo.name = newName;
Game1.client.Name = newName;
Game1.client.SendCharacterData();
Game1.Client.CharacterInfo.name = newName;
Game1.Client.Name = newName;
Game1.Client.SendCharacterData();
textBox.Text = newName;
@@ -472,7 +473,7 @@ namespace Subsurface
}
else
{
msg.Write(selectedMap.Name);
msg.Write(Path.GetFileName(selectedMap.FilePath));
msg.Write(selectedMap.MapHash.MD5Hash);
}
@@ -502,7 +503,7 @@ namespace Subsurface
else
{
mapList.Select(map);
map.Load();
//map.Load();
return true;
}
}