[U] add PlayFab SDK and SNS login improvements

- Add PlayFabSDK as local package dependency
- Add PlayFabTool.cs for PlayFab API integration
- Implement LoginBySns method in TYSdkFacade
- Add Android SNS login support in SDKManager and UnityBridgeFunc
- Add Build Android With Debug menu option
- Improve exception handling and timeout management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 16:12:17 +08:00
parent 638e6a3327
commit aa5ce1ff5a
226 changed files with 64975 additions and 62 deletions

View File

@@ -0,0 +1,36 @@
#if !DISABLE_PLAYFABENTITY_API
using PlayFab.ExperimentationModels;
namespace PlayFab.Events
{
public partial class PlayFabEvents
{
public event PlayFabRequestEvent<CreateExclusionGroupRequest> OnExperimentationCreateExclusionGroupRequestEvent;
public event PlayFabResultEvent<CreateExclusionGroupResult> OnExperimentationCreateExclusionGroupResultEvent;
public event PlayFabRequestEvent<CreateExperimentRequest> OnExperimentationCreateExperimentRequestEvent;
public event PlayFabResultEvent<CreateExperimentResult> OnExperimentationCreateExperimentResultEvent;
public event PlayFabRequestEvent<DeleteExclusionGroupRequest> OnExperimentationDeleteExclusionGroupRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationDeleteExclusionGroupResultEvent;
public event PlayFabRequestEvent<DeleteExperimentRequest> OnExperimentationDeleteExperimentRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationDeleteExperimentResultEvent;
public event PlayFabRequestEvent<GetExclusionGroupsRequest> OnExperimentationGetExclusionGroupsRequestEvent;
public event PlayFabResultEvent<GetExclusionGroupsResult> OnExperimentationGetExclusionGroupsResultEvent;
public event PlayFabRequestEvent<GetExclusionGroupTrafficRequest> OnExperimentationGetExclusionGroupTrafficRequestEvent;
public event PlayFabResultEvent<GetExclusionGroupTrafficResult> OnExperimentationGetExclusionGroupTrafficResultEvent;
public event PlayFabRequestEvent<GetExperimentsRequest> OnExperimentationGetExperimentsRequestEvent;
public event PlayFabResultEvent<GetExperimentsResult> OnExperimentationGetExperimentsResultEvent;
public event PlayFabRequestEvent<GetLatestScorecardRequest> OnExperimentationGetLatestScorecardRequestEvent;
public event PlayFabResultEvent<GetLatestScorecardResult> OnExperimentationGetLatestScorecardResultEvent;
public event PlayFabRequestEvent<GetTreatmentAssignmentRequest> OnExperimentationGetTreatmentAssignmentRequestEvent;
public event PlayFabResultEvent<GetTreatmentAssignmentResult> OnExperimentationGetTreatmentAssignmentResultEvent;
public event PlayFabRequestEvent<StartExperimentRequest> OnExperimentationStartExperimentRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationStartExperimentResultEvent;
public event PlayFabRequestEvent<StopExperimentRequest> OnExperimentationStopExperimentRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationStopExperimentResultEvent;
public event PlayFabRequestEvent<UpdateExclusionGroupRequest> OnExperimentationUpdateExclusionGroupRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationUpdateExclusionGroupResultEvent;
public event PlayFabRequestEvent<UpdateExperimentRequest> OnExperimentationUpdateExperimentRequestEvent;
public event PlayFabResultEvent<EmptyResponse> OnExperimentationUpdateExperimentResultEvent;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad18b9280bb1a7f4c926eba4c1086b6e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,208 @@
#if !DISABLE_PLAYFABENTITY_API && !DISABLE_PLAYFAB_STATIC_API
using System;
using System.Collections.Generic;
using PlayFab.ExperimentationModels;
using PlayFab.Internal;
namespace PlayFab
{
/// <summary>
/// APIs for managing experiments.
/// </summary>
public static class PlayFabExperimentationAPI
{
static PlayFabExperimentationAPI() {}
/// <summary>
/// Verify entity login.
/// </summary>
public static bool IsEntityLoggedIn()
{
return PlayFabSettings.staticPlayer.IsEntityLoggedIn();
}
/// <summary>
/// Clear the Client SessionToken which allows this Client to call API calls requiring login.
/// A new/fresh login will be required after calling this.
/// </summary>
public static void ForgetAllCredentials()
{
PlayFabSettings.staticPlayer.ForgetAllCredentials();
}
/// <summary>
/// Creates a new experiment exclusion group for a title.
/// </summary>
public static void CreateExclusionGroup(CreateExclusionGroupRequest request, Action<CreateExclusionGroupResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/CreateExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Creates a new experiment for a title.
/// </summary>
public static void CreateExperiment(CreateExperimentRequest request, Action<CreateExperimentResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/CreateExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Deletes an existing exclusion group for a title.
/// </summary>
public static void DeleteExclusionGroup(DeleteExclusionGroupRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/DeleteExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Deletes an existing experiment for a title.
/// </summary>
public static void DeleteExperiment(DeleteExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/DeleteExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Gets the details of all exclusion groups for a title.
/// </summary>
public static void GetExclusionGroups(GetExclusionGroupsRequest request, Action<GetExclusionGroupsResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExclusionGroups", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Gets the details of all exclusion groups for a title.
/// </summary>
public static void GetExclusionGroupTraffic(GetExclusionGroupTrafficRequest request, Action<GetExclusionGroupTrafficResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExclusionGroupTraffic", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Gets the details of all experiments for a title.
/// </summary>
public static void GetExperiments(GetExperimentsRequest request, Action<GetExperimentsResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExperiments", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Gets the latest scorecard of the experiment for the title.
/// </summary>
public static void GetLatestScorecard(GetLatestScorecardRequest request, Action<GetLatestScorecardResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetLatestScorecard", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Gets the treatment assignments for a player for every running experiment in the title.
/// </summary>
public static void GetTreatmentAssignment(GetTreatmentAssignmentRequest request, Action<GetTreatmentAssignmentResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetTreatmentAssignment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Starts an existing experiment for a title.
/// </summary>
public static void StartExperiment(StartExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/StartExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Stops an existing experiment for a title.
/// </summary>
public static void StopExperiment(StopExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/StopExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Updates an existing exclusion group for a title.
/// </summary>
public static void UpdateExclusionGroup(UpdateExclusionGroupRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/UpdateExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
/// <summary>
/// Updates an existing experiment for a title.
/// </summary>
public static void UpdateExperiment(UpdateExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
var callSettings = PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/UpdateExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9dbcafaa60e9f2a41930b9907fb0c133
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,200 @@
#if !DISABLE_PLAYFABENTITY_API
using System;
using System.Collections.Generic;
using PlayFab.ExperimentationModels;
using PlayFab.Internal;
using PlayFab.SharedModels;
namespace PlayFab
{
/// <summary>
/// APIs for managing experiments.
/// </summary>
public class PlayFabExperimentationInstanceAPI : IPlayFabInstanceApi
{
public readonly PlayFabApiSettings apiSettings = null;
public readonly PlayFabAuthenticationContext authenticationContext = null;
public PlayFabExperimentationInstanceAPI(PlayFabAuthenticationContext context)
{
if (context == null)
throw new PlayFabException(PlayFabExceptionCode.AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or call <PlayFabClientInstanceAPI>.GetAuthenticationContext()");
authenticationContext = context;
}
public PlayFabExperimentationInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
{
if (context == null)
throw new PlayFabException(PlayFabExceptionCode.AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or call <PlayFabClientInstanceAPI>.GetAuthenticationContext()");
apiSettings = settings;
authenticationContext = context;
}
/// <summary>
/// Verify entity login.
/// </summary>
public bool IsEntityLoggedIn()
{
return authenticationContext == null ? false : authenticationContext.IsEntityLoggedIn();
}
/// <summary>
/// Clear the Client SessionToken which allows this Client to call API calls requiring login.
/// A new/fresh login will be required after calling this.
/// </summary>
public void ForgetAllCredentials()
{
if (authenticationContext != null)
{
authenticationContext.ForgetAllCredentials();
}
}
/// <summary>
/// Creates a new experiment exclusion group for a title.
/// </summary>
public void CreateExclusionGroup(CreateExclusionGroupRequest request, Action<CreateExclusionGroupResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/CreateExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Creates a new experiment for a title.
/// </summary>
public void CreateExperiment(CreateExperimentRequest request, Action<CreateExperimentResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/CreateExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Deletes an existing exclusion group for a title.
/// </summary>
public void DeleteExclusionGroup(DeleteExclusionGroupRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/DeleteExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Deletes an existing experiment for a title.
/// </summary>
public void DeleteExperiment(DeleteExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/DeleteExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Gets the details of all exclusion groups for a title.
/// </summary>
public void GetExclusionGroups(GetExclusionGroupsRequest request, Action<GetExclusionGroupsResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExclusionGroups", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Gets the details of all exclusion groups for a title.
/// </summary>
public void GetExclusionGroupTraffic(GetExclusionGroupTrafficRequest request, Action<GetExclusionGroupTrafficResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExclusionGroupTraffic", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Gets the details of all experiments for a title.
/// </summary>
public void GetExperiments(GetExperimentsRequest request, Action<GetExperimentsResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetExperiments", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Gets the latest scorecard of the experiment for the title.
/// </summary>
public void GetLatestScorecard(GetLatestScorecardRequest request, Action<GetLatestScorecardResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetLatestScorecard", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Gets the treatment assignments for a player for every running experiment in the title.
/// </summary>
public void GetTreatmentAssignment(GetTreatmentAssignmentRequest request, Action<GetTreatmentAssignmentResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/GetTreatmentAssignment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Starts an existing experiment for a title.
/// </summary>
public void StartExperiment(StartExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/StartExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Stops an existing experiment for a title.
/// </summary>
public void StopExperiment(StopExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/StopExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Updates an existing exclusion group for a title.
/// </summary>
public void UpdateExclusionGroup(UpdateExclusionGroupRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/UpdateExclusionGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
/// <summary>
/// Updates an existing experiment for a title.
/// </summary>
public void UpdateExperiment(UpdateExperimentRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
{
var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
var callSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
PlayFabHttp.MakeApiCall("/Experimentation/UpdateExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ecc5b8d11fae41b4daaaf638349fdc78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,670 @@
#if !DISABLE_PLAYFABENTITY_API
using System;
using System.Collections.Generic;
using PlayFab.SharedModels;
namespace PlayFab.ExperimentationModels
{
public enum AnalysisTaskState
{
Waiting,
ReadyForSubmission,
SubmittingToPipeline,
Running,
Completed,
Failed,
Canceled
}
/// <summary>
/// Given a title entity token and exclusion group details, will create a new exclusion group for the title.
/// </summary>
[Serializable]
public class CreateExclusionGroupRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// Description of the exclusion group.
/// </summary>
public string Description;
/// <summary>
/// Friendly name of the exclusion group.
/// </summary>
public string Name;
}
[Serializable]
public class CreateExclusionGroupResult : PlayFabResultCommon
{
/// <summary>
/// Identifier of the exclusion group.
/// </summary>
public string ExclusionGroupId;
}
/// <summary>
/// Given a title entity token and experiment details, will create a new experiment for the title.
/// </summary>
[Serializable]
public class CreateExperimentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// Description of the experiment.
/// </summary>
public string Description;
/// <summary>
/// When experiment should end.
/// </summary>
public DateTime? EndDate;
/// <summary>
/// Id of the exclusion group.
/// </summary>
public string ExclusionGroupId;
/// <summary>
/// Percentage of exclusion group traffic that will see this experiment.
/// </summary>
public uint? ExclusionGroupTrafficAllocation;
/// <summary>
/// Type of experiment.
/// </summary>
public ExperimentType? ExperimentType;
/// <summary>
/// Friendly name of the experiment.
/// </summary>
public string Name;
/// <summary>
/// Id of the segment to which this experiment applies. Defaults to the 'All Players' segment.
/// </summary>
public string SegmentId;
/// <summary>
/// When experiment should start.
/// </summary>
public DateTime StartDate;
/// <summary>
/// List of title player account IDs that automatically receive treatments in the experiment, but are not included when
/// calculating experiment metrics.
/// </summary>
public List<string> TitlePlayerAccountTestIds;
/// <summary>
/// List of variants for the experiment.
/// </summary>
public List<Variant> Variants;
}
[Serializable]
public class CreateExperimentResult : PlayFabResultCommon
{
/// <summary>
/// The ID of the new experiment.
/// </summary>
public string ExperimentId;
}
/// <summary>
/// Given an entity token and an exclusion group ID this API deletes the exclusion group.
/// </summary>
[Serializable]
public class DeleteExclusionGroupRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the exclusion group to delete.
/// </summary>
public string ExclusionGroupId;
}
/// <summary>
/// Given an entity token and an experiment ID this API deletes the experiment. A running experiment must be stopped before
/// it can be deleted.
/// </summary>
[Serializable]
public class DeleteExperimentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the experiment to delete.
/// </summary>
public string ExperimentId;
}
[Serializable]
public class EmptyResponse : PlayFabResultCommon
{
}
/// <summary>
/// Combined entity type and ID structure which uniquely identifies a single entity.
/// </summary>
[Serializable]
public class EntityKey : PlayFabBaseModel
{
/// <summary>
/// Unique ID of the entity.
/// </summary>
public string Id;
/// <summary>
/// Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types
/// </summary>
public string Type;
}
[Serializable]
public class ExclusionGroupTrafficAllocation : PlayFabBaseModel
{
/// <summary>
/// Id of the experiment.
/// </summary>
public string ExperimentId;
/// <summary>
/// Percentage of exclusion group traffic that will see this experiment.
/// </summary>
public uint TrafficAllocation;
}
[Serializable]
public class Experiment : PlayFabBaseModel
{
/// <summary>
/// Description of the experiment.
/// </summary>
public string Description;
/// <summary>
/// When experiment should end/was ended.
/// </summary>
public DateTime? EndDate;
/// <summary>
/// Id of the exclusion group for this experiment.
/// </summary>
public string ExclusionGroupId;
/// <summary>
/// Percentage of exclusion group traffic that will see this experiment.
/// </summary>
public uint? ExclusionGroupTrafficAllocation;
/// <summary>
/// Type of experiment.
/// </summary>
public ExperimentType? ExperimentType;
/// <summary>
/// Id of the experiment.
/// </summary>
public string Id;
/// <summary>
/// Friendly name of the experiment.
/// </summary>
public string Name;
/// <summary>
/// Id of the segment to which this experiment applies. Defaults to the 'All Players' segment.
/// </summary>
public string SegmentId;
/// <summary>
/// When experiment should start/was started.
/// </summary>
public DateTime StartDate;
/// <summary>
/// State experiment is currently in.
/// </summary>
public ExperimentState? State;
/// <summary>
/// List of title player account IDs that automatically receive treatments in the experiment, but are not included when
/// calculating experiment metrics.
/// </summary>
public List<string> TitlePlayerAccountTestIds;
/// <summary>
/// List of variants for the experiment.
/// </summary>
public List<Variant> Variants;
}
[Serializable]
public class ExperimentExclusionGroup : PlayFabBaseModel
{
/// <summary>
/// Description of the exclusion group.
/// </summary>
public string Description;
/// <summary>
/// Id of the exclusion group.
/// </summary>
public string ExclusionGroupId;
/// <summary>
/// Friendly name of the exclusion group.
/// </summary>
public string Name;
}
public enum ExperimentState
{
New,
Started,
Stopped,
Deleted
}
public enum ExperimentType
{
Active,
Snapshot
}
/// <summary>
/// Given a title entity token will return the list of all exclusion groups for a title.
/// </summary>
[Serializable]
public class GetExclusionGroupsRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
}
[Serializable]
public class GetExclusionGroupsResult : PlayFabResultCommon
{
/// <summary>
/// List of exclusion groups for the title.
/// </summary>
public List<ExperimentExclusionGroup> ExclusionGroups;
}
/// <summary>
/// Given a title entity token and an exclusion group ID, will return the list of traffic allocations for the exclusion
/// group.
/// </summary>
[Serializable]
public class GetExclusionGroupTrafficRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the exclusion group.
/// </summary>
public string ExclusionGroupId;
}
[Serializable]
public class GetExclusionGroupTrafficResult : PlayFabResultCommon
{
/// <summary>
/// List of traffic allocations for the exclusion group.
/// </summary>
public List<ExclusionGroupTrafficAllocation> TrafficAllocations;
}
/// <summary>
/// Given a title entity token will return the list of all experiments for a title, including scheduled, started, stopped or
/// completed experiments.
/// </summary>
[Serializable]
public class GetExperimentsRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
}
[Serializable]
public class GetExperimentsResult : PlayFabResultCommon
{
/// <summary>
/// List of experiments for the title.
/// </summary>
public List<Experiment> Experiments;
}
/// <summary>
/// Given a title entity token and experiment details, will return the latest available scorecard.
/// </summary>
[Serializable]
public class GetLatestScorecardRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the experiment.
/// </summary>
public string ExperimentId;
}
[Serializable]
public class GetLatestScorecardResult : PlayFabResultCommon
{
/// <summary>
/// Scorecard for the experiment of the title.
/// </summary>
public Scorecard Scorecard;
}
/// <summary>
/// Given a title player or a title entity token, returns the treatment variants and variables assigned to the entity across
/// all running experiments
/// </summary>
[Serializable]
public class GetTreatmentAssignmentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The optional entity to perform this action on. Defaults to the currently logged in entity.
/// </summary>
public EntityKey Entity;
}
[Serializable]
public class GetTreatmentAssignmentResult : PlayFabResultCommon
{
/// <summary>
/// Treatment assignment for the entity.
/// </summary>
public TreatmentAssignment TreatmentAssignment;
}
[Serializable]
public class MetricData : PlayFabBaseModel
{
/// <summary>
/// The upper bound of the confidence interval for the relative delta (Delta.RelativeValue).
/// </summary>
public double ConfidenceIntervalEnd;
/// <summary>
/// The lower bound of the confidence interval for the relative delta (Delta.RelativeValue).
/// </summary>
public double ConfidenceIntervalStart;
/// <summary>
/// The absolute delta between TreatmentStats.Average and ControlStats.Average.
/// </summary>
public float DeltaAbsoluteChange;
/// <summary>
/// The relative delta ratio between TreatmentStats.Average and ControlStats.Average.
/// </summary>
public float DeltaRelativeChange;
/// <summary>
/// The machine name of the metric.
/// </summary>
public string InternalName;
/// <summary>
/// Indicates if a movement was detected on that metric.
/// </summary>
public string Movement;
/// <summary>
/// The readable name of the metric.
/// </summary>
public string Name;
/// <summary>
/// The expectation that a movement is real
/// </summary>
public float PMove;
/// <summary>
/// The p-value resulting from the statistical test run for this metric
/// </summary>
public float PValue;
/// <summary>
/// The threshold for observing sample ratio mismatch.
/// </summary>
public float PValueThreshold;
/// <summary>
/// Indicates if the movement is statistically significant.
/// </summary>
public string StatSigLevel;
/// <summary>
/// Observed standard deviation value of the metric.
/// </summary>
public float StdDev;
/// <summary>
/// Observed average value of the metric.
/// </summary>
public float Value;
}
[Serializable]
public class Scorecard : PlayFabBaseModel
{
/// <summary>
/// Represents the date the scorecard was generated.
/// </summary>
public string DateGenerated;
/// <summary>
/// Represents the duration of scorecard analysis.
/// </summary>
public string Duration;
/// <summary>
/// Represents the number of events processed for the generation of this scorecard
/// </summary>
public double EventsProcessed;
/// <summary>
/// Id of the experiment.
/// </summary>
public string ExperimentId;
/// <summary>
/// Friendly name of the experiment.
/// </summary>
public string ExperimentName;
/// <summary>
/// Represents the latest compute job status.
/// </summary>
public AnalysisTaskState? LatestJobStatus;
/// <summary>
/// Represents the presence of a sample ratio mismatch in the scorecard data.
/// </summary>
public bool SampleRatioMismatch;
/// <summary>
/// Scorecard containing list of analysis.
/// </summary>
public List<ScorecardDataRow> ScorecardDataRows;
}
[Serializable]
public class ScorecardDataRow : PlayFabBaseModel
{
/// <summary>
/// Represents whether the variant is control or not.
/// </summary>
public bool IsControl;
/// <summary>
/// Data of the analysis with the internal name of the metric as the key and an object of metric data as value.
/// </summary>
public Dictionary<string,MetricData> MetricDataRows;
/// <summary>
/// Represents the player count in the variant.
/// </summary>
public uint PlayerCount;
/// <summary>
/// Name of the variant of analysis.
/// </summary>
public string VariantName;
}
/// <summary>
/// Given a title entity token and an experiment ID, this API starts the experiment.
/// </summary>
[Serializable]
public class StartExperimentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the experiment to start.
/// </summary>
public string ExperimentId;
}
/// <summary>
/// Given a title entity token and an experiment ID, this API stops the experiment if it is running.
/// </summary>
[Serializable]
public class StopExperimentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// The ID of the experiment to stop.
/// </summary>
public string ExperimentId;
}
[Serializable]
public class TreatmentAssignment : PlayFabBaseModel
{
/// <summary>
/// List of the experiment variables.
/// </summary>
public List<Variable> Variables;
/// <summary>
/// List of the experiment variants.
/// </summary>
public List<string> Variants;
}
/// <summary>
/// Given an entity token and exclusion group details this API updates the exclusion group.
/// </summary>
[Serializable]
public class UpdateExclusionGroupRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// Description of the exclusion group.
/// </summary>
public string Description;
/// <summary>
/// The ID of the exclusion group to update.
/// </summary>
public string ExclusionGroupId;
/// <summary>
/// Friendly name of the exclusion group.
/// </summary>
public string Name;
}
/// <summary>
/// Given a title entity token and experiment details, this API updates the experiment. If an experiment is already running,
/// only the description and duration properties can be updated.
/// </summary>
[Serializable]
public class UpdateExperimentRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
/// <summary>
/// Description of the experiment.
/// </summary>
public string Description;
/// <summary>
/// When experiment should end.
/// </summary>
public DateTime? EndDate;
/// <summary>
/// Id of the exclusion group.
/// </summary>
public string ExclusionGroupId;
/// <summary>
/// Percentage of exclusion group traffic that will see this experiment.
/// </summary>
public uint? ExclusionGroupTrafficAllocation;
/// <summary>
/// Type of experiment.
/// </summary>
public ExperimentType? ExperimentType;
/// <summary>
/// Id of the experiment.
/// </summary>
public string Id;
/// <summary>
/// Friendly name of the experiment.
/// </summary>
public string Name;
/// <summary>
/// Id of the segment to which this experiment applies. Defaults to the 'All Players' segment.
/// </summary>
public string SegmentId;
/// <summary>
/// When experiment should start.
/// </summary>
public DateTime StartDate;
/// <summary>
/// List of title player account IDs that automatically receive treatments in the experiment, but are not included when
/// calculating experiment metrics.
/// </summary>
public List<string> TitlePlayerAccountTestIds;
/// <summary>
/// List of variants for the experiment.
/// </summary>
public List<Variant> Variants;
}
[Serializable]
public class Variable : PlayFabBaseModel
{
/// <summary>
/// Name of the variable.
/// </summary>
public string Name;
/// <summary>
/// Value of the variable.
/// </summary>
public string Value;
}
[Serializable]
public class Variant : PlayFabBaseModel
{
/// <summary>
/// Description of the variant.
/// </summary>
public string Description;
/// <summary>
/// Id of the variant.
/// </summary>
public string Id;
/// <summary>
/// Specifies if variant is control for experiment.
/// </summary>
public bool IsControl;
/// <summary>
/// Name of the variant.
/// </summary>
public string Name;
/// <summary>
/// Id of the TitleDataOverride to use with this variant.
/// </summary>
public string TitleDataOverrideLabel;
/// <summary>
/// Percentage of target audience traffic that will see this variant.
/// </summary>
public uint TrafficPercentage;
/// <summary>
/// Variables returned by this variant.
/// </summary>
public List<Variable> Variables;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0804132d8066c1440a5cfdd0e56bf63c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: