示例#1
0
 private void _on_GameContainter_scrolling(float value)
 {
     requested_level = 2 * (((int)(value + games_scrollbar.RectSize.y)) / GameContainer.BUTTON_HEIGHT) + 2;
     if (next_page != null && requested_level > game_container.GamesCount && http_levels_node.GetHttpClientStatus() == 0)
     {
         http_levels_node.Request(next_page);
         next_page = null;
     }
 }
示例#2
0
    private async void MonitorRequestTimeout(HTTPRequest request, int timeout, string url)
    {
        Timer t = new Timer();

        t.WaitTime  = timeout;
        t.Autostart = true;
        Global.Instance.AddChild(t);
        await ToSignal(t, "timeout");

        t.QueueFree();

        if (request.GetHttpClientStatus() == HTTPClient.Status.Connecting ||
            request.GetHttpClientStatus() == HTTPClient.Status.ConnectionError ||
            request.GetHttpClientStatus() == HTTPClient.Status.CantConnect)
        {
            // timed out, log the error and kill the request
            BasicPopup.Notify("Could not connect to server! Connection timed out");
            Global.Error(string.Format("Request to {0} timed out after {1} second(s)", url, timeout));
            request.QueueFree();
        }
    }