本文整理汇总了C#中GameEngine.Start方法的典型用法代码示例。如果您正苦于以下问题:C# GameEngine.Start方法的具体用法?C# GameEngine.Start怎么用?C# GameEngine.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameEngine
的用法示例。
在下文中一共展示了GameEngine.Start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
FleckLog.Level = LogLevel.Error;
var renderers = new ConcurrentDictionary<IWebSocketConnection, IRenderer>();
var proxyRenderer = new ProxyRenderer();
proxyRenderer.AddRenderer( new ConsoleRenderer());
var allSockets = new List<IWebSocketConnection>();
var server = new WebSocketServer("ws://localhost:8080/websession");
server.Start(socket =>
{
socket.OnOpen = () =>
{
allSockets.Add(socket);
renderers[socket] = new WebRenderer(socket);
proxyRenderer.AddRenderer(renderers[socket]);
if (allSockets.Count == 1)
{
var size = new Size(10, 15);
var dto = new InitMessageDto(new SizeDto(size));
socket.Send(dto.ToJson());
var engine = new GameEngine(size, new ConsoleInputListener(), proxyRenderer);
engine.Start();
}
else
{
var size = new Size(10, 15);
var dto = new InitMessageDto(new SizeDto(size));
socket.Send(dto.ToJson());
}
};
socket.OnClose = () =>
{
allSockets.Remove(socket);
proxyRenderer.RemoveRenderer(renderers[socket]);
IRenderer toRemove;
renderers.TryRemove(socket, out toRemove);
};
socket.OnMessage = message =>
{
//Console.WriteLine(message);
//allSockets.ToList().ForEach(s => s.Send("Echo: " + message));
};
});
while (true)
{
Thread.Sleep(1000);
}
// Console.ReadLine();
}
示例2: Main
public static void Main()
{
IGameDatabase gameDatabase = new GameDatabase();
IInputReader reader = new ConsoleReader();
IOutputWriter writer = new ConsoleWriter();
var engine = new GameEngine(
gameDatabase,
reader,
writer);
engine.Start();
}
示例3: Main
public static void Main()
{
GameEngine gameEngine = new GameEngine();
gameEngine.Start();
}