mirror of https://github.com/axmolengine/axmol.git
Merge pull request #5700 from dumganhar/develop
Some fixes: [lua] Reverts 'removing tolua.cast in test case, I don't know why it was re-added. Some warning fixes in TriggerMng.cpp and TriggerObj.cpp Comment some lines in CCEditBoxImplIOS.mm/CCEditBoxImplAndroid.cpp, since after re-implement LabelTTF by Label, '(g|s)etTextureRect' will not work, it's because LabelTTF is inherited from Node rather than Sprite now. We need to fix this as soon as possible.
This commit is contained in:
commit
02971082ba
|
@ -36,7 +36,7 @@ TriggerMng* TriggerMng::_sharedTriggerMng = nullptr;
|
|||
TriggerMng::TriggerMng(void)
|
||||
: _movementDispatches(new std::unordered_map<Armature*, ArmatureMovementDispatcher*>)
|
||||
{
|
||||
_eventDispatcher = CCDirector::getInstance()->getEventDispatcher();
|
||||
_eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||
_eventDispatcher->retain();
|
||||
}
|
||||
|
||||
|
|
|
@ -220,14 +220,14 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
|||
std::string custom_event_name(buf);
|
||||
CC_SAFE_DELETE_ARRAY(buf);
|
||||
|
||||
EventListenerCustom *_listener = EventListenerCustom::create(custom_event_name, [=](EventCustom* event){
|
||||
EventListenerCustom* listener = EventListenerCustom::create(custom_event_name, [=](EventCustom* evt){
|
||||
if (detect())
|
||||
{
|
||||
done();
|
||||
}
|
||||
});
|
||||
_listeners.pushBack(_listener);
|
||||
TriggerMng::getInstance()->addEventListenerWithFixedPriority(_listener, 1);
|
||||
_listeners.pushBack(listener);
|
||||
TriggerMng::getInstance()->addEventListenerWithFixedPriority(listener, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,12 +178,14 @@ void EditBoxImplAndroid::setText(const char* pText)
|
|||
_label->setString(strToShow.c_str());
|
||||
|
||||
// Clip the text width to fit to the text box
|
||||
float fMaxWidth = _editSize.width - CC_EDIT_BOX_PADDING * 2;
|
||||
Rect clippingRect = _label->getTextureRect();
|
||||
if(clippingRect.size.width > fMaxWidth) {
|
||||
clippingRect.size.width = fMaxWidth;
|
||||
_label->setTextureRect(clippingRect);
|
||||
}
|
||||
// FIXME: After re-implement LabelTTF by Label, '(g|s)etTextureRect' will not work, it's because LabelTTF is inherited from Node rather than Sprite now.
|
||||
|
||||
// float fMaxWidth = _editSize.width - CC_EDIT_BOX_PADDING * 2;
|
||||
// Rect clippingRect = _label->getTextureRect();
|
||||
// if(clippingRect.size.width > fMaxWidth) {
|
||||
// clippingRect.size.width = fMaxWidth;
|
||||
// _label->setTextureRect(clippingRect);
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
|
|
|
@ -362,13 +362,14 @@ void EditBoxImplIOS::setInactiveText(const char* pText)
|
|||
_label->setString(getText());
|
||||
|
||||
// Clip the text width to fit to the text box
|
||||
float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2;
|
||||
Rect clippingRect = _label->getTextureRect();
|
||||
if(clippingRect.size.width > fMaxWidth)
|
||||
{
|
||||
clippingRect.size.width = fMaxWidth;
|
||||
_label->setTextureRect(clippingRect);
|
||||
}
|
||||
// FIXME: After re-implement LabelTTF by Label, '(g|s)etTextureRect' will not work, it's because LabelTTF is inherited from Node rather than Sprite now.
|
||||
// float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2;
|
||||
// Rect clippingRect = _label->getTextureRect();
|
||||
// if(clippingRect.size.width > fMaxWidth)
|
||||
// {
|
||||
// clippingRect.size.width = fMaxWidth;
|
||||
// _label->setTextureRect(clippingRect);
|
||||
// }
|
||||
}
|
||||
|
||||
void EditBoxImplIOS::setFont(const char* pFontName, int fontSize)
|
||||
|
@ -574,7 +575,7 @@ static CGPoint convertDesignCoordToScreenCoord(const Point& designCoord, bool bI
|
|||
screenPos.x = screenPos.x / 2.0f;
|
||||
screenPos.y = screenPos.y / 2.0f;
|
||||
}
|
||||
CCLOG("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
||||
CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Point& designCoord
|
|||
screenPos.y = screenPos.y / 2.0f;
|
||||
}
|
||||
|
||||
CCLOG("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
||||
CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
|
|
|
@ -425,10 +425,10 @@ local function SpeedTest()
|
|||
local spawn = cc.Spawn:create(seq3_1, seq3_2)
|
||||
SpeedTest_action1 = cc.Speed:create(cc.RepeatForever:create(spawn), 1.0)
|
||||
|
||||
local spawn2 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
local spawn2 = spawn:clone()
|
||||
SpeedTest_action2 = cc.Speed:create(cc.RepeatForever:create(spawn2), 1.0)
|
||||
|
||||
local spawn3 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
local spawn3 = spawn:clone()
|
||||
SpeedTest_action3 = cc.Speed:create(cc.RepeatForever:create(spawn3), 1.0)
|
||||
|
||||
grossini:runAction(SpeedTest_action2)
|
||||
|
|
|
@ -550,8 +550,8 @@ local function ActionAnimate()
|
|||
tamara:runAction(cc.Sequence:create(action2, action2:reverse()))
|
||||
|
||||
local animation3 = animation2:clone()
|
||||
-- problem
|
||||
tolua.cast(animation3,"cc.Animation"):setLoops(4)
|
||||
|
||||
animation3:setLoops(4)
|
||||
|
||||
local action3 = cc.Animate:create(animation3)
|
||||
kathia:runAction(action3)
|
||||
|
@ -740,7 +740,7 @@ local function ActionRotateToRepeat()
|
|||
local act2 = cc.RotateTo:create(1, 0)
|
||||
local seq = cc.Sequence:create(act1, act2)
|
||||
local rep1 = cc.RepeatForever:create(seq)
|
||||
local rep2 = cc.Repeat:create(tolua.cast(seq:clone(), "cc.Sequence"), 10)
|
||||
local rep2 = cc.Repeat:create(seq:clone(), 10)
|
||||
|
||||
tamara:runAction(rep1)
|
||||
kathia:runAction(rep2)
|
||||
|
@ -931,8 +931,8 @@ local function ActionOrbit()
|
|||
local seq = cc.Sequence:create(move, move_back)
|
||||
local rfe = cc.RepeatForever:create(seq)
|
||||
kathia:runAction(rfe)
|
||||
tamara:runAction(tolua.cast(rfe:clone(), "cc.ActionInterval"))
|
||||
grossini:runAction(tolua.cast(rfe:clone(), "cc.ActionInterval"))
|
||||
tamara:runAction(rfe:clone())
|
||||
grossini:runAction(rfe:clone())
|
||||
|
||||
|
||||
Helper.subtitleLabel:setString("OrbitCamera action")
|
||||
|
|
|
@ -428,7 +428,7 @@ end
|
|||
|
||||
function TestPerformance:refreshTitle()
|
||||
local subTitleInfo = ArmatureTestLayer.subTitle(5) .. self._armatureCount
|
||||
local label = tolua.cast(self:getChildByTag(10001),"cc.LabelTTF")
|
||||
local label = self:getChildByTag(10001)
|
||||
label:setString(subTitleInfo)
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
a28b4af8f8f426d3719766b446d2fc2a18c4ba25
|
||||
c43e2d2b4092953dba18fe8223330eb29809bb01
|
|
@ -193,9 +193,9 @@ function SpriteComponentTest:createGameScene()
|
|||
local action1 = cc.Blink:create(2, 10)
|
||||
local action2 = cc.Blink:create(2, 5)
|
||||
|
||||
local sister1 = tolua.cast(node:getChildByTag(10003):getComponent("CCSprite"),"ccs.ComRender")
|
||||
local sister1 = node:getChildByTag(10003):getComponent("CCSprite")
|
||||
sister1:getNode():runAction(action1)
|
||||
local sister2 = tolua.cast(node:getChildByTag(10004):getComponent("CCSprite"),"ccs.ComRender")
|
||||
local sister2 = node:getChildByTag(10004):getComponent("CCSprite")
|
||||
sister2:getNode():runAction(action2)
|
||||
end
|
||||
|
||||
|
@ -245,10 +245,10 @@ end
|
|||
function ArmatureComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ArmatureComponentTest/ArmatureComponentTest.json")
|
||||
if nil ~= node then
|
||||
local blowFish = tolua.cast(node:getChildByTag(10007):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local blowFish = node:getChildByTag(10007):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10008):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local butterflyfish = node:getChildByTag(10008):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(CCMoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
|
||||
|
@ -298,15 +298,15 @@ end
|
|||
function UIComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/UIComponentTest/UIComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10025):getComponent("GUIComponent"),"ccs.ComRender")
|
||||
local widget = tolua.cast(render:getNode(), "ccui.Widget")
|
||||
local button = tolua.cast(widget:getChildByName("Button_156"),"ccui.Button")
|
||||
local render = node: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 = tolua.cast(node:getChildByTag(10010):getComponent("CCArmature"), "ccs.ComRender")
|
||||
local blowFish = node:getChildByTag(10010):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10011):getComponent("CCArmature"), "ccs.ComRender")
|
||||
local butterflyfish = node:getChildByTag(10011):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
end
|
||||
|
@ -360,7 +360,7 @@ end
|
|||
function TmxMapComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TmxMapComponentTest/TmxMapComponentTest.json")
|
||||
if nil ~= node then
|
||||
local tmxMap = tolua.cast(node:getChildByTag(10015):getComponent("CCTMXTiledMap"),"ccs.ComRender")
|
||||
local tmxMap = node: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)
|
||||
|
@ -420,7 +420,7 @@ end
|
|||
function ParticleComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ParticleComponentTest/ParticleComponentTest.json")
|
||||
if nil ~= node then
|
||||
local particle = tolua.cast(node:getChildByTag(10020):getComponent("CCParticleSystemQuad"),"ccs.ComRender")
|
||||
local particle = node: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)
|
||||
|
@ -472,13 +472,13 @@ end
|
|||
function EffectComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/EffectComponentTest/EffectComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10015):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local armature = tolua.cast(render:getNode(),"ccs.Armature")
|
||||
local render = node: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 = tolua.cast(node:getChildByTag(10015):getComponent("CCComAudio"), "ccs.ComAudio")
|
||||
local audio = node:getChildByTag(10015):getComponent("CCComAudio")
|
||||
audio:playEffect()
|
||||
end
|
||||
end
|
||||
|
@ -533,7 +533,7 @@ end
|
|||
function BackgroundComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/BackgroundComponentTest/BackgroundComponentTest.json")
|
||||
if nil ~= node then
|
||||
local audio = tolua.cast(node:getComponent("CCBackgroundAudio"),"ccs.ComAudio")
|
||||
local audio = node:getComponent("CCBackgroundAudio")
|
||||
audio:playBackgroundMusic()
|
||||
end
|
||||
|
||||
|
@ -582,7 +582,7 @@ end
|
|||
|
||||
function AttributeComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/AttributeComponentTest/AttributeComponentTest.json")
|
||||
local attribute = tolua.cast(node:getChildByTag(10015):getComponent("CCComAttribute"), "ccs.ComAttribute")
|
||||
local attribute = node:getChildByTag(10015):getComponent("CCComAttribute")
|
||||
print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP")))
|
||||
return node
|
||||
end
|
||||
|
|
|
@ -95,7 +95,7 @@ local function Effect2()
|
|||
|
||||
local delay = cc.DelayTime:create(1)
|
||||
|
||||
target:runAction(cc.Sequence:create(shaky, delay ,reuse, shuffle, tolua.cast(delay:clone(), "cc.Action"), turnoff, turnon))
|
||||
target:runAction(cc.Sequence:create(shaky, delay ,reuse, shuffle, delay:clone(), turnoff, turnon))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ ccb["TestScrollViewsLayer"] = TestScrollViewsLayer
|
|||
|
||||
local function onMenuItemAClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item A clicked.");
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ end
|
|||
|
||||
local function onMenuItemBClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item B clicked.");
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ end
|
|||
|
||||
local function pressedC( ... )
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item C clicked.");
|
||||
end
|
||||
|
@ -59,9 +59,9 @@ local function onMenuTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestMenus.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestMenus.ccbi")
|
||||
end
|
||||
|
@ -88,9 +88,9 @@ local function onSpriteTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestSprites.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestSprites.ccbi")
|
||||
end
|
||||
|
@ -107,9 +107,9 @@ local function onButtonTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestButtons.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestButtons.ccbi")
|
||||
end
|
||||
|
@ -122,7 +122,7 @@ local function onButtonTestClicked()
|
|||
end
|
||||
|
||||
local function onCCControlButtonClicked(sender,controlEvent)
|
||||
local labelTTF = tolua.cast(TestButtonsLayer["mCCControlEventLabel"],"cc.LabelBMFont")
|
||||
local labelTTF = TestButtonsLayer["mCCControlEventLabel"]
|
||||
|
||||
if nil == labelTTF then
|
||||
return
|
||||
|
@ -158,9 +158,9 @@ local function onAnimationsTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestAnimations.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestAnimations.ccbi")
|
||||
end
|
||||
|
@ -177,9 +177,9 @@ local function onParticleSystemTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestParticleSystems.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestParticleSystems.ccbi")
|
||||
end
|
||||
|
@ -193,7 +193,7 @@ end
|
|||
|
||||
local function onCCControlButtonIdleClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Idle", 0.3)
|
||||
end
|
||||
|
@ -202,7 +202,7 @@ end
|
|||
|
||||
local function onCCControlButtonWaveClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Wave", 0.3)
|
||||
end
|
||||
|
@ -211,7 +211,7 @@ end
|
|||
|
||||
local function onCCControlButtonJumpClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Jump", 0.3)
|
||||
end
|
||||
|
@ -220,7 +220,7 @@ end
|
|||
|
||||
local function onCCControlButtonFunkyClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Funky", 0.3)
|
||||
end
|
||||
|
@ -237,9 +237,9 @@ local function onScrollViewTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestScrollViews.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestScrollViews.ccbi")
|
||||
end
|
||||
|
@ -256,9 +256,9 @@ local function onTimelineCallbackSoundClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestTimelineCallback.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestTimelineCallback.ccbi")
|
||||
end
|
||||
|
@ -272,7 +272,7 @@ end
|
|||
|
||||
function onCallback1()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
local ccLabelTTF = TestTimelineLayer["helloLabel"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(1, 360))
|
||||
ccLabelTTF:setString("Callback 1");
|
||||
|
@ -282,7 +282,7 @@ end
|
|||
|
||||
function onCallback2()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
local ccLabelTTF = TestTimelineLayer["helloLabel"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(2, 360))
|
||||
ccLabelTTF:setString("Callback 2");
|
||||
|
@ -306,7 +306,7 @@ local function HelloCCBTestMainLayer()
|
|||
print(type(cc.Scene))
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/HelloCocosBuilder.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
return layer
|
||||
end
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ local function runNotificationCenterTest()
|
|||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function toggleSwitch(tag,menuItem)
|
||||
local toggleItem = tolua.cast(menuItem,"cc.MenuItemToggle")
|
||||
local toggleItem = menuItem
|
||||
local nIndex = toggleItem:getSelectedIndex()
|
||||
local selectedItem = toggleItem:getSelectedItem()
|
||||
if 0 == nIndex then
|
||||
|
@ -155,7 +155,7 @@ local function runNotificationCenterTest()
|
|||
connectitem:setTag(NotificationCenterParam.kTagConnect+i)
|
||||
|
||||
local function connectToSwitch(tag,menuItem)
|
||||
local connectMenuitem = tolua.cast(menuItem,"cc.MenuItemToggle")
|
||||
local connectMenuitem = menuItem
|
||||
local bConnected = true
|
||||
if connectMenuitem:getSelectedIndex() == 0 then
|
||||
bConnected = false
|
||||
|
@ -376,7 +376,7 @@ local function runCCControlTest()
|
|||
if nil == pSender or nil == pDisplayValueLabel then
|
||||
return
|
||||
end
|
||||
local pControl = tolua.cast(pSender,"cc.ControlSlider")
|
||||
local pControl = pSender
|
||||
local strFmt = nil
|
||||
if pControl:getTag() == 1 then
|
||||
strFmt = string.format("Upper slider value = %.02f",pControl:getValue())
|
||||
|
@ -434,7 +434,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pPicker = tolua.cast(pSender,"cc.ControlColourPicker")
|
||||
local pPicker = pSender
|
||||
local strFmt = string.format("#%02X%02X%02X",pPicker:getColor().r, pPicker:getColor().g, pPicker:getColor().b)
|
||||
pColorLabel:setString(strFmt)
|
||||
end
|
||||
|
@ -499,7 +499,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlSwitch")
|
||||
local pControl = pSender
|
||||
if pControl:isOn() then
|
||||
pDisplayValueLabel:setString("On")
|
||||
else
|
||||
|
@ -774,7 +774,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlPotentiometer")
|
||||
local pControl = pSender
|
||||
local strFmt = string.format("%0.2f",pControl:getValue())
|
||||
pDisplayValueLabel:setString(strFmt )
|
||||
end
|
||||
|
@ -831,7 +831,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlStepper")
|
||||
local pControl = pSender
|
||||
local strFmt = string.format("%0.02f",pControl:getValue() )
|
||||
pDisplayValueLabel:setString(strFmt )
|
||||
end
|
||||
|
@ -917,7 +917,7 @@ local function runEditBoxTest()
|
|||
local EditEmail = nil
|
||||
|
||||
local function editBoxTextEventHandle(strEventName,pSender)
|
||||
local edit = tolua.cast(pSender,"cc.EditBox")
|
||||
local edit = pSender
|
||||
local strFmt
|
||||
if strEventName == "began" then
|
||||
strFmt = string.format("editBox %p DidBegin !", edit)
|
||||
|
@ -1038,7 +1038,7 @@ function TableViewTestLayer.tableCellAtIndex(table, idx)
|
|||
label:setTag(123)
|
||||
cell:addChild(label)
|
||||
else
|
||||
label = tolua.cast(cell:getChildByTag(123),"cc.LabelTTF")
|
||||
label = cell:getChildByTag(123)
|
||||
if nil ~= label then
|
||||
label:setString(strValue)
|
||||
end
|
||||
|
|
|
@ -32,11 +32,11 @@ function LabelAtlasTest.step(dt)
|
|||
local string = string.format("%2.2f Test", m_time)
|
||||
|
||||
local label1_origin = LabelAtlasTest.layer:getChildByTag(kTagSprite1)
|
||||
local label1 = tolua.cast(label1_origin, "cc.LabelAtlas")
|
||||
local label1 = label1_origin
|
||||
label1:setString(string) --
|
||||
|
||||
local label2_origin = LabelAtlasTest.layer:getChildByTag(kTagSprite2)
|
||||
local label2 = tolua.cast(label2_origin, "cc.LabelAtlas")
|
||||
local label2 = label2_origin
|
||||
string = string.format("%d", m_time)
|
||||
|
||||
label2:setString(string)
|
||||
|
@ -88,11 +88,11 @@ function LabelAtlasColorTest.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test", m_time)
|
||||
local label1_origin = LabelAtlasColorTest.layer:getChildByTag(kTagSprite1)
|
||||
local label1 = tolua.cast(label1_origin, "cc.LabelAtlas")
|
||||
local label1 = label1_origin
|
||||
label1:setString(string)
|
||||
|
||||
local label2_origin = LabelAtlasColorTest.layer:getChildByTag(kTagSprite2)
|
||||
local label2 = tolua.cast(label2_origin, "cc.LabelAtlas")
|
||||
local label2 = label2_origin
|
||||
string = string.format("%d", m_time)
|
||||
|
||||
label2:setString(string)
|
||||
|
@ -199,7 +199,7 @@ function Atlas3.create()
|
|||
label2:setColor(cc.c3b(255, 0, 0 ))
|
||||
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
||||
|
||||
label2:runAction( tolua.cast(repeatAction:clone(), "cc.Action") )
|
||||
label2:runAction( repeatAction:clone())
|
||||
|
||||
local label3 = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest2.fnt")
|
||||
-- testing anchors
|
||||
|
@ -223,13 +223,13 @@ function Atlas3.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test j", m_time)
|
||||
|
||||
local label1 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas1), "cc.LabelBMFont")
|
||||
local label1 = Atlas3.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
label1:setString(string)
|
||||
|
||||
local label2 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelBMFont")
|
||||
local label2 = Atlas3.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label2:setString(string)
|
||||
|
||||
local label3 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas3), "cc.LabelBMFont")
|
||||
local label3 = Atlas3.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
label3:setString(string)
|
||||
end
|
||||
|
||||
|
@ -309,7 +309,7 @@ function Atlas4.create()
|
|||
label2:setPosition( cc.p(s.width/2.0, 80) )
|
||||
|
||||
local lastChar = label2:getChildByTag(3)
|
||||
lastChar:runAction(tolua.cast( rot_4ever:clone(), "cc.Action" ))
|
||||
lastChar:runAction(rot_4ever:clone())
|
||||
|
||||
layer:registerScriptHandler(Atlas4.onNodeEvent)
|
||||
|
||||
|
@ -329,7 +329,7 @@ function Atlas4.step(dt)
|
|||
|
||||
local string = string.format("%04.1f", m_time)
|
||||
|
||||
local label1 = tolua.cast(Atlas4.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelBMFont")
|
||||
local label1 = Atlas4.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label1:setString(string)
|
||||
end
|
||||
|
||||
|
@ -592,9 +592,9 @@ function LabelsEmpty.create()
|
|||
end
|
||||
|
||||
function LabelsEmpty.updateStrings(dt)
|
||||
local label1 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas1), "cc.LabelBMFont")
|
||||
local label2 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelTTF")
|
||||
local label3 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas3), "cc.LabelAtlas")
|
||||
local label1 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
local label2 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
local label3 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
|
||||
if( LabelsEmpty.setEmpty == false) then
|
||||
label1:setString("not empty")
|
||||
|
@ -1118,7 +1118,7 @@ end
|
|||
|
||||
|
||||
function BitmapFontMultiLineAlignment.stringChanged(tag, sender)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
@ -1136,7 +1136,7 @@ end
|
|||
|
||||
function BitmapFontMultiLineAlignment.alignmentChanged(tag, sender)
|
||||
-- cclog("BitmapFontMultiLineAlignment.alignmentChanged, tag:"..tag)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
|
|
@ -61,7 +61,7 @@ function LabelFNTColorAndOpacity.create()
|
|||
label2:setColor(cc.c3b(255, 0, 0 ))
|
||||
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
||||
|
||||
label2:runAction( tolua.cast(repeatAction:clone(), "cc.Action") )
|
||||
label2:runAction(repeatAction:clone())
|
||||
|
||||
local label3 = cc.Label:createWithBMFont("fonts/bitmapFontTest2.fnt", "Test")
|
||||
-- testing anchors
|
||||
|
@ -85,13 +85,13 @@ function LabelFNTColorAndOpacity.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test j", m_time)
|
||||
|
||||
local label1 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas1), "cc.Label")
|
||||
local label1 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
label1:setString(string)
|
||||
|
||||
local label2 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas2), "cc.Label")
|
||||
local label2 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label2:setString(string)
|
||||
|
||||
local label3 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas3), "cc.Label")
|
||||
local label3 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
label3:setString(string)
|
||||
end
|
||||
|
||||
|
@ -165,7 +165,7 @@ function LabelFNTSpriteActions.create()
|
|||
label2:setPosition( cc.p(s.width/2.0, 80) )
|
||||
|
||||
local lastChar = label2:getLetter(3)
|
||||
lastChar:runAction(tolua.cast( rot_4ever:clone(), "cc.Action" ))
|
||||
lastChar:runAction(rot_4ever:clone())
|
||||
|
||||
layer:registerScriptHandler(LabelFNTSpriteActions.onNodeEvent)
|
||||
|
||||
|
@ -725,7 +725,7 @@ end
|
|||
|
||||
|
||||
function LabelFNTMultiLineAlignment.stringChanged(tag, sender)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
@ -743,7 +743,7 @@ end
|
|||
|
||||
function LabelFNTMultiLineAlignment.alignmentChanged(tag, sender)
|
||||
-- cclog("LabelFNTMultiLineAlignment.alignmentChanged, tag:"..tag)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
|
|
@ -314,7 +314,7 @@ local function LayerTest1()
|
|||
|
||||
local newSize = cc.size( math.abs(x - s.width/2)*2, math.abs(y - s.height/2)*2)
|
||||
|
||||
local l = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
local l = ret:getChildByTag(kTagLayer)
|
||||
|
||||
l:setContentSize( newSize )
|
||||
end
|
||||
|
@ -395,7 +395,7 @@ local function LayerTestBlend()
|
|||
local blend = true
|
||||
|
||||
local function newBlend(dt)
|
||||
local layer = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
local layer = ret:getChildByTag(kTagLayer)
|
||||
|
||||
local src = 0
|
||||
local dst = 0
|
||||
|
@ -445,7 +445,7 @@ local function LayerGradient()
|
|||
|
||||
local function toggleItem(sender)
|
||||
-- cclog("toggleItem")
|
||||
local gradient = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerGradient")
|
||||
local gradient = ret:getChildByTag(kTagLayer)
|
||||
gradient:setCompressedInterpolation(not gradient:isCompressedInterpolation())
|
||||
end
|
||||
|
||||
|
@ -463,7 +463,7 @@ local function LayerGradient()
|
|||
local diff = cc.p(movingPos.x - start.x, movingPos.y - start.y)
|
||||
diff = cc.pNormalize(diff)
|
||||
|
||||
local gradient = tolua.cast(ret:getChildByTag(1), "cc.LayerGradient")
|
||||
local gradient = ret:getChildByTag(1)
|
||||
gradient:setVector(diff)
|
||||
end
|
||||
|
||||
|
@ -492,7 +492,7 @@ local function LayerIgnoreAnchorPointPos()
|
|||
l:setPosition(cc.p( s.width/2, s.height/2))
|
||||
|
||||
local move = cc.MoveBy:create(2, cc.p(100,2))
|
||||
local back = tolua.cast(move:reverse(), "cc.MoveBy")
|
||||
local back = move:reverse()
|
||||
local seq = cc.Sequence:create(move, back)
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
ret:addChild(l, 0, kLayerIgnoreAnchorPoint)
|
||||
|
@ -569,7 +569,7 @@ local function LayerIgnoreAnchorPointScale()
|
|||
|
||||
|
||||
local scale = cc.ScaleBy:create(2, 2)
|
||||
local back = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local back = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, back)
|
||||
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
|
|
|
@ -32,13 +32,13 @@ local function MenuLayerMainMenu()
|
|||
|
||||
local function menuCallback(sender)
|
||||
cclog("menuCallback...")
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(1)
|
||||
ret:getParent():switchTo(1)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
-- Image Item
|
||||
local function menuCallback2(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(2)
|
||||
ret:getParent():switchTo(2)
|
||||
end
|
||||
|
||||
local item2 = cc.MenuItemImage:create(s_SendScore, s_PressSendScore)
|
||||
|
@ -46,7 +46,7 @@ local function MenuLayerMainMenu()
|
|||
|
||||
|
||||
local schedulerEntry = nil
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local function allowTouches(dt)
|
||||
local pDirector = cc.Director:getInstance()
|
||||
--pDirector:getTouchDispatcher():setPriority(cc.MENU_HANDLER_PRIORITY +1, ret)
|
||||
|
@ -85,7 +85,7 @@ local function MenuLayerMainMenu()
|
|||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
|
||||
local function menuCallbackConfig(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(3)
|
||||
ret:getParent():switchTo(3)
|
||||
end
|
||||
|
||||
-- Label Item (cc.LabelBMFont)
|
||||
|
@ -99,7 +99,7 @@ local function MenuLayerMainMenu()
|
|||
-- Events
|
||||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
local function menuCallbackBugsTest(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(4)
|
||||
ret:getParent():switchTo(4)
|
||||
end
|
||||
|
||||
-- Bugs Item
|
||||
|
@ -115,7 +115,7 @@ local function MenuLayerMainMenu()
|
|||
item7:registerScriptTapHandler(onQuit)
|
||||
|
||||
local function menuMovingCallback(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(5)
|
||||
ret:getParent():switchTo(5)
|
||||
end
|
||||
|
||||
local item8 = cc.MenuItemFont:create("Remove menu item when moving")
|
||||
|
@ -152,7 +152,7 @@ local function MenuLayerMainMenu()
|
|||
if pObject == nil then
|
||||
break
|
||||
end
|
||||
child = tolua.cast(pObject, "cc.Node")
|
||||
child = pObject
|
||||
local dstPointX, dstPointY = child:getPosition()
|
||||
local offset = s.width/2 + 50
|
||||
if i % 2 == 0 then
|
||||
|
@ -200,7 +200,7 @@ local function MenuLayer2()
|
|||
local function alignMenusH()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
local menu = ret:getChildByTag(100+i)
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
|
@ -219,7 +219,7 @@ local function MenuLayer2()
|
|||
local function alignMenusV()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
local menu = ret:getChildByTag(100+i)
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
|
@ -236,11 +236,11 @@ local function MenuLayer2()
|
|||
end
|
||||
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallbackOpacity(tag, sender)
|
||||
local menu = tolua.cast(sender:getParent(), "cc.Menu")
|
||||
local menu = sender:getParent()
|
||||
local opacity = menu:getOpacity()
|
||||
if opacity == 128 then
|
||||
menu:setOpacity(255)
|
||||
|
@ -305,7 +305,7 @@ local function MenuLayer3()
|
|||
local m_disabledItem = nil
|
||||
local ret = cc.Layer:create()
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallback2(sender)
|
||||
|
@ -357,8 +357,8 @@ local function MenuLayer3()
|
|||
item2:runAction( cc.RepeatForever:create(cc.Sequence:create( jump, jump:reverse())))
|
||||
|
||||
local spin1 = cc.RotateBy:create(3, 360)
|
||||
local spin2 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
local spin3 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
local spin2 = spin1:clone()
|
||||
local spin3 = spin1:clone()
|
||||
|
||||
item1:runAction( cc.RepeatForever:create(spin1) )
|
||||
item2:runAction( cc.RepeatForever:create(spin2) )
|
||||
|
@ -398,11 +398,11 @@ local function MenuLayer4()
|
|||
local item1 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "On" ))
|
||||
|
||||
local function menuCallback(tag, sender)
|
||||
cclog("selected item: tag: %d, index:%d", tag, tolua.cast(sender, "cc.MenuItemToggle"):getSelectedIndex() )
|
||||
cclog("selected item: tag: %d, index:%d", tag, sender:getSelectedIndex() )
|
||||
end
|
||||
|
||||
local function backCallback(tag, sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
|
@ -475,21 +475,21 @@ end
|
|||
local function BugsTest()
|
||||
local ret = cc.Layer:create()
|
||||
local function issue1410MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
local menu = pSender:getParent()
|
||||
menu:setEnabled(false)
|
||||
menu:setEnabled(true)
|
||||
cclog("NO CRASHES")
|
||||
end
|
||||
|
||||
local function issue1410v2MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
local menu = pSender:getParent()
|
||||
menu:setEnabled(true)
|
||||
menu:setEnabled(false)
|
||||
cclog("NO CRASHES. AND MENU SHOULD STOP WORKING")
|
||||
end
|
||||
|
||||
local function backMenuCallback(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
|
||||
|
@ -526,7 +526,7 @@ local function RemoveMenuItemWhenMove()
|
|||
|
||||
local back = cc.MenuItemFont:create("go back")
|
||||
local function goBack(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
back:registerScriptTapHandler(goBack)
|
||||
|
|
|
@ -184,7 +184,7 @@ function TouchableSpriteTest:onEnter()
|
|||
sprite2:addChild(sprite3, 1)
|
||||
|
||||
local function onTouchBegan(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(),"cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
|
||||
local locationInNode = target:convertToNodeSpace(touch:getLocation())
|
||||
local s = target:getContentSize()
|
||||
|
@ -199,14 +199,14 @@ function TouchableSpriteTest:onEnter()
|
|||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(), "cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
local posX,posY = target:getPosition()
|
||||
local delta = touch:getDelta()
|
||||
target:setPosition(cc.p(posX + delta.x, posY + delta.y))
|
||||
end
|
||||
|
||||
local function onTouchEnded(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(), "cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
print("sprite onTouchesEnded..")
|
||||
target:setOpacity(255)
|
||||
if target == sprite2 then
|
||||
|
|
|
@ -261,10 +261,10 @@ local function Test6()
|
|||
local rot = cc.RotateBy:create(2, 360)
|
||||
local rot_back = rot:reverse()
|
||||
local forever1 = cc.RepeatForever:create(cc.Sequence:create(rot, rot_back))
|
||||
local forever11 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever11 = forever1:clone()
|
||||
|
||||
local forever2 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever21 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever2 = forever1:clone()
|
||||
local forever21 = forever1:clone()
|
||||
|
||||
Test6_layer:addChild(sp1, 0, kTagSprite1)
|
||||
sp1:addChild(sp11)
|
||||
|
@ -342,7 +342,7 @@ local function shouldNotLeak(dt)
|
|||
scheduler:unscheduleScriptEntry(StressTest2_entry)
|
||||
|
||||
local sublayer = StressTest2_layer:getChildByTag(kTagSprite1)
|
||||
sublayer:removeAllChildrenWithCleanup(true)
|
||||
sublayer:removeAllChildren(true)
|
||||
end
|
||||
|
||||
local function StressTest2_onEnterOrExit(tag)
|
||||
|
@ -370,10 +370,9 @@ local function StressTest2()
|
|||
|
||||
local fire = cc.ParticleFire:create()
|
||||
fire:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png"))
|
||||
fire = tolua.cast(fire, "cc.Node")
|
||||
fire:setPosition(80, s.height / 2 - 50)
|
||||
|
||||
local copy_seq3 = tolua.cast(seq3:clone(), "cc.Sequence")
|
||||
local copy_seq3 = seq3:clone()
|
||||
fire:runAction(cc.RepeatForever:create(copy_seq3))
|
||||
sublayer:addChild(fire, 2)
|
||||
|
||||
|
@ -564,7 +563,7 @@ local function ConvertToNode()
|
|||
|
||||
point:setPosition(sprite:getPosition())
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.RepeatForever")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
ConvertToNode_layer:addChild(sprite, i)
|
||||
end
|
||||
|
|
|
@ -147,7 +147,7 @@ local function OpenGLTestMainLayer()
|
|||
local i = 0
|
||||
local len = table.getn(children)
|
||||
for i= 0 ,len - 1 do
|
||||
local child = tolua.cast(children[i + 1], "cc.Sprite")
|
||||
local child = children[i + 1]
|
||||
local oldPosX,oldPosY = child:getPosition()
|
||||
child:setPosition(oldPosX,math.sin(accum * 2 + i / 2.0) * 20)
|
||||
local scaleY = math.sin(accum * 2 + i / 2.0 + 0.707)
|
||||
|
@ -558,7 +558,7 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local function getCurrentResult()
|
||||
local var = {}
|
||||
local glProgam = tolua.cast(sprite:getShaderProgram(),"cc.GLProgram")
|
||||
local glProgam = sprite:getShaderProgram()
|
||||
if nil ~= glProgam then
|
||||
local p = glProgam:getProgram()
|
||||
local aaSize,aaType,aaName = gl.getActiveAttrib(p,0)
|
||||
|
|
|
@ -148,7 +148,7 @@ local function runNodeChildrenTest()
|
|||
local function updateQuantityLabel()
|
||||
if nQuantityOfNodes ~= nLastRenderedCount then
|
||||
-- local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local pInfoLabel = tolua.cast(pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNode = nQuantityOfNodes.." nodes"
|
||||
pInfoLabel:setString(strNode)
|
||||
nLastRenderedCount = nQuantityOfNodes
|
||||
|
@ -167,7 +167,7 @@ local function runNodeChildrenTest()
|
|||
local i = 0
|
||||
local len = table.getn(pChildren)
|
||||
for i = 0, len - 1, 1 do
|
||||
local child = tolua.cast(pChildren[i + 1], "cc.Sprite")
|
||||
local child = pChildren[i + 1]
|
||||
child:setVisible(false)
|
||||
end
|
||||
end
|
||||
|
@ -190,7 +190,7 @@ local function runNodeChildrenTest()
|
|||
end
|
||||
|
||||
for i = 0 , nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, zs[i], NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -217,7 +217,7 @@ local function runNodeChildrenTest()
|
|||
end
|
||||
-- add them with random Z (very important!)
|
||||
for i=0, nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -245,7 +245,7 @@ local function runNodeChildrenTest()
|
|||
|
||||
--dd them with random Z (very important!)
|
||||
for i = 0, nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1] ,"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -253,7 +253,7 @@ local function runNodeChildrenTest()
|
|||
|
||||
-- reorder them
|
||||
for i = 0, nTotalToAdd - 1 do
|
||||
local pNode = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pNode = pSprites[i + 1]
|
||||
pBatchNode:reorderChild(pNode, math.random(-1,1) * 50)
|
||||
end
|
||||
pBatchNode:sortAllChildren()
|
||||
|
@ -509,7 +509,7 @@ local function runParticleTest()
|
|||
|
||||
local function UpdateQuantityLabel()
|
||||
if nQuantityParticles ~= nLastRenderedCount then
|
||||
local pInfoLabel = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewScene:getChildByTag(ParticleTestParam.kTagInfoLayer)
|
||||
local strInfo = string.format("%u particles", nQuantityParticles)
|
||||
pInfoLabel:setString(strInfo)
|
||||
|
||||
|
@ -519,7 +519,7 @@ local function runParticleTest()
|
|||
|
||||
local function doTest()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local pParticleSystem = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem),"cc.ParticleSystem")
|
||||
local pParticleSystem = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem)
|
||||
if nil == pParticleSystem then
|
||||
return
|
||||
end
|
||||
|
@ -764,8 +764,8 @@ local function runParticleTest()
|
|||
end
|
||||
|
||||
local function step(t)
|
||||
local pAtlas = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagLabelAtlas),"cc.LabelAtlas")
|
||||
local pEmitter = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem),"cc.ParticleSystem")
|
||||
local pAtlas = pNewScene:getChildByTag(ParticleTestParam.kTagLabelAtlas)
|
||||
local pEmitter = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem)
|
||||
local strInfo = string.format("%4d",pEmitter:getParticleCount())
|
||||
pAtlas:setString(strInfo)
|
||||
end
|
||||
|
@ -990,7 +990,7 @@ local function runSpriteTest()
|
|||
|
||||
local function UpdateNodes()
|
||||
if nQuantityNodes ~= nLastRenderedCount then
|
||||
local pInfoLabel = tolua.cast(pNewScene:getChildByTag(SpriteTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewScene:getChildByTag(SpriteTestParam.kTagInfoLayer)
|
||||
local strInfo = string.format("%u nodes", nQuantityNodes)
|
||||
pInfoLabel:setString(strInfo)
|
||||
nLastRenderedCount = nQuantityNodes
|
||||
|
@ -1701,14 +1701,14 @@ local function runFuncRelateWithTable()
|
|||
if quantityOfNodes == 0 then
|
||||
quantityOfNodes = 100
|
||||
end
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNum = string.format("%d", quantityOfNodes)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
local function onIncrease()
|
||||
quantityOfNodes = quantityOfNodes + 100
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNum = string.format("%d", quantityOfNodes)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
|
|
@ -446,7 +446,7 @@ function SpriteAnchorPoint.initLayer(layer)
|
|||
end
|
||||
point:setPosition( sprite:getPosition() )
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.Action")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
layer:addChild(sprite, i)
|
||||
end
|
||||
|
@ -499,7 +499,7 @@ function SpriteBatchNodeAnchorPoint.initLayer(layer)
|
|||
|
||||
point:setPosition( cc.p(sprite:getPosition()) )
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.Action")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
batch:addChild(sprite, i)
|
||||
end
|
||||
|
|
|
@ -110,7 +110,7 @@ local function TextureMipMap()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
img0:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -148,7 +148,7 @@ local function TexturePVRMipMap()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
imgMipMap:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -182,7 +182,7 @@ local function TexturePVRMipMap2()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
imgMipMap:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -803,9 +803,9 @@ local function TextureAlias()
|
|||
|
||||
-- scale them to show
|
||||
local sc = cc.ScaleBy:create(3, 8.0)
|
||||
local sc_back = tolua.cast(sc:reverse(), "cc.ScaleBy")
|
||||
local sc_back = sc:reverse()
|
||||
local scaleforever = cc.RepeatForever:create(cc.Sequence:create(sc, sc_back))
|
||||
local scaleToo = tolua.cast(scaleforever:clone(), "cc.RepeatForever")
|
||||
local scaleToo = scaleforever:clone()
|
||||
|
||||
sprite2:runAction(scaleforever)
|
||||
sprite:runAction(scaleToo)
|
||||
|
@ -829,7 +829,7 @@ local function TexturePixelFormat()
|
|||
-- 3- 16-bit RGB5A1
|
||||
-- 4- 16-bit RGB565
|
||||
|
||||
local label = tolua.cast(ret:getChildByTag(kTagLabel), "cc.LabelTTF")
|
||||
local label = ret:getChildByTag(kTagLabel)
|
||||
label:setColor(cc.c3b(16,16,255))
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
@ -895,10 +895,10 @@ local function TexturePixelFormat()
|
|||
local fadein = cc.FadeIn:create(2)
|
||||
local seq = cc.Sequence:create(cc.DelayTime:create(2), fadeout, fadein)
|
||||
local seq_4ever = cc.RepeatForever:create(seq)
|
||||
local seq_4ever2 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever3 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever4 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever5 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever2 = seq_4ever:clone()
|
||||
local seq_4ever3 = seq_4ever:clone()
|
||||
local seq_4ever4 = seq_4ever:clone()
|
||||
local seq_4ever5 = seq_4ever:clone()
|
||||
|
||||
sprite1:runAction(seq_4ever)
|
||||
sprite2:runAction(seq_4ever2)
|
||||
|
@ -964,12 +964,12 @@ local function TextureAsync()
|
|||
ret:addChild(label, 10)
|
||||
|
||||
local scale = cc.ScaleBy:create(0.3, 2)
|
||||
local scale_back = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scale_back = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scale_back)
|
||||
label:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
local function imageLoaded(pObj)
|
||||
local tex = tolua.cast(pObj, "cc.Texture2D")
|
||||
local tex = pObj
|
||||
local director = cc.Director:getInstance()
|
||||
|
||||
--cc.ASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread")
|
||||
|
@ -1043,7 +1043,7 @@ local function TextureGlClamp()
|
|||
local rotate = cc.RotateBy:create(4, 360)
|
||||
sprite:runAction(rotate)
|
||||
local scale = cc.ScaleBy:create(2, 0.04)
|
||||
local scaleBack = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scaleBack = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scaleBack)
|
||||
sprite:runAction(seq)
|
||||
local function onNodeEvent(event)
|
||||
|
@ -1077,7 +1077,7 @@ local function TextureGlRepeat()
|
|||
local rotate = cc.RotateBy:create(4, 360)
|
||||
sprite:runAction(rotate)
|
||||
local scale = cc.ScaleBy:create(2, 0.04)
|
||||
local scaleBack = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scaleBack = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scaleBack)
|
||||
sprite:runAction(seq)
|
||||
local function onNodeEvent(event)
|
||||
|
@ -1338,7 +1338,7 @@ local function TexturePVRv3Premult()
|
|||
local function transformSprite(sprite)
|
||||
local fade = cc.FadeOut:create(2)
|
||||
local dl = cc.DelayTime:create(2)
|
||||
local fadein = tolua.cast(fade:reverse(), "cc.FadeOut")
|
||||
local fadein = fade:reverse()
|
||||
local seq = cc.Sequence:create(fade, fadein, dl)
|
||||
local repeatAction = cc.RepeatForever:create(seq)
|
||||
sprite:runAction(repeatAction)
|
||||
|
|
|
@ -82,7 +82,7 @@ local function TileMapEditTest()
|
|||
-- The only limitation is that you cannot change an empty, or assign an empty tile to a tile
|
||||
-- The value 0 not rendered so don't assign or change a tile with value 0
|
||||
|
||||
local tilemap = tolua.cast(layer:getChildByTag(kTagTileMap), "cc.TileMapAtlas")
|
||||
local tilemap = layer:getChildByTag(kTagTileMap)
|
||||
|
||||
--
|
||||
-- For example you can iterate over all the tiles
|
||||
|
@ -157,7 +157,7 @@ local function TMXOrthoTest()
|
|||
local len = table.getn(pChildrenArray)
|
||||
for i = 0, len-1, 1 do
|
||||
pObject = pChildrenArray[i + 1]
|
||||
child = tolua.cast(pObject, "cc.SpriteBatchNode")
|
||||
child = pObject
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -211,7 +211,7 @@ local function TMXOrthoTest2()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -243,7 +243,7 @@ local function TMXOrthoTest3()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -277,7 +277,7 @@ local function TMXOrthoTest4()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -304,7 +304,7 @@ local function TMXOrthoTest4()
|
|||
local function removeSprite(dt)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
schedulerEntry = nil
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer0 = map:getLayer("Layer 0")
|
||||
local s = layer0:getLayerSize()
|
||||
|
||||
|
@ -368,7 +368,7 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function removeSprite(sender)
|
||||
--------cclog("removing tile: %x", sender)
|
||||
local node = tolua.cast(sender, "cc.Node")
|
||||
local node = sender
|
||||
if nil == node then
|
||||
print("Errro node is nil")
|
||||
end
|
||||
|
@ -382,9 +382,9 @@ local function TMXReadWriteTest()
|
|||
|
||||
local finish = cc.CallFunc:create(removeSprite)
|
||||
local seq0 = cc.Sequence:create(move, rotate, scale, opacity, fadein, scaleback, finish)
|
||||
local seq1 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq2 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq3 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq1 = seq0:clone()
|
||||
local seq2 = seq0:clone()
|
||||
local seq3 = seq0:clone()
|
||||
|
||||
tile0:runAction(seq0)
|
||||
tile1:runAction(seq1)
|
||||
|
@ -400,8 +400,8 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function updateCol(dt)
|
||||
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
|
||||
--------cclog("++++atlas quantity: %d", layer:textureAtlas():getTotalQuads())
|
||||
--------cclog("++++children: %d", layer:getChildren():count() )
|
||||
|
@ -418,8 +418,8 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function repaintWithGID(dt)
|
||||
-- unschedule:_cmd)
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
|
||||
local s = layer:getLayerSize()
|
||||
local x = 0
|
||||
|
@ -433,8 +433,8 @@ local function TMXReadWriteTest()
|
|||
local function removeTiles(dt)
|
||||
scheduler:unscheduleScriptEntry(removeTilesScheduler)
|
||||
removeTilesScheduler = nil
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
local s = layer:getLayerSize()
|
||||
local y = 0
|
||||
for y=0, s.height-1, 1 do
|
||||
|
@ -580,7 +580,7 @@ local function TMXUncompressedTest()
|
|||
local i = 0
|
||||
local len = table.getn(pChildrenArray)
|
||||
for i = 0, len-1, 1 do
|
||||
layer = tolua.cast(pChildrenArray[i + 1], "cc.TMXLayer")
|
||||
layer = pChildrenArray[i + 1]
|
||||
if layer == nil then
|
||||
break
|
||||
end
|
||||
|
@ -1075,7 +1075,7 @@ local function TMXOrthoFlipTest()
|
|||
|
||||
local i = 0
|
||||
for i = 0, table.getn(map:getChildren())-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ local function TMXOrthoFlipRunTimeTest()
|
|||
|
||||
local i = 0
|
||||
for i = 0, table.getn(map:getChildren())-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1180,7 +1180,7 @@ local function TMXOrthoFromXMLTest()
|
|||
local i = 0
|
||||
local len = table.getn(map:getChildren())
|
||||
for i = 0, len-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ local function TMXBug987()
|
|||
local len = table.getn(childs)
|
||||
local pNode = nil
|
||||
for i = 0, len-1, 1 do
|
||||
pNode = tolua.cast(childs[i + 1], "cc.TMXLayer")
|
||||
pNode = childs[i + 1]
|
||||
if pNode == nil then
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue