1 /****************************************************************************
  2  Copyright (c) 2011-2012 cocos2d-x.org
  3  Copyright (c) 2013-2014 Chukong Technologies Inc.
  4 
  5  http://www.cocos2d-x.org
  6 
  7  Permission is hereby granted, free of charge, to any person obtaining a copy
  8  of this software and associated documentation files (the "Software"), to deal
  9  in the Software without restriction, including without limitation the rights
 10  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 11  copies of the Software, and to permit persons to whom the Software is
 12  furnished to do so, subject to the following conditions:
 13 
 14  The above copyright notice and this permission notice shall be included in
 15  all copies or substantial portions of the Software.
 16 
 17  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 22  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 23  THE SOFTWARE.
 24  ****************************************************************************/
 25 
 26 /**
 27  * Decorative a display node for Cocos Armature
 28  * @class
 29  * @extends ccs.Class
 30  */
 31 ccs.DecorativeDisplay = ccs.Class.extend(/** @lends ccs.DecorativeDisplay# */{
 32     _display: null,
 33     _colliderDetector: null,
 34     _displayData: null,
 35 
 36     ctor:function () {
 37         this._display = null;
 38         this._colliderDetector = null;
 39         this._displayData = null;
 40 
 41         //ccs.DecorativeDisplay.prototype.init.call(this);
 42     },
 43 
 44     /**
 45      * Initializes a ccs.DecorativeDisplay
 46      * @returns {boolean}
 47      */
 48     init:function () {
 49         return true;
 50     },
 51 
 52     /**
 53      * Sets display node to decorative
 54      * @param {cc.Node} display
 55      */
 56     setDisplay:function (display) {
 57         if(display._parent){
 58             display._parent.removeChild(display);
 59             delete display._parent;
 60         }
 61         this._display = display;
 62     },
 63 
 64     /**
 65      * Returns the display node
 66      * @returns {cc.Node}
 67      */
 68     getDisplay:function () {
 69         return this._display;
 70     },
 71 
 72     /**
 73      * Sets collide detector
 74      * @param {ccs.ColliderDetector} colliderDetector
 75      */
 76     setColliderDetector:function (colliderDetector) {
 77         this._colliderDetector = colliderDetector;
 78     },
 79 
 80     /**
 81      * Returns collide detector
 82      * @returns {ccs.ColliderDetector}
 83      */
 84     getColliderDetector:function () {
 85         return this._colliderDetector;
 86     },
 87 
 88     /**
 89      * Sets display data
 90      * @param {ccs.DisplayData} displayData
 91      */
 92     setDisplayData:function (displayData) {
 93         this._displayData = displayData;
 94     },
 95 
 96     /**
 97      * Returns display data
 98      * @returns {ccs.DisplayData}
 99      */
100     getDisplayData:function () {
101         return this._displayData;
102     },
103 
104     release:function () {
105         this._display = null;
106         this._displayData = null;
107         this._colliderDetector = null;
108     }
109 });
110 
111 /**
112  * Allocates and initializes a decorative display.
113  * @return {ccs.DecorativeDisplay}
114  * @deprecated since v3.1, please use new construction instead
115  */
116 ccs.DecorativeDisplay.create = function () {
117     return new ccs.DecorativeDisplay();
118 };