Remove cocos studio tests in JS-tests

This commit is contained in:
pandamicro 2016-06-24 13:50:24 +08:00
parent b8b362df92
commit d643b306ef
46 changed files with 5 additions and 6168 deletions

@ -1 +1 @@
Subproject commit 50f82c2e0736d127e0b58fef0d8b773af90a7f3d
Subproject commit 892e3cbdc27d24c39c62d700a81be27e593823b7

View File

@ -110,41 +110,6 @@
"src/ExtensionsTest/PluginXTest/PluginXTestsManager.js",
"src/ExtensionsTest/PluginXTest/IOSIAPTest.js",
"src/ExtensionsTest/PluginXTest/AnalyticsTest.js",
"src/CocoStudioTest/ArmatureTest/ArmatureTest.js",
"src/CocoStudioTest/ComponentsTest/ComponentsTestScene.js",
"src/CocoStudioTest/ComponentsTest/EnemyController.js",
"src/CocoStudioTest/ComponentsTest/GameOverScene.js",
"src/CocoStudioTest/ComponentsTest/PlayerController.js",
"src/CocoStudioTest/ComponentsTest/ProjectileController.js",
"src/CocoStudioTest/ComponentsTest/SceneController.js",
"src/CocoStudioTest/GUITest/UISceneTest.js",
"src/CocoStudioTest/GUITest/UIBaseLayer.js",
"src/CocoStudioTest/GUITest/UIButtonTest/UIButtonTest.js",
"src/CocoStudioTest/GUITest/UICheckBoxTest/UICheckBoxTest.js",
"src/CocoStudioTest/GUITest/UIImageViewTest/UIImageViewTest.js",
"src/CocoStudioTest/GUITest/UITextTest/UITextTest.js",
"src/CocoStudioTest/GUITest/UITextAtlasTest/UITextAtlasTest.js",
"src/CocoStudioTest/GUITest/UITextBMFontTest/UITextBMFontTest.js",
"src/CocoStudioTest/GUITest/UILoadingBarTest/UILoadingBarTest.js",
"src/CocoStudioTest/GUITest/UISliderTest/UISliderTest.js",
"src/CocoStudioTest/GUITest/UITextFieldTest/UITextFieldTest.js",
"src/CocoStudioTest/GUITest/UINodeContainerTest/UINodeContainerTest.js",
"src/CocoStudioTest/GUITest/UILayoutTest/UILayoutTest.js",
"src/CocoStudioTest/GUITest/UIListViewTest/UIListViewTest.js",
"src/CocoStudioTest/GUITest/UIPageViewTest/UIPageViewTest.js",
"src/CocoStudioTest/GUITest/UIScrollViewTest/UIScrollViewTest.js",
"src/CocoStudioTest/ParserTest/ParserTest.js",
"src/CocoStudioTest/CustomTest/CustomImageView/CustomImageView.js",
"src/CocoStudioTest/CustomTest/CustomImageView/CustomImageViewReader.js",
"src/CocoStudioTest/CustomTest/CustomImageView/CustomParticleWidget.js",
"src/CocoStudioTest/CustomTest/CustomImageView/CustomParticWidgetReader.js",
"src/CocoStudioTest/CustomTest/CustomImageView/CustomReader.js",
"src/CocoStudioTest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.js",
"src/CocoStudioTest/CustomTest/CustomImageScene/CustomImageScene.js",
"src/CocoStudioTest/CustomTest/CustomGUIScene.js",
"src/CocoStudioTest/ActionTimelineTest/ActionTimelineTest.js",
"src/CocoStudioTest/IssueTest/AnimationsWithOnlyOneFrame/AnimationsWithOnlyOneFrame.js",
"src/CocoStudioTest/IssueTest/CCSIssueTest.js",
"src/GUITest/UIScene.js",
"src/GUITest/UIButtonTest/UIButtonTest.js",
"src/GUITest/UICheckBoxTest/UICheckBoxTest.js",
@ -168,11 +133,6 @@
"src/GUITest/UIWebViewTest/UIWebViewTest.js",
"src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js",
"src/CocoStudioTest/SceneTest/TriggerCode/Acts.js",
"src/CocoStudioTest/SceneTest/TriggerCode/Cons.js",
"src/CocoStudioTest/SceneTest/TriggerCode/EventDef.js",
"src/CocoStudioTest/SceneTest/SceneEditorTest.js",
"src/CocoStudioTest/CocoStudioTest.js",
"src/XHRTest/XHRTest.js",
"src/XHRTest/XHRArrayBufferTest.js",

View File

@ -1,138 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var runActionTimeLineTest;
(function(){
runActionTimeLineTest = function(){
var scene = new cc.Scene();
scene.addChild(new layer);
cc.director.runScene(scene);
};
var layer = cc.Layer.extend({
ctor: function(){
cc.Layer.prototype.ctor.call(this);
var json = ccs.load("ActionTimeline/DemoPlayer_skeleton.json");
var node = json.node, action = json.action;
node.x = 200;
node.y = 160;
node.setScale(0.2);
this.addChild(node);
node.setDebugDrawEnabled(true);
if (action) {
node.runAction(action);
action.gotoFrameAndPlay(0, 40, true);
}
this.createMenu(node, action);
},
createMenu: function(node, action){
var menus = [];
action.addAnimationInfo(new ccs.AnimationInfo("stand", 0, 40));
action.addAnimationInfo(new ccs.AnimationInfo("walk", 41, 81));
var items = [
{
title: "debug",
callback: function(){
node.setDebugDrawEnabled(!node.isDebugDrawEnabled());
}
},{
title: "change animation",
callback: function(){
if(action.getStartFrame() == 0)
action.gotoFrameAndPlay(41, 81, true);
else
action.gotoFrameAndPlay(0, 40, true);
}
},/*{
title: "set Frame callback",
callback: function(evnt){
action.setFrameEventCallFunc(function(){
if("" == "changeColor"){
evnt.getNode().setColor(cc.color(0,0,0));
}else{
evnt.getNode().setColor(cc.color(255,255,255));
}
}, this);
}
},*/{
title: "AnimationList: walk",
callback: function(){
action.play("walk", true);
}
},{
title: "AnimationList: stand",
callback: function(){
action.play("stand", true);
}
},{
title: "change skin",
callback: function(){
if (weapSkinToAdd.isVisible())
weaponHandeBone.displaySkin("3", true);
else
weaponHandeBone.displaySkin(weapSkinToAdd, true);
}
}
];
var weaponHandeBone = node.getBoneNode("Layer20");
var weapSkinToAdd = new cc.Sprite("ActionTimeline/testAnimationResource/girl_arms.png");
weapSkinToAdd.setName("Knife");
weapSkinToAdd.setPosition(cc.p(135, 23));
weapSkinToAdd.setScale(3.0);
weapSkinToAdd.setRotation(86);
weaponHandeBone.addSkin(weapSkinToAdd, false);
items.forEach(function(item, index){
var menuItem = new cc.MenuItemFont(item.title, item.callback, this);
menuItem.setPosition((index / 7 | 0) * 100, 120 - index % 7 * 30);
menus.push(menuItem);
});
var menuItem = new cc.MenuItemFont("Back", function(){
var scene = new CocoStudioTestScene();
scene.runThisTest();
}, this);
menuItem.setPosition(325, -175);
menus.push(menuItem);
var menu = new cc.Menu(menus);
this.addChild(menu);
}
});
})();

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var LINE_SPACE = 40;
var ITEM_TAG_BASIC = 1000;
var cocoStudioTestItemNames = [
{
itemTitle:"CocoStudioArmatureTest",
testScene:function () {
runArmatureTestScene();
}
},
{
itemTitle:"CocoStudioGUITest",
testScene:function () {
runGuiTestMain();
}
},
{
itemTitle:"CocoStudioSceneTest",
testScene:function () {
runSceneEditorTest();
}
},
{
itemTitle:"ParserTest",
testScene:function(){
runParserTest();
}
},
{
itemTitle:"ActionTimeLineTest",
testScene:function () {
runActionTimeLineTest();
}
}
];
if(!cc.sys.isNative){
cocoStudioTestItemNames.push({
itemTitle: "CocoStudioComponentsTest",
testScene: function () {
runComponentsTestLayer();
}
});
cocoStudioTestItemNames.push({
itemTitle:"CustomWidget",
testScene:function(){
runCustomGUITest();
}
});
}
cocoStudioTestItemNames.push({
itemTitle:"CCSIssueTest",
testScene:function () {
runCCSIssueTest();
}
});
var CocoStudioMainLayer = cc.Layer.extend({
onEnter:function () {
this._super();
var winSize = cc.director.getWinSize();
var pMenu = new cc.Menu();
pMenu.x = 0;
pMenu.y = 0;
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(24);
for (var i = 0; i < cocoStudioTestItemNames.length; ++i) {
var selItem = cocoStudioTestItemNames[i];
var pItem = new cc.MenuItemFont(selItem.itemTitle,
this.menuCallback, this);
pItem.x = winSize.width / 2;
pItem.y = winSize.height - (i + 1) * LINE_SPACE;
pMenu.addChild(pItem, ITEM_TAG_BASIC + i);
}
this.addChild(pMenu);
},
menuCallback:function (sender) {
var nIndex = sender.zIndex - ITEM_TAG_BASIC;
cocoStudioTestItemNames[nIndex].testScene();
}
});
var cocoStudioOldApiFlag = 0;
var CocoStudioTestScene = TestScene.extend({
onEnter: function(){
TestScene.prototype.onEnter.call(this);
var winSize = cc.director.getWinSize();
var pMenu = new cc.Menu();
pMenu.x = 0;
pMenu.y = 0;
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(24);
var str = "new api";
if(cocoStudioOldApiFlag){
str = "old api";
}
var pItem = new cc.MenuItemFont(str,
function(){
if(cocoStudioOldApiFlag){
cocoStudioOldApiFlag = 0;
pItem.setString("new api");
}else{
cocoStudioOldApiFlag = 1;
pItem.setString("old api");
}
}, this);
pItem.x = 50;
pItem.y = winSize.height - 20;
pMenu.addChild(pItem);
this.addChild(pMenu);
},
runThisTest:function () {
var pLayer = new CocoStudioMainLayer();
this.addChild(pLayer);
cc.director.runScene(this);
}
});

View File

@ -1,77 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var ComponentsTestLayer = cc.LayerColor.extend({
init: function () {
if (cc.LayerColor.prototype.init.call(this, cc.color(255, 255, 255, 255))) {
var root = this.createGameScene();
this.addChild(root, 0, 1);
root.getChildByTag(1).addComponent(new ccs.ComAudio());
root.getChildByTag(1).addComponent(PlayerController.create());
root.addComponent(new ccs.ComAudio());
root.addComponent(new ccs.ComAttribute());
root.addComponent(SceneController.create());
return true;
}
return false;
},
createGameScene: function () {
var root = new cc.Node();
var winSize = cc.director.getWinSize();
var player = new cc.Sprite("components/Player.png", cc.rect(0, 0, 27, 40));
player.x = 30;
player.y = winSize.height / 2;
root.addChild(player, 1, 1);
var itemBack = new cc.MenuItemFont("Back", this.toExtensionsMainLayer, this);
itemBack.color = cc.color(0, 0, 0);
itemBack.x = cc.visibleRect.bottomRight.x - 50;
itemBack.y = cc.visibleRect.bottomRight.y + 25;
var menuBack = new cc.Menu(itemBack);
menuBack.x = 0;
menuBack.y = 0;
this.addChild(menuBack);
return root;
},
toExtensionsMainLayer: function (sender) {
cc.audioEngine.stopMusic("background-music-aac.wav");
var scene = new CocoStudioTestScene();
scene.runThisTest();
}
});
ComponentsTestLayer.scene = function(){
var scene = new cc.Scene();
var layer = new ComponentsTestLayer();
layer.init();
scene.addChild(layer);
return scene;
};
var runComponentsTestLayer = function () {
var scene = ComponentsTestLayer.scene();
cc.director.runScene(scene);
};

View File

