Progress on tutorial, gap tweaking (water flows faster from room to room), UPnP error messages, input keys in array, underwater aiming tweaking, tons of misc stuff commit more often ffs
This commit is contained in:
@@ -18,10 +18,10 @@ namespace Subsurface
|
||||
characterFile = ToolBox.GetAttributeString(element, "characterfile", "");
|
||||
|
||||
minAmount = ToolBox.GetAttributeInt(element, "minamount", 1);
|
||||
maxAmount = Math.Max(ToolBox.GetAttributeInt(element, "maxamount", 1),minAmount);
|
||||
maxAmount = Math.Max(ToolBox.GetAttributeInt(element, "maxamount", 1), minAmount);
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
private void SpawnMonsters()
|
||||
{
|
||||
WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Enemy);
|
||||
|
||||
@@ -40,22 +40,26 @@ namespace Subsurface
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
base.Update(deltaTime);
|
||||
if (monsters == null) SpawnMonsters();
|
||||
|
||||
if (!isStarted) return;
|
||||
|
||||
if (!isFinished)
|
||||
//base.Update(deltaTime);
|
||||
|
||||
//if (!isStarted) return;
|
||||
|
||||
if (isFinished) return;
|
||||
|
||||
bool monstersDead = true;
|
||||
for (int i = 0; i < monsters.Length; i++)
|
||||
{
|
||||
bool monstersDead = true;
|
||||
for (int i = 0; i < monsters.Length; i++)
|
||||
{
|
||||
if (monsters[i].IsDead) continue;
|
||||
if (monsters[i].IsDead) continue;
|
||||
|
||||
if (!isStarted && monsters[i].SimPosition != Vector2.Zero && monsters[i].SimPosition.Length() < 20.0) isStarted = true;
|
||||
|
||||
monstersDead = false;
|
||||
break;
|
||||
}
|
||||
if (monstersDead) Finished();
|
||||
monstersDead = false;
|
||||
break;
|
||||
}
|
||||
if (monstersDead) Finished();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Subsurface
|
||||
|
||||
public override void Start(Level level)
|
||||
{
|
||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)];
|
||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
|
||||
|
||||
monster = new Character(monsterFile, ConvertUnits.ToSimUnits(position+level.Position));
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Subsurface
|
||||
|
||||
try
|
||||
{
|
||||
t = Type.GetType("Subsurface." + type + ", Subsurface", true, true);
|
||||
t = Type.GetType("Subsurface." + type, true, true);
|
||||
if (t == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in " + configFile + "! Could not find a quest class of the type ''" + type + "''.");
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Subsurface
|
||||
|
||||
try
|
||||
{
|
||||
t = Type.GetType("Subsurface." + type + ", Subsurface", true, true);
|
||||
t = Type.GetType("Subsurface." + type, true, true);
|
||||
if (t == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in " + configFile + "! Could not find an event class of the type ''" + type + "''.");
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
|
||||
private bool prevStarted;
|
||||
|
||||
public override bool IsStarted
|
||||
{
|
||||
get { return scriptedEvent.IsStarted; }
|
||||
}
|
||||
|
||||
public ScriptedTask(ScriptedEvent scriptedEvent)
|
||||
: base(scriptedEvent.Difficulty, scriptedEvent.Name)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace Subsurface
|
||||
get { return isFinished; }
|
||||
}
|
||||
|
||||
public virtual bool IsStarted
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Task(float priority, string name)
|
||||
{
|
||||
if (Game1.GameSession==null || Game1.GameSession.taskManager == null) return;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Subsurface
|
||||
|
||||
private List<Task> tasks;
|
||||
|
||||
private GUIListBox taskListBox;
|
||||
//private GUIListBox taskListBox;
|
||||
|
||||
public List<Task> Tasks
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace Subsurface
|
||||
{
|
||||
tasks = new List<Task>();
|
||||
|
||||
taskListBox = new GUIListBox(new Rectangle(Game1.GraphicsWidth - 250, 50, 250, 500), Color.Transparent);
|
||||
//taskListBox = new GUIListBox(new Rectangle(Game1.GraphicsWidth - 250, 50, 250, 500), Color.Transparent);
|
||||
//taskListBox.ScrollBarEnabled = false;
|
||||
//taskListBox.Padding = GUI.style.smallPadding;
|
||||
}
|
||||
@@ -50,24 +50,24 @@ namespace Subsurface
|
||||
{
|
||||
CreateScriptedEvents(level);
|
||||
|
||||
taskListBox.ClearChildren();
|
||||
//taskListBox.ClearChildren();
|
||||
}
|
||||
|
||||
|
||||
public void EndShift()
|
||||
{
|
||||
taskListBox.ClearChildren();
|
||||
//taskListBox.ClearChildren();
|
||||
tasks.Clear();
|
||||
}
|
||||
|
||||
private void CreateScriptedEvents(Level level)
|
||||
{
|
||||
Random rand = new Random(level.Seed.GetHashCode());
|
||||
Random rand = new Random(ToolBox.StringToInt(level.Seed));
|
||||
|
||||
float totalDifficulty = level.Difficulty;
|
||||
|
||||
int tries = 0;
|
||||
do
|
||||
while (tries < 5)
|
||||
{
|
||||
ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom(rand);
|
||||
if (scriptedEvent==null || scriptedEvent.Difficulty > totalDifficulty)
|
||||
@@ -79,36 +79,36 @@ namespace Subsurface
|
||||
AddTask(new ScriptedTask(scriptedEvent));
|
||||
totalDifficulty -= scriptedEvent.Difficulty;
|
||||
tries = 0;
|
||||
} while (tries < 5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TaskStarted(Task task)
|
||||
{
|
||||
Color color = Color.Red;
|
||||
int width = 250;
|
||||
if (task.Priority < 30.0f)
|
||||
{
|
||||
width = 200;
|
||||
color = Color.Yellow;
|
||||
}
|
||||
else if (task.Priority < 60)
|
||||
{
|
||||
width = 220;
|
||||
color = Color.Orange;
|
||||
}
|
||||
//Color color = Color.Red;
|
||||
//int width = 250;
|
||||
//if (task.Priority < 30.0f)
|
||||
//{
|
||||
// width = 200;
|
||||
// color = Color.Yellow;
|
||||
//}
|
||||
//else if (task.Priority < 60)
|
||||
//{
|
||||
// width = 220;
|
||||
// color = Color.Orange;
|
||||
//}
|
||||
|
||||
GUIFrame frame = new GUIFrame(new Rectangle(0,0,width,40), Color.Transparent, Alignment.Right, null, taskListBox);
|
||||
frame.UserData = task;
|
||||
frame.Padding = new Vector4(0.0f, 5.0f, 5.0f, 5.0f);
|
||||
//GUIFrame frame = new GUIFrame(new Rectangle(0,0,width,40), Color.Transparent, Alignment.Right, null, taskListBox);
|
||||
//frame.UserData = task;
|
||||
//frame.Padding = new Vector4(0.0f, 5.0f, 5.0f, 5.0f);
|
||||
|
||||
GUIFrame colorFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), color * 0.5f, Alignment.Right, null, frame);
|
||||
GUITextBlock textBlock = new GUITextBlock(new Rectangle(5, 5, 0, 20), task.Name, Color.Transparent, Color.Black, Alignment.Right, null, colorFrame);
|
||||
//GUIFrame colorFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), color * 0.5f, Alignment.Right, null, frame);
|
||||
//GUITextBlock textBlock = new GUITextBlock(new Rectangle(5, 5, 0, 20), task.Name, Color.Transparent, Color.Black, Alignment.Right, null, colorFrame);
|
||||
//textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f);
|
||||
|
||||
//colorFrame.AddChild(textBlock);
|
||||
|
||||
taskListBox.children.Sort((x, y) => ((Task)y.UserData).Priority.CompareTo(((Task)x.UserData).Priority));
|
||||
//taskListBox.children.Sort((x, y) => ((Task)y.UserData).Priority.CompareTo(((Task)x.UserData).Priority));
|
||||
}
|
||||
|
||||
public void TaskFinished(Task task)
|
||||
@@ -121,23 +121,22 @@ namespace Subsurface
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
Task removeTask = null;
|
||||
GUIComponent removeComponent = null;
|
||||
foreach (Task task in tasks)
|
||||
{
|
||||
if (task.IsFinished)
|
||||
{
|
||||
foreach (GUIComponent comp in taskListBox.children)
|
||||
{
|
||||
if (comp.UserData as Task != task) continue;
|
||||
comp.Rect = new Rectangle(comp.Rect.X, comp.Rect.Y, comp.Rect.Width, comp.Rect.Height - 1);
|
||||
comp.children[0].ClearChildren();
|
||||
if (comp.Rect.Height < 1)
|
||||
{
|
||||
removeComponent = comp;
|
||||
//foreach (GUIComponent comp in taskListBox.children)
|
||||
//{
|
||||
// if (comp.UserData as Task != task) continue;
|
||||
// comp.Rect = new Rectangle(comp.Rect.X, comp.Rect.Y, comp.Rect.Width, comp.Rect.Height - 1);
|
||||
// comp.children[0].ClearChildren();
|
||||
// if (comp.Rect.Height < 1)
|
||||
// {
|
||||
// removeComponent = comp;
|
||||
removeTask = task;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -146,18 +145,14 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
if (removeComponent!= null)
|
||||
if (removeTask!= null)
|
||||
{
|
||||
taskListBox.RemoveChild(removeComponent);
|
||||
//taskListBox.RemoveChild(removeComponent);
|
||||
tasks.Remove(removeTask);
|
||||
}
|
||||
|
||||
//endShiftButton.Enabled = finished || Game1.server!=null;
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
taskListBox.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user