コード例 #1
0
void LuaLevelEngine::loadNPCClass(int id, const QString &path)
{
    if(shouldShutdown())
        return;

    luabind::object _G = luabind::globals(getNativeState());
    if(luabind::type(_G["npc_class_table"]) != LUA_TTABLE){
        _G["npc_class_table"] = luabind::newtable(getNativeState());
    }

    if(luabind::type(_G["npc_class_table"][id]) != LUA_TNIL)
        return;

    _G["npc_class_table"][id] = loadClassAPI(path);
}
コード例 #2
0
void LuaLevelEngine::destoryLuaNpc(LVL_Npc *npc)
{
    try {
        luabind::call_function<void>(getNativeState(), "__destroy_luanpc", npc);
    } catch (luabind::error& error){
        postLateShutdownError(error);
        return;
    }
}
コード例 #3
0
LVL_Npc *LuaLevelEngine::createLuaNpc(unsigned int id)
{
    try {
        return luabind::call_function<LVL_Npc*>(getNativeState(), "__create_luanpc", id);
    } catch (luabind::error& error){
        postLateShutdownError(error);
        return nullptr;
    }
}
コード例 #4
0
LVL_Player *LuaLevelEngine::createLuaPlayer()
{
    try {
        return luabind::call_function<LVL_Player*>(getNativeState(), "__create_luaplayer");
    } catch (luabind::error& error){
        postLateShutdownError(error);
        return nullptr;
    }
}
コード例 #5
0
void LuaLevelEngine::onBindAll()
{
    luabind::module(getNativeState())[
        Binding_Level_Class_PhysObj::bindToLua(),
        Binding_Level_Class_InAreaDetector::bindToLua(),
        Binding_Level_Class_PlayerPosDetector::bindToLua(),
        Binding_Level_ClassWrapper_LVL_Player::bindToLua(),
        Binding_Level_ClassWrapper_LVL_NPC::bindToLua(),
        Binding_Level_GlobalFuncs_Player::bindToLua(),
        Binding_Level_GlobalFuncs_NPC::bindToLua()
    ];

    {
        luabind::object _G = luabind::globals(getNativeState());
        if(luabind::type(_G["bases"]) != LUA_TTABLE){
            _G["bases"] = luabind::newtable(getNativeState());
        }

        _G["bases"]["npc"] = loadClassAPI(m_npcBaseClassPath);
        _G["bases"]["player"] = loadClassAPI(m_playerBaseClassPath);
    }

}
コード例 #6
0
void LuaTitleScreenEngine::onBindAll()
{
    Binding_Global_Constants::bindToLua(getNativeState());
}