misc UI stuff, gamesession additions, limbs don't have individual health anymore, background music
This commit is contained in:
@@ -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,7 @@ namespace Subsurface
|
||||
|
||||
AmbientSoundManager.Update();
|
||||
|
||||
Game1.gameSession.Update((float)deltaTime);
|
||||
if (Game1.GameSession!=null) Game1.GameSession.Update((float)deltaTime);
|
||||
//EventManager.Update(gameTime);
|
||||
|
||||
Character.UpdateAll(cam, (float)deltaTime);
|
||||
@@ -107,7 +107,7 @@ namespace Subsurface
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
spriteBatch.Begin();
|
||||
if (Game1.gameSession != null) Game1.gameSession.Draw(spriteBatch);
|
||||
if (Game1.GameSession != null) Game1.GameSession.Draw(spriteBatch);
|
||||
|
||||
//EventManager.DrawInfo(spriteBatch);
|
||||
|
||||
|
||||
@@ -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,20 @@ 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;
|
||||
}
|
||||
|
||||
@@ -112,8 +112,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 +132,7 @@ namespace Subsurface
|
||||
{
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.gameScreen.DrawMap(graphics, spriteBatch);
|
||||
Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
|
||||
@@ -150,9 +150,9 @@ namespace Subsurface
|
||||
if (selectedMap == null) return false;
|
||||
|
||||
|
||||
Game1.gameSession = new GameSession(selectedMap.FilePath, true, TimeSpan.Zero);
|
||||
Game1.GameSession = new GameSession(selectedMap.FilePath, true, TimeSpan.Zero);
|
||||
|
||||
Game1.lobbyScreen.Select();
|
||||
Game1.LobbyScreen.Select();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -162,15 +162,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,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 +132,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 +157,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 +180,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 +199,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 +240,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 +275,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 +288,7 @@ namespace Subsurface
|
||||
|
||||
pos += offset * 0.8f;
|
||||
|
||||
Game1.gameScreen.Cam.TargetPos = pos;
|
||||
Game1.GameScreen.Cam.TargetPos = pos;
|
||||
|
||||
menu.Update((float)deltaTime);
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Subsurface
|
||||
{
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.gameScreen.DrawMap(graphics, spriteBatch);
|
||||
Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
|
||||
@@ -310,18 +310,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 +346,7 @@ namespace Subsurface
|
||||
|
||||
public bool StartGame(object obj)
|
||||
{
|
||||
Game1.server.StartGame(null, obj);
|
||||
Game1.Server.StartGame(null, obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -356,11 +356,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 +368,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 +406,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 +421,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user