@ -1,83 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var EnemyController = ccs.ComController.extend({
ctor: function () {
this._super();
this._name = "EnemyController";
},
init: function () {
return true;
},
onEnter: function () {
// Determine where to spawn the target along the Y axis
var winSize = cc.director.getWinSize();
var minY = this.getOwner().height / 2;
var rangeY = winSize.height - this.getOwner().height;
var actualY = (Math.random() * rangeY ) + minY;
// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated
this.getOwner().x = winSize.width + (this.getOwner().width / 2);
this.getOwner().y = actualY;
// Determine speed of the target
var minDuration = 2.0;
var maxDuration = 4.0;
var rangeDuration = maxDuration - minDuration;
var actualDuration = ( Math.random() % rangeDuration ) + minDuration;
// Create the actions
var actionMove = cc.moveTo(actualDuration, cc.p(0 - this.getOwner().width / 2, actualY));
var actionMoveDone = cc.callFunc(function () {
var comController = this.getOwner().parent.getComponent("SceneController");
comController.spriteMoveFinished(this.getOwner());
}, this);
this.getOwner().runAction(cc.sequence(actionMove, actionMoveDone));
},
onExit: function () {
},
update: function (dt) {
},
die: function () {
var com = this.getOwner().parent.getComponent("SceneController");
var targets = com.getTargets();
cc.arrayRemoveObject(targets, this.getOwner());
this.getOwner().removeFromParent(true);
com.increaseKillCount();
}
});
EnemyController.create = function () {
var controller = new EnemyController();
controller.init();
return controller;
};

View File

@ -1,74 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var GameOverLayer = cc.LayerColor.extend({
_label: null,
init: function () {
if (this._super(cc.color(255, 255, 255, 255))) {
var winSize = cc.director.getWinSize();
this._label = new cc.LabelTTF("", "Artial", 32);
this._label.retain();
this._label.color = cc.color(0, 0, 0);
this._label.x = winSize.width / 2;
this._label.y = winSize.height / 2;
this.addChild(this._label);
this.runAction(cc.sequence(cc.delayTime(3), cc.callFunc(this.gameOverDone, this)));
var itemBack = new cc.MenuItemFont("Back", this.toExtensionsMainLayer, this);
itemBack.color = cc.color(0, 0, 0);
itemBack.x = cc.visibleRect.bottomRight.x - 50;
itemBack.y = cc.visibleRect.bottomRight.y + 25;
var menuBack = new cc.Menu(itemBack);
menuBack.x = 0;
menuBack.y = 0;
this.addChild(menuBack);
return true;
}
return false;
},
gameOverDone: function () {
cc.director.runScene(ComponentsTestLayer.scene());
},
getLabel: function () {
return this._label;
}
});
var GameOverScene = cc.Scene.extend({
_layer: null,
init: function () {
this._super();
this._layer = new GameOverLayer();
this._layer.init();
this.addChild(this._layer);
},
getLayer: function () {
return this._layer;
}
});
GameOverScene.create = function () {
var scene = new GameOverScene();
scene.init();
return scene;
};

View File

@ -1,66 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var PlayerController = ccs.ComController.extend({
ctor: function () {
this._super();
this._name = "PlayerController";
this._listener1 = cc.EventListener.create({
event: cc.EventListener.TOUCH_ALL_AT_ONCE,
onTouchesEnded: this.onTouchesEnded.bind(this)
});
cc.eventManager.addListener(this._listener1, 1);
},
update: function (dt) {
},
onTouchesEnded: function (touch, event) {
var location = touch[0].getLocation();
var projectile = new cc.Sprite("components/Projectile.png", cc.rect(0, 0, 20, 20));
this.getOwner().parent.addChild(projectile, 1, 4);
var com = ProjectileController.create();
projectile.addComponent(com);
com.move(location.x, location.y);
this.getOwner().getComponent("Audio").playEffect("pew-pew-lei.wav");
},
onExit:function(){
cc.eventManager.removeListener(this._listener1);
this._super();
}
});
PlayerController.create = function () {
var controller = new PlayerController();
controller.init();
return controller;
};

View File

@ -1,122 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var ProjectileController = ccs.ComController.extend({
ctor: function () {
this._super();
this._name = "ProjectileController";
},
init: function () {
return true;
},
onEnter: function () {
var winSize = cc.director.getWinSize();
this.getOwner().x = 30;
this.getOwner().y = winSize.height / 2;
this.getOwner().tag = 3;
var com = this.getOwner().parent.getComponent("SceneController");
com.getProjectiles().push(this.getOwner());
},
onExit: function () {
},
update: function (dt) {
var com = this.getOwner().parent.getComponent("SceneController");
var targets = com.getTargets();
var projectile = this.getOwner();
var projectileRect = cc.rect(projectile.x - (projectile.width / 2), projectile.y - (projectile.height / 2), projectile.width, projectile.height);
var targetsToDelete = [];
var target = null;
var targetSize = null;
for (var i = 0; i < targets.length; i++) {
target = targets[i];
var targetRect = cc.rect(target.x - (target.width / 2), target.y - (target.height / 2), target.width, target.height);
if (cc.rectIntersectsRect(projectileRect, targetRect)) {
targetsToDelete.push(target);
}
}
for (var i = 0; i < targetsToDelete.length; i++) {
var target = targetsToDelete[i];
target.getComponent("EnemyController").die();
}
var isDied = targetsToDelete.length;
if (isDied) {
this.die();
}
},
move: function (x, y) {
var winSize = cc.director.getWinSize();
var offX = x - this.getOwner().x;
var offY = y - this.getOwner().y;
if (offX <= 0) return;
// Determine where we wish to shoot the projectile to
var realX = winSize.width + (this.getOwner().width / 2);
var ratio = offY / offX;
var realY = (realX * ratio) + this.getOwner().y;
var realDest = cc.p(realX, realY);
// Determine the length of how far we're shooting
var offRealX = realX - this.getOwner().x;
var offRealY = realY - this.getOwner().y;
var length = Math.sqrt((offRealX * offRealX) + (offRealY * offRealY));
var velocity = 480 / 1; // 480pixels/1sec
var realMoveDuration = length / velocity;
// Move projectile to actual endpoint
this.getOwner().runAction(cc.sequence(
cc.moveTo(realMoveDuration, realDest),
cc.callFunc(function () {
var sceneController = this.getOwner().parent.getComponent("SceneController");
sceneController.spriteMoveFinished(this.getOwner());
}, this)));
},
die: function () {
var com = this.getOwner().parent.getComponent("SceneController");
var projectiles = com.getProjectiles();
cc.arrayRemoveObject(projectiles, this.getOwner());
this.getOwner().removeFromParent(true);
}
});
ProjectileController.create = function () {
var controller = new ProjectileController();
controller.init();
return controller;
};

View File

@ -1,107 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var SceneController = ccs.ComController.extend({
_targets: null,
_projectiles: null,
_addTargetTime: 0,
_elapsedTime: 0,
ctor: function () {
this._super();
this._name = "SceneController";
this._targets = [];
this._projectiles = [];
},
init: function () {
return true;
},
onEnter: function () {
this._addTargetTime = 1;
this._targets = [];
this._projectiles = [];
this.getOwner().getComponent("Audio").playBackgroundMusic("background-music-aac.wav", true);
this.getOwner().getComponent("CCComAttribute").setInt("KillCount", 0);
},
onExit: function () {
},
update: function (dt) {
this._elapsedTime += dt;
if (this._elapsedTime > this._addTargetTime) {
this.addTarget();
this._elapsedTime = 0.0;
}
},
addTarget: function () {
var target = new cc.Sprite("components/Target.png", cc.rect(0, 0, 27, 40));
this.getOwner().addChild(target, 1, 2);
target.addComponent(EnemyController.create());
target.tag = 2;
this._targets.push(target);
},
spriteMoveFinished: function (sender) {
var sprite = sender;
this.getOwner().removeChild(sprite, true);
if (sprite.tag == 2) {
cc.arrayRemoveObject(this._targets, sprite);
var gameOverScene = GameOverScene.create();
gameOverScene.getLayer().getLabel().setString("You Lose!");
cc.director.runScene(gameOverScene);
}
else if (sprite.tag == 3) {
cc.arrayRemoveObject(this._projectiles, sprite);
}
},
increaseKillCount: function () {
var comAttribute = this.getOwner().getComponent("CCComAttribute");
var projectilesDestroyed = comAttribute.getInt("KillCount");
comAttribute.setInt("KillCount", ++projectilesDestroyed);
if (projectilesDestroyed >= 5) {
var gameOverScene = GameOverScene.create();
gameOverScene.getLayer().getLabel().setString("You Win!");
cc.director.runScene(gameOverScene);
}
},
getProjectiles: function () {
return this._projectiles;
},
getTargets: function () {
return this._targets;
}
});
SceneController.create = function () {
var controller = new SceneController();
controller.init();
return controller;
};

View File

@ -1,107 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var g_guisTests = [
{
title: "custom gui image Test",
test: function(){
var pScene = new CustomImageScene();
pScene.runThisTest();
}
},{
title: "custom gui particle widget Test",
test: function(){
var pScene = new CustomParticleWidgetScene();
pScene.runThisTest();
}
}
];
var CustomGUITestMainLayer = cc.Layer.extend({
onEnter: function(){
cc.Layer.prototype.onEnter.call(this);
var winSize = cc.director.getWinSize();
var pMenu = new cc.Menu();
pMenu.x = 0;
pMenu.y = 0;
cc.MenuItemFont.setFontName("fonts/arial.ttf");
cc.MenuItemFont.setFontSize(24);
for (var i = 0; i < g_guisTests.length; ++i) {
var selItem = g_guisTests[i];
var pItem = new cc.MenuItemFont(selItem.title,
selItem.test, this);
pItem.x = winSize.width / 2;
pItem.y = winSize.height - (i + 1) * LINE_SPACE;
pMenu.addChild(pItem, ITEM_TAG_BASIC + i);
}
this.addChild(pMenu);
},
onTouchesBegan: function(touches, event){
var touch = touches[0];
this._beginPos = touch.getLocation();
},
touchEvent: function(){
}
});
var CustomGUITestScene = cc.Scene.extend({
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition(cc.pAdd(cc.visibleRect.bottomRight,cc.p(-50,25)));
this.addChild(pMenu, 1);
},
runThisTest: function(){
var pLayer = new CustomGUITestMainLayer();
this.addChild(pLayer);
cc.director.runScene(this);
},
BackCallback: function(pSender){
var pScene = new CocoStudioTestScene();
pScene.runThisTest();
}
});
var runCustomGUITest = function(){
var scene = new CustomGUITestScene();
scene.runThisTest();
};

View File

@ -1,67 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CustomImageLayer = cc.Layer.extend({
onEnter: function(){
cc.Layer.prototype.onEnter.call(this);
var guiReader = ccs.uiReader;
guiReader.registerTypeAndCallBack("CustomImageView",
CustomImageView,
customImageViewReader,
customImageViewReader.setProperties);
var layout = guiReader.widgetFromJsonFile("ccs-res/cocosui/CustomImageViewTest/NewProject_2_1.ExportJson");
this.addChild(layout);
}
});
var CustomImageScene = cc.Scene.extend({
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition( cc.p( 750, 25) );
this.addChild(pMenu, 1);
},
runThisTest: function(){
var pLayer = new CustomImageLayer();
this.addChild(pLayer);
cc.director.runScene(this);
},
BackCallback: function(pSender){
var pScene = new CustomGUITestScene();
pScene.runThisTest();
}
});

View File

@ -1,66 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CustomImageView = ccui.ImageView.extend({
_label: null,
init: function(){
if (ccui.ImageView.prototype.init.call(this))
{
return true;
}
return false;
},
_initRenderer: function(){
ccui.ImageView.prototype._initRenderer.call(this);
this._label = new cc.LabelTTF();
cc.ProtectedNode.prototype.addChild.call(this, this._label, this.getLocalZOrder() + 1, -1);
},
createInstance: function(){
return CustomImageView;
},
setText: function(text){
this._label.setString(text);
},
getText: function(){
return this._label.getString();
}
});
CustomImageView.create = function(){
var custom = new CustomImageView();
if (custom && custom.init())
{
return custom;
}
return null;
};

View File

@ -1,42 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var customImageViewReader = {
_instanceCustomImageViewReader: null,
setProperties: function(classType, widget, customOptions){
var custom = widget;
var StringTest = customOptions["StringTest"];
if (StringTest) {
custom.setText(StringTest);
}
},
setPropsFromJsonDictionary: function(){
ccs.imageViewReader.setPropsFromJsonDictionary.apply(this, arguments);
}
};

