EVR.include("history/record/Record.js");
EVR.include("history/Parser.js");
EVR.include("history/view/View.js");
EVR.History = function(container)
{
   EVR.Pop_Up.call(this, container, HISTORY_WIDTH, HISTORY_HEIGHT);
   this.set_location();
   this.load();
   this.view = new EVR.History.View(this);
}
EVR.History.prototype = new EVR.Pop_Up;
EVR.History.prototype.set_location = function()
{
   this.location = SOURCE_PATH + "history/";
}
EVR.History.prototype.load = function()
{
   var path = this.location + "fetch.php";
   var document = new EVR.Requester(path, null, true).execute();
   this.records = new EVR.History.Parser(document).records;
}
EVR.History.prototype.set_level = function(level)
{
   this.level = level;
}
EVR.History.prototype.store_newest_record = function()
{
   this.build_newest_record();
   this.store_record(this.newest);
}
EVR.History.prototype.build_newest_record = function()
{
   var level = this.level;
   var time = level.clock.time.get();
   var accuracy = level.road.path.calculate_accuracy();
   this.newest = new EVR.History.Record(level.id, time, accuracy);
}
EVR.History.prototype.store_record = function(record)
{
   this.records.push(record);
   var id = record.level;
   var time = record.time.valueOf();
   var accuracy = record.accuracy.valueOf();
   var path = this.location + "insert.php";
   var query = "level=" + id + "&time=" + time + "&accuracy=" + accuracy;
   new EVR.Requester(path, query).execute();
}
EVR.History.prototype.get_accuracies = function()
{
   return this.get_field("accuracy");
}
EVR.History.prototype.get_times = function()
{
   return this.get_field("time");
}
EVR.History.prototype.get_field = function(field)
{
   var records = this.records;
   var entries = [];
   for (var ii = 0; ii < records.length; ii++)
   {
      if (records[ii].level == this.level.id)
      {
	 entries.push(records[ii][field]);
      }
   }
   return entries;
}
EVR.History.prototype.get_newest = function()
{
   return this.newest;
}
EVR.History.prototype.get_best_time = function()
{
   var times = this.get_times();
   var time, best = null;
   for (var ii = 0; ii < times.length; ii++)
   {
      time = times[ii];
      if (time < best || best == null)
      {
	 best = time;
      }
   }
   return best;
}
EVR.History.prototype.count_records = function()
{
   return this.records.length;
}
EVR.History.prototype.append = function()
{
   EVR.Pop_Up.prototype.append.call(this);
   this.view.build();
}
EVR.History.prototype.draw = function()
{
   EVR.Pop_Up.prototype.draw.call(this);
   this.view.draw();
}
EVR.History.prototype.remove = function()
{
   EVR.Pop_Up.prototype.remove.call(this);
   this.view.reset();
}
EVR.History.prototype.toString = function()
{
   return "[EVR.History]";
}
<?php
require_once "../account/get_user_path.php";
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$path = account\get_user_path() . $GLOBALS["HISTORY_FILE_NAME"];
ob_start();
readgzfile($path);
ob_end_flush();
<?php
require_once "../account/get_user_path.php";
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$path = account\get_user_path() . $GLOBALS["HISTORY_FILE_NAME"];
$level = $_GET["level"];
$time = $_GET["time"];
$accuracy = $_GET["accuracy"];
$file = gzopen($path, "a");
gzwrite($file, "$level $time $accuracy\n");
EVR.include("history/record/Time.js");
EVR.include("history/record/Accuracy.js");
EVR.History.Record = function(level, time, accuracy)
{
   this.level = level;
   this.time = new EVR.History.Record.Time(time);
   this.accuracy = new EVR.History.Record.Accuracy(accuracy);
}
EVR.History.Record.prototype.toString = function()
{
   return "[object EVR.History.Record]";
}
EVR.History.Record.Time = function(time)
{
   EVR.Time.call(this, time);
}
EVR.History.Record.Time.prototype = new EVR.Time;
EVR.History.Record.Time.prototype.toString = function(precision)
{
   if (precision == null)
   {
      precision = CLOCK_PRECISION;
   }
   var minutes = this.get_minutes();
   var seconds = this.pad(this.get_seconds() % 60, 2);
   var display = minutes + ":" + seconds;
   if (precision > 0)
   {
      var milliseconds = this.pad(this.get_milliseconds(precision), precision);
      display += "." + milliseconds;
   }
   return display;
}
EVR.History.Record.Time.prototype.valueOf = function()
{
   return this.get();
}
EVR.History.Record.Accuracy = function(accuracy)
{
   this.accuracy = accuracy;
}
EVR.History.Record.Accuracy.prototype.toString = function(precision)
{
   if (precision == null)
   {
      precision = ACCURACY_PRECISION;
   }
   return (100 * this.accuracy).toFixed(precision) + "%";
}
EVR.History.Record.Accuracy.prototype.valueOf = function()
{
   return parseFloat(this.accuracy);
}
EVR.include("history/view/level/Level.js");
EVR.History.View = function(history)
{
   EVR.Table.call(this, history, "100%", null);
   this.field = history.container;
   this.cell_count = HISTORY_CELL_COUNT;
   this.levels = [];
   this.record_index = 0;
   this.set_attributes();
   this.append();
}
EVR.History.View.prototype = new EVR.Table;
EVR.History.View.prototype.set_attributes = function()
{
   var element = this.element;
   element.cellSpacing = HISTORY_CELL_SPACING;
   var style = element.style;
   style.textAlign = "center";
   style.verticalAlign = "middle";
   style.color = "#404040";
   this.container.set_color(HISTORY_BACKGROUND);
}
EVR.History.View.prototype.build = function()
{
   this.records = this.container.records.sort(this.compare_records);
   while (this.record_index < this.records.length)
   {
      this.levels.push(new EVR.History.View.Level(this));
      this.advance_record_to_next_level();
   }
}
EVR.History.View.prototype.compare_records = function(a, b)
{
   var swap = a.level - b.level;
   if (swap === 0)
   {
      swap = a.time - b.time;
   }
   return swap;
}
EVR.History.View.prototype.advance_record_to_next_level = function()
{
   var ii = this.record_index;
   var records = this.records;
   var current = records[ii].level;
   while (ii < records.length && records[ii].level == current)
   {
      ii++;
   }
   this.record_index = ii;
}
EVR.History.View.prototype.reset = function()
{
   this.clear();
   this.record_index = 0;
   this.levels = [];
}
EVR.History.View.prototype.draw = function()
{
   var levels = this.levels;
   for (var ii = 0; ii < levels.length; ii++)
   {
      levels[ii].draw();
   }
}
EVR.History.View.prototype.toString = function()
{
   return "[object EVR.History.View]";
}
54.91.121.255
54.91.121.255
54.91.121.255
 
November 9, 2013


Food Spring - Watermelon Stage

Getting the fruit as far as possible is the object of each level, collecting bigger, more valuable guns. The final result is determined by the size of the fruits' collection when the monkey arrives in North America and either survives or perishes in the fruits' attack.

Watermelon Peach
Pineapple Grapes

↠ RSS Feed ↞