misc UI stuff, gamesession additions, limbs don't have individual health anymore, background music
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
public delegate bool IsFinishedHandler();
|
||||
private IsFinishedHandler IsFinishedChecker;
|
||||
|
||||
public PropertyTask(TaskManager taskManager, Item item, IsFinishedHandler isFinished, float priority, string name)
|
||||
: base(taskManager, priority, name)
|
||||
public PropertyTask(Item item, IsFinishedHandler isFinished, float priority, string name)
|
||||
: base(priority, name)
|
||||
{
|
||||
if (taskManager == null) return;
|
||||
|
||||
this.item = item;
|
||||
IsFinishedChecker = isFinished;
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
{
|
||||
Item item;
|
||||
|
||||
public RepairTask(TaskManager taskManager, Item item, float priority, string name)
|
||||
: base(taskManager, priority, name)
|
||||
public RepairTask(Item item, float priority, string name)
|
||||
: base(priority, name)
|
||||
{
|
||||
if (taskManager == null) return;
|
||||
|
||||
this.item = item;
|
||||
|
||||
taskManager.TaskStarted(this);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Subsurface
|
||||
|
||||
protected bool isStarted;
|
||||
protected bool isFinished;
|
||||
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
@@ -46,6 +46,12 @@ namespace Subsurface
|
||||
get { return commonness; }
|
||||
}
|
||||
|
||||
public string MusicType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsStarted
|
||||
{
|
||||
get { return isStarted; }
|
||||
@@ -69,6 +75,10 @@ namespace Subsurface
|
||||
difficulty = ToolBox.GetAttributeInt(element, "difficulty", 1);
|
||||
commonness = ToolBox.GetAttributeInt(element, "commonness", 1);
|
||||
|
||||
|
||||
MusicType = ToolBox.GetAttributeString(element, "musictype", "default");
|
||||
|
||||
|
||||
if (element.Attribute("starttime") != null)
|
||||
{
|
||||
startTimeMax = ToolBox.GetAttributeInt(element, "starttime", 1);
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
private bool prevStarted;
|
||||
|
||||
public ScriptedTask(TaskManager taskManager, ScriptedEvent scriptedEvent)
|
||||
: base(taskManager, scriptedEvent.Difficulty, scriptedEvent.Name)
|
||||
public ScriptedTask(ScriptedEvent scriptedEvent)
|
||||
: base(scriptedEvent.Difficulty, scriptedEvent.Name)
|
||||
{
|
||||
if (taskManager == null) return;
|
||||
|
||||
this.musicType = scriptedEvent.MusicType;
|
||||
|
||||
this.scriptedEvent = scriptedEvent;
|
||||
scriptedEvent.Init();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Subsurface
|
||||
|
||||
private float priority;
|
||||
|
||||
protected string musicType;
|
||||
|
||||
protected TaskManager taskManager;
|
||||
|
||||
protected bool isFinished;
|
||||
@@ -22,14 +24,22 @@ namespace Subsurface
|
||||
get { return priority; }
|
||||
}
|
||||
|
||||
public string MusicType
|
||||
{
|
||||
get { return musicType; }
|
||||
}
|
||||
|
||||
public bool IsFinished
|
||||
{
|
||||
get { return isFinished; }
|
||||
}
|
||||
|
||||
public Task(TaskManager taskManager, float priority, string name)
|
||||
public Task(float priority, string name)
|
||||
{
|
||||
this.taskManager = taskManager;
|
||||
if (Game1.GameSession==null || Game1.GameSession.taskManager == null) return;
|
||||
|
||||
taskManager = Game1.GameSession.taskManager;
|
||||
musicType = "repair";
|
||||
this.priority = priority;
|
||||
this.name = name;
|
||||
|
||||
|
||||
@@ -6,10 +6,29 @@ namespace Subsurface
|
||||
{
|
||||
class TaskManager
|
||||
{
|
||||
const float CriticalPriority = 50.0f;
|
||||
|
||||
private List<Task> tasks;
|
||||
|
||||
private GUIListBox taskListBox;
|
||||
|
||||
public List<Task> Tasks
|
||||
{
|
||||
get { return tasks; }
|
||||
}
|
||||
|
||||
public bool CriticalTasks
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (Task task in tasks)
|
||||
{
|
||||
if (task.Priority >= CriticalPriority) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskManager(GameSession session)
|
||||
{
|
||||
tasks = new List<Task>();
|
||||
@@ -45,7 +64,7 @@ namespace Subsurface
|
||||
for (int i = 0; i < scriptedEventCount; i++)
|
||||
{
|
||||
ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom();
|
||||
AddTask(new ScriptedTask(this, scriptedEvent));
|
||||
AddTask(new ScriptedTask(scriptedEvent));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user