View File

@ -1,43 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var customParticleWidgetReader = {
setProperties: function(classType, widget, customOptions){
var guiReader = ccs.uiReader;
var custom = widget;
var isExistPlistFile = customOptions["PlistFile"];
if (isExistPlistFile)
{
var PlistFile = customOptions["PlistFile"];
var PlistFilePath = guiReader.getFilePath();
PlistFilePath += PlistFile;
custom.setParticlePlist(PlistFilePath);
}
}
};

View File

@ -1,104 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CustomParticleWidget = ccui.Widget.extend({
_emitter: null,
_emitterPlist: null,
_emitterPostion: null,
init: function(){
if (ccui.Widget.prototype.init.call(this))
{
return true;
}
return false;
},
_initRenderer: function(){
ccui.Widget.prototype._initRenderer.call(this);
},
removeAllChildren: function(){
ccui.Widget.prototype.removeAllChildren.call(this);
},
createInstance: function(){
return CustomParticleWidget.create();
},
setParticlePlist: function(plist){
if (!this._emitter)
{
this._emitter = new cc.ParticleSystem(plist);
}
else
{
this._emitter.removeFromParent();
this._emitter = new cc.ParticleSystem(plist);
}
//Warning!!! don't forget to set the position
this.addProtectedChild(this._emitter , this.getLocalZOrder() + 1, -1);
this.setParticlePosition(cc.p(0, 0));
this._emitterPlist = plist;
},
getParticlePlist: function(){
return this._emitterPlist;
},
setParticlePosition: function(pos){
this._emitter.setPosition(pos);
this._emitterPostion = pos;
},
getParticlePosition: function(){
return this._emitterPostion;
},
playParticle: function(){
if (this._emitter)
{
this._emitter.resetSystem();
}
},
stopParticle: function(){
if (this._emitter)
{
this._emitter.stopSystem();
}
}
});
CustomParticleWidget.create = function(){
var custom = new CustomParticleWidget();
if (custom && custom.init())
{
return custom;
}
return null;
};

View File

@ -1,43 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
ccui.customReader = {
_instanceCustomReader: null,
setProperties: function(classType, widget, customOptions){
if (classType.compare("CustomImageView") == 0)
{
var customImageView = widget;
var isExistText = customOptions["text"];
if (isExistText)
{
var text = customOptions["text"];
customImageView.setText(text);
}
}
}
};

View File

@ -1,74 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CustomParticleWidgetLayer = cc.Layer.extend({
onEnter: function(){
cc.Layer.prototype.onEnter.call(this);
var guiReader = ccs.uiReader;
guiReader.registerTypeAndCallBack("CustomParticleWidget",
CustomParticleWidget,
customParticleWidgetReader,
customParticleWidgetReader.setProperties);
var custom = CustomParticleWidget.create();
custom.setPosition(cc.p(370, 210));
custom.setParticlePlist("Particles/BoilingFoam.plist");
this.addChild(custom, 10, -1);
}
});
var CustomParticleWidgetScene = cc.Scene.extend({
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition( cc.p( 750, 25) );
this.addChild(pMenu, 1);
},
runThisTest: function(){
var pLayer = new CustomParticleWidgetLayer();
this.addChild(pLayer);
cc.director.runScene(this);
},
BackCallback: function(pSender){
var pScene = new CustomGUITestScene();
pScene.runThisTest();
}
});

View File

@ -1,70 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIBaseLayer = cc.Layer.extend({
_mainNode:null,
_topDisplayText:null,
ctor: function () {
this._super();
var winSize = cc.director.getWinSize();
//add main node
var mainNode = new cc.Node();
var scale = winSize.height / 320;
mainNode.attr({anchorX: 0, anchorY: 0, scale: scale, x: (winSize.width - 480 * scale) / 2, y: (winSize.height - 320 * scale) / 2});
this.addChild(mainNode);
var topDisplayText = new ccui.Text();
topDisplayText.attr({
string: "",
font: "20px Arial",
x: 240,
y: 320-50
});
mainNode.addChild(topDisplayText,100);
this._mainNode = mainNode;
this._topDisplayText = topDisplayText;
},
_parseUIFile: function(file){
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
return json.node;
}else{
//ccs.uiReader.widgetFromJsonFile only supports 1.x file.
cc.log("ccs.uiReader.widgetFromJsonFile : %s", file);
return ccs.uiReader.widgetFromJsonFile(file)
}
},
backEvent: function (sender, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
runGuiTestMain();
}
}
});

View File

@ -1,68 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIButtonEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UIButton/Button_1.json");
this._mainNode.addChild(root);
var back_label = ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var button = ccui.helper.seekWidgetByName(root, "Button_123");
button.addTouchEventListener(this.touchEvent,this);
var title_button = ccui.helper.seekWidgetByName(root, "Button_126");
title_button.addTouchEventListener(this.touchEvent,this);
var scale9_button = ccui.helper.seekWidgetByName(root, "Button_129");
scale9_button.addTouchEventListener(this.touchEvent,this);
},
touchEvent: function (sender, type) {
switch (type) {
case ccui.Widget.TOUCH_BEGAN:
this._topDisplayText.setString("Touch Down");
break;
case ccui.Widget.TOUCH_MOVED:
this._topDisplayText.setString("Touch Move");
break;
case ccui.Widget.TOUCH_ENDED:
this._topDisplayText.setString("Touch Up");
break;
case ccui.Widget.TOUCH_CANCELED:
this._topDisplayText.setString("Touch Cancelled");
break;
default:
break;
}
}
});

View File

@ -1,113 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CEHCK_BOX_INDEX = 0;
var UICheckBoxEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var left_button = new ccui.Button();
left_button.loadTextures("Images/b1.png", "Images/b2.png", "");
left_button.x = 240-50;
left_button.y = 50;
left_button.anchorX = 0.5;
left_button.anchorY = 0.5;
left_button.addTouchEventListener(this.previousCallback, this);
this._mainNode.addChild(left_button, 999);
var right_button = new ccui.Button();
right_button.loadTextures("Images/f1.png", "Images/f2.png", "");
right_button.x = 240+50;
right_button.y = 50;
right_button.anchorX = 0.5;
right_button.anchorY = 0.5;
right_button.addTouchEventListener(this.nextCallback, this);
this._mainNode.addChild(right_button, 999);
},
previousCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
CEHCK_BOX_INDEX--;
if (CEHCK_BOX_INDEX < 0)CEHCK_BOX_INDEX = CEHCK_BOX_SCENE.length-1;
if (CEHCK_BOX_INDEX >= CEHCK_BOX_SCENE.length)CEHCK_BOX_INDEX = 0;
this.runNextScene();
}
},
nextCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
CEHCK_BOX_INDEX++;
if (CEHCK_BOX_INDEX < 0)CEHCK_BOX_INDEX = CEHCK_BOX_SCENE.length-1;
if (CEHCK_BOX_INDEX >= CEHCK_BOX_SCENE.length)CEHCK_BOX_INDEX = 0;
this.runNextScene();
}
},
runNextScene: function () {
var scene = new cc.Scene();
scene.addChild(new CEHCK_BOX_SCENE[CEHCK_BOX_INDEX]());
cc.director.runScene(scene);
},
selectedStateEvent: function (sender, type) {
switch (type) {
case ccui.CheckBox.EVENT_SELECTED:
this._topDisplayText.setString("Selected");
break;
case ccui.CheckBox.EVENT_UNSELECTED:
this._topDisplayText.setString("Unselected");
break;
default:
break;
}
}
});
var UICheckBoxOldTest = UICheckBoxEditorTest.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UICheckBox/checkbox_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var checkbox = ccui.helper.seekWidgetByName(root, "CheckBox_540");
checkbox.addEventListener(this.selectedStateEvent,this);
}
});
var UICheckBoxNewTest = UICheckBoxEditorTest.extend({
ctor: function () {
this._super();
var root = ccs.load("ccs-res/cocosui/UIEditorTest/UICheckBox/MainScene.json");
this._mainNode.addChild(root.node);
var checkbox = ccui.helper.seekWidgetByName(root.node, "CheckBox_1");
checkbox.addEventListener(this.selectedStateEvent,this);
}
});
var CEHCK_BOX_SCENE = [
UICheckBoxOldTest,
UICheckBoxNewTest
];

View File

@ -1,36 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIImageViewEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UIImageView/ImageView_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
}
});

View File

@ -1,88 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var LAYOUT_RES = [
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/layout_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/color_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/gradient_color_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/backgroundimage_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/scale9.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/linear_vertical.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/linear_horizontal.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/relative_align_parent.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/relative_align_location.json"
];
var LAYOUT_INDEX = 0;
var UILayoutEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile(LAYOUT_RES[LAYOUT_INDEX]);
this._mainNode.addChild(root);
var back_label = ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent, this);
var left_button = new ccui.Button();
left_button.loadTextures("Images/b1.png", "Images/b2.png", "");
left_button.x = 240-50;
left_button.y = 50;
left_button.anchorX = 0.5;
left_button.anchorY = 0.5;
left_button.zOrder = 999;
left_button.addTouchEventListener(this.previousCallback, this);
this._mainNode.addChild(left_button);
var right_button = new ccui.Button();
right_button.loadTextures("Images/f1.png", "Images/f2.png", "");
right_button.x = 240+50;
right_button.y = 50;
right_button.zOrder = 999;
right_button.anchorX = 0.5;
right_button.anchorY = 0.5;
right_button.addTouchEventListener(this.nextCallback, this);
this._mainNode.addChild(right_button);
},
previousCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
LAYOUT_INDEX--;
if (LAYOUT_INDEX < 0)LAYOUT_INDEX = LAYOUT_RES.length-1;
if (LAYOUT_INDEX >= LAYOUT_RES.length)LAYOUT_INDEX = 0;
this.runNextScene();
}
},
nextCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
LAYOUT_INDEX++;
if (LAYOUT_INDEX < 0)LAYOUT_INDEX = LAYOUT_RES.length-1;
if (LAYOUT_INDEX >= LAYOUT_RES.length)LAYOUT_INDEX = 0;
this.runNextScene();
}
},
runNextScene: function () {
var scene = new cc.Scene();
scene.addChild(new UILayoutEditorTest());
cc.director.runScene(scene);
}
});

View File

@ -1,97 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var LISTVIEW_RES = [
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/vertical_1.json",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/horizontal_1.json"
];
var LISTVIEW_INDEX = 0;
var UIListViewEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile(LISTVIEW_RES[LISTVIEW_INDEX]);
this._mainNode.addChild(root);
var back_label = ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent, this);
var listView = ccui.helper.seekWidgetByName(root, "ListView_1214");
listView.addEventListener(this.selectedItemEvent,this);
var left_button = new ccui.Button();
left_button.loadTextures("Images/b1.png", "Images/b2.png", "");
left_button.x = 240-50;
left_button.y = 50;
left_button.anchorX = 0.5;
left_button.anchorY = 0.5;
left_button.zOrder = 999;
left_button.addTouchEventListener(this.previousCallback, this);
this._mainNode.addChild(left_button);
var right_button = new ccui.Button();
right_button.loadTextures("Images/f1.png", "Images/f2.png", "");
right_button.x = 240+50;
right_button.y = 50;
right_button.zOrder = 999;
right_button.anchorX = 0.5;
right_button.anchorY = 0.5;
right_button.addTouchEventListener(this.nextCallback, this);
this._mainNode.addChild(right_button);
},
selectedItemEvent: function (sender, type) {
switch (type) {
case ccui.ListView.EVENT_SELECTED_ITEM:
var listViewEx = sender;
cc.log("select child index = " + listViewEx.getCurSelectedIndex());
break;
default:
break;
}
},
previousCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
LISTVIEW_INDEX--;
if (LISTVIEW_INDEX < 0)LISTVIEW_INDEX = LISTVIEW_RES.length-1;
if (LISTVIEW_INDEX >= LISTVIEW_RES.length)LISTVIEW_INDEX = 0;
this.runNextScene();
}
},
nextCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
LISTVIEW_INDEX++;
if (LISTVIEW_INDEX < 0)LISTVIEW_INDEX = LISTVIEW_RES.length-1;
if (LISTVIEW_INDEX >= LISTVIEW_RES.length)LISTVIEW_INDEX = 0;
this.runNextScene();
}
},
runNextScene: function () {
var scene = new cc.Scene();
scene.addChild(new UIListViewEditorTest());
cc.director.runScene(scene);
}
});

