コード例 #1
0
        static public void performOperation(string parameters, Message msg)
        {
            try {
                if (msg.msg.ToLower().Trim() == "!register")
                {
                    if (!pokerContexts.ContainsKey(msg.name))
                    {
                        pokerContexts.Add(msg.name, new PokerContext());
                        Chat.sendMessage("You are now registered, and have $1000. The default bet is $1. You can !raise #, !bet #, !roll, or !check the standings.");
                    }
                    else
                    {
                        Chat.sendMessage("You are already registered.");
                    }
                }
                else
                {
                    if (pokerContexts.ContainsKey(msg.name))
                    {
                        PokerContext ctx = pokerContexts[msg.name];
                        switch (msg.msg.ToLower().Trim())
                        {
                        case "!help":
                            Chat.sendMessage("You can !raise #, !bet #, !roll, or !check the standings.");
                            break;

                        case "!check":
                            Chat.sendMessage(msg.name + " has $" + ctx.playerMoney + ". " + _G.propername + " has $" + ctx.botMoney + ". Both sides are currently betting $" + ctx.currentBet);
                            break;

                        case "!roll":
                            ctx.PerformTurn(msg.name);
                            break;
                        }

                        if (msg.msg.ToLower().Trim().StartsWith("!bet"))
                        {
                            try {
                                ctx.Bet(Int32.Parse(msg.msg.Substring(msg.msg.IndexOf(' ') + 1)));
                            } catch (Exception e) { }
                        }

                        if (msg.msg.ToLower().Trim().StartsWith("!raise"))
                        {
                            try {
                                ctx.Raise(Int32.Parse(msg.msg.Substring(msg.msg.IndexOf(' ') + 1)));
                            } catch (Exception e) { }
                        }
                    }
                    else
                    {
                        Chat.sendMessage("You are not registered. Register with !register.");
                    }
                }
            } catch (Exception e) {
                Console.WriteLine(e.Message + " " + e.StackTrace);
            }
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: YanaGrain/PlanningPoker
 public void Configuration(IAppBuilder app)
 {
     PokerContext ctx = new PokerContext();
     new PokerDbInitializer().InitializeDatabase(ctx);
     // Дополнительные сведения о настройке приложения см. по адресу: http://go.microsoft.com/fwlink/?LinkID=316888
     ConfigureOAuth(app);
     HttpConfiguration config = new HttpConfiguration();
     WebApiConfig.Register(config);
     app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
     app.UseWebApi(config);
     app.MapSignalR();
 }
コード例 #3
0
 public UnitOfWork(PokerContext context)
 {
     _context = context;
 }
コード例 #4
0
 public RoundRepository(PokerContext context)
 {
     _context = context;
 }
コード例 #5
0
 public PlayerRepository(PokerContext context)
 {
     _context = context;
 }
コード例 #6
0
 public RankingPointRepository(PokerContext context)
 {
     _context = context;
 }
コード例 #7
0
 public RegulationRepository(PokerContext context)
 {
     _context = context;
 }