private void update()
        {
            string json;

            try
            {
                ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;
                json = new WebClient().DownloadString(URL);
                JObject jo = JObject.Parse(json);
                game = jo.ToObject <Api.Game>();
                game.currentHealth = (int)jo.SelectToken("championStats.currentHealth");
                game.maxHealth     = (int)jo.SelectToken("championStats.maxHealth");
                game.resourceValue = (int)jo.SelectToken("championStats.resourceValue");
                game.resourceMax   = (int)jo.SelectToken("championStats.resourceMax");
                game.attackDamage  = (double)jo.SelectToken("championStats.attackDamage");
                game.attackRange   = (double)jo.SelectToken("championStats.attackRange");
                game.attackSpeed   = (double)jo.SelectToken("championStats.attackSpeed");
            }
            catch
            {
                game.currentHealth = 1;
                game.maxHealth     = 1;
                game.resourceMax   = 1;
                game.resourceValue = 1;
                game.attackDamage  = 1;
                game.attackRange   = 1;
                game.attackSpeed   = 1;
            }
        }
        private void update()
        {
            string json;

            try
            {
                ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;
                json = new WebClient().DownloadString("https://127.0.0.1:2999/liveclientdata/activeplayer");
                JObject jo = JObject.Parse(json);
                game = jo.ToObject <Api.Game>();
                game.currentHealth = (int)jo.SelectToken("championStats.currentHealth");
                game.maxHealth     = (int)jo.SelectToken("championStats.maxHealth");
                game.resourceValue = (int)jo.SelectToken("championStats.resourceValue");
                game.resourceMax   = (int)jo.SelectToken("championStats.resourceMax");
                game.summonerName  = (string)jo.SelectToken("summonerName");
                this.summonerName  = (string)jo.SelectToken("summonerName");
            }
            catch
            {
                game.currentHealth = 1;
                game.maxHealth     = 1;
                game.resourceMax   = 1;
                game.resourceValue = 1;
                game.summonerName  = "Cant read";
            }
        }
Exemple #3
0
 public CameraSystem(Api.Game game) : base(game)
 {
     Camera = new Camera2D(new BoxingViewportAdapter(
                               Game.Window,
                               Game.GraphicsDevice,
                               Game.Config.ViewportWidth,
                               Game.Config.ViewportHeight
                               ));
 }
Exemple #4
0
 public Player(Api.Game game, Vector2 position, Vector2 bounds, Vector2 origin = new Vector2()) : base(game)
 {
     Position = position;
     Bounds   = bounds;
     Origin   = origin;
 }
Exemple #5
0
 public TestScene(Api.Game game) : base(game)
 {
 }