Project

General

Profile

« Previous | Next » 

Revision fcf7320f

Added by Leszek Koltunski over 2 years ago

Progress downloading objects and extras.

View differences:

src/main/java/org/distorted/network/RubikNetwork.java
36 36
import androidx.fragment.app.FragmentActivity;
37 37

  
38 38
import org.distorted.library.main.DistortedLibrary;
39
import org.distorted.objectlib.json.JsonWriter;
39 40
import org.distorted.objects.RubikObjectList;
40 41

  
41 42
import static org.distorted.objects.RubikObjectList.MAX_LEVEL;
......
112 113
  private static String mVersion;
113 114
  private static String mDebug;
114 115
  private static int mNumObjects;
116
  private static RubikUpdates mUpdates;
115 117

  
116 118
///////////////////////////////////////////////////////////////////////////////////////////////////
117 119

  
......
122 124
    if( mCountry==null || newNum!=mNumObjects ) mCountry = new String[newNum][MAX_LEVEL][MAX_PLACES];
123 125
    if( mName==null    || newNum!=mNumObjects ) mName    = new String[newNum][MAX_LEVEL][MAX_PLACES];
124 126
    if( mTime==null    || newNum!=mNumObjects ) mTime    = new  float[newNum][MAX_LEVEL][MAX_PLACES];
125
    if( mPlaces==null  || newNum!=mNumObjects ) mPlaces  = new int[newNum][MAX_LEVEL];
127
    if( mPlaces==null  || newNum!=mNumObjects ) mPlaces  = new    int[newNum][MAX_LEVEL];
128

  
129
    if( mUpdates==null ) mUpdates = new RubikUpdates();
126 130

  
127 131
    mNumObjects = newNum;
128 132
    }
......
157 161

  
158 162
///////////////////////////////////////////////////////////////////////////////////////////////////
159 163

  
160
  private boolean fillValues()
164
  private boolean fillValuesNormal()
161 165
    {
162 166
    int begin=-1 ,end, len = mScores.length();
163 167
    String row;
......
380 384
      conn.setRequestMethod("GET");
381 385
      conn.connect();
382 386
      conn.getOutputStream().flush();
383
      conn.getInputStream();
387

  
388
      InputStream is = conn.getInputStream();
389
      BufferedReader r = new BufferedReader(new InputStreamReader(is));
390
      StringBuilder answer = new StringBuilder();
391

  
392
      for (String line; (line = r.readLine()) != null; )
393
        {
394
        answer.append(line).append('\n');
395
        }
396

  
397
      String updates = answer.toString();
398
      mUpdates.parse(updates);
384 399
      }
385 400
    catch( final Exception e )
386 401
      {
......
490 505
    String country = scores.getCountry();
491 506
    String renderer = DistortedLibrary.getDriverRenderer();
492 507
    String version  = DistortedLibrary.getDriverVersion();
508
    int objectAPI   = JsonWriter.VERSION_OBJECT_MAJOR;
509
    int tutorialAPI = JsonWriter.VERSION_EXTRAS_MAJOR;
493 510

  
494 511
    renderer = URLencode(renderer);
495 512
    version  = URLencode(version);
496 513

  
497
    String url="https://distorted.org/magic/cgi-bin/debugs.cgi";
498
    url += "?n="+name+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion+"d"+"&d="+renderer+"&v="+version;
514
    String url="https://distorted.org/magic/cgi-bin/debugs-new.cgi";
515
    url += "?n="+name+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion+"d";
516
    url += "&d="+renderer+"&v="+version+"&a="+objectAPI+"&b="+tutorialAPI;
499 517

  
500 518
    return url;
501 519
    }
......
599 617

  
600 618
    if( mRunning )
601 619
      {
602
      receiveValues = fillValues();
620
      receiveValues = fillValuesNormal();
603 621
      mRunning = false;
604 622
      }
605 623

  

Also available in: Unified diff