| 590 | } |
| 591 | |
| 592 | void ResourcePool::ExportResourceList(lua_State* L, ResourceType t)const LNOEXCEPT |
| 593 | { |
| 594 | int cnt = 1; |
| 595 | switch (t) |
| 596 | { |
| 597 | case ResourceType::Texture: |
| 598 | lua_newtable(L); // t |
| 599 | for (auto& i : m_TexturePool) |
| 600 | { |
| 601 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 602 | lua_rawseti(L, -2, cnt++); // t |
| 603 | } |
| 604 | break; |
| 605 | case ResourceType::Sprite: |
| 606 | lua_newtable(L); // t |
| 607 | for (auto& i : m_SpritePool) |
| 608 | { |
| 609 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 610 | lua_rawseti(L, -2, cnt++); // t |
| 611 | } |
| 612 | break; |
| 613 | case ResourceType::Animation: |
| 614 | lua_newtable(L); // t |
| 615 | for (auto& i : m_AnimationPool) |
| 616 | { |
| 617 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 618 | lua_rawseti(L, -2, cnt++); // t |
| 619 | } |
| 620 | break; |
| 621 | case ResourceType::Music: |
| 622 | lua_newtable(L); // t |
| 623 | for (auto& i : m_MusicPool) |
| 624 | { |
| 625 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 626 | lua_rawseti(L, -2, cnt++); // t |
| 627 | } |
| 628 | break; |
| 629 | case ResourceType::SoundEffect: |
| 630 | lua_newtable(L); // t |
| 631 | for (auto& i : m_SoundSpritePool) |
| 632 | { |
| 633 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 634 | lua_rawseti(L, -2, cnt++); // t |
| 635 | } |
| 636 | break; |
| 637 | case ResourceType::Particle: |
| 638 | lua_newtable(L); // t |
| 639 | for (auto& i : m_ParticlePool) |
| 640 | { |
| 641 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |
| 642 | lua_rawseti(L, -2, cnt++); // t |
| 643 | } |
| 644 | break; |
| 645 | case ResourceType::SpriteFont: |
| 646 | lua_newtable(L); // t |
| 647 | for (auto& i : m_SpriteFontPool) |
| 648 | { |
| 649 | lua_pushstring(L, i.second->GetResName().c_str()); // t s |