View File

@ -1,55 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UILoadingBarEditorTest = UIBaseLayer.extend({
_count: 0,
_loadingBar_left_to_right:null,
_loadingBar_right_to_left:null,
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UILoadingBar/loadingbar_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
this._loadingBar_left_to_right = ccui.helper.seekWidgetByName(root, "LoadingBar_856");
this._loadingBar_left_to_right.setPercent(0);
this._loadingBar_right_to_left = ccui.helper.seekWidgetByName(root, "LoadingBar_857");
this._loadingBar_right_to_left.setPercent(0);
this.scheduleUpdate();
},
update: function (dt) {
this._count++;
if (this._count > 100) {
this._count = 0;
}
this._loadingBar_left_to_right.setPercent(this._count);
this._loadingBar_right_to_left.setPercent(this._count);
}
});

View File

@ -1,41 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIWidgetAddNodeEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UIWidgetAddNode/widget_add_node.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var sprite = new cc.Sprite("ccs-res/cocosui/ccicon.png");
sprite.x = 240;
sprite.y = 160;
root.addNode(sprite,9999);
}
});

View File

@ -1,50 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIPageViewEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UIPageView/pageview_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var pageView =ccui.helper.seekWidgetByName(root, "PageView_1269");
pageView.addEventListener(this.pageViewEvent, this);
},
pageViewEvent: function (sender, type) {
switch (type) {
case ccui.PageView.EVENT_TURNING:
var pageView = sender;
this._topDisplayText.setString("page = " + (pageView.getCurPageIndex() + 1));
break;
default:
break;
}
}
});

View File

@ -1,92 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UIRichTextTest = UISceneEditor.extend({
_richText:null,
init: function () {
if (this._super()) {
//init text
this._topDisplayLabel.setString("");
this._bottomDisplayLabel.setString("RichText");
var widgetSize = this._widget.getContentSize();
var button = new ccui.Button();
button.setTouchEnabled(true);
button.loadTextures("ccs-res/cocosui/animationbuttonnormal.png", "ccs-res/cocosui/animationbuttonpressed.png", "");
button.setTitleText("switch");
button.setPosition(cc.p(widgetSize.width / 2, widgetSize.height / 2 + button.getContentSize().height * 2.5));
button.addTouchEventListener(this.touchEvent,this);
this._mainNode.addChild(button);
// RichText
var richText = new ccui.RichText();
richText.ignoreContentAdaptWithSize(false);
richText.setContentSize(cc.size(120, 100));
var re1 = new ccui.RichElementText(1, cc.color.WHITE, 255, "This color is white. ", "Helvetica", 10);
var re2 = new ccui.RichElementText(2, cc.color.YELLOW, 255, "And this is yellow. ", "Helvetica", 10);
var re3 = new ccui.RichElementText(3, cc.color.BLUE, 255, "This one is blue. ", "Helvetica", 10);
var re4 = new ccui.RichElementText(4, cc.color.GREEN, 255, "And green. ", "Helvetica", 10);
var re5 = new ccui.RichElementText(5, cc.color.RED, 255, "Last one is red ", "Helvetica", 10);
var reimg = new ccui.RichElementImage(6, cc.color.WHITE, 255, "ccs-res/cocosui/sliderballnormal.png");
ccs.armatureDataManager.addArmatureFileInfo("ccs-res/cocosui/100/100.ExportJson");
var pAr = new ccs.Armature("100");
pAr.getAnimation().play("Animation1");
var recustom = new ccui.RichElementCustomNode(1, cc.color.WHITE, 255, pAr);
var re6 = new ccui.RichElementText(7, cc.color.ORANGE, 255, "Have fun!! ", "Helvetica", 10);
richText.pushBackElement(re1);
richText.insertElement(re2, 1);
richText.pushBackElement(re3);
richText.pushBackElement(re4);
richText.pushBackElement(re5);
richText.insertElement(reimg, 2);
richText.pushBackElement(recustom);
richText.pushBackElement(re6);
richText.setPosition(cc.p(widgetSize.width / 2, widgetSize.height / 2));
this._mainNode.addChild(richText);
this._richText = richText;
return true;
}
return false;
},
touchEvent: function (sender, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
if (this._richText.isIgnoreContentAdaptWithSize()) {
this._richText.ignoreContentAdaptWithSize(false);
this._richText.setContentSize(cc.size(120, 100));
}
else {
this._richText.ignoreContentAdaptWithSize(true);
}
}
}
});

View File

@ -1,177 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS()", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var s_GuiTestEditorArray = [
{
title: "Button",
layer: function () {
return new UIButtonEditorTest();
}
},
{
title: "CheckBox",
layer: function () {
return new CEHCK_BOX_SCENE[0]();
}
},
{
title: "ImageView",
layer: function () {
return new UIImageViewEditorTest();
}
},
{
title: "Text",
layer: function () {
return new UITextEditorTest();
}
},
{
title: "TextAtlas",
layer: function () {
return new UITextAtlasEditorTest();
}
},
{
title: "TextBMFont",
layer: function () {
return new UITextBMFontEditorTest();
}
},
{
title: "LoadingBar",
layer: function () {
return new UILoadingBarEditorTest();
}
},
{
title: "Slider",
layer: function () {
return new UISliderEditorTest();
}
},
{
title: "TextField",
layer: function () {
return new UITextFieldEditorTest();
}
},
{
title: "AddNode",
layer: function () {
return new UIWidgetAddNodeEditorTest();
}
},
{
title: "Layout",
layer: function () {
return new UILayoutEditorTest();
}
},
{
title: "ListView",
layer: function () {
return new UIListViewEditorTest();
}
},
{
title: "PageView",
layer: function () {
return new UIPageViewEditorTest();
}
},
{
title: "ScrollView",
layer: function () {
return new UIScrollViewEditorTest();
}
}
];
var GuiTestMainLayer = cc.Layer.extend({
ctor: function () {
this._super();
var winSize = cc.winSize;
var x = 0;
var y = winSize.height - 10;
for (var i = 0; i < s_GuiTestEditorArray.length; i++) {
var guiTest = s_GuiTestEditorArray[i];
var text = new ccui.Text();
if (i % 2 == 0) {
x = winSize.width / 2 - 100;
y -= 30;
} else {
x = winSize.width / 2 + 100;
}
text.attr({
string: guiTest.title,
font: "20px Arial",
x: x,
y: y,
tag: i
});
text.setTouchEnabled(true);
text.setTouchScaleChangeEnabled(true);
text.addTouchEventListener(this.touchEvent, this);
this.addChild(text);
}
var backText = new ccui.Text();
backText.attr({
string: "Back",
font: "20px Arial",
x: winSize.width-50,
y: 50,
tag: 10000
});
backText.setTouchEnabled(true);
backText.setTouchScaleChangeEnabled(true);
backText.addTouchEventListener(this.backEvent, this);
this.addChild(backText);
},
touchEvent:function(sender,type){
if(type==ccui.Widget.TOUCH_ENDED){
var tag = sender.tag;
var scene = new cc.Scene();
var guiTest = s_GuiTestEditorArray[tag];
scene.addChild(guiTest.layer());
cc.director.runScene(scene);
}
},
backEvent:function(sender,type){
if(type==ccui.Widget.TOUCH_ENDED){
var scene = new CocoStudioTestScene();
scene.runThisTest();
}
}
});
var runGuiTestMain = function(){
var scene = new cc.Scene();
var main = new GuiTestMainLayer();
scene.addChild(main);
cc.director.runScene(scene);
}

View File

@ -1,84 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var SCROLLVIEW_RES = [
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/vertical_1.json",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/horizontal_1.json",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/both_1.json"
];
var SCROLLVIEW_INDEX = 0;
var UIScrollViewEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile(SCROLLVIEW_RES[SCROLLVIEW_INDEX]);
this._mainNode.addChild(root);
var back_label = ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent, this);
var left_button = new ccui.Button();
left_button.loadTextures("Images/b1.png", "Images/b2.png", "");
left_button.x = 240-50;
left_button.y = 50;
left_button.anchorX = 0.5;
left_button.anchorY = 0.5;
left_button.zOrder = 999;
left_button.addTouchEventListener(this.previousCallback, this);
this._mainNode.addChild(left_button);
var right_button = new ccui.Button();
right_button.loadTextures("Images/f1.png", "Images/f2.png", "");
right_button.x = 240+50;
right_button.y = 50;
right_button.zOrder = 999;
right_button.anchorX = 0.5;
right_button.anchorY = 0.5;
right_button.addTouchEventListener(this.nextCallback, this);
this._mainNode.addChild(right_button);
},
previousCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
SCROLLVIEW_INDEX--;
if (SCROLLVIEW_INDEX < 0)SCROLLVIEW_INDEX = SCROLLVIEW_RES.length-1;
if (SCROLLVIEW_INDEX >= SCROLLVIEW_RES.length)SCROLLVIEW_INDEX = 0;
this.runNextScene();
}
},
nextCallback: function (render, type) {
if (type == ccui.Widget.TOUCH_ENDED) {
SCROLLVIEW_INDEX++;
if (SCROLLVIEW_INDEX < 0)SCROLLVIEW_INDEX = SCROLLVIEW_RES.length-1;
if (SCROLLVIEW_INDEX >= SCROLLVIEW_RES.length)SCROLLVIEW_INDEX = 0;
this.runNextScene();
}
},
runNextScene: function () {
var scene = new cc.Scene();
scene.addChild(new UIScrollViewEditorTest());
cc.director.runScene(scene);
}
});

View File

@ -1,54 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UISliderEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UISlider/slider_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var slider = ccui.helper.seekWidgetByName(root, "Slider_738");
slider.addEventListener(this.sliderEvent,this);
var scale9_slider = ccui.helper.seekWidgetByName(root, "Slider_740");
scale9_slider.addEventListener(this.sliderEvent,this);
},
sliderEvent: function (sender, type) {
switch (type) {
case ccui.Slider.EVENT_PERCENT_CHANGED:
var slider = sender;
var percent = slider.getPercent();
this._topDisplayText.setString("Percent " + percent.toFixed(0));
break;
default:
break;
}
}
});

View File

@ -1,41 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UITextAtlasEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UILabelAtlas/labelatlas_1.json");
this._mainNode.addChild(root);
var label =ccui.helper.seekWidgetByName(root, "LabelAtlas_961");
label.setString("0123456");
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
}
});

View File

@ -1,37 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UITextBMFontEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UILabelBMFont/labelbmfont_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
}
});

View File

@ -1,63 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UITextFieldEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UITextField/textfield_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
var textField_normal = ccui.helper.seekWidgetByName(root, "TextField_1109");
textField_normal.addEventListener(this.textFieldEvent,this);
var textField_max_character = ccui.helper.seekWidgetByName(root, "TextField_1110");
textField_max_character.addEventListener(this.textFieldEvent,this);
var textField_password = ccui.helper.seekWidgetByName(root, "TextField_1107");
textField_password.addEventListener(this.textFieldEvent,this);
},
textFieldEvent: function (sender, type) {
switch (type) {
case ccui.TextField. EVENT_ATTACH_WITH_IME:
this._topDisplayText.setString("attach with IME");
break;
case ccui.TextField. EVENT_DETACH_WITH_IME:
this._topDisplayText.setString("detach with IME");
break;
case ccui.TextField. EVENT_INSERT_TEXT:
this._topDisplayText.setString("insert words");
break;
case ccui.TextField. EVENT_DELETE_BACKWARD:
this._topDisplayText.setString("delete word");
break;
default:
break;
}
}
});

View File

@ -1,37 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var UITextEditorTest = UIBaseLayer.extend({
ctor: function () {
this._super();
var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UILabel/label_1.json");
this._mainNode.addChild(root);
var back_label =ccui.helper.seekWidgetByName(root, "back");
back_label.addTouchEventListener(this.backEvent,this);
}
});

View File

