With this function you can check that a given user has a chosen privilege. The function will return true or false in the System Asynchronous Event depending on whether the privilege is enabled or not, and if you set the attempt_resolution argument to true and the privilege isn't enabled, it will also open a system dialogue (suspending the game) to prompt the user to upgrade the account or whatever is required to get the privilege. If the user then enables the required option, the function will return true.
The function requires that you use one of the following constants for the privilege request:
常量 描述 uwp_privilege_internet_browsing Check to see if internet browsing is permitted uwp_privilege_social_network_sharing Check to see if sharing to social networks is permitted uwp_privilege_share_kinect_content Check whether sharing the Kinect controller is permitted uwp_privilege_video_communications Check to see if video communication is permitted uwp_privilege_communications Check to see if internet communication is permitted uwp_privilege_user_created_content Check if access to user created content is permitted uwp_privilege_multiplayer_sessions Check to see if online multiplayer sessions are permitted uwp_privilege_sessions Check to see if online sessions are permitted uwp_privilege_fitness_upload Check to see if fitness data uploading is permitted
Once the function has been called it will trigger an Asynchronous System event when the callback result has been received, which will have the special DS map async_load. This map should then be parsed for the following key:
- "event_type" - should hold the value "check_privilege_result" if the event was triggered by this function
If the event type relates to this function, then there will also be the following additional keys:
- "result" - Will be one or more of the following constants (combined values):
常量 值 描述 uwp_privilege_result_no_issue 0 There are no privilege issues with the user uwp_privilege_result_purchase_required 1 The user must purchase something additional, usually a subscription, for access uwp_privilege_result_aborted 2 The check was aborted uwp_privilege_result_banned 4 The user is banned uwp_privilege_result_restricted 8 The user is restricted from access, usually through parental controls
- "privilege" - will be one of the constants listed above for use in the function, so you can check which privilege you have requested in the case of multiple checks.
uwp_check_privilege(user_id, privilege, attempt_resolution);
参数 描述 user_id The User ID pointer to check. privilege The privilege constant to check (see description, above). attempt_resolution Enable attempting a resolution if set to true, or ignore if set to false.
Real(实数)
var user_one = xboxlive_get_user(0);
if (xboxlive_user_is_signed_in(user_one))
{
uwp_check_privilege(user_one, xboxlive_privilege_multiplayer_sessions, true);
}
The above checks to see if the user is signed in and if they are it checks the multiplayer sessions permission.