mirror of https://github.com/axmolengine/axmol.git
remove studio related test cases
This commit is contained in:
parent
6b9c76fd93
commit
359fdb92f2
|
@ -1,751 +0,0 @@
|
|||
local itemTagBasic = 1000
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local TimelineTestIndex =
|
||||
{
|
||||
TEST_ACTION_TIMELINE = 1,
|
||||
TEST_CHANGE_PLAY_SECTION = 2,
|
||||
TEST_TIMELINE_FRAME_EVENT = 3,
|
||||
TEST_TIMELINE_PERFORMACE = 4,
|
||||
TEST_TIMELINE_ANIMATION_LIST = 5,
|
||||
TEST_TIMELINE_PROJECT_NODE = 6,
|
||||
TEST_PROJECT_NODE_FOR_SIMULATOR = 7,
|
||||
TEST_TIMELINE_NODE_LOADED_CALLBACK = 8,
|
||||
TEST_ACTION_TIMELINE_EASE = 9,
|
||||
}
|
||||
local timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE
|
||||
|
||||
local TimelineTestScene = class("TimelineTestScene")
|
||||
TimelineTestScene.__index = TimelineTestScene
|
||||
|
||||
function TimelineTestScene.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TimelineTestScene)
|
||||
return target
|
||||
end
|
||||
|
||||
function TimelineTestScene:runThisTest()
|
||||
timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE
|
||||
self:addChild(restartTimelineTest())
|
||||
end
|
||||
|
||||
function TimelineTestScene.create()
|
||||
local scene = TimelineTestScene.extend(cc.Scene:create())
|
||||
local bg = cc.Sprite:create("armature/bg.jpg")
|
||||
bg:setPosition(VisibleRect:center())
|
||||
|
||||
local scaleX = VisibleRect:getVisibleRect().width / bg:getContentSize().width
|
||||
local scaleY = VisibleRect:getVisibleRect().height / bg:getContentSize().height
|
||||
|
||||
bg:setScaleX(scaleX)
|
||||
bg:setScaleY(scaleY)
|
||||
|
||||
scene:addChild(bg)
|
||||
return scene
|
||||
end
|
||||
|
||||
function TimelineTestScene.toMainMenuCallback()
|
||||
|
||||
end
|
||||
|
||||
local TimelineTestLayer = class("TimelineTestLayer")
|
||||
TimelineTestLayer.__index = TimelineTestLayer
|
||||
TimelineTestLayer._backItem = nil
|
||||
TimelineTestLayer._restarItem = nil
|
||||
TimelineTestLayer._nextItem = nil
|
||||
|
||||
function TimelineTestLayer:onEnter()
|
||||
|
||||
end
|
||||
|
||||
function TimelineTestLayer.title(idx)
|
||||
if TimelineTestIndex.TEST_ACTION_TIMELINE == idx then
|
||||
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_PERFORMACE == idx then
|
||||
return "Test ActionTimeline performance"
|
||||
elseif TimelineTestIndex.TEST_ACTION_TIMELINE_EASE == idx then
|
||||
return "Test ActionTimelineEase"
|
||||
elseif TimelineTestIndex.TEST_TIMELINE_ANIMATION_LIST == idx then
|
||||
return "Test ActionTimeline AnimationList"
|
||||
elseif TimelineTestIndex.TEST_TIMELINE_PROJECT_NODE == idx then
|
||||
return "Test ActionTimeline ProjectNode"
|
||||
elseif TimelineTestIndex.TEST_PROJECT_NODE_FOR_SIMULATOR == idx then
|
||||
return "Test ProjectNode for Simalator"
|
||||
elseif TimelineTestIndex.TEST_TIMELINE_NODE_LOADED_CALLBACK == idx then
|
||||
return "Test node loaded call back"
|
||||
end
|
||||
end
|
||||
|
||||
function TimelineTestLayer.subTitle(idx)
|
||||
if TimelineTestIndex.TEST_ACTION_TIMELINE == idx then
|
||||
return ""
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
function TimelineTestLayer.create()
|
||||
local layer = TimelineTestLayer.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
function TimelineTestLayer.backCallback()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(backTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTestLayer.restartCallback()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTestLayer.nextCallback()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(nextTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTestLayer:createMenu()
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
self._backItem:registerScriptTapHandler(self.backCallback)
|
||||
menu:addChild(self._backItem,itemTagBasic)
|
||||
self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
self._restarItem:registerScriptTapHandler(self.restartCallback)
|
||||
menu:addChild(self._restarItem,itemTagBasic)
|
||||
self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
self._nextItem:registerScriptTapHandler(self.nextCallback)
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2))
|
||||
self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
|
||||
self:addChild(menu)
|
||||
end
|
||||
|
||||
function TimelineTestLayer.toExtensionMenu()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local scene = CocoStudioTestMain()
|
||||
if scene ~= nil then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
|
||||
function TimelineTestLayer:createToExtensionMenu()
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
menuItemFont:registerScriptTapHandler(TimelineTestLayer.toExtensionMenu)
|
||||
|
||||
local backMenu = cc.Menu:create()
|
||||
backMenu:addChild(menuItemFont)
|
||||
backMenu:setPosition(cc.p(0, 0))
|
||||
self:addChild(backMenu,10)
|
||||
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)
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
local subTitle = nil
|
||||
if "" ~= TimelineTestLayer.subTitle(idx) then
|
||||
local subTitle = cc.Label:createWithTTF(TimelineTestLayer.subTitle(idx), "fonts/Thonburi.ttf", 18)
|
||||
subTitle:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(subTitle, 1, 10001)
|
||||
subTitle:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 60) )
|
||||
end
|
||||
end
|
||||
|
||||
local TestActionTimeline = class("TestActionTimeline",TimelineTestLayer)
|
||||
TestActionTimeline.__index = TestActionTimeline
|
||||
|
||||
function TestActionTimeline.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestActionTimeline)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestActionTimeline:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestActionTimeline.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestActionTimeline.create()
|
||||
local layer = TestActionTimeline.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestChangePlaySection = class("TestChangePlaySection",TimelineTestLayer)
|
||||
TestChangePlaySection.__index = TestChangePlaySection
|
||||
|
||||
function TestChangePlaySection.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestChangePlaySection)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestChangePlaySection:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(41)
|
||||
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
action:addAnimationInfo(ccs.AnimationInfo("stand", 0 , 40))
|
||||
action:addAnimationInfo(ccs.AnimationInfo("walk", 41 , 81))
|
||||
action:addAnimationInfo(ccs.AnimationInfo("killall", 174, 249))
|
||||
|
||||
assert(action:IsAnimationInfoExists("stand") == true, "stand animation didn't exist")
|
||||
action:play("stand", true)
|
||||
assert(action:getAnimationInfo("stand").endIndex == 40, "endIndex of animationInfo is not 40")
|
||||
action:removeAnimationInfo("stand")
|
||||
assert(action:IsAnimationInfoExists("stand") == false, "stand animation has already existed")
|
||||
|
||||
local function onTouchesEnded(touches, event)
|
||||
if action:getStartFrame() == 0 then
|
||||
action:gotoFrameAndPlay(41, 81, true)
|
||||
else
|
||||
action:gotoFrameAndPlay(0, 40, true)
|
||||
end
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED )
|
||||
|
||||
local eventDispatcher = self:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestChangePlaySection.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestChangePlaySection.create()
|
||||
local layer = TestChangePlaySection.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestTimelineFrameEvent = class("TestTimelineFrameEvent",TimelineTestLayer)
|
||||
TestTimelineFrameEvent.__index = TestTimelineFrameEvent
|
||||
|
||||
function TestTimelineFrameEvent.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineFrameEvent)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
self:addChild(node)
|
||||
|
||||
local function onFrameEvent(frame)
|
||||
if nil == frame then
|
||||
return
|
||||
end
|
||||
|
||||
local str = frame:getEvent()
|
||||
|
||||
if str == "changeColor" then
|
||||
frame:getNode():setColor(cc.c3b(0, 0, 0))
|
||||
elseif(str == "endChangeColor") then
|
||||
frame:getNode():setColor(cc.c3b(255,255,255))
|
||||
end
|
||||
end
|
||||
|
||||
action:setFrameEventCallFunc(onFrameEvent)
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent.create()
|
||||
local layer = TestTimelineFrameEvent.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestTimelinePerformance = class("TestTimelinePerformance",TimelineTestLayer)
|
||||
TestTimelinePerformance.__index = TestTimelinePerformance
|
||||
|
||||
function TestTimelinePerformance.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelinePerformance)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelinePerformance:onEnter()
|
||||
|
||||
for i = 1,100 do
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(41)
|
||||
|
||||
node:setScale(0.1)
|
||||
node:setPosition((i - 1) * 2, 100)
|
||||
self:addChild(node)
|
||||
end
|
||||
end
|
||||
|
||||
function TestTimelinePerformance.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelinePerformance.create()
|
||||
local layer = TestTimelinePerformance.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineAnimationList
|
||||
-------------------------------------------
|
||||
local TestTimelineAnimationList = class("TestTimelineAnimationList",TimelineTestLayer)
|
||||
TestTimelineAnimationList.__index = TestTimelineAnimationList
|
||||
|
||||
function TestTimelineAnimationList.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineAnimationList)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
local standInfo = ccs.AnimationInfo("stand", 0, 40)
|
||||
local walkInfo = ccs.AnimationInfo("walk", 41, 81)
|
||||
action:addAnimationInfo(standInfo)
|
||||
action:addAnimationInfo(walkInfo)
|
||||
node:runAction(action)
|
||||
action:play("walk", true)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(150,100)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList.create()
|
||||
local layer = TestTimelineAnimationList.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineProjectNode
|
||||
-------------------------------------------
|
||||
local TestTimelineProjectNode = class("TestTimelineProjectNode",TimelineTestLayer)
|
||||
TestTimelineProjectNode.__index = TestTimelineProjectNode
|
||||
|
||||
function TestTimelineProjectNode.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineProjectNode)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/TestAnimation.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/TestAnimation.csb")
|
||||
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0, true)
|
||||
|
||||
node:setPosition(-300, -300)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode.create()
|
||||
local layer = TestTimelineProjectNode.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
---TestProjectNodeForSimulator
|
||||
-------------------------------------------
|
||||
local TestProjectNodeForSimulator = class("TestProjectNodeForSimulator",TimelineTestLayer)
|
||||
TestProjectNodeForSimulator.__index = TestProjectNodeForSimulator
|
||||
|
||||
function TestProjectNodeForSimulator.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestProjectNodeForSimulator)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator:onEnter()
|
||||
local node = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd")
|
||||
local action = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd")
|
||||
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0, true)
|
||||
|
||||
node:setPosition(-300, -300)
|
||||
self:addChild(node)
|
||||
|
||||
--test for when ProjectNode file lost
|
||||
local lackProjectNodefileNode = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd")
|
||||
local lackProjectNodefileAction = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd")
|
||||
lackProjectNodefileNode:runAction(lackProjectNodefileAction)
|
||||
lackProjectNodefileAction:gotoFrameAndPlay(0)
|
||||
self:addChild(lackProjectNodefileNode)
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator.create()
|
||||
local layer = TestProjectNodeForSimulator.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineNodeLoadedCallback
|
||||
-------------------------------------------
|
||||
local TestTimelineNodeLoadedCallback = class("TestTimelineNodeLoadedCallback",TimelineTestLayer)
|
||||
TestTimelineNodeLoadedCallback.__index = TestTimelineNodeLoadedCallback
|
||||
|
||||
function TestTimelineNodeLoadedCallback.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineNodeLoadedCallback)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb", function(object)
|
||||
if nil ~= object then
|
||||
print("object type is ", tolua.type(object))
|
||||
print("node name = ",object:getName())
|
||||
print("node parent name = ", object:getParent():getName())
|
||||
end
|
||||
end)
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback.create()
|
||||
local layer = TestTimelineNodeLoadedCallback.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestActionTimelineEase
|
||||
-------------------------------------------
|
||||
local TestActionTimelineEase = class("TestActionTimelineEase",TimelineTestLayer)
|
||||
TestActionTimelineEase.__index = TestActionTimelineEase
|
||||
|
||||
function TestActionTimelineEase.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestActionTimelineEase)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestActionTimelineEase:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/ActionTimelineEase.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/ActionTimelineEase.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestActionTimelineEase.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTestScene.create()
|
||||
newScene:addChild(restartTimelineTest())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestActionTimelineEase.create()
|
||||
local layer = TestActionTimelineEase.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local actionlineSceneArr =
|
||||
{
|
||||
TestActionTimeline.create,
|
||||
TestChangePlaySection.create,
|
||||
TestTimelineFrameEvent.create,
|
||||
TestTimelinePerformance.create,
|
||||
TestTimelineAnimationList.create,
|
||||
TestTimelineProjectNode.create,
|
||||
TestProjectNodeForSimulator.create,
|
||||
TestTimelineNodeLoadedCallback.create,
|
||||
TestActionTimelineEase.create,
|
||||
}
|
||||
|
||||
function nextTimelineTest()
|
||||
timelineSceneIdx = timelineSceneIdx + 1
|
||||
timelineSceneIdx = timelineSceneIdx % table.getn(actionlineSceneArr)
|
||||
if 0 == timelineSceneIdx then
|
||||
timelineSceneIdx = table.getn(actionlineSceneArr)
|
||||
end
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function backTimelineTest()
|
||||
timelineSceneIdx = timelineSceneIdx - 1
|
||||
if timelineSceneIdx <= 0 then
|
||||
timelineSceneIdx = timelineSceneIdx + table.getn(actionlineSceneArr)
|
||||
end
|
||||
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function restartTimelineTest()
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function runCocoStudioActionTimelineTestScene()
|
||||
local scene = TimelineTestScene.create()
|
||||
scene:runThisTest()
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
|
@ -1,726 +0,0 @@
|
|||
|
||||
local itemTagBasic = 1000
|
||||
local timelineSceneIdx = 1
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
|
||||
local TimelineTest2Scene = class("TimelineTest2Scene")
|
||||
TimelineTest2Scene.__index = TimelineTest2Scene
|
||||
|
||||
function TimelineTest2Scene.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TimelineTest2Scene)
|
||||
return target
|
||||
end
|
||||
|
||||
function TimelineTest2Scene:runThisTest()
|
||||
timelineSceneIdx = 1
|
||||
self:addChild(restartTimelineTest2())
|
||||
end
|
||||
|
||||
function TimelineTest2Scene.create()
|
||||
local scene = TimelineTest2Scene.extend(cc.Scene:create())
|
||||
local bg = cc.Sprite:create("armature/bg.jpg")
|
||||
bg:setPosition(VisibleRect:center())
|
||||
|
||||
local scaleX = VisibleRect:getVisibleRect().width / bg:getContentSize().width
|
||||
local scaleY = VisibleRect:getVisibleRect().height / bg:getContentSize().height
|
||||
|
||||
bg:setScaleX(scaleX)
|
||||
bg:setScaleY(scaleY)
|
||||
|
||||
scene:addChild(bg)
|
||||
return scene
|
||||
end
|
||||
|
||||
function TimelineTest2Scene.toMainMenuCallback()
|
||||
|
||||
end
|
||||
|
||||
local TimelineTest2Layer = class("TimelineTest2Layer")
|
||||
TimelineTest2Layer.__index = TimelineTest2Layer
|
||||
TimelineTest2Layer._backItem = nil
|
||||
TimelineTest2Layer._restarItem = nil
|
||||
TimelineTest2Layer._nextItem = nil
|
||||
|
||||
function TimelineTest2Layer:onEnter()
|
||||
|
||||
end
|
||||
|
||||
local _titles = {
|
||||
"debug",
|
||||
"change animation",
|
||||
"AnimationList: walk",
|
||||
"AnimationList: stand",
|
||||
}
|
||||
|
||||
function TimelineTest2Layer.title(idx)
|
||||
return _titles[idx] or "";
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.subTitle(idx)
|
||||
return ""
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.create()
|
||||
local layer = TimelineTest2Layer.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.backCallback()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(backTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.restartCallback()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.nextCallback()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(nextTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TimelineTest2Layer:createMenu()
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
self._backItem:registerScriptTapHandler(self.backCallback)
|
||||
menu:addChild(self._backItem,itemTagBasic)
|
||||
self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
self._restarItem:registerScriptTapHandler(self.restartCallback)
|
||||
menu:addChild(self._restarItem,itemTagBasic)
|
||||
self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
self._nextItem:registerScriptTapHandler(self.nextCallback)
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2))
|
||||
self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
|
||||
self:addChild(menu)
|
||||
end
|
||||
|
||||
function TimelineTest2Layer.toExtensionMenu()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local scene = CocoStudioTestMain()
|
||||
if scene ~= nil then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
|
||||
function TimelineTest2Layer:createToExtensionMenu()
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
menuItemFont:registerScriptTapHandler(TimelineTest2Layer.toExtensionMenu)
|
||||
|
||||
local backMenu = cc.Menu:create()
|
||||
backMenu:addChild(menuItemFont)
|
||||
backMenu:setPosition(cc.p(0, 0))
|
||||
self:addChild(backMenu,10)
|
||||
end
|
||||
|
||||
function TimelineTest2Layer:creatTitleAndSubTitle(idx)
|
||||
print("set title")
|
||||
local title = cc.Label:createWithTTF(TimelineTest2Layer.title(idx), "fonts/Thonburi.ttf", 18)
|
||||
title:setColor(cc.c3b(255,0,0))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
local subTitle = nil
|
||||
if "" ~= TimelineTest2Layer.subTitle(idx) then
|
||||
local subTitle = cc.Label:createWithTTF(TimelineTest2Layer.subTitle(idx), "fonts/Thonburi.ttf", 18)
|
||||
subTitle:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(subTitle, 1, 10001)
|
||||
subTitle:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 60) )
|
||||
end
|
||||
end
|
||||
|
||||
local TestActionTimeline = class("TestActionTimeline",TimelineTest2Layer)
|
||||
TestActionTimeline.__index = TestActionTimeline
|
||||
|
||||
function TestActionTimeline.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestActionTimeline)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestActionTimeline:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestActionTimeline.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestActionTimeline.create()
|
||||
local layer = TestActionTimeline.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestChangePlaySection = class("TestChangePlaySection",TimelineTest2Layer)
|
||||
TestChangePlaySection.__index = TestChangePlaySection
|
||||
|
||||
function TestChangePlaySection.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestChangePlaySection)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestChangePlaySection:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(41)
|
||||
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
action:addAnimationInfo(ccs.AnimationInfo("stand", 0 , 40))
|
||||
action:addAnimationInfo(ccs.AnimationInfo("walk", 41 , 81))
|
||||
action:addAnimationInfo(ccs.AnimationInfo("killall", 174, 249))
|
||||
|
||||
assert(action:IsAnimationInfoExists("stand") == true, "stand animation didn't exist")
|
||||
action:play("stand", true)
|
||||
assert(action:getAnimationInfo("stand").endIndex == 40, "endIndex of animationInfo is not 40")
|
||||
action:removeAnimationInfo("stand")
|
||||
assert(action:IsAnimationInfoExists("stand") == false, "stand animation has already existed")
|
||||
|
||||
local function onTouchesEnded(touches, event)
|
||||
if action:getStartFrame() == 0 then
|
||||
action:gotoFrameAndPlay(41, 81, true)
|
||||
else
|
||||
action:gotoFrameAndPlay(0, 40, true)
|
||||
end
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED )
|
||||
|
||||
local eventDispatcher = self:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestChangePlaySection.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestChangePlaySection.create()
|
||||
local layer = TestChangePlaySection.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestTimelineFrameEvent = class("TestTimelineFrameEvent",TimelineTest2Layer)
|
||||
TestTimelineFrameEvent.__index = TestTimelineFrameEvent
|
||||
|
||||
function TestTimelineFrameEvent.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineFrameEvent)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent:onEnter()
|
||||
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
self:addChild(node)
|
||||
|
||||
local function onFrameEvent(frame)
|
||||
if nil == frame then
|
||||
return
|
||||
end
|
||||
|
||||
local str = frame:getEvent()
|
||||
|
||||
if str == "changeColor" then
|
||||
frame:getNode():setColor(cc.c3b(0, 0, 0))
|
||||
elseif(str == "endChangeColor") then
|
||||
frame:getNode():setColor(cc.c3b(255,255,255))
|
||||
end
|
||||
end
|
||||
|
||||
action:setFrameEventCallFunc(onFrameEvent)
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineFrameEvent.create()
|
||||
local layer = TestTimelineFrameEvent.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestTimelinePerformance = class("TestTimelinePerformance",TimelineTest2Layer)
|
||||
TestTimelinePerformance.__index = TestTimelinePerformance
|
||||
|
||||
function TestTimelinePerformance.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelinePerformance)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelinePerformance:onEnter()
|
||||
|
||||
for i = 1,100 do
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(41)
|
||||
|
||||
node:setScale(0.1)
|
||||
node:setPosition((i - 1) * 2, 100)
|
||||
self:addChild(node)
|
||||
end
|
||||
end
|
||||
|
||||
function TestTimelinePerformance.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelinePerformance.create()
|
||||
local layer = TestTimelinePerformance.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineAnimationList
|
||||
-------------------------------------------
|
||||
local TestTimelineAnimationList = class("TestTimelineAnimationList",TimelineTest2Layer)
|
||||
TestTimelineAnimationList.__index = TestTimelineAnimationList
|
||||
|
||||
function TestTimelineAnimationList.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineAnimationList)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
local standInfo = ccs.AnimationInfo("stand", 0, 40)
|
||||
local walkInfo = ccs.AnimationInfo("walk", 41, 81)
|
||||
action:addAnimationInfo(standInfo)
|
||||
action:addAnimationInfo(walkInfo)
|
||||
node:runAction(action)
|
||||
action:play("walk", true)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(150,100)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineAnimationList.create()
|
||||
local layer = TestTimelineAnimationList.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineProjectNode
|
||||
-------------------------------------------
|
||||
local TestTimelineProjectNode = class("TestTimelineProjectNode",TimelineTest2Layer)
|
||||
TestTimelineProjectNode.__index = TestTimelineProjectNode
|
||||
|
||||
function TestTimelineProjectNode.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineProjectNode)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/TestAnimation.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/TestAnimation.csb")
|
||||
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0, true)
|
||||
|
||||
node:setPosition(-300, -300)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineProjectNode.create()
|
||||
local layer = TestTimelineProjectNode.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
---TestProjectNodeForSimulator
|
||||
-------------------------------------------
|
||||
local TestProjectNodeForSimulator = class("TestProjectNodeForSimulator",TimelineTest2Layer)
|
||||
TestProjectNodeForSimulator.__index = TestProjectNodeForSimulator
|
||||
|
||||
function TestProjectNodeForSimulator.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestProjectNodeForSimulator)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator:onEnter()
|
||||
local node = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd")
|
||||
local action = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd")
|
||||
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0, true)
|
||||
|
||||
node:setPosition(-300, -300)
|
||||
self:addChild(node)
|
||||
|
||||
--test for when ProjectNode file lost
|
||||
local lackProjectNodefileNode = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd")
|
||||
local lackProjectNodefileAction = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd")
|
||||
lackProjectNodefileNode:runAction(lackProjectNodefileAction)
|
||||
lackProjectNodefileAction:gotoFrameAndPlay(0)
|
||||
self:addChild(lackProjectNodefileNode)
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestProjectNodeForSimulator.create()
|
||||
local layer = TestProjectNodeForSimulator.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestTimelineNodeLoadedCallback
|
||||
-------------------------------------------
|
||||
local TestTimelineNodeLoadedCallback = class("TestTimelineNodeLoadedCallback",TimelineTest2Layer)
|
||||
TestTimelineNodeLoadedCallback.__index = TestTimelineNodeLoadedCallback
|
||||
|
||||
function TestTimelineNodeLoadedCallback.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestTimelineNodeLoadedCallback)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb", function(object)
|
||||
if nil ~= object then
|
||||
print("object type is ", tolua.type(object))
|
||||
print("node name = ",object:getName())
|
||||
print("node parent name = ", object:getParent():getName())
|
||||
end
|
||||
end)
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
|
||||
node:setScale(0.2)
|
||||
node:setPosition(VisibleRect:center())
|
||||
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestTimelineNodeLoadedCallback.create()
|
||||
local layer = TestTimelineNodeLoadedCallback.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------------
|
||||
---TestActionTimelineEase
|
||||
-------------------------------------------
|
||||
local TestActionTimelineEase = class("TestActionTimelineEase",TimelineTest2Layer)
|
||||
TestActionTimelineEase.__index = TestActionTimelineEase
|
||||
|
||||
function TestActionTimelineEase.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TestActionTimelineEase)
|
||||
return target
|
||||
end
|
||||
|
||||
function TestActionTimelineEase:onEnter()
|
||||
local node = cc.CSLoader:createNode("ActionTimeline/ActionTimelineEase.csb")
|
||||
local action = cc.CSLoader:createTimeline("ActionTimeline/ActionTimelineEase.csb")
|
||||
node:runAction(action)
|
||||
action:gotoFrameAndPlay(0)
|
||||
self:addChild(node)
|
||||
end
|
||||
|
||||
function TestActionTimelineEase.restartCallback()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
local newScene = TimelineTest2Scene.create()
|
||||
newScene:addChild(restartTimelineTest2())
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
function TestActionTimelineEase.create()
|
||||
local layer = TestActionTimelineEase.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(timelineSceneIdx)
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local actionlineSceneArr =
|
||||
{
|
||||
TestActionTimeline.create,
|
||||
TestChangePlaySection.create,
|
||||
TestTimelineFrameEvent.create,
|
||||
TestTimelinePerformance.create,
|
||||
TestTimelineAnimationList.create,
|
||||
TestTimelineProjectNode.create,
|
||||
TestProjectNodeForSimulator.create,
|
||||
TestTimelineNodeLoadedCallback.create,
|
||||
TestActionTimelineEase.create,
|
||||
}
|
||||
|
||||
function nextTimelineTest2()
|
||||
timelineSceneIdx = timelineSceneIdx + 1
|
||||
timelineSceneIdx = timelineSceneIdx % table.getn(actionlineSceneArr)
|
||||
if 0 == timelineSceneIdx then
|
||||
timelineSceneIdx = table.getn(actionlineSceneArr)
|
||||
end
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function backTimelineTest2()
|
||||
timelineSceneIdx = timelineSceneIdx - 1
|
||||
if timelineSceneIdx <= 0 then
|
||||
timelineSceneIdx = timelineSceneIdx + table.getn(actionlineSceneArr)
|
||||
end
|
||||
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function restartTimelineTest2()
|
||||
return actionlineSceneArr[timelineSceneIdx]()
|
||||
end
|
||||
|
||||
function runCocoStudioActionTimelineTest2Scene()
|
||||
local scene = TimelineTest2Scene.create()
|
||||
scene:runThisTest()
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,929 +0,0 @@
|
|||
require "CocoStudioTest/CocoStudioSceneTest/TriggerCode/acts"
|
||||
require "CocoStudioTest/CocoStudioSceneTest/TriggerCode/cons"
|
||||
require "CocoStudioTest/CocoStudioSceneTest/TriggerCode/eventDef"
|
||||
|
||||
local itemTagBasic = 1000
|
||||
|
||||
local sceneEditorTestIdx = 1
|
||||
|
||||
local SceneEditorTestLayer = class("SceneEditorTestLayer")
|
||||
SceneEditorTestLayer.__index = SceneEditorTestLayer
|
||||
SceneEditorTestLayer._backItem = nil
|
||||
SceneEditorTestLayer._restarItem = nil
|
||||
SceneEditorTestLayer._nextItem = nil
|
||||
SceneEditorTestLayer.title =
|
||||
{
|
||||
"loadSceneEdtiorFile Test",
|
||||
"Sprite Component Test",
|
||||
"Armature Component Test",
|
||||
"UI Component Test",
|
||||
"TmxMap Component Test",
|
||||
"Particle Component Test",
|
||||
"Effect Component Test",
|
||||
"Background Component Test",
|
||||
"Attribute Component Test",
|
||||
"Trigger Test",
|
||||
}
|
||||
|
||||
SceneEditorTestLayer.loadtypeStr=
|
||||
{
|
||||
"change to load \nwith binary file",
|
||||
"change to load \nwith json file"
|
||||
}
|
||||
|
||||
SceneEditorTestLayer.fileName = ""
|
||||
SceneEditorTestLayer.rootNode = nil
|
||||
|
||||
function SceneEditorTestLayer.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, SceneEditorTestLayer)
|
||||
return target
|
||||
end
|
||||
|
||||
|
||||
function SceneEditorTestLayer:onEnter()
|
||||
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:onExit()
|
||||
ccs.TriggerMng.destroyInstance()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
ccs.SceneReader:destroyInstance()
|
||||
ccs.ActionManagerEx:destroyInstance()
|
||||
ccs.GUIReader:destroyInstance()
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer.create()
|
||||
local layer = SceneEditorTestLayer.extend(cc.Layer:create())
|
||||
if nil ~= layer then
|
||||
layer:createTitle()
|
||||
layer:createMenu()
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:createTitle()
|
||||
local title = cc.Label:createWithTTF(self.title[sceneEditorTestIdx], s_arialPath, 18)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
title:setColor(cc.c3b(255, 255, 255))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:loadFileChangeHelper(filePathName)
|
||||
local indexTable = {}
|
||||
local index = 0
|
||||
|
||||
while true do
|
||||
index = string.find(filePathName, "%.", index + 1)
|
||||
if nil == index then
|
||||
break
|
||||
end
|
||||
|
||||
indexTable[#indexTable + 1] = index
|
||||
end
|
||||
|
||||
if #indexTable == 0 then
|
||||
return filePathName
|
||||
end
|
||||
|
||||
local lastIndex = indexTable[#indexTable]
|
||||
if lastIndex == 1 then
|
||||
return filePathName
|
||||
end
|
||||
local renamePathName= string.sub(filePathName, 1, lastIndex - 1)
|
||||
|
||||
if self.isCsbLoad then
|
||||
renamePathName = renamePathName .. ".csb"
|
||||
else
|
||||
renamePathName = renamePathName .. ".json"
|
||||
end
|
||||
print("renamePath is", renamePathName)
|
||||
return renamePathName
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:defaultPlay()
|
||||
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:createMenu()
|
||||
local menu = cc.Menu:create()
|
||||
local function pre()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(backSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function restart()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(restartSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function next()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(nextSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
self._backItem:registerScriptTapHandler(pre)
|
||||
self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
self._restarItem:registerScriptTapHandler(restart)
|
||||
self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
self._nextItem:registerScriptTapHandler(next)
|
||||
|
||||
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2))
|
||||
self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
|
||||
menu:addChild(self._backItem,itemTagBasic)
|
||||
menu:addChild(self._restarItem,itemTagBasic)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
menu:setPosition(cc.p(0,0))
|
||||
self:addChild(menu, 100)
|
||||
|
||||
local function back()
|
||||
local scene = CocoStudioTestMain()
|
||||
if nil ~= scene then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
|
||||
self.isCsbLoad = false
|
||||
self.loadtypeLabel = cc.Label:createWithSystemFont(self.loadtypeStr[1], "Arial", 12)
|
||||
local function changeLoadTypeCallback(tag,sender)
|
||||
self.isCsbLoad = not self.isCsbLoad
|
||||
if self.isCsbLoad then
|
||||
self.loadtypeLabel:setString(self.loadtypeStr[2])
|
||||
else
|
||||
self.loadtypeLabel:setString(self.loadtypeStr[1])
|
||||
end
|
||||
|
||||
if sceneEditorTestIdx == #SceneEditorTestLayer.title then
|
||||
ccs.TriggerMng.getInstance():removeAll()
|
||||
end
|
||||
|
||||
SceneEditorTestLayer.fileName = self:loadFileChangeHelper(SceneEditorTestLayer.fileName)
|
||||
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
self:removeChild(SceneEditorTestLayer.rootNode, true)
|
||||
SceneEditorTestLayer.rootNode = ccs.SceneReader:getInstance():createNodeWithSceneFile(SceneEditorTestLayer.fileName)
|
||||
if SceneEditorTestLayer.rootNode == nil then
|
||||
return
|
||||
end
|
||||
self:defaultPlay()
|
||||
self:addChild(SceneEditorTestLayer.rootNode, 0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local loadTypeItem = cc.MenuItemLabel:create(self.loadtypeLabel)
|
||||
loadTypeItem:registerScriptTapHandler(changeLoadTypeCallback)
|
||||
local loadtypeMenu = cc.Menu:create()
|
||||
loadtypeMenu:addChild(loadTypeItem)
|
||||
loadtypeMenu:setPosition(cc.p(0,0))
|
||||
loadTypeItem:setPosition(cc.p(VisibleRect:rightTop().x -80,VisibleRect:rightTop().y -30))
|
||||
self:addChild(loadtypeMenu, 100)
|
||||
|
||||
local backMenu = cc.Menu:create()
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
menuItemFont:registerScriptTapHandler(back)
|
||||
|
||||
backMenu:addChild(menuItemFont)
|
||||
backMenu:setPosition(cc.p(0, 0))
|
||||
self:addChild(backMenu,10)
|
||||
end
|
||||
|
||||
local LoadSceneEdtiorFileTest = class("LoadSceneEdtiorFileTest",SceneEditorTestLayer)
|
||||
LoadSceneEdtiorFileTest.__index = LoadSceneEdtiorFileTest
|
||||
|
||||
function LoadSceneEdtiorFileTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, LoadSceneEdtiorFileTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/LoadSceneEdtiorFileTest/FishJoy2.json")
|
||||
SceneEditorTestLayer.fileName = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
self:defaultPlay()
|
||||
return node
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest:defaultPlay()
|
||||
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest.create()
|
||||
local layer = LoadSceneEdtiorFileTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local SpriteComponentTest = class("SpriteComponentTest",SceneEditorTestLayer)
|
||||
SpriteComponentTest.__index = SpriteComponentTest
|
||||
|
||||
function SpriteComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, SpriteComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function SpriteComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/SpriteComponentTest/SpriteComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/SpriteComponentTest/SpriteComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function SpriteComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function SpriteComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local action1 = cc.Blink:create(2, 10)
|
||||
local action2 = cc.Blink:create(2, 5)
|
||||
|
||||
local sister1 = SceneEditorTestLayer.rootNode:getChildByTag(10003):getComponent("CCSprite")
|
||||
sister1:getNode():runAction(action1)
|
||||
local sister2 = SceneEditorTestLayer.rootNode:getChildByTag(10004):getComponent("CCSprite")
|
||||
sister2:getNode():runAction(action2)
|
||||
end
|
||||
end
|
||||
|
||||
function SpriteComponentTest.create()
|
||||
local layer = SpriteComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local ArmatureComponentTest = class("ArmatureComponentTest",SceneEditorTestLayer)
|
||||
ArmatureComponentTest.__index = ArmatureComponentTest
|
||||
|
||||
function ArmatureComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, ArmatureComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function ArmatureComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ArmatureComponentTest/ArmatureComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/ArmatureComponentTest/ArmatureComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function ArmatureComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootName ~= nil then
|
||||
local blowFish = node:getChildByTag(10007):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = node:getChildByTag(10008):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
end
|
||||
|
||||
function ArmatureComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ArmatureComponentTest.create()
|
||||
local layer = ArmatureComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local UIComponentTest = class("UIComponentTest",SceneEditorTestLayer)
|
||||
UIComponentTest.__index = UIComponentTest
|
||||
|
||||
function UIComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, UIComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function UIComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/UIComponentTest/UIComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/UIComponentTest/UIComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function UIComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local render = SceneEditorTestLayer.rootNode:getChildByTag(10025):getComponent("GUIComponent")
|
||||
local widget = render:getNode()
|
||||
local button = widget:getChildByName("Button_156")
|
||||
local function onTouch(sender, eventType)
|
||||
if eventType == ccui.TouchEventType.began then
|
||||
local blowFish = SceneEditorTestLayer.rootNode:getChildByTag(10010):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = SceneEditorTestLayer.rootNode:getChildByTag(10011):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
end
|
||||
|
||||
button:addTouchEventListener(onTouch)
|
||||
end
|
||||
end
|
||||
|
||||
function UIComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function UIComponentTest.create()
|
||||
local layer = UIComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TmxMapComponentTest = class("TmxMapComponentTest",SceneEditorTestLayer)
|
||||
TmxMapComponentTest.__index = TmxMapComponentTest
|
||||
|
||||
function TmxMapComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TmxMapComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function TmxMapComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TmxMapComponentTest/TmxMapComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/TmxMapComponentTest/TmxMapComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function TmxMapComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local tmxMap = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCTMXTiledMap")
|
||||
local actionTo = cc.SkewTo:create(2, 0.0, 2.0)
|
||||
local rotateTo = cc.RotateTo:create(2, 61.0)
|
||||
local actionScaleTo = cc.ScaleTo:create(2, -0.44, 0.47)
|
||||
|
||||
local actionScaleToBack = cc.ScaleTo:create(2, 1.0, 1.0)
|
||||
local rotateToBack = cc.RotateTo:create(2, 0)
|
||||
local actionToBack = cc.SkewTo:create(2, 0, 0)
|
||||
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(actionTo, actionToBack))
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(rotateTo, rotateToBack))
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(actionScaleTo, actionScaleToBack))
|
||||
end
|
||||
end
|
||||
|
||||
function TmxMapComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function TmxMapComponentTest.create()
|
||||
local layer = TmxMapComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local ParticleComponentTest = class("ParticleComponentTest",SceneEditorTestLayer)
|
||||
ParticleComponentTest.__index = ParticleComponentTest
|
||||
|
||||
function ParticleComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, ParticleComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function ParticleComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ParticleComponentTest/ParticleComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/ParticleComponentTest/ParticleComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function ParticleComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local particle = SceneEditorTestLayer.rootNode:getChildByTag(10020):getComponent("CCParticleSystemQuad")
|
||||
local jump = cc.JumpBy:create(5, cc.p(-500,0), 50, 4)
|
||||
local action = cc.Sequence:create( jump, jump:reverse())
|
||||
particle:getNode():runAction(action)
|
||||
end
|
||||
end
|
||||
|
||||
function ParticleComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ParticleComponentTest.create()
|
||||
local layer = ParticleComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local EffectComponentTest = class("EffectComponentTest",SceneEditorTestLayer)
|
||||
EffectComponentTest.__index = EffectComponentTest
|
||||
|
||||
function EffectComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, EffectComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function EffectComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/EffectComponentTest/EffectComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/EffectComponentTest/EffectComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function EffectComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local render = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCArmature")
|
||||
local armature = render:getNode()
|
||||
local function animationEvent(armatureBack,movementType,movementID)
|
||||
local id = movementID
|
||||
if movementType == ccs.MovementEventType.loopComplete then
|
||||
if id == "Fire" then
|
||||
local audio = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCComAudio")
|
||||
audio:playEffect()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
armature:getAnimation():setMovementEventCallFunc(animationEvent)
|
||||
end
|
||||
end
|
||||
|
||||
function EffectComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EffectComponentTest.create()
|
||||
local layer = EffectComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local BackgroundComponentTest = class("BackgroundComponentTest",SceneEditorTestLayer)
|
||||
BackgroundComponentTest.__index = BackgroundComponentTest
|
||||
|
||||
function BackgroundComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, BackgroundComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function BackgroundComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/BackgroundComponentTest/BackgroundComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/BackgroundComponentTest/BackgroundComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function BackgroundComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local audio = SceneEditorTestLayer.rootNode:getComponent("CCBackgroundAudio")
|
||||
audio:playBackgroundMusic()
|
||||
end
|
||||
end
|
||||
|
||||
function BackgroundComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function BackgroundComponentTest.create()
|
||||
local layer = BackgroundComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local AttributeComponentTest = class("AttributeComponentTest",SceneEditorTestLayer)
|
||||
AttributeComponentTest.__index = AttributeComponentTest
|
||||
|
||||
function AttributeComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, AttributeComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function AttributeComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/AttributeComponentTest/AttributeComponentTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/AttributeComponentTest/AttributeComponentTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
self:defaultPlay()
|
||||
end
|
||||
return node
|
||||
end
|
||||
|
||||
function AttributeComponentTest:defaultPlay()
|
||||
if SceneEditorTestLayer.rootNode ~= nil then
|
||||
local attribute = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCComAttribute")
|
||||
print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP")))
|
||||
end
|
||||
end
|
||||
|
||||
function AttributeComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function AttributeComponentTest.create()
|
||||
local layer = AttributeComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TriggerTest = class("TriggerTest",SceneEditorTestLayer)
|
||||
TriggerTest.__index = TriggerTest
|
||||
TriggerTest._touchListener = nil
|
||||
|
||||
function TriggerTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TriggerTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function TriggerTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TriggerTest/TriggerTest.json")
|
||||
if nil ~= node then
|
||||
SceneEditorTestLayer.fileName = "scenetest/TriggerTest/TriggerTest.json"
|
||||
SceneEditorTestLayer.rootNode = node
|
||||
|
||||
self:defaultPlay()
|
||||
end
|
||||
return node
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchBegan(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHBEGAN)
|
||||
return true
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchMoved(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHMOVED)
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchEnded(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHENDED)
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchCancelled(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHCANCELLED)
|
||||
end
|
||||
|
||||
function TriggerTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
local function onTouchEvent(touch, event)
|
||||
if eventType == "began" then
|
||||
return self:onTouchBegan(touch, event)
|
||||
elseif eventType == "moved" then
|
||||
self:onTouchMoved(touch, event)
|
||||
elseif eventType == "ended" then
|
||||
self:onTouchEnded(touch, event)
|
||||
elseif eventType == "cancelled" then
|
||||
self:onTouchCancelled(touch, event)
|
||||
end
|
||||
end
|
||||
self._touchListener = nil
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:setSwallowTouches(true)
|
||||
listener:registerScriptHandler(self.onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(self.onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
listener:registerScriptHandler(self.onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED )
|
||||
listener:registerScriptHandler(self.onTouchCancelled,cc.Handler.EVENT_TOUCH_CANCELLED )
|
||||
local eventDispatcher = self:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
|
||||
self._touchListener = listener
|
||||
|
||||
self:unscheduleUpdate()
|
||||
local function update(dt)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE)
|
||||
end
|
||||
self:scheduleUpdateWithPriorityLua(update,0)
|
||||
end
|
||||
end
|
||||
|
||||
function TriggerTest:defaultPlay()
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE)
|
||||
end
|
||||
|
||||
function TriggerTest:onExit()
|
||||
self:unscheduleUpdate()
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_LEAVESCENE)
|
||||
local dispatcher = self:getEventDispatcher()
|
||||
dispatcher:removeEventListener(self._touchListener)
|
||||
self._touchListener = nil
|
||||
ccs.TriggerMng.destroyInstance()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
ccs.SceneReader:destroyInstance()
|
||||
ccs.ActionManagerEx:destroyInstance()
|
||||
ccs.GUIReader:destroyInstance()
|
||||
end
|
||||
|
||||
function TriggerTest.create()
|
||||
local layer = TriggerTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local createSceneEditorTest =
|
||||
{
|
||||
LoadSceneEdtiorFileTest.create,
|
||||
SpriteComponentTest.create,
|
||||
ArmatureComponentTest.create,
|
||||
UIComponentTest.create,
|
||||
TmxMapComponentTest.create,
|
||||
ParticleComponentTest.create,
|
||||
EffectComponentTest.create,
|
||||
BackgroundComponentTest.create,
|
||||
AttributeComponentTest.create,
|
||||
TriggerTest.create,
|
||||
}
|
||||
|
||||
function nextSceneEditorTest( )
|
||||
sceneEditorTestIdx = sceneEditorTestIdx + 1
|
||||
sceneEditorTestIdx = sceneEditorTestIdx % table.getn(createSceneEditorTest)
|
||||
|
||||
if 0 == sceneEditorTestIdx then
|
||||
sceneEditorTestIdx = table.getn(createSceneEditorTest)
|
||||
end
|
||||
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function backSceneEditorTest()
|
||||
sceneEditorTestIdx = sceneEditorTestIdx - 1
|
||||
if sceneEditorTestIdx <= 0 then
|
||||
sceneEditorTestIdx = sceneEditorTestIdx + table.getn(createSceneEditorTest)
|
||||
end
|
||||
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function restartSceneEditorTest()
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function runCocosSceneTestScene()
|
||||
local scene = cc.Scene:create()
|
||||
sceneEditorTestIdx = 1
|
||||
scene:addChild(restartSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
|
@ -1,170 +0,0 @@
|
|||
local TMoveBy = class("TMoveBy")
|
||||
TMoveBy._tag = -1
|
||||
TMoveBy._duration = 0
|
||||
TMoveBy._x = 0
|
||||
TMoveBy._y = 0
|
||||
TMoveBy._reverse = false
|
||||
function TMoveBy:ctor()
|
||||
self._tag = -1
|
||||
self._duration = 0.0
|
||||
self._x = 0
|
||||
self._y = 0
|
||||
self._reverse = false
|
||||
end
|
||||
|
||||
function TMoveBy:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TMoveBy:done()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil == node then
|
||||
return
|
||||
end
|
||||
local actionBy = cc.MoveBy:create(self._duration, cc.p(self._x, self._y))
|
||||
if nil == actionBy then
|
||||
return
|
||||
end
|
||||
|
||||
if true == self._reverse then
|
||||
local actionByBack = actionBy:reverse()
|
||||
node:runAction(cc.Sequence:create(actionBy, actionByBack))
|
||||
else
|
||||
node:runAction(actionBy)
|
||||
end
|
||||
end
|
||||
|
||||
function TMoveBy:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "Duration" then
|
||||
self._duration = subDict["value"]
|
||||
elseif key == "x" then
|
||||
self._x = subDict["value"]
|
||||
elseif key == "y" then
|
||||
self._y = subDict["value"]
|
||||
elseif key == "IsReverse" then
|
||||
self._reverse = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TMoveBy:removeAll()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
node:getActionManager():removeAllActions()
|
||||
print("TMoveBy::removeAll")
|
||||
end
|
||||
|
||||
local TScaleTo = class("TScaleTo")
|
||||
TScaleTo._tag = -1
|
||||
TScaleTo._duration = 0
|
||||
TScaleTo._scaleX = 0
|
||||
TScaleTo._scaleY = 0
|
||||
|
||||
function TScaleTo:ctor()
|
||||
self._tag = -1
|
||||
self._duration = 0
|
||||
self._scaleX = 0
|
||||
self._scaleY = 0
|
||||
end
|
||||
|
||||
function TScaleTo:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TScaleTo:done()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil == node then
|
||||
return
|
||||
end
|
||||
|
||||
local actionTo = cc.ScaleTo:create(self._duration, self._scaleX, self._scaleY)
|
||||
if nil == actionTo then
|
||||
return
|
||||
end
|
||||
|
||||
node:runAction(actionTo)
|
||||
end
|
||||
|
||||
function TScaleTo:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "Duration" then
|
||||
self._duration = subDict["value"]
|
||||
elseif key == "ScaleX" then
|
||||
self._scaleX = subDict["value"]
|
||||
elseif key == "ScaleY" then
|
||||
self._scaleY = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TScaleTo:removeAll()
|
||||
print("TScaleTo::removeAll")
|
||||
end
|
||||
|
||||
|
||||
local TriggerState = class("TriggerState")
|
||||
TriggerState._id = -1
|
||||
TriggerState._state = 0
|
||||
|
||||
function TriggerState:ctor()
|
||||
self._id = -1
|
||||
self._state = 0
|
||||
end
|
||||
|
||||
function TriggerState:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TriggerState:done()
|
||||
local obj = ccs.TriggerMng.getInstance():getTriggerObj(self._id)
|
||||
if nil ~= obj then
|
||||
if self._state == 0 then
|
||||
obj:setEnable(false)
|
||||
elseif self._state == 1 then
|
||||
obj:setEnable(true)
|
||||
elseif self._state == 2 then
|
||||
ccs.TriggerMng.getInstance():removeTriggerObj(self._id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TriggerState:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "ID" then
|
||||
self._id = subDict["value"]
|
||||
elseif key == "State" then
|
||||
self._state = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TriggerState:removeAll()
|
||||
print("TriggerState::removeAll")
|
||||
end
|
||||
|
||||
|
||||
ccs.registerTriggerClass("TScaleTo",TScaleTo.new)
|
||||
ccs.registerTriggerClass("TMoveBy",TMoveBy.new)
|
||||
ccs.registerTriggerClass("TriggerState",TriggerState.new)
|
|
@ -1,53 +0,0 @@
|
|||
local NodeInRect = class("NodeInRect")
|
||||
NodeInRect._tag = -1
|
||||
NodeInRect._origin = nil
|
||||
NodeInRect._size = nil
|
||||
|
||||
function NodeInRect:ctor()
|
||||
self._tag = -1
|
||||
self._origin = nil
|
||||
self._size = nil
|
||||
self._origin = cc.p(0, 0)
|
||||
self._size = cc.size(0, 0)
|
||||
end
|
||||
|
||||
function NodeInRect:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function NodeInRect:detect()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil ~= node and math.abs(node:getPositionX() - self._origin.x) <= self._size.width and math.abs(node:getPositionY() - self._origin.y) <= self._size.height then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function NodeInRect:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "originX" then
|
||||
self._origin.x = subDict["value"]
|
||||
elseif key == "originY" then
|
||||
self._origin.y = subDict["value"]
|
||||
elseif key == "sizeWidth" then
|
||||
self._size.width = subDict["value"]
|
||||
elseif key == "sizeHeight" then
|
||||
self._size.height = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function NodeInRect:removeAll()
|
||||
print("NodeInRect::removeAll")
|
||||
end
|
||||
|
||||
ccs.registerTriggerClass("NodeInRect",NodeInRect.new)
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
triggerEventDef =
|
||||
{
|
||||
TRIGGEREVENT_ENTERSCENE = 0,
|
||||
TRIGGEREVENT_LEAVESCENE = 1,
|
||||
TRIGGEREVENT_INITSCENE = 2,
|
||||
TRIGGEREVENT_UPDATESCENE = 3,
|
||||
TRIGGEREVENT_TOUCHBEGAN = 4,
|
||||
TRIGGEREVENT_TOUCHMOVED = 5,
|
||||
TRIGGEREVENT_TOUCHENDED = 6,
|
||||
TRIGGEREVENT_TOUCHCANCELLED = 7,
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
require "CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest"
|
||||
require "CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest"
|
||||
require "CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest"
|
||||
require "CocoStudioTest/CocoStudioUIEditorTest/CocoStudioUIEditorTest"
|
||||
require "CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest"
|
||||
require "CocoStudioTest/CocoStudioActionTimelineTest2/CocoStudioActionTimelineTest2"
|
||||
|
||||
local LINE_SPACE = 40
|
||||
local ITEM_TAG_BASIC = 1000
|
||||
|
||||
local cocoStudioTestItemNames =
|
||||
{
|
||||
{
|
||||
itemTitle = "CocoStudioArmatureTest",
|
||||
testScene = function ()
|
||||
runArmatureTestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioGUITest",
|
||||
testScene = function ()
|
||||
runCocosGUITestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioSceneTest",
|
||||
testScene = function ()
|
||||
runCocosSceneTestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioUIEditorTest",
|
||||
testScene = function()
|
||||
runCocoStudioUIEditorTestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioActionTimelineTest",
|
||||
testScene = function()
|
||||
runCocoStudioActionTimelineTestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioActionTimelineTest2",
|
||||
testScene = function()
|
||||
runCocoStudioActionTimelineTest2Scene()
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
local CocoStudioTestScene = class("CocoStudioTestScene")
|
||||
CocoStudioTestScene.__index = CocoStudioTestScene
|
||||
|
||||
function CocoStudioTestScene.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, CocoStudioTestScene)
|
||||
return target
|
||||
end
|
||||
|
||||
function CocoStudioTestScene:runThisTest()
|
||||
|
||||
--armatureSceneIdx = ArmatureTestIndex.TEST_COCOSTUDIO_WITH_SKELETON
|
||||
--self:addChild(restartArmatureTest())
|
||||
end
|
||||
|
||||
function CocoStudioTestScene.create()
|
||||
local scene = CocoStudioTestScene.extend(cc.Scene:create())
|
||||
return scene
|
||||
end
|
||||
|
||||
local CocoStudioTestLayer = class("CocoStudioTestLayer")
|
||||
CocoStudioTestLayer.__index = CocoStudioTestLayer
|
||||
|
||||
function CocoStudioTestLayer.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, CocoStudioTestLayer)
|
||||
return target
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer.onMenuCallback(tag,sender)
|
||||
local index = sender:getLocalZOrder() - ITEM_TAG_BASIC
|
||||
cocoStudioTestItemNames[index].testScene()
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer:createMenu()
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:setPosition(cc.p(0,0))
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
|
||||
for i = 1, table.getn(cocoStudioTestItemNames) do
|
||||
local menuItem = cc.MenuItemFont:create(cocoStudioTestItemNames[i].itemTitle)
|
||||
menuItem:setPosition(cc.p(winSize.width / 2, winSize.height - (i + 1) * LINE_SPACE))
|
||||
menuItem:registerScriptTapHandler(CocoStudioTestLayer.onMenuCallback)
|
||||
menu:addChild(menuItem, ITEM_TAG_BASIC + i)
|
||||
end
|
||||
|
||||
self:addChild(menu)
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer.create()
|
||||
local layer = CocoStudioTestLayer.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
--CocoStudio Test
|
||||
-------------------------------------
|
||||
function CocoStudioTestMain()
|
||||
local newScene = CocoStudioTestScene.create()
|
||||
newScene:addChild(CreateBackMenuItem())
|
||||
newScene:addChild(CocoStudioTestLayer.create())
|
||||
newScene:runThisTest()
|
||||
return newScene
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -1,111 +0,0 @@
|
|||
----------------------------------------
|
||||
----CSNode3DTest
|
||||
----------------------------------------
|
||||
|
||||
local CSNode3DTest = {}
|
||||
CSNode3DTest.__index = CSNode3DTest
|
||||
|
||||
function CSNode3DTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("Node3DReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("ccs-res/scene3DTest/Node3D.csb");
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
local label = cc.LabelTTF:create("Function demo, no content to show", "Arial", 24)
|
||||
label:setPosition( cc.p(size.width / 2, size.height / 2) )
|
||||
label:setColor(cc.c3b(255, 127, 0))
|
||||
node:addChild(label);
|
||||
|
||||
layer:addChild(node);
|
||||
|
||||
return layer;
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
----CSSprite3DTest
|
||||
----------------------------------------
|
||||
|
||||
local CSSprite3DTest = {}
|
||||
CSSprite3DTest.__index = CSSprite3DTest
|
||||
|
||||
function CSSprite3DTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("Sprite3DReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("ccs-res/scene3DTest/Sprite3D.csb")
|
||||
|
||||
local sprite3D = node:getChildByTag(8)
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
|
||||
sprite3D:setPosition(size.width / 2, size.height / 2 - 50)
|
||||
sprite3D:setColor(cc.c3b(255, 255, 255))
|
||||
sprite3D:setOpacity(255)
|
||||
|
||||
layer:addChild(node)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
----CSUserCameraTest
|
||||
----------------------------------------
|
||||
|
||||
local CSUserCameraTest = {}
|
||||
CSUserCameraTest.__index = CSUserCameraTest
|
||||
|
||||
function CSUserCameraTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("UserCameraReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("ccs-res/scene3DTest/UserCamera.csb")
|
||||
|
||||
local sprite3D = cc.Sprite3D:create("ccs-res/scene3DTest/dragon/dragon.c3b")
|
||||
sprite3D:setPosition3D(cc.vec3(100, 95, 80))
|
||||
sprite3D:setCameraMask(cc.CameraFlag.USER1)
|
||||
|
||||
layer:addChild(node)
|
||||
layer:addChild(sprite3D)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
----CSParticle3DTest
|
||||
----------------------------------------
|
||||
|
||||
local CSParticle3DTest = {}
|
||||
CSParticle3DTest.__index = CSParticle3DTest
|
||||
|
||||
function CSParticle3DTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("Particle3DReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("ccs-res/scene3DTest/Particle3D.csb")
|
||||
|
||||
layer:addChild(node)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
function CocosStudio3DTest()
|
||||
cc.FileUtils:getInstance():addSearchPath("ccs-res/scene3DTest")
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable =
|
||||
{
|
||||
CSNode3DTest.create,
|
||||
CSSprite3DTest.create,
|
||||
CSUserCameraTest.create,
|
||||
CSParticle3DTest.create
|
||||
}
|
||||
|
||||
scene:addChild(CSNode3DTest.create())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
return scene
|
||||
end
|
|
@ -43,75 +43,6 @@ local function addSearchPath(resPrefix, height)
|
|||
table.insert(searchPaths, 1, resPrefix .. "hd")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/Images")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ArmatureComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/AttributeComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/BackgroundComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/EffectComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/LoadSceneEdtiorFileTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ParticleComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/SpriteComponentTest")
|
||||
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 .. "ccs-res/hd/cocosui/UIEditorTest/UIButton")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UICheckBox")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIImageView")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILabel")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILabelBMFont")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/BackgroundImage")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/Color")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/Layout")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/Gradient_Color")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILayout/LayoutComponent")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UILoadingBar")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIPageView")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Both")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Horizontal")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Vertical")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UISlider")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UITextField")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIWidgetAddNode")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/cocosui/UIEditorTest/UIListView/New")
|
||||
|
||||
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")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/AttributeComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/BackgroundComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/EffectComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/LoadSceneEdtiorFileTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ParticleComponentTest")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/SpriteComponentTest")
|
||||
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 .. "ccs-res/cocosui/UIEditorTest/UIButton")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UICheckBox")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIImageView")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILabel")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILabelBMFont")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/BackgroundImage")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/Color")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/Layout")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/Gradient_Color")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/Scale9_BackgroundImage")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILayout/LayoutComponent")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UILoadingBar")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIPageView")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIScrollView/Both")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UISlider")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UITextField")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIWidgetAddNode")
|
||||
table.insert(searchPaths, 1, resPrefix .. "ccs-res/cocosui/UIEditorTest/UIListView/New")
|
||||
|
||||
table.insert(searchPaths, 1, resPrefix .. "ActionTimeline")
|
||||
end
|
||||
|
||||
fileUtils:setSearchPaths(searchPaths)
|
||||
|
@ -119,7 +50,6 @@ local function addSearchPath(resPrefix, height)
|
|||
end
|
||||
|
||||
addSearchPath("res/", screenSize.height)
|
||||
addSearchPath("res/ccs-res/scene3DTest", screenSize.height)
|
||||
addSearchPath("", screenSize.height)
|
||||
|
||||
require "mainMenu"
|
||||
|
|
|
@ -15,7 +15,6 @@ require "ByteCodeEncryptTest/ByteCodeEncryptTest"
|
|||
require "Camera3DTest/Camera3DTest"
|
||||
require "ClickAndMoveTest/ClickAndMoveTest"
|
||||
require "CocosDenshionTest/CocosDenshionTest"
|
||||
require "CocoStudioTest/CocoStudioTest"
|
||||
require "ComponentTest/main"
|
||||
require "CurrentLanguageTest/CurrentLanguageTest"
|
||||
require "DrawPrimitivesTest/DrawPrimitivesTest"
|
||||
|
@ -59,7 +58,6 @@ require "CaptureScreenTest/CaptureScreenTest"
|
|||
require "VideoPlayerTest/VideoPlayerTest"
|
||||
require "FastTiledMapTest/FastTiledMapTest"
|
||||
require "NewAudioEngineTest/NewAudioEngineTest"
|
||||
require "CocosStudio3DTest/CocosStudio3DTest"
|
||||
require "WebViewTest/WebViewTest"
|
||||
require "SpritePolygonTest/SpritePolygonTest"
|
||||
require "Physics3DTest/Physics3DTest"
|
||||
|
@ -107,8 +105,6 @@ local _allTests = {
|
|||
{ isSupported = false, name = "ChipmunkAccelTouchTest" , create_func= ChipmunkAccelTouchTestMain },
|
||||
{ isSupported = true, name = "ClickAndMoveTest" , create_func = ClickAndMoveTest },
|
||||
{ isSupported = true, name = "CocosDenshionTest" , create_func = CocosDenshionTestMain },
|
||||
{ isSupported = true, name = "CocosStudio3DTest" , create_func = CocosStudio3DTest},
|
||||
{ isSupported = true, name = "CocoStudioTest" , create_func = CocoStudioTestMain },
|
||||
{ isSupported = true, name = "ComponentTest" , create_func = ComponentTestMain },
|
||||
{ isSupported = false, name = "CurlTest" , create_func= CurlTestMain },
|
||||
{ isSupported = true, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain },
|
||||
|
|
Loading…
Reference in New Issue