@ -1,102 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var CCSIssueAnimationsWithOnlyOneFrameLayer = cc.Layer.extend({
onEnter: function(){
cc.Layer.prototype.onEnter.call(this);
var json = ccs.load(s_testIssueAnimationsWithOnlyOneFrame_json);
var jsonNode = json.node;
jsonNode.x = this.getContentSize().width * 0.5 - jsonNode.getContentSize().width * 0.5;
jsonNode.y = this.getContentSize().height * 0.5 - jsonNode.getContentSize().height * 0.5;
this.addChild(jsonNode);
var winSize = director.getWinSize();
var logLabel = new cc.LabelTTF("Issue #15714: Animations with only one frame are allowed now", "Thonburi", 16);
this.addChild(logLabel);
logLabel.x = winSize.width / 2;
logLabel.y = winSize.height / 3;
var animationOneFramePosition = ccs.actionManager.getActionByName(
s_testIssueAnimationsWithOnlyOneFrame_json,
"AnimationOneFramePosition"
);
var animationOneFrameRotation = ccs.actionManager.getActionByName(
s_testIssueAnimationsWithOnlyOneFrame_json,
"AnimationOneFrameRotation"
);
var delayTime = 5;
var that = this;
this.runAction(cc.sequence(
cc.delayTime(delayTime),
cc.callFunc(function(target) {
if(animationOneFramePosition != null)
{
animationOneFramePosition.play();
logLabel.setString("Animation with only one frame played! Image position should change");
}
}, this),
cc.delayTime(delayTime),
cc.callFunc(function(target) {
if(animationOneFrameRotation != null)
{
animationOneFrameRotation.play();
logLabel.setString("Animation with only one frame played! Image rotation should change");
}
}, this)
));
}
});
var CCSIssueAnimationsWithOnlyOneFrameScene = cc.Scene.extend({
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition(cc.pAdd(cc.visibleRect.bottomRight,cc.p(-50,25)));
this.addChild(pMenu, 1);
},
runThisTest: function(){
var pLayer = new CCSIssueAnimationsWithOnlyOneFrameLayer();
this.addChild(pLayer);
cc.director.runScene(this);
},
BackCallback: function(pSender){
var pScene = new CCSIssueTestScene();
pScene.runThisTest();
}
});

View File

@ -1,101 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var g_ccsIssuesTests = [
{
title: "Cocos Studio 1.x Issue: Animations With Only One Frame Test",
test: function(){
var pScene = new CCSIssueAnimationsWithOnlyOneFrameScene();
pScene.runThisTest();
}
}
];
var CCSIssueTestMainLayer = cc.Layer.extend({
onEnter: function(){
cc.Layer.prototype.onEnter.call(this);
var winSize = cc.director.getWinSize();
var pMenu = new cc.Menu();
pMenu.x = 0;
pMenu.y = 0;
cc.MenuItemFont.setFontName("fonts/arial.ttf");
cc.MenuItemFont.setFontSize(24);
for (var i = 0; i < g_ccsIssuesTests.length; ++i) {
var selItem = g_ccsIssuesTests[i];
var pItem = new cc.MenuItemFont(selItem.title,
selItem.test, this);
pItem.x = winSize.width / 2;
pItem.y = winSize.height - (i + 1) * LINE_SPACE;
pMenu.addChild(pItem, ITEM_TAG_BASIC + i);
}
this.addChild(pMenu);
},
onTouchesBegan: function(touches, event){
var touch = touches[0];
this._beginPos = touch.getLocation();
},
touchEvent: function(){
}
});
var CCSIssueTestScene = cc.Scene.extend({
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition(cc.pAdd(cc.visibleRect.bottomRight,cc.p(-50,25)));
this.addChild(pMenu, 1);
},
runThisTest: function(){
var pLayer = new CCSIssueTestMainLayer();
this.addChild(pLayer);
cc.director.runScene(this);
},
BackCallback: function(pSender){
var pScene = new CocoStudioTestScene();
pScene.runThisTest();
}
});
var runCCSIssueTest = function(){
var scene = new CCSIssueTestScene();
scene.runThisTest();
};

View File

@ -1,156 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var g_parsersTests = [
{
title: "cocostudio 1.3",
test: function(){
new CocostudioParserJsonScene("ccs-res/cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.ExportJson").runThisTest();
}
},{
title: "cocostudio 1.4",
test: function(){
new CocostudioParserJsonScene("ccs-res/cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.ExportJson").runThisTest();
}
},{
title: "cocostudio 1.5",
test: function(){
new CocostudioParserJsonScene("ccs-res/cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.ExportJson").runThisTest();
}
},{
title: "cocostudio 2.1",
test: function(){
new CocostudioParserJsonScene("ccs-res/cocosui/UIEditorTest/2.1/MainScene.json").runThisTest();
}
}
];
var runParserTest = function () {
var pScene = new CocostudioParserJsonScene();
if (pScene) {
pScene.runThisTest();
}
};
var CocostudioParserJsonLayer = cc.Layer.extend({
_jsonFile: null,
ctor: function(jsonFile){
this._super();
this._jsonFile = jsonFile;
},
onEnter: function(){
this._super();
cc.Layer.prototype.onEnter.call(this);
var layout;
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", this._jsonFile);
var json = ccs.load(this._jsonFile);
layout = json.node;
}else{
//ccs.uiReader.widgetFromJsonFile only supports 1.x file
cc.log("ccs.uiReader.widgetFromJsonFile : %s", this._jsonFile);
var guiReader = ccs.uiReader;
layout = guiReader.widgetFromJsonFile(this._jsonFile);
}
if(layout){
if(layout.getScale() == 1)
layout.setScale(0.7);
this.addChild(layout);
}
}
});
var CocostudioParserJsonScene = cc.Scene.extend({
_jsonFile: null,
ctor: function(jsonFile){
this._super();
if(jsonFile){
this._jsonFile = jsonFile;
}
},
onEnter: function(){
cc.Scene.prototype.onEnter.call(this);
var label = new cc.LabelTTF("Back", "fonts/arial.ttf", 20);
//#endif
var pMenuItem = new cc.MenuItemLabel(label, this.BackCallback, this);
var pMenu = new cc.Menu(pMenuItem);
pMenu.setPosition( cc.p(0, 0) );
pMenuItem.setPosition( cc.pAdd(cc.visibleRect.bottomRight,cc.p(-50,25)) );
this.addChild(pMenu, 1);
},
runThisTest: function(){
if(this._jsonFile){
var pLayer = new CocostudioParserJsonLayer(this._jsonFile);
this.addChild(pLayer);
}else{
var winSize = cc.director.getWinSize();
var pMenu = new cc.Menu();
pMenu.x = 0;
pMenu.y = 0;
cc.MenuItemFont.setFontName("fonts/arial.ttf");
cc.MenuItemFont.setFontSize(24);
var testNum = 0;
if(cocoStudioOldApiFlag == 0){
testNum = g_parsersTests.length;
}else{
testNum = g_parsersTests.length - 1;
}
for (var i = 0; i < testNum; ++i) {
var selItem = g_parsersTests[i];
var pItem = new cc.MenuItemFont(selItem.title,
selItem.test, this);
pItem.x = winSize.width / 2;
pItem.y = winSize.height - (i + 1) * LINE_SPACE;
pMenu.addChild(pItem, ITEM_TAG_BASIC + i);
}
this.addChild(pMenu);
}
cc.director.runScene(this);
},
BackCallback: function(){
cc.audioEngine.stopMusic();
cc.audioEngine.stopAllEffects();
if(this._jsonFile){
new CocostudioParserJsonScene().runThisTest();
}else{
new CocoStudioTestScene().runThisTest();
}
}
});

View File

