Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LeagueAPI"/> class.
        /// </summary>
        /// <param name="port">The league client API's port.</param>
        /// <param name="token">The authentication token.</param>
        /// <param name="eventHandler">The event handler.</param>
        private PykeAPI(int port, string token, Websocket.ILeagueEventHandler eventHandler, LeagueProcessHandler _pHandler, LockFileHandler _lfHandler, Logger logger)
        {
            this.logger             = logger;
            _processHandler         = _pHandler;
            _lockFileHandler        = _lfHandler;
            EventHandler            = eventHandler;
            RequestHandler          = new LeagueRequestHandler(port, token, this);
            RiotClientEndpoint      = new RiotClientEndpoint(RequestHandler);
            ProcessControlEndpoint  = new ProcessControlEndpoint(RequestHandler);
            _processHandler.Exited += OnDisconnected;
            cProc = Process.GetProcessById(ProcessId);

            _processHandler  = new LeagueProcessHandler();
            _lockFileHandler = new LockFileHandler();
            ChampSelect      = new ChampSelect.ChampSelect(this);
            Events           = new LeagueEvents(this);
            Gameflow         = new ClientGameflow(this);
            MatchMaker       = new MatchMaker(this);
            ClientInfo       = new ClientInformation(this);
            Login            = new Login.Login(this);
            Summoners        = new Summoners.Summoners(this);
            WindowHandler    = new Window.WindowHandler(this);
            Lobby            = new ClientLobby(this);
            Champions        = JsonConvert.DeserializeObject <ChampionInfo>(new WebClient().DownloadString("https://ddragon.leagueoflegends.com/cdn/10.16.1/data/en_US/champion.json"), Converter.Settings).Data.Values.ToList();
            logger.Information("Pyke Ready");
            PykeReady?.Invoke(this, this);
        }
Ejemplo n.º 2
0
        protected override void OnInstanceCreated()
        {
            // base.OnInstanceCreated();

            NetworkManager = Mirror.NetworkManager.singleton as EventNetworkManager;
            ClientLobby    = ClientLobby.Instance;

            NetworkResources.LoadAndRegister(new ClientSessionLoader());
            AlwaysExist = true;
        }
Ejemplo n.º 3
0
        public async Task CreateLobby()
        {
            var lobby   = new ClientLobby(CreateLobbyName, CurrentUser);
            var content = JsonConvert.SerializeObject(lobby);

            Console.WriteLine($"Create Lobby: {CreateLobbyName}   User: {CurrentUser}{Environment.NewLine}" +
                              $"Serialized: {content}");
            var lobbyResponse = await _http.PostAsJsonAsync("/chat/create", content);

            Console.WriteLine(lobbyResponse.StatusCode.ToString() + $" status code returned when creating a new lobby.");
        }
Ejemplo n.º 4
0
        private void InitializeClient(Scene scene, LoadSceneMode loadSceneMode)
        {
            ClientLobby.CreateInstance();
            var lobby = ClientLobby.Instance;

            var networkManager = NetworkManager.singleton as EventNetworkManager;

            if (networkManager == null)
            {
                throw new InvalidCastException();
            }

            lobby.NetworkManager = networkManager;
            lobby.Initialize();

            SceneManager.sceneLoaded -= InitializeClient;
            DestroyIfExist(true);
        }
Ejemplo n.º 5
0
 public ClientLobbyScene(ClientLobby lobby)
 {
     this.lobby = lobby;
 }