Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support extension module reduce #1673

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,6 @@
* THE SOFTWARE.
*/

/**
* @type {Object}
* @name jsb.AssetsManager
* jsb.AssetsManager is the native AssetsManager for your game resources or scripts.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.AssetsManager = cc.AssetsManager;
delete cc.AssetsManager;
/**
* @type {Object}
* @name jsb.EventListenerAssetsManager
* jsb.EventListenerAssetsManager is the native event listener for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventListenerAssetsManager = cc.EventListenerAssetsManager;
delete cc.EventListenerAssetsManager;
/**
* @type {Object}
* @name jsb.EventAssetsManager
* jsb.EventAssetsManager is the native event for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventAssetsManager = cc.EventAssetsManager;
delete cc.EventAssetsManager;

// move from jsb_cocos2d
//start------------------------------
cc.ControlButton.extend = cc.Class.extend;
cc.ControlColourPicker.extend = cc.Class.extend;
cc.ControlPotentiometer.extend = cc.Class.extend;
cc.ControlSlider.extend = cc.Class.extend;
cc.ControlStepper.extend = cc.Class.extend;
cc.ControlSwitch.extend = cc.Class.extend;
//end------------------------------

//
// cocos2d constants
//
// This helper file should be required after jsb_cocos2d.js
//

var cc = cc || {};

cc.SCROLLVIEW_DIRECTION_NONE = -1;
Expand All @@ -73,7 +29,6 @@ cc.SCROLLVIEW_DIRECTION_BOTH = 2;
cc.TABLEVIEW_FILL_TOPDOWN = 0;
cc.TABLEVIEW_FILL_BOTTOMUP = 1;


/**
* @constant
* @type Number
Expand Down Expand Up @@ -224,20 +179,240 @@ cc.CONTROL_STEPPER_LABELFONT = "CourierNewPSMT";
cc.AUTOREPEAT_DELTATIME = 0.15;
cc.AUTOREPEAT_INCREASETIME_INCREMENT = 12;


jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
jsb.EventAssetsManager.ASSET_UPDATED = 6;
jsb.EventAssetsManager.ERROR_UPDATING = 7;
jsb.EventAssetsManager.UPDATE_FINISHED = 8;
jsb.EventAssetsManager.UPDATE_FAILED = 9;
jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;

cc.ScrollView.extend = cc.Class.extend;
cc.TableView.extend = cc.Class.extend;
cc.TableViewCell.extend = cc.Class.extend;

var _proto = null;
if (cc.AssetsManager){
/**
* @type {Object}
* @name jsb.AssetsManager
* jsb.AssetsManager is the native AssetsManager for your game resources or scripts.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.AssetsManager = cc.AssetsManager;
delete cc.AssetsManager;
}

if (cc.EventListenerAssetsManager){
/**
* @type {Object}
* @name jsb.EventListenerAssetsManager
* jsb.EventListenerAssetsManager is the native event listener for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventListenerAssetsManager = cc.EventListenerAssetsManager;
delete cc.EventListenerAssetsManager;

jsb.EventListenerAssetsManager.prototype._ctor = function(assetsManager, callback) {
callback !== undefined && this.init(assetsManager, callback);
};
}

if (cc.EventAssetsManager){
/**
* @type {Object}
* @name jsb.EventAssetsManager
* jsb.EventAssetsManager is the native event for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventAssetsManager = cc.EventAssetsManager;
delete cc.EventAssetsManager;

jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
jsb.EventAssetsManager.ASSET_UPDATED = 6;
jsb.EventAssetsManager.ERROR_UPDATING = 7;
jsb.EventAssetsManager.UPDATE_FINISHED = 8;
jsb.EventAssetsManager.UPDATE_FAILED = 9;
jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;
}

if (cc.Control){
_proto = cc.Control.prototype;
cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB);
cc.defineGetterSetter(_proto, "state", _proto.getState);
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "selected", _proto.isSelected, _proto.setSelected);
cc.defineGetterSetter(_proto, "highlighted", _proto.isHighlighted, _proto.setHighlighted);
}

if (cc.ControlButton){
cc.ControlButton.extend = cc.Class.extend;

_proto = cc.ControlButton.prototype;
cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor);
cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity);
cc.defineGetterSetter(_proto, "adjustBackgroundImage", _proto.getAdjustBackgroundImage, _proto.setAdjustBackgroundImage);
cc.defineGetterSetter(_proto, "zoomOnTouchDown", _proto.getZoomOnTouchDown, _proto.setZoomOnTouchDown);
cc.defineGetterSetter(_proto, "preferredSize", _proto.getPreferredSize, _proto.setPreferredSize);
cc.defineGetterSetter(_proto, "labelAnchor", _proto.getLabelAnchorPoint, _proto.setLabelAnchorPoint);

cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize){
if(fontSize != undefined)
this.initWithTitleAndFontNameAndFontSize(label, backgroundSprite, fontSize);
else if(backgroundSprite != undefined)
this.initWithLabelAndBackgroundSprite(label, backgroundSprite);
else if(label != undefined)
this.initWithBackgroundSprite(label);
else
this.init();
};

}

if (cc.ControlColourPicker){
cc.ControlColourPicker.extend = cc.Class.extend;

_proto = cc.ControlColourPicker.prototype;
cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor);
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "background", _proto.getBackground);

cc.ControlColourPicker.prototype._ctor = function(){
this.init();
};

}

if (cc.ControlHuePicker){
_proto = cc.ControlHuePicker.prototype;
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "hue", _proto.getHue, _proto.setHue);
cc.defineGetterSetter(_proto, "huePercent", _proto.getHuePercentage, _proto.setHuePercentage);
cc.defineGetterSetter(_proto, "background", _proto.getBackground);
cc.defineGetterSetter(_proto, "slider", _proto.getSlider);
cc.defineGetterSetter(_proto, "startPos", _proto.getStartPos);
}

if (cc.ControlSaturationBrightnessPicker){
_proto = cc.ControlSaturationBrightnessPicker.prototype;
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "saturation", _proto.getSaturation);
cc.defineGetterSetter(_proto, "brightness", _proto.getBrightness);
cc.defineGetterSetter(_proto, "background", _proto.getBackground);
cc.defineGetterSetter(_proto, "overlay", _proto.getOverlay);
cc.defineGetterSetter(_proto, "shadow", _proto.getShadow);
cc.defineGetterSetter(_proto, "slider", _proto.getSlider);
cc.defineGetterSetter(_proto, "startPos", _proto.getStartPos);
}

if (cc.ControlPotentiometer){
cc.ControlPotentiometer.extend = cc.Class.extend;

_proto = cc.ControlPotentiometer.prototype;
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue);
cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue);
cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue);
cc.defineGetterSetter(_proto, "progressTimer", _proto.getProgressTimer, _proto.setProgressTimer);
cc.defineGetterSetter(_proto, "thumbSprite", _proto.getThumbSprite, _proto.setThumbSprite);
cc.defineGetterSetter(_proto, "prevLocation", _proto.getPreviousLocation, _proto.setPreviousLocation);

cc.ControlPotentiometer.prototype._ctor = function(backgroundFile, progressFile, thumbFile){
if (thumbFile != undefined) {
// Prepare track for potentiometer
var backgroundSprite = cc.Sprite.create(backgroundFile);

// Prepare thumb for potentiometer
var thumbSprite = cc.Sprite.create(thumbFile);

// Prepare progress for potentiometer
var progressTimer = cc.ProgressTimer.create(cc.Sprite.create(progressFile));
this.initWithTrackSprite_ProgressTimer_ThumbSprite(backgroundSprite, progressTimer, thumbSprite);
}
};
}

if (cc.ControlSlider){
cc.ControlSlider.extend = cc.Class.extend;

_proto = cc.ControlSlider.prototype;
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);
cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue);
cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue);
cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue);
cc.defineGetterSetter(_proto, "minAllowedValue", _proto.getMinimumAllowedValue, _proto.setMinimumAllowedValue);
cc.defineGetterSetter(_proto, "maxAllowedValue", _proto.getMaximumAllowedValue, _proto.setMaximumAllowedValue);
cc.defineGetterSetter(_proto, "thumbSprite", _proto.getThumbSprite);
cc.defineGetterSetter(_proto, "progressSprite", _proto.getProgressSprite);
cc.defineGetterSetter(_proto, "backgroundSprite", _proto.getBackgroundSprite);

cc.ControlSlider.prototype._ctor = function(bgFile, progressFile, thumbFile){
if (thumbFile != undefined) {
// Prepare background for slider
bgSprite = cc.Sprite.create(bgFile);

// Prepare progress for slider
progressSprite = cc.Sprite.create(progressFile);

// Prepare thumb (menuItem) for slider
thumbSprite = cc.Sprite.create(thumbFile);

this.initWithSprites(bgSprite, progressSprite, thumbSprite);
}
};
}

if (cc.ControlStepper){
cc.ControlStepper.extend = cc.Class.extend;

_proto = cc.ControlStepper.prototype;
cc.defineGetterSetter(_proto, "wraps", _proto.getWraps, _proto.setWraps);
cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue);
cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue);
cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue);
cc.defineGetterSetter(_proto, "stepValue", _proto.getStepValue, _proto.setStepValue);
cc.defineGetterSetter(_proto, "continuous", _proto.isContinuous);
cc.defineGetterSetter(_proto, "minusSprite", _proto.getMinusSprite, _proto.setMinusSprite);
cc.defineGetterSetter(_proto, "plusSprite", _proto.getPlusSprite, _proto.setPlusSprite);
cc.defineGetterSetter(_proto, "minusLabel", _proto.getMinusLabel, _proto.setMinusLabel);
cc.defineGetterSetter(_proto, "plusSLabel", _proto.getPlusSLabel, _proto.setPlusSLabel);

cc.ControlStepper.prototype._ctor = function(minusSprite, plusSprite){
plusSprite !== undefined && this.initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite);
};
}

if (cc.ControlSwitch){
cc.ControlSwitch.extend = cc.Class.extend;

_proto = cc.ControlSwitch.prototype;
cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled);

cc.ControlSwitch.prototype._ctor = function(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel){
offLabel !== undefined && this.initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);
};
}

if (cc.ScrollView){
cc.ScrollView.extend = cc.Class.extend;

_proto = cc.ScrollView.prototype;
cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth);
cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight);
cc.defineGetterSetter(_proto, "direction", _proto.getDirection, _proto.setDirection);

cc.ScrollView.prototype._ctor = function(size, container) {
size == undefined ? this.init() : (container ? this.initWithViewSize(size, container) : this.initWithViewSize(size));
};
}

if (cc.TableView){
cc.TableView.extend = cc.Class.extend;

cc.TableView.prototype._ctor = function(dataSouurce, size, container){
container == undefined ? this._init(dataSouurce, size) : this._init(dataSouurce, size, container);
};
}

if (cc.TableViewCell){
cc.TableViewCell.extend = cc.Class.extend;

_proto = cc.TableViewCell.prototype;
cc.defineGetterSetter(_proto, "objectId", _proto.getObjectID, _proto.setObjectID);
}
Loading