Merge pull request #9371 from samuele3hu/v3_cocostudio

[ci skip]Update CocoStudioActionTimelineTest for Lua
This commit is contained in:
minggo 2014-12-04 15:24:17 +08:00
commit 10aa9ade99
2 changed files with 17 additions and 20 deletions

View File

@ -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,
}

View File

@ -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)