Adding xbox_live_context access for C++ Xbox Live Creators so they can call privacy, profile, and title storage service APIs (#161)
This commit is contained in:
Родитель
01f246c279
Коммит
f9245f6a71
|
@ -15,14 +15,14 @@
|
|||
#include "xsapi/leaderboard.h"
|
||||
#include "xsapi/social_manager.h"
|
||||
#include "xsapi/stats_manager.h"
|
||||
|
||||
#if !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
#include "xsapi/http_call.h"
|
||||
#include "xsapi/xbox_live_context_settings.h"
|
||||
#include "xsapi/events.h"
|
||||
#include "xsapi/title_storage.h"
|
||||
#include "xsapi/privacy.h"
|
||||
#include "xsapi/profile.h"
|
||||
|
||||
#if !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
#include "xsapi/events.h"
|
||||
#include "xsapi/social.h"
|
||||
#include "xsapi/achievements.h"
|
||||
#include "xsapi/user_statistics.h"
|
||||
|
@ -34,12 +34,13 @@
|
|||
#include "xsapi/game_server_platform.h"
|
||||
#include "xsapi/contextual_search_service.h"
|
||||
#include "xsapi/marketplace.h"
|
||||
#include "xsapi/title_callable_ui.h"
|
||||
#include "xsapi/multiplayer_manager.h"
|
||||
#include "xsapi/entertainment_profile.h"
|
||||
#include "xsapi/xbox_live_context.h"
|
||||
#endif // !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
|
||||
#include "xsapi/title_callable_ui.h"
|
||||
#include "xsapi/xbox_live_context.h"
|
||||
|
||||
#ifdef U
|
||||
#undef U // clean up cpprest's global define in case it's used by app
|
||||
#endif
|
||||
|
|
|
@ -82,6 +82,7 @@ class title_callable_ui
|
|||
{
|
||||
public:
|
||||
#if UWP_API
|
||||
#if !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
/// <summary>
|
||||
/// Shows a picker UI that allows a person playing the game to select players
|
||||
/// from a presented list of other people.
|
||||
|
@ -132,22 +133,6 @@ public:
|
|||
_In_opt_ Windows::System::User^ user = nullptr
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Shows UI displaying the profile card for a specified user.
|
||||
/// </summary>
|
||||
/// <param name="targetXboxUserId">The Xbox User ID to show information about.</param>
|
||||
/// <param name="user">System user that identifies the user to show the UI on behalf of</param>
|
||||
/// <returns>
|
||||
/// Returns a pplx::task<T> object that represents the state of the asynchronous operation.
|
||||
/// The task completes when the UI is closed.
|
||||
/// result.err() contains the error based on what happened in the case of an error.
|
||||
/// </returns>
|
||||
_XSAPIIMP static pplx::task<xbox::services::xbox_live_result<void>>
|
||||
show_profile_card_ui(
|
||||
_In_ const string_t& targetXboxUserId,
|
||||
_In_opt_ Windows::System::User^ user = nullptr
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Shows UI for adding or removing a specified person to or from the requesting user's friend list.
|
||||
/// </summary>
|
||||
|
@ -179,6 +164,23 @@ public:
|
|||
_In_ uint32_t titleId,
|
||||
_In_opt_ Windows::System::User^ user = nullptr
|
||||
);
|
||||
#endif // !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
|
||||
/// <summary>
|
||||
/// Shows UI displaying the profile card for a specified user.
|
||||
/// </summary>
|
||||
/// <param name="targetXboxUserId">The Xbox User ID to show information about.</param>
|
||||
/// <param name="user">System user that identifies the user to show the UI on behalf of</param>
|
||||
/// <returns>
|
||||
/// Returns a pplx::task<T> object that represents the state of the asynchronous operation.
|
||||
/// The task completes when the UI is closed.
|
||||
/// result.err() contains the error based on what happened in the case of an error.
|
||||
/// </returns>
|
||||
_XSAPIIMP static pplx::task<xbox::services::xbox_live_result<void>>
|
||||
show_profile_card_ui(
|
||||
_In_ const string_t& targetXboxUserId,
|
||||
_In_opt_ Windows::System::User^ user = nullptr
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the current user has a specific privilege
|
||||
|
|
|
@ -128,11 +128,6 @@ public:
|
|||
/// </summary>
|
||||
_XSAPIIMP std::shared_ptr<xbox_live_app_config> application_config();
|
||||
|
||||
/// <summary>
|
||||
/// A service for managing leaderboards.
|
||||
/// </summary>
|
||||
_XSAPIIMP leaderboard::leaderboard_service& leaderboard_service();
|
||||
|
||||
/// <summary>
|
||||
/// A service for storing data in the cloud.
|
||||
/// </summary>
|
||||
|
@ -143,6 +138,17 @@ public:
|
|||
/// </summary>
|
||||
_XSAPIIMP social::profile_service& profile_service();
|
||||
|
||||
/// <summary>
|
||||
/// A service for managing privacy settings.
|
||||
/// </summary>
|
||||
_XSAPIIMP privacy::privacy_service& privacy_service();
|
||||
|
||||
#if !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
/// <summary>
|
||||
/// A service for managing leaderboards.
|
||||
/// </summary>
|
||||
_XSAPIIMP leaderboard::leaderboard_service& leaderboard_service();
|
||||
|
||||
/// <summary>
|
||||
/// A service for managing social networking links.
|
||||
/// </summary>
|
||||
|
@ -153,11 +159,6 @@ public:
|
|||
/// </summary>
|
||||
_XSAPIIMP social::reputation_service& reputation_service();
|
||||
|
||||
/// <summary>
|
||||
/// A service for managing privacy settings.
|
||||
/// </summary>
|
||||
_XSAPIIMP privacy::privacy_service& privacy_service();
|
||||
|
||||
/// <summary>
|
||||
/// A service for managing achievements.
|
||||
/// </summary>
|
||||
|
@ -231,6 +232,7 @@ public:
|
|||
/// </summary>
|
||||
_XSAPIIMP entertainment_profile::entertainment_profile_list_service& entertainment_profile_list_service();
|
||||
#endif // TV_API || UNIT_TEST_SERVICES
|
||||
#endif // !defined(XBOX_LIVE_CREATORS_SDK)
|
||||
|
||||
#if (TV_API | XBOX_UWP) && defined(XSAPI_CPPWINRT)
|
||||
_XSAPIIMP xbox_live_context(
|
||||
|
|
|
@ -548,6 +548,17 @@ void Game::HandleSignInResult(
|
|||
switch (result.status())
|
||||
{
|
||||
case xbox::services::system::sign_in_status::success:
|
||||
m_xboxLiveContext = std::make_shared<xbox::services::xbox_live_context>(m_user);
|
||||
|
||||
// These can be accessed from xbox_live_context:
|
||||
m_xboxLiveContext->application_config();
|
||||
m_xboxLiveContext->privacy_service();
|
||||
m_xboxLiveContext->profile_service();
|
||||
m_xboxLiveContext->title_storage_service();
|
||||
m_xboxLiveContext->settings();
|
||||
m_xboxLiveContext->user();
|
||||
m_xboxLiveContext->xbox_live_user_id();
|
||||
|
||||
AddUserToSocialManager(m_user);
|
||||
Log(L"Sign in succeeded");
|
||||
break;
|
||||
|
|
|
@ -78,7 +78,8 @@ namespace Sample
|
|||
|
||||
static std::mutex m_socialManagerLock;
|
||||
private:
|
||||
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
||||
std::shared_ptr<xbox::services::xbox_live_context> m_xboxLiveContext;
|
||||
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
||||
std::unique_ptr<Renderer> m_sceneRenderer;
|
||||
DX::StepTimer m_timer;
|
||||
bool bInitialized;
|
||||
|
|
Загрузка…
Ссылка в новой задаче