2015-12-23 16:21:03 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class AssetHandler : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef Game::XAssetHeader(*Callback)(Game::XAssetType, const char*);
|
2015-12-25 20:51:58 -05:00
|
|
|
typedef bool(*RestrictCallback)(Game::XAssetType type, Game::XAssetHeader asset, const char* name);
|
2015-12-23 16:21:03 -05:00
|
|
|
|
|
|
|
AssetHandler();
|
|
|
|
~AssetHandler();
|
|
|
|
const char* GetName() { return "AssetHandler"; };
|
|
|
|
|
2015-12-26 08:27:34 -05:00
|
|
|
static void OnFind(Game::XAssetType type, Callback callback);
|
|
|
|
static void OnLoad(RestrictCallback callback);
|
|
|
|
|
|
|
|
static const bool Restrict;
|
|
|
|
static const bool Load;
|
2015-12-23 16:21:03 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
static bool BypassState;
|
|
|
|
|
|
|
|
static Game::XAssetHeader FindAsset(Game::XAssetType type, const char* filename);
|
2015-12-25 20:51:58 -05:00
|
|
|
static bool IsAssetEligible(Game::XAssetType type, Game::XAssetHeader* asset);
|
2015-12-23 16:21:03 -05:00
|
|
|
static void FindAssetStub();
|
2015-12-25 20:51:58 -05:00
|
|
|
static void AddAssetStub();
|
2015-12-23 16:21:03 -05:00
|
|
|
|
|
|
|
static std::map<Game::XAssetType, Callback> TypeCallbacks;
|
2015-12-25 20:51:58 -05:00
|
|
|
static std::vector<RestrictCallback> RestrictCallbacks;
|
2015-12-23 16:21:03 -05:00
|
|
|
};
|
|
|
|
}
|