@ -1,547 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var sceneTestIdx = -1;
var SceneEditorScene = TestScene.extend({
onEnter: function () {
this._super();
},
runThisTest: function () {
sceneTestIdx = -1;
this.addChild(nextSceneEditorTest());
director.runScene(this);
},
onMainMenuCallback: function () {
var scene = new CocoStudioTestScene();
scene.runThisTest();
},
onExit: function () {
this._super();
}
});
var sceneEditorArr = [
function () {
return new LoadSceneEdtiorFileTest();
},
function () {
return new SpriteComponentTest();
},
function () {
return new ArmatureComponentTest();
},
function () {
return new UIComponentTest();
},
function () {
return new TmxMapComponentTest();
},
function () {
return new ParticleComponentTest();
},
function () {
return new EffectComponentTest();
},
function () {
return new BackgroundComponentTest();
},
function () {
return new AttributeComponentTest();
},
function () {
return new TriggerTest();
}
];
var nextSceneEditorTest = function () {
sceneTestIdx++;
sceneTestIdx = sceneTestIdx % sceneEditorArr.length;
return sceneEditorArr[sceneTestIdx]();
};
var backSceneEditorTest = function () {
sceneTestIdx--;
if (sceneTestIdx < 0)
sceneTestIdx += sceneEditorArr.length;
return sceneEditorArr[sceneTestIdx]();
};
var restartSceneEditorTest = function () {
return sceneEditorArr[sceneTestIdx]();
};
var SceneEditorTestLayer = BaseTestLayer.extend({
ctor: function () {
if (arguments.length === 0) {
this._super(cc.color(0, 0, 0, 255), cc.color(98, 99, 117, 255));
} else {
this._super.apply(this, arguments);
}
},
onRestartCallback: function (sender) {
var s = new SceneEditorScene();
s.addChild(restartSceneEditorTest());
director.runScene(s);
},
onNextCallback: function (sender) {
var s = new SceneEditorScene();
s.addChild(nextSceneEditorTest());
director.runScene(s);
},
onBackCallback: function (sender) {
var s = new SceneEditorScene();
s.addChild(backSceneEditorTest());
director.runScene(s);
},
onExit: function () {
ccs.armatureDataManager.clear();
ccs.sceneReader.clear();
ccs.actionManager.clear();
ccs.uiReader.clear();
this._super();
},
initSize:function(node){
var winSize = cc.director.getWinSize();
var scale = winSize.height / 320;
node.scale = scale;
node.x = (winSize.width - 480 * scale) / 2;
node.y = (winSize.height - 320 * scale) / 2;
}
});
var runSceneEditorTest = function () {
var pScene = new SceneEditorScene();
if (pScene) {
pScene.runThisTest();
}
};
//------------------------------------------------------------------
//
// LoadSceneEdtiorFileTest
//
//------------------------------------------------------------------
var LoadSceneEdtiorFileTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/LoadSceneEdtiorFileTest/FishJoy2.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
ccs.actionManager.playActionByName("startMenu_1.json", "Animation1");
this.initSize(node);
},
onExit: function() {
ccs.actionManager.releaseActions();
this._super();
},
title: function () {
return "loadSceneEdtiorFile Test";
}
});
//------------------------------------------------------------------
//
// SpriteComponentTest
//
//------------------------------------------------------------------
var SpriteComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/SpriteComponentTest/SpriteComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
var action1 = cc.blink(2, 10);
var action2 = cc.blink(2, 5);
var sister1 = node.getChildByTag(10003).getComponent("CCSprite").getNode();
sister1.runAction(action1);
var sister2 = node.getChildByTag(10004).getComponent("CCSprite").getNode();
sister2.runAction(action2);
this.initSize(node);
},
title: function () {
return "Sprite Component Test";
}
});
//------------------------------------------------------------------
//
// ArmatureComponentTest
//
//------------------------------------------------------------------
var ArmatureComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/ArmatureComponentTest/ArmatureComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;ccs.load(file);
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
var blowFish = node.getChildByTag(10007).getComponent("CCArmature").getNode();
blowFish.runAction(cc.moveBy(10, cc.p(-1000, 0)));
var butterFlyFish = node.getChildByTag(10008).getComponent("CCArmature").getNode();
butterFlyFish.runAction(cc.moveBy(10, cc.p(-1000, 0)));
this.initSize(node);
},
title: function () {
return "Armature Component Test";
}
});
//------------------------------------------------------------------
//
// UIComponentTest
//
//------------------------------------------------------------------
var UIComponentTest = SceneEditorTestLayer.extend({
_node: null,
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/UIComponentTest/UIComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this._node = node;
this.addChild(this._node);
var widget = this._node.getChildByTag(10025).getComponent("GUIComponent").getNode();
var button = widget.getChildByName("Button_156");
button.addTouchEventListener(this.touchEvent, this);
this.initSize(this._node);
},
touchEvent: function (sender, type) {
switch (type) {
case ccui.Widget.TOUCH_BEGAN:
var blowFish = this._node.getChildByTag(10010).getComponent("CCArmature").getNode();
blowFish.runAction(cc.moveBy(10, cc.p(-1000, 0)));
var butterFlyFish = this._node.getChildByTag(10011).getComponent("CCArmature").getNode();
butterFlyFish.runAction(cc.moveBy(10, cc.p(-1000.0, 0)));
break;
default:
break;
}
},
title: function () {
return "UI Component Test";
}
});
//------------------------------------------------------------------
//
// TmxMapComponentTest
//
//------------------------------------------------------------------
var TmxMapComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/TmxMapComponentTest/TmxMapComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
var tmxMap = node.getChildByTag(10015).getComponent("CCTMXTiledMap").getNode();
var actionTo = cc.skewTo(2, 0, 2);
var rotateTo = cc.rotateTo(2, 61);
var actionScaleTo = cc.scaleTo(2, -0.44, 0.47);
var actionScaleToBack = cc.scaleTo(2, 1, 1);
var rotateToBack = cc.rotateTo(2, 0);
var actionToBack = cc.skewTo(2, 0, 0);
tmxMap.runAction(cc.sequence(actionTo, actionToBack));
tmxMap.runAction(cc.sequence(rotateTo, rotateToBack));
tmxMap.runAction(cc.sequence(actionScaleTo, actionScaleToBack));
this.initSize(node);
},
title: function () {
return "TmxMap Component Test";
}
});
//------------------------------------------------------------------
//
// ParticleComponentTest
//
//------------------------------------------------------------------
var ParticleComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/ParticleComponentTest/ParticleComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
var particle = node.getChildByTag(10020).getComponent("CCParticleSystemQuad").getNode();
var jump = cc.jumpBy(5, cc.p(-500, 0), 50, 4);
var action = cc.sequence(jump, jump.reverse());
particle.runAction(action);
this.initSize(node);
},
title: function () {
return "Particle Component Test";
}
});
//------------------------------------------------------------------
//
// EffectComponentTest
//
//------------------------------------------------------------------
var EffectComponentTest = SceneEditorTestLayer.extend({
_node: null,
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/EffectComponentTest/EffectComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this._node = node;
this.addChild(this._node);
var armature = this._node.getChildByTag(10015).getComponent("CCArmature").getNode();
armature.getAnimation().setMovementEventCallFunc(this.animationEvent, this);
this.initSize(this._node);
},
title: function () {
return "Effect Component Test";
},
animationEvent: function (armature, movementType, movementID) {
if (movementType == ccs.MovementEventType.loopComplete) {
if (movementID == "Fire") {
var audio = this._node.getChildByTag(10015).getComponent("CCComAudio");
audio.playEffect();
}
}
}
});
//------------------------------------------------------------------
//
// BackgroundComponentTest
//
//------------------------------------------------------------------
var BackgroundComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/BackgroundComponentTest/BackgroundComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
ccs.actionManager.playActionByName("startMenu_1.json", "Animation1");
var audio = node.getComponent("CCBackgroundAudio");
audio.playBackgroundMusic();
this.initSize(node);
},
onExit: function() {
ccs.actionManager.releaseActions();
this._super();
},
title: function () {
return "Background Component Test";
}
});
//------------------------------------------------------------------
//
// AttributeComponentTest
//
//------------------------------------------------------------------
var AttributeComponentTest = SceneEditorTestLayer.extend({
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/AttributeComponentTest/AttributeComponentTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
var comAttribute = node.getChildByTag(10015).getComponent("CCComAttribute");
cc.log("name:" + comAttribute.getString("name"));
cc.log("maxHP:" + comAttribute.getFloat("maxHP"));
cc.log("maxMP:" + comAttribute.getFloat("maxMP"));
this.initSize(node);
},
title: function () {
return "Attribute Component Test";
},
subtitle:function(){
return "See console";
}
});
//------------------------------------------------------------------
//
// TriggerTest
//
//------------------------------------------------------------------
var TriggerTest = SceneEditorTestLayer.extend({
_blowFishNode: null,
_flyFishNode: null,
onEnter: function () {
this._super();
var node,
file = "ccs-res/scenetest/TriggerTest/TriggerTest.json";
if(cocoStudioOldApiFlag == 0){
cc.log("ccs.load : %s", file);
var json = ccs.load(file);
node = json.node;
}else{
//ccs.sceneReader only supports 1.x file
cc.log("ccs.sceneReader.createNodeWithSceneFile : %s", file);
node = ccs.sceneReader.createNodeWithSceneFile(file);
}
this.addChild(node);
ccs.actionManager.playActionByName("startMenu_1.json", "Animation1");
this.schedule(this.gameLogic);
ccs.sendEvent(TRIGGER_EVENT_ENTERSCENE);
var listener1 = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,
onTouchBegan: this.onTouchBegan.bind(this),
onTouchMoved: this.onTouchMoved.bind(this),
onTouchEnded: this.onTouchEnded.bind(this)
});
cc.eventManager.addListener(listener1, this);
this.initSize(node);
},
onExit: function () {
ccs.actionManager.releaseActions();
ccs.sendEvent(TRIGGER_EVENT_LEAVESCENE);
this.unschedule(this.gameLogic, this);
this._super();
},
onTouchBegan: function (touch, event) {
ccs.sendEvent(TRIGGER_EVENT_TOUCHBEGAN);
return true;
},
onTouchMoved: function (touch, event) {
ccs.sendEvent(TRIGGER_EVENT_TOUCHMOVED);
},
onTouchEnded: function (touch, event) {
ccs.sendEvent(TRIGGER_EVENT_TOUCHENDED);
},
onTouchCancelled: function (touch, event) {
ccs.sendEvent(TRIGGER_EVENT_TOUCHCANCELLED);
},
gameLogic: function () {
ccs.sendEvent(TRIGGER_EVENT_UPDATESCENE);
},
title: function () {
return "Trigger Test";
}
});

View File

@ -1,642 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var PlayMusic = ccs.BaseTriggerAction.extend({
_tag: -1,
_comName: "",
_type: -1,
ctor: function () {
this._tag = -1;
this._comName = "";
this._type = -1;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var audio = node.getComponent(this._comName);
if (!audio)
return;
if (this._type == 0) {
audio.playBackgroundMusic();
}
else if (this._type == 1) {
audio.playEffect();
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "componentName") {
this._comName = subDict["value"];
continue;
}
if (key == "type") {
this._type = subDict["value"];
}
}
},
removeAll: function () {
}
});
var TMoveTo = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_pos: cc.p(0, 0),
ctor: function () {
this._tag = -1;
this._duration = 0;
this._pos = cc.p(0, 0);
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionTo = cc.moveTo(this._duration, cc.p(this._pos.x, this._pos.y));
node.runAction(actionTo);
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "x") {
this._pos.x = subDict["value"];
continue;
}
if (key == "y") {
this._pos.y = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TMoveBy = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_pos: cc.p(0, 0),
_reverse: false,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._pos = cc.p(0, 0);
this._reverse = false;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var moveBy = cc.moveBy(this._duration, cc.p(this._pos.x, this._pos.y));
if (this._reverse) {
var actionByBack = moveBy.reverse();
node.runAction(cc.sequence(moveBy, actionByBack));
} else {
node.runAction(moveBy);
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "x") {
this._pos.x = subDict["value"];
continue;
}
if (key == "y") {
this._pos.y = subDict["value"];
continue;
}
if (key == "IsReverse") {
this._reverse = subDict["value"] || false;
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TRotateTo = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_deltaAngle: 0,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._deltaAngle = 0;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionTo = cc.rotateTo(this._duration, this._deltaAngle);
node.runAction(actionTo);
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "DeltaAngle") {
this._deltaAngle = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TRotateBy = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_deltaAngle: 0,
_reverse: false,
ctor:function(){
this._tag = -1;
this._duration = 0;
this._deltaAngle = 0;
this._reverse = false;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionBy = cc.rotateBy(this._duration, this._deltaAngle);
if (this._reverse == true) {
var actionByBack = actionBy.reverse();
node.runAction(cc.sequence(actionBy, actionByBack));
}
else {
node.runAction(actionBy);
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "DeltaAngle") {
this._deltaAngle = subDict["value"];
continue;
}
if (key == "IsReverse") {
this._reverse = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TScaleTo = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_scaleX: 0,
_scaleY: 0,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._scaleX = 0;
this._scaleY = 0;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionTo = cc.scaleTo(this._duration, this._scaleX, this._scaleY);
node.runAction(actionTo);
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "ScaleX") {
this._scaleX = subDict["value"];
continue;
}
if (key == "ScaleY") {
this._scaleY = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TScaleBy = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_scaleX: 0,
_scaleY: 0,
_reverse: false,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._scaleX = 0;
this._scaleY = 0;
this._reverse = false;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionBy = cc.scaleBy(this._duration, this._scaleX, this._scaleY);
if (this._reverse == true) {
var actionByBack = actionBy.reverse();
node.runAction(cc.sequence(actionBy, actionByBack));
}
else {
node.runAction(actionBy);
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "ScaleX") {
this._scaleX = subDict["value"];
continue;
}
if (key == "ScaleY") {
this._scaleY = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TSkewTo = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_skewX: 0,
_skewY: 0,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._skewX = 0;
this._skewY = 0;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionTo = cc.skewTo(this._duration, this._skewX, this._skewY);
node.runAction(actionTo);
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "SkewX") {
this._skewX = subDict["value"];
continue;
}
if (key == "SkewY") {
this._skewY = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TSkewBy = ccs.BaseTriggerAction.extend({
_tag: -1,
_duration: 0,
_skewX: 0,
_skewY: 0,
_reverse: false,
ctor: function () {
this._tag = -1;
this._duration = 0;
this._skewX = 0;
this._skewY = 0;
this._reverse = false;
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var actionBy = cc.skewBy(this._duration, this._skewX, this._skewY);
if (this._reverse == true) {
var actionByBack = actionBy.reverse();
node.runAction(cc.sequence(actionBy, actionByBack));
}
else {
node.runAction(actionBy);
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Duration") {
this._duration = subDict["value"];
continue;
}
if (key == "SkewX") {
this._skewX = subDict["value"];
continue;
}
if (key == "SkewY") {
this._skewY = subDict["value"];
}
}
},
removeAll: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
node.actionManager.removeAllActions();
}
});
var TriggerState = ccs.BaseTriggerAction.extend({
_id: -1,
_state: 0,
ctor: function () {
this._id = -1;
this._state = 0;
},
init: function () {
return true;
},
done: function () {
var obj = ccs.triggerManager.getTriggerObj(this._id);
if (obj) {
if (this._state == 0) {
obj.setEnable(false);
}
else if (this._state == 1) {
obj.setEnable(true);
}
else if (this._state == 2) {
ccs.triggerManager.removeTriggerObj(this._id);
}
}
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "ID") {
this._id = subDict["value"];
continue;
}
if (key == "State") {
this._state = subDict["value"];
}
}
},
removeAll: function () {
}
});
var ArmaturePlayAction = ccs.BaseTriggerAction.extend({
_tag: -1,
_comName: 0,
_aniName: "",
ctor: function () {
this._tag = -1;
this._comName = 0;
this._aniName = "";
},
init: function () {
return true;
},
done: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node)
return;
var render = node.getComponent(this._comName);
if (!render)
return;
var armature = render.getNode();
if (!armature)
return;
armature.getAnimation().play(this._aniName);
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "ID") {
this._id = subDict["value"];
continue;
}
if (key == "componentName") {
this._comName = subDict["value"];
continue;
}
if (key == "AnimationName") {
this._aniName = subDict["value"];
}
}
},
removeAll: function () {
}
});
ccs.registerTriggerClass("PlayMusic", PlayMusic);
ccs.registerTriggerClass("TMoveTo", TMoveTo);
ccs.registerTriggerClass("TMoveBy", TMoveBy);
ccs.registerTriggerClass("TRotateTo", TRotateTo);
ccs.registerTriggerClass("TRotateBy", TRotateBy);
ccs.registerTriggerClass("TScaleTo", TScaleTo);
ccs.registerTriggerClass("TScaleBy", TScaleBy);
ccs.registerTriggerClass("TSkewTo", TSkewTo);
ccs.registerTriggerClass("TSkewBy", TSkewBy);
ccs.registerTriggerClass("TriggerState", TriggerState);
ccs.registerTriggerClass("ArmaturePlayAction", ArmaturePlayAction);

