//
// BrowseSmartTemplateLayer::onTemplateObject from 0x53f8c0 to 0x53f9d0 (272 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void BrowseSmartTemplateLayer::onTemplateObject(BrowseSmartTemplateLayer *a1, cocos2d::CCObject *a2)
{
GJSmartTemplate *m_template; // r8
cocos2d::CCArray *Prefabs; // r8
GJSmartTemplate *v5; // r8
BrowseSmartTemplateLayer *v6; // r6
void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // r8
cocos2d::CCNode *v8; // r0
char v9; // [sp+14h] [bp-Ch] BYREF
std::string v10; // [sp+18h] [bp-8h] BYREF
a2->__vftable[13].~CCObject_0(a2);
m_template = a1->m_template;
sub_775C20(&v10);
Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs((int)m_template, &v10);
sub_774008(&v10);
if ( Prefabs && cocos2d::CCArray::count(Prefabs) )
{
BrowseSmartTemplateLayer::onClose(a1, nullptr);
v5 = a1->m_template;
sub_775C20(&v10);
v6 = BrowseSmartKeyLayer::create(v5, (int)&v10);
sub_774008(&v10);
v6[1].m_uID = a1->m_page;
v6->show(v6);
}
else
{
sub_775C20(&v10);
BrowseSmartTemplateLayer::createPrefab((int)a1, (int)&v10, 0);
sub_774008(&v10);
addChild_0 = a1->addChild_0;
sub_776584((int)&v9, "Added to editor");
sub_776584((int)&v10, (char *)&unk_939830);
v8 = TextAlertPopup::create((TextAlertPopup *)&v9, (std::string)1056964608, 0.6, 150, (int)&v10);
addChild_0(a1, v8, 100);
sub_774008(&v10);
sub_774008(&v9);
}
}