3#ifndef GAME_CLIENT_COMPONENTS_SKINS_H
4#define GAME_CLIENT_COMPONENTS_SKINS_H
15#include <unordered_map>
26 int Sizeof()
const override {
return sizeof(*this); }
41 constexpr static const char *
VANILLA_SKINS[] = {
"bluekitty",
"bluestripe",
"brownbear",
42 "cammo",
"cammostripes",
"coala",
"default",
"limekitty",
43 "pinky",
"redbopp",
"redstripe",
"saddo",
"toptri",
44 "twinbop",
"twintri",
"warpaint",
"x_ninja",
"x_spec"};
74 std::shared_ptr<CSkinDownloadJob> m_pDownloadJob =
nullptr;
89 std::unordered_map<std::string_view, std::unique_ptr<CSkin>>
m_Skins;
91 std::unordered_map<std::string_view, std::unique_ptr<CLoadingSkin>>
m_LoadingSkins;
97 const CSkin *
LoadSkin(
const char *pName,
const char *pPath,
int DirType);
100 static int SkinScan(
const char *pName,
int IsDir,
int DirType,
void *pUser);
Definition: component.h:20
const char * Name() const
Definition: skins.h:86
CLoadingSkin & operator=(CLoadingSkin &&Other)=default
CLoadingSkin(CLoadingSkin &&Other)=default
void Run() override REQUIRES(!m_Lock)
Definition: skins.cpp:469
CImageInfo & ImageInfo()
Definition: skins.h:55
CImageInfo m_ImageInfo
Definition: skins.h:65
CSkinDownloadJob(CSkins *pSkins, const char *pName)
Definition: skins.cpp:441
bool Abort() override REQUIRES(!m_Lock)
Definition: skins.cpp:453
CSkins * m_pSkins
Definition: skins.h:61
~CSkinDownloadJob()
Definition: skins.cpp:448
char m_aName[MAX_SKIN_LENGTH]
Definition: skins.h:62
std::shared_ptr< CHttpRequest > m_pGetRequest
Definition: skins.h:64
CLock m_Lock
Definition: skins.h:63
const CSkin * LoadSkin(const char *pName, const char *pPath, int DirType)
Definition: skins.cpp:119
const std::unordered_map< std::string_view, std::unique_ptr< CSkin > > & GetSkinsUnsafe() const
Definition: skins.h:33
char m_aEventSkinPrefix[MAX_SKIN_LENGTH]
Definition: skins.h:95
static bool IsVanillaSkin(const char *pName)
Definition: skins.cpp:41
CSkin m_PlaceholderSkin
Definition: skins.h:94
const CSkin * FindOrNullptr(const char *pName, bool IgnorePrefix=false)
Definition: skins.cpp:338
void OnShutdown() override
Definition: skins.cpp:300
std::unordered_map< std::string_view, std::unique_ptr< CSkin > > m_Skins
Definition: skins.h:89
CSkins()
Definition: skins.cpp:21
const CSkin * FindImpl(const char *pName)
Definition: skins.cpp:361
int Sizeof() const override
Definition: skins.h:26
void OnInit() override
Definition: skins.cpp:282
std::function< void()> TSkinLoadedCallback
Definition: skins.h:24
void RandomizeSkin(int Dummy)
Definition: skins.cpp:399
static constexpr const char * VANILLA_SKINS[]
Definition: skins.h:41
const CSkin * Find(const char *pName)
Definition: skins.cpp:324
std::unordered_map< std::string_view, std::unique_ptr< CLoadingSkin > > m_LoadingSkins
Definition: skins.h:91
static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition: skins.cpp:53
void Refresh(TSkinLoadedCallback &&SkinLoadedCallback)
Definition: skins.cpp:305
std::chrono::nanoseconds m_LastRefreshTime
Definition: skins.h:92
std::chrono::nanoseconds LastRefreshTime() const
Definition: skins.h:31
@ MAX_SKIN_LENGTH
Definition: protocol.h:99
bool operator==(const SHA256_DIGEST &that, const SHA256_DIGEST &other)
Definition: hash.h:36
#define REQUIRES(...)
Definition: lock.h:32
bool operator<(const ColorRGBA &Left, const ColorRGBA &Right)
Definition: tileart.cpp:8