View File

@ -1,245 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var TimeElapsed = ccs.BaseTriggerCondition.extend({
_totalTime: 0,
_tmpTime: 0,
_scheduler: null,
_success: false,
ctor: function () {
this._totalTime = 0;
this._tmpTime = 0;
this._scheduler = null;
this._success = false;
this._scheduler = cc.director.getScheduler();
},
init: function () {
this._scheduler.scheduleCallbackForTarget(this, this.update);
return true;
},
detect: function () {
return this._success;
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "TotalTime") {
this._totalTime = subDict["value"];
}
}
},
removeAll: function () {
this._scheduler.unscheduleUpdateForTarget(this);
},
update: function (dt) {
this._tmpTime += dt;
if (this._tmpTime > this._totalTime) {
this._tmpTime = 0.0;
this._success = true;
}
}
});
var ArmatureActionState = ccs.BaseTriggerCondition.extend({
_tag: -1,
_state: -1,
_success: false,
_aniName: "",
_comName: "",
_armature: null,
ctor: function () {
this._tag = -1;
this._state = -1;
this._success = false;
this._aniName = "";
this._comName = "";
this._armature = null;
},
init: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (!node) return false;
var render = node.getComponent(this._comName);
if (!render) return false;
var armature = render.getNode();
if (!armature) return false;
this._armature = armature;
ccs.triggerManager.addArmatureMovementCallBack(this._armature, this.animationEvent, this);
return true;
},
detect: function () {
return this._success;
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "TotalTime") {
this._totalTime = subDict["value"];
continue;
}
if (key == "componentName") {
this._comName = subDict["value"];
continue;
}
if (key == "AnimationName") {
this._aniName = subDict["value"];
continue;
}
if (key == "ActionType") {
this._state = subDict["value"];
}
}
},
removeAll: function () {
if (this._armature) {
ccs.triggerManager.removeArmatureMovementCallBack(this._armature, this.animationEvent, this);
}
},
animationEvent: function (armature, movementType, movementID) {
if (movementType == this._state && movementID == this._aniName) {
this._success = true;
}
}
});
var NodeInRect = ccs.BaseTriggerCondition.extend({
_tag: -1,
_origin: null,
_size: null,
ctor: function () {
this._tag = -1;
this._origin = null;
this._size = null;
this._origin = cc.p(0, 0);
this._size = cc.p(0, 0);
},
init: function () {
return true;
},
detect: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (node && Math.abs(node.x - this._origin.x) <= this._size.width && Math.abs(node.y - this._origin.y) <= this._size.height) {
return true;
}
return false;
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "originX") {
this._origin.x = subDict["value"];
continue;
}
if (key == "originY") {
this._origin.y = subDict["value"];
continue;
}
if (key == "originX") {
this._origin.x = subDict["value"];
continue;
}
if (key == "originY") {
this._origin.y = subDict["value"];
continue;
}
if (key == "sizeWidth") {
this._size.width = subDict["value"];
continue;
}
if (key == "sizeHeight") {
this._size.height = subDict["value"];
}
}
},
removeAll: function () {
}
});
var NodeVisible = ccs.BaseTriggerCondition.extend({
_tag: -1,
_visible: false,
cotr: function () {
this._tag = -1;
this._visible = false;
},
init: function () {
return true;
},
detect: function () {
var node = ccs.sceneReader.getNodeByTag(this._tag);
if (node && node.visible == this._visible) {
return true;
}
return false;
},
serialize: function (jsonVal) {
var dataitems = jsonVal["dataitems"] || [];
for (var i = 0; i < dataitems.length; i++) {
var subDict = dataitems[i];
var key = subDict["key"];
if (key == "Tag") {
this._tag = subDict["value"];
continue;
}
if (key == "Visible") {
this._visible = subDict["value"];
}
}
},
removeAll: function () {
}
});
ccs.registerTriggerClass("TimeElapsed", TimeElapsed);
ccs.registerTriggerClass("ArmatureActionState", ArmatureActionState);
ccs.registerTriggerClass("NodeInRect", NodeInRect);
ccs.registerTriggerClass("NodeVisible", NodeVisible);

View File

@ -1,33 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var TRIGGER_EVENT_ENTERSCENE = 0;
var TRIGGER_EVENT_LEAVESCENE = 1;
var TRIGGER_EVENT_INITSCENE = 2;
var TRIGGER_EVENT_UPDATESCENE = 3;
var TRIGGER_EVENT_TOUCHBEGAN = 4;
var TRIGGER_EVENT_TOUCHMOVED = 5;
var TRIGGER_EVENT_TOUCHENDED = 6;
var TRIGGER_EVENT_TOUCHCANCELLED = 7;

View File

