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:
Regalis
2015-08-31 19:57:49 +03:00
parent 1e990784b2
commit f739808520
150 changed files with 15933 additions and 588 deletions
+38 -43
View File
@@ -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);
}
}
}