var MainScene = function(){};
MainScene.prototype.onDidLoadFromCCB = function()
{
cc.log("加载成功");
this._uiLayer = ccs.UILayer.create();
this.rootNode.addChild(this._uiLayer);
this._widget = ccs.GUIReader.getInstance().widgetFromJsonFile("res/MenuUI_1.json");
this._uiLayer.addWidget(this._widget);
//获取点击按钮
var button = this._uiLayer.getWidgetByName("Button_23");
//设置按钮点击事件响应
button.addTouchEventListener(this.touchEvent,this);
};
// 点击button事件
MainScene.prototype.touchEvent = function (sender, type) {
switch (type) {
case ccs.TouchEventType.began:
ccs.ActionManager.getInstance().playActionByName("MenuUI_1.json","Animation0");
break;
default:
break;
}
}
MainScene.prototype.next = function()
{
var sp = cc.Sprite.create("01.png");
sp.setPosition(300,300);
this.rootNode.addChild(sp);
cc.log("按住nextbtn");
this.ttt();
// 启动定时器
//this.rootNode.schedule(this.ttt,1)
};
MainScene.prototype.ttt = function()
{
//cc.log("定时器1")
ccs.ActionManager.getInstance().playActionByName("MenuUI_1.json","Animation0");
};
-----------------------------------------————————————————执行动画——————————————————————————————————————————
var s_Dragon_plist = "res/Dragon.plist";
var s_Dragon_png = "res/Dragon.png";
var s_Dragon_xml = "res/Dragon.xml";
var s_Cowboy_json = "res/Cowboy.ExportJson";
var s_Cowboy_plist = "res/Cowboy0.plist";
var s_Cowboy_png = "res/Cowboy0.png";
var ArmatureTestLayer = cc.Layer.extend({
ctor:function () {
this._super();
cc.associateWithNative( this, cc.Layer );
ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(s_Cowboy_json);
var armature = ccs.Armature.create("Cowboy");
//armature.getAnimation().playWithIndex(0);
armature.getAnimation().play("FireWithoutBullet");
armature.getAnimation().setSpeedScale(0.4);
armature.setScale(0.6);
armature.setAnchorPoint(0.5, 0.5);
armature.setPosition(300, 300);
this.addChild(armature);
// ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(s_Dragon_png, s_Dragon_plist, s_Dragon_xml);
// var armature = ccs.Armature.create("Dragon");
// armature.getAnimation().playWithIndex(0);
// //armature.getAnimation().play("Dragon");
// armature.getAnimation().setSpeedScale(0.4);
// armature.setScale(0.6);
// armature.setAnchorPoint(0.5, 0.5);
// armature.setPosition(300, 300);
// this.addChild(armature);
}
});