From 781afbec3ff05ca1293b364d1489c9bbb1efc924 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 4 Dec 2014 15:14:19 +0800 Subject: [PATCH] Update CocoStudioActionTimelineTest --- .../CocoStudioActionTimelineTest.lua | 35 ++++++++----------- tests/lua-tests/src/controller.lua | 2 ++ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua index d02fdfa330..bf40597fca 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua @@ -5,8 +5,8 @@ local TimelineTestIndex = { TEST_ACTION_TIMELINE = 1, TEST_CHANGE_PLAY_SECTION = 2, - TEST_TIMELINE_FRAME_EVENT = 3, - TEST_TIMELINE_PERFORMACE = 4, + --TEST_TIMELINE_FRAME_EVENT = 3, + TEST_TIMELINE_PERFORMACE = 3, } local timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE @@ -62,8 +62,8 @@ function TimelineTestLayer.title(idx) return "Test ActionTimeline" elseif TimelineTestIndex.TEST_CHANGE_PLAY_SECTION == idx then return "Test Change Play Section" - elseif TimelineTestIndex.TEST_TIMELINE_FRAME_EVENT == idx then - return "Test Frame Event" + -- elseif TimelineTestIndex.TEST_TIMELINE_FRAME_EVENT == idx then + -- return "Test Frame Event" elseif TimelineTestIndex.TEST_TIMELINE_PERFORMACE == idx then return "Test ActionTimeline performance" end @@ -158,7 +158,6 @@ function TimelineTestLayer:createToExtensionMenu() end function TimelineTestLayer:creatTitleAndSubTitle(idx) - print("set title") local title = cc.Label:createWithTTF(TimelineTestLayer.title(idx), "fonts/Thonburi.ttf", 18) title:setColor(cc.c3b(255,0,0)) self:addChild(title, 1, 10000) @@ -186,16 +185,14 @@ function TestActionTimeline.extend(target) end function TestActionTimeline:onEnter() - cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png") - - local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb") - local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb") + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb") node:runAction(action) - action:gotoFrameAndPlay(0, 60, true) + action:gotoFrameAndPlay(0, 40, true) node:setScale(0.2) - node:setPosition(150, 100) + node:setPosition(VisibleRect:center()) self:addChild(node) end @@ -239,16 +236,15 @@ function TestChangePlaySection.extend(target) end function TestChangePlaySection:onEnter() - cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png") - local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb") - local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb") + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb") node:runAction(action) - action:gotoFrameAndPlay(70, action:getDuration(), true) + action:gotoFrameAndPlay(41, action:getDuration(), true) node:setScale(0.2) - node:setPosition(150, 100) + node:setPosition(VisibleRect:center()) local function onTouchesEnded(touches, event) if action:getStartFrame() == 0 then @@ -374,11 +370,10 @@ function TestTimelinePerformance.extend(target) end function TestTimelinePerformance:onEnter() - cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png") for i = 1,100 do - local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb") - local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb") + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb") node:runAction(action) action:gotoFrameAndPlay(70, action:getDuration(), true) @@ -418,7 +413,7 @@ local actionlineSceneArr = { TestActionTimeline.create, TestChangePlaySection.create, - TestTimelineFrameEvent.create, + --TestTimelineFrameEvent.create, TestTimelinePerformance.create, } diff --git a/tests/lua-tests/src/controller.lua b/tests/lua-tests/src/controller.lua index 7bb0d8cfa5..04fc48dd54 100644 --- a/tests/lua-tests/src/controller.lua +++ b/tests/lua-tests/src/controller.lua @@ -54,6 +54,7 @@ local function addSearchPath(resPrefix, height) table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TmxMapComponentTest") table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/UIComponentTest") table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TriggerTest") + table.insert(searchPaths, 1, resPrefix .. "hd/ActionTimeline") else table.insert(searchPaths, 1, resPrefix .. "ccs-res/Images") table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ArmatureComponentTest") @@ -66,6 +67,7 @@ local function addSearchPath(resPrefix, height) table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TmxMapComponentTest") table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/UIComponentTest") table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TriggerTest") + table.insert(searchPaths, 1, resPrefix .. "ActionTimeline") end fileUtils:setSearchPaths(searchPaths)