EVR.include("menu/Command.js");
EVR.Menu.Parser = function(container, width, height, margin, dispatcher)
{
   this.container = container;
   this.width = width;
   this.height = height;
   this.margin = margin;
   this.dispatcher = dispatcher;
   this.parse();
}
EVR.Menu.Parser.prototype.parse = function()
{
   var document = this.fetch_folder(MENU_INITIAL_SCRIPT);
   this.options = [];
   this.build_options(document.firstChild, this.options, true);
}
EVR.Menu.Parser.prototype.fetch_folder = function(file)
{
   var path = SOURCE_PATH + "menu/folder/" + file;
   var document = new EVR.Requester(path, null).execute();
   return document;
}
EVR.Menu.Parser.prototype.build_path = function(name)
{
   return MENU_PATH + name + MENU_EXTENSION;
}
EVR.Menu.Parser.prototype.build_options = function(node, options, visible)
{
   var current = node.firstChild;
   for (var ii = 0; current; ii++)
   {
      options.push(this.build_option(current, ii, visible));
      current = current.nextElementSibling || current.nextSibling;
      if (!!!current || current.nodeType == 3)
      {
	 break;
      }
   }
   return options;
}
EVR.Menu.Parser.prototype.build_option = function(node, ii, visible)
{
   var name = this.extract_name(node);
   var command = new EVR.Menu.Command(node);
   var option = new EVR.Menu.Option(
      this.container, this.dispatcher, ii, name, this.width, this.height,
      this.margin, visible, command);
   this.add_children(option, node);
   return option;
}
EVR.Menu.Parser.prototype.extract_name = function(node)
{
   var name = node.firstChild.nodeValue;
   name = name.replace(/^\s+|\s+$/g, "");
   name = name.toUpperCase();
   return name;
}
EVR.Menu.Parser.prototype.add_children = function(option, node)
{
   if (node.tagName == "folder")
   {
      node = this.fetch_folder(node.getAttribute("script")).firstChild;
      option.children = [];
      this.build_options(node, option.children, false);
   }
}
EVR.Menu.Parser.prototype.toString = function()
{
   return "[object EVR.Menu.Parser]";
}
EVR.Menu.Dispatcher = function(evr, menu)
{
   this.evr = evr;
   this.menu = menu;
}
EVR.Menu.Dispatcher.prototype.escape = function()
{
   this.menu.escape();
}
EVR.Menu.Dispatcher.prototype.load_level = function(id, practice)
{
   practice = parseInt(practice) ? true : false;
   this.evr.load_level(id, practice);
}
EVR.Menu.Dispatcher.prototype.load_album = function(index)
{
   this.evr.load_album(index - 1);
}
EVR.Menu.Dispatcher.prototype.load_instructions = function()
{
   this.evr.load_instructions();
}
EVR.Menu.Dispatcher.prototype.load_history = function()
{
   this.evr.load_history();
}
EVR.Menu.Dispatcher.prototype.load_account = function()
{
   this.evr.load_account();
}
EVR.Menu.Dispatcher.prototype.log_out = function()
{
   this.evr.log_out();
}
EVR.Menu.Dispatcher.prototype.load_about = function()
{
   this.evr.load_about();
}
EVR.Menu.Dispatcher.prototype.load_ending = function()
{
   this.evr.load_ending();
}
EVR.Menu.Dispatcher.prototype.ignore = function()
{
}
EVR.Menu.Dispatcher.prototype.toString = function()
{
   return "[object EVR.Menu.Dispatcher]";
}
EVR.Menu.Background = function(container)
{
   EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
   this.set_proportions(1, .36);
   this.place(null, -.0025);
//    this.set_color(MENU_BACKGROUND_COLOR);
//    this.css.borderTop = "2px solid #505050";
//    this.css.borderBottom = "2px solid #505050";
   this.append();
}
EVR.Menu.Background.prototype = new EVR.Graphic;
EVR.Menu.Background.prototype.toString = function()
{
   return "[object EVR.Menu.Background]";
}
<?php
require_once(dirname(__FILE__) . "/Levels.php");
echo new folder\Levels(true);
<?php
require_once(dirname(__FILE__) . "/Album.php");
echo new folder\Album();
<?php
namespace folder;
require_once "Builder.php";
class Main extends Builder
{
   public function __construct()
   {
      parent::__construct(False);
   }
   protected function add_options()
   {
      $this->add_folder("Play", "fetch_levels_folder");
      $this->add_folder("Practice", "fetch_practice_levels_folder");
      if ($this->progress > 0)
      {
         $this->add_folder("Browse Album", "fetch_album_folder");
      }
      if ($this->progress > 0)
      {
         $this->add_option("Records", "load_history");
      }
      $this->add_option("How to Play", "load_instructions");
      if (!\account\is_permanent_account($this->user_path))
      {
         $this->add_option("Log in / Register", "load_account");
      }
      $this->add_option("About", "load_about");
      if (\account\is_permanent_account($this->user_path))
      {
         $this->add_option("Log out (" . $_COOKIE["name"] . ")", "log_out");
      }
      if ($this->progress >= 10)
      {
         $this->add_option("View Ending", "load_ending");
      }
      $this->add_option("Press F11 for fullscreen", "ignore");
   }
   private function add_folder($name, $script)
   {
      $this->startElement("folder");
      $this->writeAttribute("script", $script . ".php");
      $this->text($name);
      $this->endElement();
   }
   private function add_option($name, $action)
   {
      $this->startElement("option");
      $this->writeAttribute("action", $action);
      $this->text($name);
      $this->endElement();
   }
}
54.234.114.202
54.234.114.202
54.234.114.202
 
June 7, 2018


↠ RSS Feed ↞