Esempio n. 1
0
    private void Awake()
    {
        m_match = new Match();

        switch (m_matchControlType)
        {
        case MatchControlType.Local:
        {
            var userInput = new MouseAndKbInput();
            m_matchCtrl = new LocalMatchController(m_match, userInput);
            m_matchView.Init(m_match);
            break;
        }

        case MatchControlType.Client:
        {
            m_match.SetLogic(new ClientMatchLogic(m_match));
            m_matchCtrl = ClientBuilder.Create(m_match, m_matchView);
            break;
        }

        case MatchControlType.Server:
        {
            m_match.SetLogic(new ServerMatchLogic(m_match));
            m_matchCtrl = ServerBuilder.Create(m_match);
            m_matchView.Init(m_match);
            break;
        }
        }
    }
Esempio n. 2
0
File: Program.cs Progetto: basp/kiri
        private static async Task Run()
        {
            var cfg = new Config(
                nick: Nick,
                url: "https://github.com/basp/methbot",
                host: "chat.freenode.net",
                port: 6667);

            var session = new Session(cfg.Nick, cfg.Url, Aliases);
            var builder = ClientBuilder.Create(session);
            var client  = builder
                          .Use(new GreetingMiddleware <Session>())
                          .UseIdentity()
                          .UsePong()
                          .UseLogging()
                          .Build()
                          .Connect(cfg.Host, cfg.Port);

            Thread.Sleep(20 * 1000);
            await client.JoinAsync(Channel);

            while (true)
            {
                var s = Console.ReadLine();
                await client.SendAsync(s);
            }
        }
        public async Task <string> GetAuthToken()
        {
            using (System.Net.Http.HttpClient httpClient = ClientBuilder
                                                           .Create(_baseUri)
                                                           .WithHandler(innerHandler => new LoggingHandler(_loggerFactory, innerHandler))
                                                           .Build())
            {
                SessionResponse response = await httpClient
                                           .MakeSession(_username, _password, _serialNumber)
                                           .ConfigureAwait(false);

                return(response.SecurityToken);
            }
        }