home *** CD-ROM | disk | FTP | other *** search
/ Ice Age Fan CD 1 / CD1_Scrat.iso / flash / data / game.swf / scripts / com / google / analytics / debug / DebugConfiguration.as < prev    next >
Encoding:
Text File  |  2012-07-04  |  6.0 KB  |  250 lines

  1. package com.google.analytics.debug
  2. {
  3.    import com.google.analytics.core.GIFRequest;
  4.    import flash.net.URLRequest;
  5.    import flash.ui.Keyboard;
  6.    import flash.utils.getTimer;
  7.    
  8.    public class DebugConfiguration
  9.    {
  10.       public var showHideKey:Number;
  11.       
  12.       private var _mode:VisualDebugMode;
  13.       
  14.       private var _verbose:Boolean = false;
  15.       
  16.       public var destroyKey:Number;
  17.       
  18.       public var GIFRequests:Boolean = false;
  19.       
  20.       public var showInfos:Boolean = true;
  21.       
  22.       public var infoTimeout:Number = 1000;
  23.       
  24.       public var minimizedOnStart:Boolean = false;
  25.       
  26.       private var _active:Boolean = false;
  27.       
  28.       public var traceOutput:Boolean = false;
  29.       
  30.       public var layout:ILayout;
  31.       
  32.       public var warningTimeout:Number = 1500;
  33.       
  34.       public var javascript:Boolean = false;
  35.       
  36.       public var showWarnings:Boolean = true;
  37.       
  38.       private var _visualInitialized:Boolean = false;
  39.       
  40.       public function DebugConfiguration()
  41.       {
  42.          _mode = VisualDebugMode.basic;
  43.          showHideKey = Keyboard.SPACE;
  44.          destroyKey = Keyboard.BACKSPACE;
  45.          super();
  46.       }
  47.       
  48.       public function get verbose() : Boolean
  49.       {
  50.          return _verbose;
  51.       }
  52.       
  53.       public function set verbose(param1:Boolean) : void
  54.       {
  55.          _verbose = param1;
  56.       }
  57.       
  58.       public function set mode(param1:*) : void
  59.       {
  60.          if(param1 is String)
  61.          {
  62.             switch(param1)
  63.             {
  64.                case "geek":
  65.                   param1 = VisualDebugMode.geek;
  66.                   break;
  67.                case "advanced":
  68.                   param1 = VisualDebugMode.advanced;
  69.                   break;
  70.                case "basic":
  71.                default:
  72.                   param1 = VisualDebugMode.basic;
  73.             }
  74.          }
  75.          _mode = param1;
  76.       }
  77.       
  78.       public function success(param1:String) : void
  79.       {
  80.          if(layout)
  81.          {
  82.             layout.createSuccessAlert(param1);
  83.          }
  84.          if(traceOutput)
  85.          {
  86.             trace("[+] " + param1 + " !!");
  87.          }
  88.       }
  89.       
  90.       public function get active() : Boolean
  91.       {
  92.          return _active;
  93.       }
  94.       
  95.       private function _initializeVisual() : void
  96.       {
  97.          if(layout)
  98.          {
  99.             layout.init();
  100.             _visualInitialized = true;
  101.          }
  102.       }
  103.       
  104.       private function _destroyVisual() : void
  105.       {
  106.          if(Boolean(layout) && _visualInitialized)
  107.          {
  108.             layout.destroy();
  109.          }
  110.       }
  111.       
  112.       public function warning(param1:String, param2:VisualDebugMode = null) : void
  113.       {
  114.          if(_filter(param2))
  115.          {
  116.             return;
  117.          }
  118.          if(Boolean(layout) && showWarnings)
  119.          {
  120.             layout.createWarning(param1);
  121.          }
  122.          if(traceOutput)
  123.          {
  124.             trace("## " + param1 + " ##");
  125.          }
  126.       }
  127.       
  128.       private function _filter(param1:VisualDebugMode = null) : Boolean
  129.       {
  130.          return Boolean(param1) && int(param1) >= int(this.mode);
  131.       }
  132.       
  133.       public function failure(param1:String) : void
  134.       {
  135.          if(layout)
  136.          {
  137.             layout.createFailureAlert(param1);
  138.          }
  139.          if(traceOutput)
  140.          {
  141.             trace("[-] " + param1 + " !!");
  142.          }
  143.       }
  144.       
  145.       public function get mode() : *
  146.       {
  147.          return _mode;
  148.       }
  149.       
  150.       public function set active(param1:Boolean) : void
  151.       {
  152.          _active = param1;
  153.          if(_active)
  154.          {
  155.             _initializeVisual();
  156.          }
  157.          else
  158.          {
  159.             _destroyVisual();
  160.          }
  161.       }
  162.       
  163.       protected function trace(param1:String) : void
  164.       {
  165.          var _loc7_:Array = null;
  166.          var _loc8_:int = 0;
  167.          var _loc2_:Array = [];
  168.          var _loc3_:* = "";
  169.          var _loc4_:* = "";
  170.          if(this.mode == VisualDebugMode.geek)
  171.          {
  172.             _loc3_ = getTimer() + " - ";
  173.             _loc4_ = new Array(_loc3_.length).join(" ") + " ";
  174.          }
  175.          if(param1.indexOf("\n") > -1)
  176.          {
  177.             _loc7_ = param1.split("\n");
  178.             _loc8_ = 0;
  179.             while(_loc8_ < _loc7_.length)
  180.             {
  181.                if(_loc7_[_loc8_] != "")
  182.                {
  183.                   if(_loc8_ == 0)
  184.                   {
  185.                      _loc2_.push(_loc3_ + _loc7_[_loc8_]);
  186.                   }
  187.                   else
  188.                   {
  189.                      _loc2_.push(_loc4_ + _loc7_[_loc8_]);
  190.                   }
  191.                }
  192.                _loc8_++;
  193.             }
  194.          }
  195.          else
  196.          {
  197.             _loc2_.push(_loc3_ + param1);
  198.          }
  199.          var _loc5_:int = int(_loc2_.length);
  200.          var _loc6_:int = 0;
  201.          while(_loc6_ < _loc5_)
  202.          {
  203.             trace(_loc2_[_loc6_]);
  204.             _loc6_++;
  205.          }
  206.       }
  207.       
  208.       public function alert(param1:String) : void
  209.       {
  210.          if(layout)
  211.          {
  212.             layout.createAlert(param1);
  213.          }
  214.          if(traceOutput)
  215.          {
  216.             trace("!! " + param1 + " !!");
  217.          }
  218.       }
  219.       
  220.       public function info(param1:String, param2:VisualDebugMode = null) : void
  221.       {
  222.          if(_filter(param2))
  223.          {
  224.             return;
  225.          }
  226.          if(Boolean(layout) && showInfos)
  227.          {
  228.             layout.createInfo(param1);
  229.          }
  230.          if(traceOutput)
  231.          {
  232.             trace(param1);
  233.          }
  234.       }
  235.       
  236.       public function alertGifRequest(param1:String, param2:URLRequest, param3:GIFRequest) : void
  237.       {
  238.          if(layout)
  239.          {
  240.             layout.createGIFRequestAlert(param1,param2,param3);
  241.          }
  242.          if(traceOutput)
  243.          {
  244.             trace(">> " + param1 + " <<");
  245.          }
  246.       }
  247.    }
  248. }
  249.  
  250.