Esempio n. 1
0
 //
 // GET: /Players/1
 // GET: /Players/
 public JsonResult Index(int? id)
 {
     var players = new WebKinect.Models.Player[6];
     lock (Player.Players)
     {
         //int i = 0;
         //foreach(var player in Player.Players)
         //{
         //    players[i] = new Player(i);
         //}
         return Json(Player.Players, JsonRequestBehavior.AllowGet);
     }
 }
Esempio n. 2
0
        public static Player FindOrCreateByIndex(int i)
        {
            if (Players == null)
            {
                Players = new ConcurrentBag<Player>();
            }
            var p = Players.ElementAtOrDefault(i);

            if (null == p)
            {
                p = new Player(i);
                Players.Add(p);
            }

            return p;
        }