Online quest mode, fixed bug when swimming from hull to another, monitors with editable text, choosing exe in content package, monster quests, misc bugfixes

This commit is contained in:
Regalis
2015-07-30 18:52:20 +03:00
parent 5d0a453e23
commit c7dd6e55f0
53 changed files with 3477 additions and 219 deletions
+8 -9
View File
@@ -45,10 +45,7 @@ namespace Subsurface
//public readonly bool IsSinglePlayer;
private GUIProgressBar timerBar;
protected bool isRunning;
//protected string name;
@@ -57,6 +54,11 @@ namespace Subsurface
private string endMessage;
public virtual Quest Quest
{
get { return null; }
}
public DateTime StartTime
{
get { return startTime; }
@@ -143,13 +145,10 @@ namespace Subsurface
public static void Init()
{
new GameModePreset("Single Player", typeof(SinglePlayerMode), true);
new GameModePreset("SandBox", typeof(GameMode), false);
new GameModePreset("Traitor", typeof(TraitorMode), false);
//new SinglePlayerMode("Single Player", true);
//new GameMode("Sandbox");
//new TraitorMode("Traitor");
new GameModePreset("Quest", typeof(QuestMode), false);
}
}
}
+18 -5
View File
@@ -19,7 +19,7 @@ namespace Subsurface
//protected DateTime endTime;
public readonly GameMode gameMode;
private GUIFrame guiRoot;
//private GUIListBox chatBox;
@@ -29,6 +29,16 @@ namespace Subsurface
private Submarine submarine;
public Quest Quest
{
get
{
if (gameMode != null) return gameMode.Quest;
return null;
}
}
private Level level;
public Level Level
@@ -100,7 +110,7 @@ namespace Subsurface
public void StartShift(TimeSpan duration, Level level, bool reloadSub = true)
{
Game1.LightManager.LosEnabled = (Game1.Server==null);
this.level = level;
if (reloadSub || Submarine.Loaded != submarine) submarine.Load();
@@ -111,15 +121,18 @@ namespace Subsurface
submarine.SetPosition(level.StartPosition - new Vector2(0.0f, 2000.0f));
}
if (Quest!=null) Quest.Start(Level.Loaded);
if (gameMode!=null) gameMode.Start(duration);
taskManager.StartShift(level);
}
public void EndShift(string endMessage)
{
if (Quest != null) Quest.End();
if (Game1.Server!=null)
{
Game1.Server.EndGame(endMessage);
+51
View File
@@ -0,0 +1,51 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Subsurface
{
class QuestMode : GameMode
{
Quest quest;
public override Quest Quest
{
get
{
return quest;
}
}
public QuestMode(GameModePreset preset)
: base(preset)
{
Location[] locations = new Location[2];
Random rand = new Random(Game1.NetLobbyScreen.LevelSeed.GetHashCode());
for (int i = 0; i < 2; i++)
{
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
quest = Quest.LoadRandom(locations, rand);
}
public override void Start(TimeSpan duration)
{
base.Start(duration);
new GUIMessageBox(quest.Name, quest.Description, 400, 400);
quest.Start(Level.Loaded);
}
public override void End(string endMessage = "")
{
quest.End();
base.End(endMessage);
}
}
}
+8 -6
View File
@@ -18,8 +18,6 @@ namespace Subsurface
private GUIButton endShiftButton;
public readonly CargoManager CargoManager;
private Quest quest;
public Map map;
@@ -28,6 +26,14 @@ namespace Subsurface
private bool savedOnStart;
public override Quest Quest
{
get
{
return map.SelectedConnection.Quest;
}
}
public int Money
{
get { return crewManager.Money; }
@@ -93,8 +99,6 @@ namespace Subsurface
{
CargoManager.CreateItems();
Game1.GameSession.Map.SelectedConnection.Quest.Start(Level.Loaded);
if (!savedOnStart)
{
SaveUtil.SaveGame(Game1.GameSession.SavePath);
@@ -176,8 +180,6 @@ namespace Subsurface
{
base.End(endMessage);
quest.End();
StringBuilder sb = new StringBuilder();
List<Character> casualties = crewManager.characters.FindAll(c => c.IsDead);
+2
View File
@@ -25,6 +25,8 @@ namespace Subsurface
public override void Update(float deltaTime)
{
if (Game1.Server == null) return;
base.Update(deltaTime);
if (!isRunning) return;