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); }
42 constexpr static const char *
VANILLA_SKINS[] = {
"bluekitty",
"bluestripe",
"brownbear",
43 "cammo",
"cammostripes",
"coala",
"default",
"limekitty",
44 "pinky",
"redbopp",
"redstripe",
"saddo",
"toptri",
45 "twinbop",
"twintri",
"warpaint",
"x_ninja",
"x_spec"};
75 std::shared_ptr<CSkinDownloadJob> m_pDownloadJob =
nullptr;
90 std::unordered_map<std::string_view, std::unique_ptr<CSkin>>
m_Skins;
92 std::unordered_map<std::string_view, std::unique_ptr<CLoadingSkin>>
m_LoadingSkins;
98 const CSkin *
LoadSkin(
const char *pName,
const char *pPath,
int DirType);
101 static int SkinScan(
const char *pName,
int IsDir,
int DirType,
void *pUser);
Definition: component.h:20
const char * Name() const
Definition: skins.h:87
CLoadingSkin & operator=(CLoadingSkin &&Other)=default
CLoadingSkin(CLoadingSkin &&Other)=default
void Run() override REQUIRES(!m_Lock)
Definition: skins.cpp:480
CImageInfo & ImageInfo()
Definition: skins.h:56
CImageInfo m_ImageInfo
Definition: skins.h:66
CSkinDownloadJob(CSkins *pSkins, const char *pName)
Definition: skins.cpp:452
bool Abort() override REQUIRES(!m_Lock)
Definition: skins.cpp:464
CSkins * m_pSkins
Definition: skins.h:62
~CSkinDownloadJob()
Definition: skins.cpp:459
char m_aName[MAX_SKIN_LENGTH]
Definition: skins.h:63
std::shared_ptr< CHttpRequest > m_pGetRequest
Definition: skins.h:65
CLock m_Lock
Definition: skins.h:64
const CSkin * LoadSkin(const char *pName, const char *pPath, int DirType)
Definition: skins.cpp:124
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:96
static bool IsVanillaSkin(const char *pName)
Definition: skins.cpp:41
CSkin m_PlaceholderSkin
Definition: skins.h:95
const CSkin * FindOrNullptr(const char *pName, bool IgnorePrefix=false)
Definition: skins.cpp:343
void OnShutdown() override
Definition: skins.cpp:305
std::unordered_map< std::string_view, std::unique_ptr< CSkin > > m_Skins
Definition: skins.h:90
CSkins()
Definition: skins.cpp:21
const CSkin * FindImpl(const char *pName)
Definition: skins.cpp:366
int Sizeof() const override
Definition: skins.h:26
void OnInit() override
Definition: skins.cpp:287
std::function< void()> TSkinLoadedCallback
Definition: skins.h:24
void RandomizeSkin(int Dummy)
Definition: skins.cpp:404
static bool IsSpecialSkin(const char *pName)
Definition: skins.cpp:46
static constexpr const char * VANILLA_SKINS[]
Definition: skins.h:42
const CSkin * Find(const char *pName)
Definition: skins.cpp:329
std::unordered_map< std::string_view, std::unique_ptr< CLoadingSkin > > m_LoadingSkins
Definition: skins.h:92
static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition: skins.cpp:58
void Refresh(TSkinLoadedCallback &&SkinLoadedCallback)
Definition: skins.cpp:310
std::chrono::nanoseconds m_LastRefreshTime
Definition: skins.h:93
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