//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-2015, Egret Technology Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
this["DEBUG"] = true;
this["RELEASE"] = false;
var egret;
(function (egret) {
/**
* @private
*/
function _getString(code) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
return egret.sys.tr.apply(egret.sys, arguments);
}
egret.getString = _getString;
function _error(code) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
var text = egret.sys.tr.apply(null, arguments);
if (DEBUG) {
egret.sys.$logToFPS("Error #" + code + ": " + text);
}
throw new Error("#" + code + ": " + text); //使用这种方式报错能够终止后续代码继续运行
}
egret.$error = _error;
function _warn(code) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
var text = egret.sys.tr.apply(null, arguments);
if (DEBUG) {
egret.sys.$logToFPS("Warning #" + code + ": " + text);
}
egret.warn("Warning #" + code + ": " + text);
}
egret.$warn = _warn;
function _markReadOnly(instance, property, isProperty) {
if (isProperty === void 0) { isProperty = true; }
var data = Object.getOwnPropertyDescriptor(isProperty ? instance.prototype : instance, property);
if (data == null) {
console.log(instance);
return;
}
data.set = function (value) {
if (isProperty) {
egret.$warn(1010, egret.getQualifiedClassName(instance), property);
}
else {
egret.$warn(1014, egret.getQualifiedClassName(instance), property);
}
};
Object.defineProperty(instance.prototype, property, data);
}
egret.$markReadOnly = _markReadOnly;
function markCannotUse(instance, property, defaultValue) {
Object.defineProperty(instance.prototype, property, {
get: function () {
egret.$warn(1009, egret.getQualifiedClassName(instance), property);
return defaultValue;
},
set: function (value) {
egret.$error(1009, egret.getQualifiedClassName(instance), property);
},
enumerable: true,
configurable: true
});
}
egret.$markCannotUse = markCannotUse;
})(egret || (egret = {}));
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-2015, Egret Technology Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
var egret;
(function (egret) {
/**
* @language en_US
* Registers the runtime class information for a class.This method adds some strings which represent the class name or
* some interface names to the class definition. After the registration,you can use egret.is() method to do the type checking
* for the instance of this class.<br/>
* Note:If you use the TypeScript programming language, the egret command line tool will automatically generate the registration code line.
* You don't need to manually call this method.
*
* @example the following code shows how to register the runtime class information for the EventDispatcher class and do the type checking:
* <pre>
* egret.registerClass(egret.EventDispatcher,"egret.EventDispatcher",["egret.IEventDispatcher"]);
* var dispatcher = new egret.EventDispatcher();
* egret.log(egret.is(dispatcher, "egret.IEventDispatcher")); //true。
* egret.log(egret.is(dispatcher, "egret.EventDispatcher")); //true。
* egret.log(egret.is(dispatcher, "egret.Bitmap")); //false。
* </pre>
* @param classDefinition the class definition to be registered.
* @param className a unique identification string of the specific class
* @param interfaceNames a list of unique identification string of the specific interfaces.
* @version Egret 2.4
* @platform Web,Native
*/
/**
* @language zh_CN
* 为一个类定义注册运行时类信息,用此方法往类定义上注册它自身以及所有接口对应的字符串。
* 在运行时,这个类的实例将可以使用 egret.is() 方法传入一个字符串来判断实例类型。
* @example 以下代码演示了如何为EventDispatcher类注册运行时类信息并判断类型:
* <pre>
* //为egret.EventDispatcher类注册运行时类信息,由于它实现了IEventDispatcher接口