Integrated Config File

This commit is contained in:
CT5
2025-11-07 15:57:20 +11:00
parent ed95d5712c
commit 2f9e562aac
3 changed files with 22 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ namespace winrt::Windows::Xbox::System::implementation
struct User : UserT<User>
{
User() = default;
User(uint64_t id) : m_id(id) {}
User(uint64_t id) : m_id(id), wdcfg(WinDurangoConfig::Instance()) {}
static winrt::Windows::Xbox::System::UserOnlineState OnlineState();
static winrt::event_token OnlineStateChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::OnlineStateChangedEventArgs> const& handler);
@@ -58,6 +58,7 @@ namespace winrt::Windows::Xbox::System::implementation
inline static winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::SignOutCompletedEventArgs>> m_signOutCompletedEvent;
inline static winrt::Windows::Xbox::System::User staticUser = {nullptr};
inline static winrt::Windows::Foundation::Collections::IVector<winrt::Windows::Xbox::System::User> staticUsers = {nullptr};
WinDurangoConfig& wdcfg;
};
}
namespace winrt::Windows::Xbox::System::factory_implementation

View File

@@ -7,43 +7,54 @@ namespace winrt::Windows::Xbox::System::implementation
hstring UserDisplayInfo::Gamertag()
{
LOG_INFO("UserDisplayInfo::Gamertag() called");
return L"HelloWorld";
return winrt::to_hstring(wdcfg.GetData().gamertag);
}
uint32_t UserDisplayInfo::GamerScore()
{
LOG_INFO("UserDisplayInfo::GamerScore() called");
return 0;
return wdcfg.GetData().gamerscore;
}
hstring UserDisplayInfo::ApplicationDisplayName()
{
LOG_INFO("UserDisplayInfo::GameDisplayName() called");
return to_hstring("WinDurango");
return winrt::to_hstring(wdcfg.GetData().gamertag);
}
hstring UserDisplayInfo::GameDisplayName()
{
LOG_INFO("UserDisplayInfo::GameDisplayName() called");
return L"HelloWorld";
return winrt::to_hstring(wdcfg.GetData().gamertag);
}
int32_t UserDisplayInfo::Reputation()
{
LOG_INFO("UserDisplayInfo::Reputation() called");
return 1;
return wdcfg.GetData().reputation;
}
UserAgeGroup UserDisplayInfo::AgeGroup()
{
LOG_INFO("UserDisplayInfo::AgeGroup() called");
return UserAgeGroup::Unknown;
switch (wdcfg.GetData().ageGroup) {
case WinDurangoConfigData::AgeGroup::Adult:
return UserAgeGroup::Adult;
case WinDurangoConfigData::AgeGroup::Child:
return UserAgeGroup::Child;
case WinDurangoConfigData::AgeGroup::Teen:
return UserAgeGroup::Teen;
case WinDurangoConfigData::AgeGroup::Unknown:
return UserAgeGroup::Unknown;
default:
return UserAgeGroup::Unknown;
}
}
Foundation::Collections::IVectorView<uint32_t> UserDisplayInfo::Privileges()

View File

@@ -6,7 +6,7 @@ namespace winrt::Windows::Xbox::System::implementation
struct UserDisplayInfo : UserDisplayInfoT<UserDisplayInfo>
{
UserDisplayInfo() = default;
UserDisplayInfo(hstring gamertag) {}
UserDisplayInfo(hstring gamertag) : wdcfg(WinDurangoConfig::Instance()) {}
hstring Gamertag();
uint32_t GamerScore();
@@ -15,5 +15,6 @@ namespace winrt::Windows::Xbox::System::implementation
int32_t Reputation();
UserAgeGroup AgeGroup();
Foundation::Collections::IVectorView<uint32_t> Privileges();
WinDurangoConfig& wdcfg;
};
}