Quests, new sounds, explosives, bugfixes, asdfasdf
This commit is contained in:
@@ -38,8 +38,6 @@ namespace Subsurface
|
||||
{
|
||||
base.Select();
|
||||
|
||||
//if (Game1.gameSession == null) Game1.gameSession = new GameSession("",false, TimeSpan.Zero);
|
||||
|
||||
foreach (MapEntity entity in MapEntity.mapEntityList)
|
||||
entity.IsHighlighted = false;
|
||||
}
|
||||
@@ -73,10 +71,9 @@ namespace Subsurface
|
||||
|
||||
Character.UpdateAll(cam, (float)deltaTime);
|
||||
|
||||
Game1.particleManager.Update((float)deltaTime);
|
||||
Game1.ParticleManager.Update((float)deltaTime);
|
||||
|
||||
StatusEffect.UpdateAll((float)deltaTime);
|
||||
//Physics.updated = false;
|
||||
|
||||
cam.MoveCamera((float)deltaTime);
|
||||
|
||||
@@ -108,24 +105,15 @@ namespace Subsurface
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called when the game should draw itself.
|
||||
/// </summary>
|
||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
//if (!Physics.updated) return;
|
||||
|
||||
DrawMap(graphics, spriteBatch);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//2. draw the HUD on top of everything
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
spriteBatch.Begin();
|
||||
if (Game1.GameSession != null) Game1.GameSession.Draw(spriteBatch);
|
||||
|
||||
//EventManager.DrawInfo(spriteBatch);
|
||||
|
||||
if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null)
|
||||
{
|
||||
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem)
|
||||
@@ -215,7 +203,7 @@ namespace Subsurface
|
||||
BlendState.AlphaBlend,
|
||||
null, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
Game1.particleManager.Draw(spriteBatch, true);
|
||||
Game1.ParticleManager.Draw(spriteBatch, true);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -233,7 +221,7 @@ namespace Subsurface
|
||||
null, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
|
||||
Game1.particleManager.Draw(spriteBatch, false);
|
||||
Game1.ParticleManager.Draw(spriteBatch, false);
|
||||
spriteBatch.End();
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
@@ -253,6 +241,12 @@ namespace Subsurface
|
||||
|
||||
Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform);
|
||||
|
||||
if (Game1.GameSession != null && Game1.GameSession.Level != null)
|
||||
{
|
||||
Game1.GameSession.Level.Render(graphics, cam);
|
||||
Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
|
||||
if (Game1.LightManager.LightingEnabled)
|
||||
{
|
||||
//multiply scene with lightmap
|
||||
@@ -264,7 +258,7 @@ namespace Subsurface
|
||||
//----------------------------------------------------------------------------------------
|
||||
//3. draw the sections of the map that are on top of the water
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
||||
null, null, null,
|
||||
@@ -279,20 +273,10 @@ namespace Subsurface
|
||||
Game1.GameSession.Level.Draw(spriteBatch);
|
||||
//Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
if (Game1.GameSession != null && Game1.GameSession.Level != null)
|
||||
{
|
||||
Game1.GameSession.Level.Render(graphics, cam);
|
||||
Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
else if (Game1.Level != null)
|
||||
{
|
||||
Game1.Level.Render(graphics, cam);
|
||||
}
|
||||
|
||||
Game1.LightManager.DrawFow(graphics,cam,LightManager.ViewPos);
|
||||
Game1.LightManager.DrawLOS(graphics, cam, LightManager.ViewPos);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Subsurface
|
||||
GUIListBox characterList;
|
||||
GUIListBox hireList;
|
||||
|
||||
GUIListBox selectedItemList;
|
||||
GUIListBox selectedItemList, itemList;
|
||||
|
||||
SinglePlayerMode gameMode;
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Subsurface
|
||||
|
||||
Level selectedLevel;
|
||||
|
||||
private string SelectedItemCost()
|
||||
private string CostTextGetter()
|
||||
{
|
||||
return selectedItemCost.ToString();
|
||||
return "Cost: "+selectedItemCost.ToString();
|
||||
}
|
||||
|
||||
private int selectedItemCost
|
||||
@@ -55,7 +55,7 @@ namespace Subsurface
|
||||
{
|
||||
Rectangle panelRect = new Rectangle(
|
||||
40, 40,
|
||||
(int)(Game1.GraphicsWidth * 0.3f) - 60,
|
||||
180,
|
||||
Game1.GraphicsHeight - 80);
|
||||
|
||||
leftPanel = new GUIFrame(panelRect, GUI.style);
|
||||
@@ -122,14 +122,15 @@ namespace Subsurface
|
||||
rightPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.style);
|
||||
|
||||
selectedItemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
selectedItemList.OnSelected = DeselectItem;
|
||||
|
||||
var costText = new GUITextBlock(new Rectangle(0, 0, 200, 25), "Cost: ", Color.Transparent, Color.White, Alignment.BottomLeft, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
costText.TextGetter = SelectedItemCost;
|
||||
var costText = new GUITextBlock(new Rectangle(0, 0, 200, 25), "Cost: ", GUI.style, Alignment.BottomLeft, Alignment.TopLeft, rightPanel[(int)PanelTab.Store]);
|
||||
costText.TextGetter = CostTextGetter;
|
||||
|
||||
buyButton = new GUIButton(new Rectangle(15, 0, 100, 25), "Buy", Alignment.Bottom, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
buyButton = new GUIButton(new Rectangle(150, 0, 100, 25), "Buy", Alignment.Bottom, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
buyButton.OnClicked = BuyItems;
|
||||
|
||||
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, Alignment.TopRight, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
itemList = new GUIListBox(new Rectangle(0, 0, 300, 400), Color.White * 0.7f, Alignment.TopRight, GUI.style, rightPanel[(int)PanelTab.Store]);
|
||||
itemList.OnSelected = SelectItem;
|
||||
|
||||
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
|
||||
@@ -196,10 +197,22 @@ namespace Subsurface
|
||||
|
||||
if (locationPanel != null) rightPanel[(int)PanelTab.Map].RemoveChild(locationPanel);
|
||||
|
||||
locationPanel = new GUIFrame(new Rectangle(0, 0, rightPanel[(int)PanelTab.Map].Rect.Width / 2 - 40, 190), Color.Transparent, null, rightPanel[(int)PanelTab.Map]);
|
||||
locationPanel = new GUIFrame(new Rectangle(0, 0, 200, 190), Color.Transparent, Alignment.TopRight, null, rightPanel[(int)PanelTab.Map]);
|
||||
locationPanel.UserData = "selectedlocation";
|
||||
|
||||
new GUITextBlock(new Rectangle(0,0,100,20), location.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
new GUITextBlock(new Rectangle(0,0,0,0), location.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
|
||||
if (Game1.GameSession.Map.SelectedConnection != null && Game1.GameSession.Map.SelectedConnection.Quest != null)
|
||||
{
|
||||
var quest = Game1.GameSession.Map.SelectedConnection.Quest;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 40, 0, 20), "Quest: "+quest.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 60, 0, 20), "Reward: " + quest.Reward, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 80, 0, 0), quest.Description, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel, true);
|
||||
|
||||
}
|
||||
|
||||
startButton.Enabled = true;
|
||||
|
||||
@@ -257,7 +270,6 @@ namespace Subsurface
|
||||
private bool SelectItem(object obj)
|
||||
{
|
||||
MapEntityPrefab prefab = obj as MapEntityPrefab;
|
||||
|
||||
if (prefab == null) return false;
|
||||
|
||||
CreateItemFrame(prefab, selectedItemList);
|
||||
@@ -267,6 +279,16 @@ namespace Subsurface
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool DeselectItem(object obj)
|
||||
{
|
||||
MapEntityPrefab prefab = obj as MapEntityPrefab;
|
||||
if (prefab == null) return false;
|
||||
|
||||
selectedItemList.RemoveChild(selectedItemList.children.Find(c => c.UserData == obj));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool BuyItems(GUIButton button, object obj)
|
||||
{
|
||||
int cost = selectedItemCost;
|
||||
@@ -323,8 +345,8 @@ namespace Subsurface
|
||||
Game1.GameSession.Map.Draw(spriteBatch, new Rectangle(
|
||||
rightPanel[selectedRightPanel].Rect.X + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Y + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Width - 40,
|
||||
rightPanel[selectedRightPanel].Rect.Height - 150), 3.0f);
|
||||
rightPanel[selectedRightPanel].Rect.Width - 250,
|
||||
rightPanel[selectedRightPanel].Rect.Height - 40), 3.0f);
|
||||
}
|
||||
|
||||
if (rightPanel[(int)selectedRightPanel].UserData as Location != Game1.GameSession.Map.CurrentLocation)
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Subsurface
|
||||
{
|
||||
class MainMenuScreen : Screen
|
||||
{
|
||||
enum Tabs { Main = 0, NewGame = 1, LoadGame = 2, JoinServer = 3 }
|
||||
public enum Tabs { Main = 0, NewGame = 1, LoadGame = 2, JoinServer = 3, HostServer = 4 }
|
||||
|
||||
private GUIFrame[] menuTabs;
|
||||
private GUIListBox mapList;
|
||||
@@ -19,6 +19,8 @@ namespace Subsurface
|
||||
|
||||
private GUITextBox nameBox, ipBox;
|
||||
|
||||
private GUITextBox serverNameBox, portBox;
|
||||
|
||||
private Game1 game;
|
||||
|
||||
int selectedTab;
|
||||
@@ -50,7 +52,8 @@ namespace Subsurface
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 180, 0, 30), "Host Server", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
|
||||
button.OnClicked = HostServerClicked;
|
||||
button.UserData = (int)Tabs.HostServer;
|
||||
button.OnClicked = SelectTab;
|
||||
//button.Enabled = false;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 240, 0, 30), "Quit", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]);
|
||||
@@ -86,7 +89,7 @@ namespace Subsurface
|
||||
seedBox.Text = ToolBox.RandomSeed(8);
|
||||
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",Alignment.BottomRight, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
button.OnClicked = StartGame;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -94,7 +97,7 @@ namespace Subsurface
|
||||
menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.style);
|
||||
//menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Load Game", Color.Transparent, Color.Black, Alignment.CenterX, null, menuTabs[(int)Tabs.LoadGame]);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Load Game", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.LoadGame]);
|
||||
|
||||
if (!Directory.Exists(SaveUtil.SaveFolder))
|
||||
{
|
||||
@@ -148,6 +151,22 @@ namespace Subsurface
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
menuTabs[(int)Tabs.HostServer] = new GUIFrame(panelRect, GUI.style);
|
||||
//menuTabs[(int)Tabs.JoinServer].Padding = GUI.style.smallPadding;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer]);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Name:", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer]);
|
||||
serverNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, null, menuTabs[(int)Tabs.HostServer]);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server port:", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer]);
|
||||
portBox = new GUITextBox(new Rectangle(0, 130, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, null, menuTabs[(int)Tabs.HostServer]);
|
||||
portBox.Text = NetworkMember.DefaultPort.ToString();
|
||||
|
||||
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomCenter, GUI.style, menuTabs[(int)Tabs.HostServer]);
|
||||
hostButton.OnClicked = HostServerClicked;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
for (int i = 1; i < 4; i++ )
|
||||
{
|
||||
button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.style, menuTabs[i]);
|
||||
@@ -158,14 +177,28 @@ namespace Subsurface
|
||||
|
||||
}
|
||||
|
||||
private bool SelectTab(GUIButton button, object obj)
|
||||
public bool SelectTab(GUIButton button, object obj)
|
||||
{
|
||||
selectedTab = (int)obj;
|
||||
|
||||
this.Select();
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HostServerClicked(GUIButton button, object obj)
|
||||
{
|
||||
string name = serverNameBox.Text;
|
||||
if (string.IsNullOrEmpty(name)) name = "Server";
|
||||
|
||||
int port;
|
||||
if (!int.TryParse(portBox.Text, out port))
|
||||
{
|
||||
DebugConsole.ThrowError("ERROR: "+portBox.Text+" is not a valid port. Using the default port "+NetworkMember.DefaultPort);
|
||||
port = NetworkMember.DefaultPort;
|
||||
}
|
||||
|
||||
Game1.NetworkMember = new GameServer(name, port);
|
||||
|
||||
Game1.NetLobbyScreen.IsServer = true;
|
||||
Game1.NetLobbyScreen.Select();
|
||||
return true;
|
||||
|
||||
@@ -148,12 +148,10 @@ namespace Subsurface
|
||||
|
||||
public override void Select()
|
||||
{
|
||||
Game1.LightManager.FowEnabled = false;
|
||||
Game1.LightManager.LosEnabled = false;
|
||||
|
||||
infoFrame.ClearChildren();
|
||||
|
||||
if (IsServer && Game1.Server == null) Game1.NetworkMember = new GameServer();
|
||||
|
||||
textBox.Select();
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 110, 0, 30), "Selected submarine:", GUI.style, infoFrame);
|
||||
@@ -219,9 +217,9 @@ namespace Subsurface
|
||||
serverName.TextGetter = GetServerName;
|
||||
serverName.Enabled = Game1.Server != null;
|
||||
serverName.OnTextChanged = ChangeServerName;
|
||||
ServerName = "Server";
|
||||
|
||||
var serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70),null,null, Alignment.TopLeft, Alignment.TopLeft, GUI.style, infoFrame);
|
||||
ServerName = (Game1.Server==null) ? "Server" : Game1.Server.Name;
|
||||
|
||||
var serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.style, infoFrame);
|
||||
serverMessage.Enabled = Game1.Server != null;
|
||||
serverMessage.Wrap = true;
|
||||
serverMessage.TextGetter = GetServerMessage;
|
||||
@@ -264,14 +262,14 @@ namespace Subsurface
|
||||
|
||||
new GUITextBlock(new Rectangle(x, 150, 200, 30), "Job preferences:", GUI.style, playerFrame);
|
||||
|
||||
jobList = new GUIListBox(new Rectangle(x, 180, 200, 0), GUI.style, playerFrame);
|
||||
jobList = new GUIListBox(new Rectangle(x, 180, 150, 0), GUI.style, playerFrame);
|
||||
|
||||
foreach (JobPrefab job in JobPrefab.List)
|
||||
{
|
||||
GUITextBlock jobText = new GUITextBlock(new Rectangle(0,0,0,20), job.Name, GUI.style, jobList);
|
||||
jobText.UserData = job;
|
||||
|
||||
GUIButton upButton = new GUIButton(new Rectangle(jobText.Rect.Width - 40, 0, 20, 20), "u", GUI.style, jobText);
|
||||
GUIButton upButton = new GUIButton(new Rectangle(jobText.Rect.Width - 45, 0, 20, 20), "u", GUI.style, jobText);
|
||||
upButton.UserData = -1;
|
||||
upButton.OnClicked += ChangeJobPreference;
|
||||
|
||||
@@ -639,11 +637,14 @@ namespace Subsurface
|
||||
|
||||
textBlock.Text = client.name + ((client.assignedJob==null) ? "" : " (" + client.assignedJob.Name + ")");
|
||||
|
||||
if (clientID == Game1.Client.ID)
|
||||
if (client.assignedJob==null || jobName != client.assignedJob.Name)
|
||||
{
|
||||
Game1.Client.CharacterInfo.Job = new Job(client.assignedJob);
|
||||
Game1.Client.CharacterInfo.Name = client.name;
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
if (clientID == Game1.Client.ID)
|
||||
{
|
||||
Game1.Client.CharacterInfo.Job = new Job(client.assignedJob);
|
||||
Game1.Client.CharacterInfo.Name = client.name;
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Subsurface
|
||||
|
||||
public virtual void Select()
|
||||
{
|
||||
if (selected != null) selected.Deselect();
|
||||
if (selected != null && selected!=this) selected.Deselect();
|
||||
selected = this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user