Skip to content

Instantly share code, notes, and snippets.

@NTaylorMullen
Created October 27, 2013 01:09
Show Gist options
  • Save NTaylorMullen/7176727 to your computer and use it in GitHub Desktop.
Save NTaylorMullen/7176727 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace DryRunDemo
{
public class GameHub : Hub
{
static MyGame game = new MyGame();
public override Task OnConnected()
{
game.UserManager.NewUser(Context);
return base.OnConnected();
}
public void Move(string direction, bool startMoving)
{
var user = game.UserManager[Context];
switch (direction)
{
case "Left":
user.Moving.Left = startMoving;
break;
case "Right":
user.Moving.Right = startMoving;
break;
case "Up":
user.Moving.Up = startMoving;
break;
case "Down":
user.Moving.Down = startMoving;
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment