Ejemplo n.º 1
0
 public void addMove(int x, int y) {
   Item item = new Item();
   item.x = x;
   item.y = y;
   item.duration = System.currentTimeMillis() - this.lastMoveTime;
   cost += item.duration;
   items.add(item);
   this.lastMoveTime = System.currentTimeMillis();
 }
Ejemplo n.º 2
0
 public void load(Bundle bundle) {
   lastMoveTime = System.currentTimeMillis();
   cost = 0;
   if (bundle == null) return;
   int x[] = bundle.getIntArray("x");
   int y[] = bundle.getIntArray("y");
   long[] d = bundle.getLongArray("d");
   cost = bundle.getLong("cost", 0);
   if (x == null || y == null || d == null) return;
   for (int n = 0; n < x.length; n++) {
     Item item = new Item();
     item.x = x[n];
     item.y = y[n];
     item.duration = d[n];
     cost += d[n];
     items.add(item);
   }
 }