@brief 检查资源是否存在 @warning 注意t可以是非法枚举量
| 548 | /// @brief 检查资源是否存在 |
| 549 | /// @warning 注意t可以是非法枚举量 |
| 550 | bool CheckResourceExists(ResourceType t, const std::string& name)const LNOEXCEPT |
| 551 | { |
| 552 | switch (t) |
| 553 | { |
| 554 | case ResourceType::Texture: |
| 555 | return m_TexturePool.find(name.c_str()) != m_TexturePool.end(); |
| 556 | case ResourceType::Sprite: |
| 557 | return m_SpritePool.find(name.c_str()) != m_SpritePool.end(); |
| 558 | case ResourceType::Animation: |
| 559 | return m_AnimationPool.find(name.c_str()) != m_AnimationPool.end(); |
| 560 | case ResourceType::Music: |
| 561 | return m_MusicPool.find(name.c_str()) != m_MusicPool.end(); |
| 562 | case ResourceType::SoundEffect: |
| 563 | return m_SoundSpritePool.find(name.c_str()) != m_SoundSpritePool.end(); |
| 564 | case ResourceType::Particle: |
| 565 | return m_ParticlePool.find(name.c_str()) != m_ParticlePool.end(); |
| 566 | case ResourceType::SpriteFont: |
| 567 | return m_SpriteFontPool.find(name.c_str()) != m_SpriteFontPool.end(); |
| 568 | case ResourceType::TrueTypeFont: |
| 569 | return m_TTFFontPool.find(name.c_str()) != m_TTFFontPool.end(); |
| 570 | case ResourceType::FX: |
| 571 | return m_FXPool.find(name.c_str()) != m_FXPool.end(); |
| 572 | default: |
| 573 | break; |
| 574 | } |
| 575 | |
| 576 | return false; |
| 577 | } |
| 578 | |
| 579 | /// @brief 导出资源表 |
| 580 | /// @note 在L的堆栈上放置一个table用以存放ResourceType中的资源名称 |