@ -51,14 +51,8 @@ var UIMainLayer = cc.Layer.extend({
this.addChild(mainNode);
var widget;
if(cocoStudioOldApiFlag == 0){
var json = ccs.load("ccs-res/cocosui/UITest/UITest.json");
widget = json.node;
}
else{
//old api
widget = ccs.uiReader.widgetFromJsonFile("ccs-res/cocosui/UITest/UITest.json");
}
var json = ccs.load("ccs-res/cocosui/UITest/UITest.json");
widget = json.node;
mainNode.addChild(widget,-1);
this._sceneTitle = widget.getChildByName("UItest");

View File

@ -312,15 +312,6 @@ var testNames = [
return new CocosDenshionTestScene();
}
},
{
title:"CocoStudio Test",
resource:g_cocoStudio,
platforms: PLATFORM_ALL,
linksrc:"",
testScene:function () {
return new CocoStudioTestScene();
}
},
{
title:"Component Test",
platforms: PLATFORM_JSB,

View File

@ -75,41 +75,6 @@ var s_tcc_issue_2 = "animations/tcc_issue_2.png";
var s_tcc_issue_1_plist = "animations/tcc_issue_1.plist";
var s_tcc_issue_2_plist = "animations/tcc_issue_2.plist";
var s_Cowboy_json = "ccs-res/armature/Cowboy.ExportJson";
var s_Cowboy_plist = "ccs-res/armature/Cowboy0.plist";
var s_Cowboy_png = "ccs-res/armature/Cowboy0.png";
var s_hero_json = "ccs-res/armature/hero.ExportJson";
var s_hero0_plist = "ccs-res/armature/hero0.plist";
var s_hero0_png = "ccs-res/armature/hero0.png";
var s_horse_json = "ccs-res/armature/horse.ExportJson";
var s_horse0_plist = "ccs-res/armature/horse0.plist";
var s_horse0_png = "ccs-res/armature/horse0.png";
var s_bear_json = "ccs-res/armature/bear.ExportJson";
var s_bear0_plist = "ccs-res/armature/bear0.plist";
var s_bear0_png = "ccs-res/armature/bear0.png";
var s_blood_plist = "ccs-res/armature/blood.plist";
var s_HeroAnimation_json = "ccs-res/armature/HeroAnimation.ExportJson";
var s_HeroAnimation0_plist = "ccs-res/armature/HeroAnimation0.plist";
var s_HeroAnimation0_png = "ccs-res/armature/HeroAnimation0.png";
var s_cyborg_plist = "ccs-res/armature/cyborg.plist";
var s_cyborg_png = "ccs-res/armature/cyborg.png";
var s_cyborg_xml = "ccs-res/armature/cyborg.xml";
var s_Dragon_plist = "ccs-res/armature/Dragon.plist";
var s_Dragon_png = "ccs-res/armature/Dragon.png";
var s_Dragon_xml = "ccs-res/armature/Dragon.xml";
var s_knight_plist = "ccs-res/armature/knight.plist";
var s_knight_png = "ccs-res/armature/knight.png";
var s_knight_xml = "ccs-res/armature/knight.xml";
var s_robot_plist = "ccs-res/armature/robot.plist";
var s_robot_png = "ccs-res/armature/robot.png";
var s_robot_xml = "ccs-res/armature/robot.xml";
var s_weapon_plist = "ccs-res/armature/weapon.plist";
var s_weapon_png = "ccs-res/armature/weapon.png";
var s_weapon_xml = "ccs-res/armature/weapon.xml";
var s_testEasing_json = "ccs-res/armature/testEasing.ExportJson";
var s_testEasing0_plist = "ccs-res/armature/testEasing0.plist";
var s_testEasing0_png = "ccs-res/armature/testEasing0.png";
// Issue CustomIssueAnimationsWithOnlyOneFrame
var s_testIssueAnimationsWithOnlyOneFrame_json = "ccs-res/cocosui/CustomIssueAnimationsWithOnlyOneFrame/AnimationsWithOnlyOneFrame.json";
var s_testIssueAnimationsWithOnlyOneFrame_png = "ccs-res/cocosui/CustomIssueAnimationsWithOnlyOneFrame/TheDigitalSpell.png";
@ -563,366 +528,6 @@ var g_extensions = [
ccbjs + "ccb/animated-grossini.plist"
];
var g_cocoStudio = [
//Armature
s_Cowboy_json ,
s_Cowboy_plist,
s_Cowboy_png,
s_hero_json,
s_hero0_plist,
s_hero0_png,
s_horse_json,
s_horse0_plist,
s_horse0_png,
s_bear_json,
s_bear0_plist,
s_bear0_png,
s_blood_plist,
s_HeroAnimation_json,
s_HeroAnimation0_plist,
s_HeroAnimation0_png,
s_cyborg_plist ,
s_cyborg_png ,
s_cyborg_xml ,
s_Dragon_plist ,
s_Dragon_png ,
s_Dragon_xml ,
s_knight_plist ,
s_knight_png ,
s_knight_xml ,
s_robot_plist ,
s_robot_png ,
s_robot_xml ,
s_weapon_plist ,
s_weapon_png ,
s_weapon_xml ,
s_testEasing_json ,
s_testEasing0_plist ,
s_testEasing0_png ,
// Issue CustomIssueAnimationsWithOnlyOneFrame
s_testIssueAnimationsWithOnlyOneFrame_json ,
s_testIssueAnimationsWithOnlyOneFrame_png ,
//GUI
"Particles/SmallSun.plist",
"Images/b1.png",
"Images/b2.png",
"Images/f1.png",
"Images/f2.png",
"ccs-res/cocosui/UIEditorTest/UIButton/background.png",
"ccs-res/cocosui/UIEditorTest/UIButton/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIButton/buttonHighlighted.png",
"ccs-res/cocosui/UIEditorTest/UIButton/button_n.png",
"ccs-res/cocosui/UIEditorTest/UIButton/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIButton/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIButton/Button_1.json",
"ccs-res/cocosui/UIEditorTest/UICheckBox/background.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/selected01.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/selected02.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/checkbox_1.json",
"ccs-res/cocosui/UIEditorTest/UICheckBox/MainScene.json",
"ccs-res/cocosui/UIEditorTest/UICheckBox/Default/CheckBox_Disable.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/img/btn_music.png",
"ccs-res/cocosui/UIEditorTest/UICheckBox/img/btn_sound_off.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/background.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/buttonHighlighted.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIImageView/ImageView_1.json",
"ccs-res/cocosui/UIEditorTest/UILabelAtlas/background.png",
"ccs-res/cocosui/UIEditorTest/UILabelAtlas/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILabelAtlas/GUI/labelatlasimg.png",
"ccs-res/cocosui/UIEditorTest/UILabelAtlas/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILabelAtlas/labelatlas_1.json",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/background.png",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/GUI/missing-font.fnt",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/GUI/missing-font.png",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont/labelbmfont_1.json",
"ccs-res/cocosui/UIEditorTest/UILabel/background.png",
"ccs-res/cocosui/UIEditorTest/UILabel/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILabel/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILabel/label_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/Hello.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage/backgroundimage_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Color/color_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Layout/layout_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color/gradient_color_1.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Horizontal_Layout/linear_horizontal.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Linear_Vertical_Layout/linear_vertical.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Location/relative_align_location.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Relative_Align_Parent/relative_align_parent.json",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/background.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/button_n.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/button_p.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/selected01.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/selected02.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/slider_bar.png",
"ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage/scale9.json",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/background.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/GUI/button.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Horizontal/horizontal_1.json",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/background.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/GUI/button.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIListView/Vertical/vertical_1.json",
"ccs-res/cocosui/UIEditorTest/UILoadingBar/background.png",
"ccs-res/cocosui/UIEditorTest/UILoadingBar/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UILoadingBar/GUI/loadingbar.png",
"ccs-res/cocosui/UIEditorTest/UILoadingBar/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UILoadingBar/loadingbar_1.json",
"ccs-res/cocosui/UIEditorTest/UIPageView/background.png",
"ccs-res/cocosui/UIEditorTest/UIPageView/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIPageView/button_n.png",
"ccs-res/cocosui/UIEditorTest/UIPageView/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIPageView/pageview_1.json",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/background.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/button_n.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/selected01.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/selected02.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Both/both_1.json",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/background.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/button_n.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/selected01.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/selected02.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal/horizontal_1.json",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/background.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/button_n.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/button_p.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/GUI/image.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/selected01.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/selected02.png",
"ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical/vertical_1.json",
"ccs-res/cocosui/UIEditorTest/UISlider/background.png",
"ccs-res/cocosui/UIEditorTest/UISlider/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UISlider/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UISlider/silder_progressBar.png",
"ccs-res/cocosui/UIEditorTest/UISlider/slider_bar.png",
"ccs-res/cocosui/UIEditorTest/UISlider/slider_bar_button.png",
"ccs-res/cocosui/UIEditorTest/UISlider/slider_1.json",
"ccs-res/cocosui/UIEditorTest/UITextField/background.png",
"ccs-res/cocosui/UIEditorTest/UITextField/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UITextField/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UITextField/textfield_1.json",
"ccs-res/cocosui/UIEditorTest/UIWidgetAddNode/background.png",
"ccs-res/cocosui/UIEditorTest/UIWidgetAddNode/buttonBackground.png",
"ccs-res/cocosui/UIEditorTest/UIWidgetAddNode/ribbon.png",
"ccs-res/cocosui/UIEditorTest/UIWidgetAddNode/widget_add_node.json",
"background-music-aac.wav",
"pew-pew-lei.wav",
//Components
"components/Player.png",
"components/Projectile.png",
"components/Target.png",
//Scene
"ccs-res/scenetest/ArmatureComponentTest/ArmatureComponentTest.json",
"ccs-res/scenetest/ArmatureComponentTest/fishes/blowFish/Blowfish.ExportJson",
"ccs-res/scenetest/ArmatureComponentTest/fishes/blowFish/Blowfish0.plist",
"ccs-res/scenetest/ArmatureComponentTest/fishes/blowFish/Blowfish0.png",
"ccs-res/scenetest/ArmatureComponentTest/fishes/Butterflyfish/Butterflyfish.ExportJson",
"ccs-res/scenetest/ArmatureComponentTest/fishes/Butterflyfish/Butterflyfish0.plist",
"ccs-res/scenetest/ArmatureComponentTest/fishes/Butterflyfish/Butterflyfish0.png",
"ccs-res/scenetest/ArmatureComponentTest/Images/startMenuBG.png",
"ccs-res/scenetest/AttributeComponentTest/AttributeComponentTest.json",
"ccs-res/scenetest/AttributeComponentTest/grossinis_sister1.png",
"ccs-res/scenetest/AttributeComponentTest/grossinis_sister2.png",
"ccs-res/scenetest/AttributeComponentTest/PlayerAttribute.json",
"ccs-res/scenetest/BackgroundComponentTest/BackgroundComponentTest.json",
"ccs-res/scenetest/BackgroundComponentTest/Images/startMenuBG.png",
"ccs-res/scenetest/BackgroundComponentTest/Misc/music_logo.mp3",
"ccs-res/scenetest/BackgroundComponentTest/Misc/music_logo.wav",
"ccs-res/scenetest/BackgroundComponentTest/Particles/qipao01.plist",
"ccs-res/scenetest/BackgroundComponentTest/Particles/qipao01.png",
"ccs-res/scenetest/BackgroundComponentTest/startMenu/Fish_UI/starMenuButton01.png",
"ccs-res/scenetest/BackgroundComponentTest/startMenu/Fish_UI/starMenuButton02.png",
"ccs-res/scenetest/BackgroundComponentTest/startMenu/Fish_UI/ui_logo_001-hd.png",
"ccs-res/scenetest/BackgroundComponentTest/startMenu/startMenu_1.json",
"ccs-res/scenetest/EffectComponentTest/CowBoy/Cowboy.ExportJson",
"ccs-res/scenetest/EffectComponentTest/CowBoy/Cowboy0.plist",
"ccs-res/scenetest/EffectComponentTest/CowBoy/Cowboy0.png",
"ccs-res/scenetest/EffectComponentTest/EffectComponentTest.json",
"ccs-res/scenetest/EffectComponentTest/pew-pew-lei.wav",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/blowFish/Blowfish.ExportJson",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/blowFish/Blowfish0.plist",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/blowFish/Blowfish0.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/Butterflyfish/Butterflyfish.ExportJson",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/Butterflyfish/Butterflyfish0.plist",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/fishes/Butterflyfish/Butterflyfish0.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/FishJoy2.json",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/Images/startMenuBG.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/Misc/music_logo.mp3",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/Misc/music_logo.wav",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/Particles/qipao01.plist",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/Particles/qipao01.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/startMenu/Fish_UI/starMenuButton01.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/startMenu/Fish_UI/starMenuButton02.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/startMenu/Fish_UI/ui_logo_001-hd.png",
"ccs-res/scenetest/LoadSceneEdtiorFileTest/startMenu/startMenu_1.json",
"ccs-res/scenetest/ParticleComponentTest/ParticleComponentTest.json",
"ccs-res/scenetest/ParticleComponentTest/SmallSun.plist",
"ccs-res/scenetest/ParticleComponentTest/Upsidedown.plist",
"ccs-res/scenetest/SpriteComponentTest/grossinis_sister1.png",
"ccs-res/scenetest/SpriteComponentTest/grossinis_sister2.png",
"ccs-res/scenetest/SpriteComponentTest/SpriteComponentTest.json",
"ccs-res/scenetest/TmxMapComponentTest/iso-test.png",
"ccs-res/scenetest/TmxMapComponentTest/iso-test.tmx",
"ccs-res/scenetest/TmxMapComponentTest/TmxMapComponentTest.json",
"ccs-res/scenetest/TriggerTest/fishes/blowFish/Blowfish.ExportJson",
"ccs-res/scenetest/TriggerTest/fishes/blowFish/Blowfish0.plist",
"ccs-res/scenetest/TriggerTest/fishes/blowFish/Blowfish0.png",
"ccs-res/scenetest/TriggerTest/fishes/Butterflyfish/Butterflyfish.ExportJson",
"ccs-res/scenetest/TriggerTest/fishes/Butterflyfish/Butterflyfish0.plist",
"ccs-res/scenetest/TriggerTest/fishes/Butterflyfish/Butterflyfish0.png",
"ccs-res/scenetest/TriggerTest/Images/startMenuBG.png",
"ccs-res/scenetest/TriggerTest/TriggerTest.json",
"ccs-res/scenetest/UIComponentTest/fishes/blowFish/Blowfish.ExportJson",
"ccs-res/scenetest/UIComponentTest/fishes/blowFish/Blowfish0.plist",
"ccs-res/scenetest/UIComponentTest/fishes/blowFish/Blowfish0.png",
"ccs-res/scenetest/UIComponentTest/fishes/Butterflyfish/Butterflyfish.ExportJson",
"ccs-res/scenetest/UIComponentTest/fishes/Butterflyfish/Butterflyfish0.plist",
"ccs-res/scenetest/UIComponentTest/fishes/Butterflyfish/Butterflyfish0.png",
"ccs-res/scenetest/UIComponentTest/Images/startMenuBG.png",
"ccs-res/scenetest/UIComponentTest/starMenuButton/starMenuButton.ExportJson",
"ccs-res/scenetest/UIComponentTest/starMenuButton/starMenuButton0.plist",
"ccs-res/scenetest/UIComponentTest/starMenuButton/starMenuButton0.png",
"ccs-res/scenetest/UIComponentTest/UIComponentTest.json",
//parser
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.ExportJson",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_30.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_30.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/SmallSun.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/GUI/labelatlasimg.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/GUI/missing-font.fnt",
"ccs-res/cocosui/UIEditorTest/cocostudio1_3/GUI/missing-font.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.ExportJson",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_40.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_40.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/SmallSun.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/GUI/labelatlasimg.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/GUI/missing-font.fnt",
"ccs-res/cocosui/UIEditorTest/cocostudio1_4/GUI/missing-font.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.ExportJson",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_50.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_50.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/SmallSun.plist",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/GUI/labelatlasimg.png",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/GUI/missing-font.fnt",
"ccs-res/cocosui/UIEditorTest/cocostudio1_5/GUI/missing-font.png",
"ccs-res/cocosui/UIEditorTest/2.1/MainScene.json",
"ccs-res/cocosui/UIEditorTest/2.1/plist1/Plist.plist",
"ccs-res/cocosui/UIEditorTest/2.1/Plist/ui.plist",
"ccs-res/cocosui/UIEditorTest/2.1/LoadingBar/pipe2.png",
"ccs-res/cocosui/UIEditorTest/2.1/particle/blue.plist",
"ccs-res/cocosui/UIEditorTest/2.1/Default/Slider_Back.png",
"ccs-res/cocosui/UIEditorTest/2.1/Default/SliderNode_Normal.png",
"ccs-res/cocosui/UIEditorTest/2.1/Default/SliderNode_Press.png",
"ccs-res/cocosui/UIEditorTest/2.1/Default/SliderNode_Disable.png",
"ccs-res/cocosui/UIEditorTest/2.1/Default/Slider_PressBar.png",
"ccs-res/cocosui/UIEditorTest/2.1/Default/defaultParticle.plist",
"ccs-res/cocosui/UIEditorTest/2.1/Default/TextAtlas.png",
"ccs-res/cocosui/UIEditorTest/2.1/fonts_weapon_001-hd.png",
"ccs-res/cocosui/UIEditorTest/2.1/FNT/futura.fnt",
"ccs-res/cocosui/UIEditorTest/2.1/Default/defaultBMFont.fnt",
"ccs-res/cocosui/UIEditorTest/2.1/FNT/Heiti18.fnt",
"Particles/BoilingFoam.plist",
"ccs-res/cocosui/CustomImageViewTest/NewProject_2_1.ExportJson",
"ccs-res/cocosui/CustomImageViewTest/NewProject_20.plist",
"ccs-res/cocosui/CustomImageViewTest/NewProject_20.png",
"ActionTimeline/DemoPlayer_skeleton.json"
];
var g_ui = [
"ccs-res/cocosui/switch-mask.png",
"ccs-res/cocosui/animationbuttonnormal.png",
@ -942,10 +547,10 @@ var g_ui = [
"ccs-res/cocosui/check_box_normal.png",
"ccs-res/cocosui/check_box_normal_disable.png",
"ccs-res/cocosui/check_box_normal_press.png",
"ccs-res/cocosui/CloseNormal.png",
s_pathClose,
"ccs-res/cocosui/CloseSelected.png",
"ccs-res/cocosui/green_edit.png",
"ccs-res/cocosui/grossini-aliases.png",
s_grossini_aliases,
"ccs-res/cocosui/Hello.png",
"ccs-res/cocosui/labelatlas.png",
"ccs-res/cocosui/loadingbar.png",
@ -1104,13 +709,6 @@ var g_spine = [
"spine/goblins-ffd.json"
];
var g_ccs2 = [
"ActionTimeline/boy_1.csb",
"ActionTimeline/armature/Cowboy0.plist",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.fnt",
"ccs-res/cocosui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png"
];
if (!cc.sys.isNative) {
var res = res || {};
res.CCControlColourPickerSpriteSheet_plist = "extensions/CCControlColourPickerSpriteSheet.plist";