Console colors, begin RNG rework

This is gonna be a PAIN
This commit is contained in:
juanjp600
2017-06-19 21:30:57 -03:00
parent 384819c528
commit 7003214847
37 changed files with 261 additions and 130 deletions
+32 -2
View File
@@ -13,11 +13,41 @@ namespace Barotrauma
{
static partial class DebugConsole
{
private static string InputText;
public static List<string> QueuedCommands = new List<string>();
public static void Update()
{
lock (QueuedCommands)
{
while (QueuedCommands.Count>0)
{
ExecuteCommand(QueuedCommands[0], GameMain.Instance);
QueuedCommands.RemoveAt(0);
}
}
}
private static bool ExecProjSpecific(string[] commands)
{
return false; //command not found
switch (commands[0].ToLower())
{
case "startgame":
case "startround":
case "start":
if (Screen.Selected == GameMain.GameScreen) break;
if (!GameMain.Server.StartGame()) NewMessage("Failed to start server",Color.Yellow);
break;
case "endgame":
case "endround":
case "end":
if (Screen.Selected == GameMain.NetLobbyScreen) break;
GameMain.Server.EndGame();
break;
default:
return false;
break;
}
return true; //command found
}
}
}
+14 -2
View File
@@ -58,6 +58,12 @@ namespace Barotrauma
{
Instance = this;
World = new World(new Vector2(0, -9.82f));
FarseerPhysics.Settings.AllowSleep = true;
FarseerPhysics.Settings.ContinuousPhysics = false;
FarseerPhysics.Settings.VelocityIterations = 1;
FarseerPhysics.Settings.PositionIterations = 1;
Config = new GameSettings("serverconfig.xml");
if (Config.WasGameUpdated)
{
@@ -65,6 +71,8 @@ namespace Barotrauma
Config.WasGameUpdated = false;
Config.Save("serverconfig.xml");
}
GameScreen = new GameScreen();
}
public void Run()
@@ -91,9 +99,10 @@ namespace Barotrauma
NetLobbyScreen = new NetLobbyScreen();
Server = new GameServer("Dedicated Server Test", 14242, true, "asd", false, 10);
Server = new GameServer("Dedicated Server Test", 14242, false, "asd", false, 10);
while (true)
{
DebugConsole.Update();
NetLobbyScreen.Update((float)Timing.Step);
Server.Update((float)Timing.Step);
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
@@ -107,7 +116,10 @@ namespace Barotrauma
while (true)
{
string input = Console.ReadLine();
DebugConsole.ExecuteCommand(input, this);
lock (DebugConsole.QueuedCommands)
{
DebugConsole.QueuedCommands.Add(input);
}
}
}
@@ -33,16 +33,24 @@ namespace Barotrauma
}
}
public override void Select()
public NetLobbyScreen()
{
List<Submarine> subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus)).ToList();
LevelSeed = ToolBox.RandomSeed(8);
SelectedSub = subsToShow[0];
SelectedShuttle = subsToShow[0]; //TODO: don't use the same sub as a shuttle by default
subs = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus)).ToList();
SelectedSub = subs[0];
SelectedShuttle = subs[0]; //TODO: don't use the same sub as a shuttle by default
DebugConsole.NewMessage("Selected sub: " + SelectedSub.Name, Color.White);
DebugConsole.NewMessage("Selected shuttle: " + SelectedShuttle.Name, Color.White);
GameModes = GameModePreset.list.ToArray();
}
public override void Select()
{
}
private List<Submarine> subs = new List<Submarine>();
@@ -62,6 +70,7 @@ namespace Barotrauma
if (levelSeed == value) return;
levelSeed = value;
LocationType.Random(levelSeed); //call to sync up with clients
}
}
@@ -0,0 +1,41 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
namespace Barotrauma
{
public static class XnaToConsoleColor
{
static Dictionary<Color, ConsoleColor> dictionary;
public static ConsoleColor Convert(Color xnaCol)
{
if (dictionary == null)
{
dictionary = new Dictionary<Color, ConsoleColor>();
dictionary.Add(Color.White, ConsoleColor.White);
dictionary.Add(Color.Gray, ConsoleColor.Gray);
dictionary.Add(Color.LightGray, ConsoleColor.Gray);
dictionary.Add(Color.DarkGray, ConsoleColor.Gray);
dictionary.Add(Color.Red, ConsoleColor.Red);
dictionary.Add(Color.DarkRed, ConsoleColor.DarkRed);
dictionary.Add(Color.Yellow, ConsoleColor.Yellow);
dictionary.Add(Color.Orange, ConsoleColor.Yellow);
dictionary.Add(Color.Green, ConsoleColor.Green);
dictionary.Add(Color.Lime, ConsoleColor.Green);
dictionary.Add(Color.Blue, ConsoleColor.Blue);
dictionary.Add(Color.Cyan, ConsoleColor.Cyan);
dictionary.Add(Color.DarkBlue, ConsoleColor.DarkBlue);
dictionary.Add(Color.Pink, ConsoleColor.Magenta);
}
ConsoleColor val = ConsoleColor.White;
if (dictionary.TryGetValue(xnaCol, out val))
{
return val;
}
return ConsoleColor.White;
}
}
}