mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7462 from chengstory/v3_FixLuaTriggerTestBug
1、 fixes lua TriggerTest bug.
This commit is contained in:
commit
ac82fdca59
|
@ -191,7 +191,7 @@ bool TriggerMng::isEmpty(void) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
|
void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
|
||||||
{
|
{
|
||||||
int count = pCocoNode[13].GetChildNum();
|
int count = pCocoNode[13].GetChildNum();
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
@ -262,12 +262,12 @@ bool TriggerMng::isEmpty(void) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rapidjson::Type type = pDataItemArray[i4].GetType(pCocoLoader);
|
rapidjson::Type type = pDataItemArray[i5].GetType(pCocoLoader);
|
||||||
if (type == rapidjson::kStringType)
|
if (type == rapidjson::kStringType)
|
||||||
{
|
{
|
||||||
dataitem.AddMember("value", str3, allocator);
|
dataitem.AddMember("value", str3, allocator);
|
||||||
}
|
}
|
||||||
else if(type == rapidjson::kNumberType)
|
else
|
||||||
{
|
{
|
||||||
int nV = atoi(str3);
|
int nV = atoi(str3);
|
||||||
float fV = atof(str3);
|
float fV = atof(str3);
|
||||||
|
@ -343,7 +343,7 @@ bool TriggerMng::isEmpty(void) const
|
||||||
{
|
{
|
||||||
dataitem.AddMember("value", str5, allocator);
|
dataitem.AddMember("value", str5, allocator);
|
||||||
}
|
}
|
||||||
else if(type == rapidjson::kNumberType)
|
else
|
||||||
{
|
{
|
||||||
int nV = atoi(str5);
|
int nV = atoi(str5);
|
||||||
float fV = atof(str5);
|
float fV = atof(str5);
|
||||||
|
|
|
@ -241,8 +241,8 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TriggerObj::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
|
void TriggerObj::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
|
||||||
{
|
{
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = pCocoNode->GetChildNum();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
@ -255,7 +255,7 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
||||||
{
|
{
|
||||||
if (str0 != nullptr)
|
if (str0 != nullptr)
|
||||||
{
|
{
|
||||||
_id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id"));
|
_id = atoi(str0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare("conditions") == 0)
|
else if (key.compare("conditions") == 0)
|
||||||
|
@ -332,7 +332,7 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@ function SceneEditorTestLayer:createMenu()
|
||||||
|
|
||||||
if sceneEditorTestIdx == #SceneEditorTestLayer.title then
|
if sceneEditorTestIdx == #SceneEditorTestLayer.title then
|
||||||
self:unscheduleUpdate()
|
self:unscheduleUpdate()
|
||||||
|
ccs.TriggerMng.getInstance():removeAll()
|
||||||
end
|
end
|
||||||
|
|
||||||
SceneEditorTestLayer.fileName = self:loadFileChangeHelper(SceneEditorTestLayer.fileName)
|
SceneEditorTestLayer.fileName = self:loadFileChangeHelper(SceneEditorTestLayer.fileName)
|
||||||
|
@ -846,13 +847,11 @@ function TriggerTest:onEnter()
|
||||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE)
|
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE)
|
||||||
end
|
end
|
||||||
self:scheduleUpdateWithPriorityLua(update,0)
|
self:scheduleUpdateWithPriorityLua(update,0)
|
||||||
|
|
||||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TriggerTest:defaultPlay()
|
function TriggerTest:defaultPlay()
|
||||||
|
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE)
|
||||||
end
|
end
|
||||||
|
|
||||||
function TriggerTest:onExit()
|
function TriggerTest:onExit()
|
||||||
|
|
Loading…
Reference in New Issue