本文整理汇总了C#中ErrorCallback类的典型用法代码示例。如果您正苦于以下问题:C# ErrorCallback类的具体用法?C# ErrorCallback怎么用?C# ErrorCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorCallback类属于命名空间,在下文中一共展示了ErrorCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePhysics
private Physics CreatePhysics(ErrorCallback errorCallback = null)
{
if (Physics.Instantiated)
Assert.Fail("Physics is still created");
if (errorCallback == null)
errorCallback = _errorLog = new ErrorLog();
if (_physics != null)
{
_physics.Dispose();
_physics = null;
}
if (_foundation != null)
{
_foundation.Dispose();
_foundation = null;
}
_foundation = new Foundation(errorCallback);
_physics = new Physics(_foundation, checkRuntimeFiles: true);
return _physics;
}
示例2: GetUserAccountInfo
/// <summary>
/// Retrieves the relevant details for a specified user, based upon a match against a supplied unique identifier
/// </summary>
public static void GetUserAccountInfo(LookupUserAccountInfoRequest request, GetUserAccountInfoCallback resultCallback, ErrorCallback errorCallback)
{
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings);
Action<string,string> callback = delegate(string responseStr, string errorStr)
{
LookupUserAccountInfoResult result = null;
PlayFabError error = null;
ResultContainer<LookupUserAccountInfoResult>.HandleResults(responseStr, errorStr, out result, out error);
if(error != null && errorCallback != null)
{
errorCallback(error);
}
if(result != null)
{
if(resultCallback != null)
{
resultCallback(result);
}
}
};
PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Admin/GetUserAccountInfo", serializedJSON, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback);
}
示例3: writeScore
/**
* Speichert den Score
*/
public void writeScore(ErrorCallback ecb, string playerName, int score, int level, long time, int mode)
{
time /= 10000;
this.ecb = ecb;
XDocument doc = new XDocument(
new XElement("scoreentry",
new XElement("playername", playerName),
new XElement("score", score),
new XElement("level", level),
new XElement("time", time),
new XElement("mode", mode)
)
);
postData = doc.ToString();
try
{
WebRequest request = WebRequest.Create(proxy);
request.Method = "POST";
request.ContentType = "text/xml";
request.BeginGetRequestStream(new AsyncCallback(RequestReady), request);
}
catch (Exception e)
{ ecb(e.Message); }
}
示例4: InsertEntity
private static object InsertEntity(object entity, DataStrategy dataStrategy, string tableName, ErrorCallback onError, bool resultRequired)
{
var dictionary = entity as IDictionary<string, object>;
if (dictionary != null)
return dataStrategy.Insert(tableName, dictionary, resultRequired);
var list = entity as IEnumerable<IDictionary<string, object>>;
if (list != null)
return dataStrategy.InsertMany(tableName, list, onError, resultRequired);
var entityList = entity as IEnumerable;
if (entityList != null)
{
var array = entityList.Cast<object>().ToArray();
var rows = new List<IDictionary<string, object>>();
foreach (var o in array)
{
dictionary = (o as IDictionary<string, object>) ?? o.ObjectToDictionary();
if (dictionary.Count == 0)
{
throw new SimpleDataException("Could not discover data in object.");
}
rows.Add(dictionary);
}
return dataStrategy.InsertMany(tableName, rows, onError, resultRequired);
}
dictionary = entity.ObjectToDictionary();
if (dictionary.Count == 0)
throw new SimpleDataException("Could not discover data in object.");
return dataStrategy.Insert(tableName, dictionary, resultRequired);
}
示例5: PlayerLeft
/// <summary>
/// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified
/// </summary>
public static void PlayerLeft(PlayerLeftRequest request, PlayerLeftCallback resultCallback, ErrorCallback errorCallback, object customData = null)
{
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings);
Action<string,PlayFabError> callback = delegate(string responseStr, PlayFabError pfError)
{
PlayerLeftResponse result = null;
ResultContainer<PlayerLeftResponse>.HandleResults(responseStr, ref pfError, out result);
if(pfError != null && errorCallback != null)
{
errorCallback(pfError);
}
if(result != null)
{
result.CustomData = customData;
result.Request = request;
if(resultCallback != null)
{
resultCallback(result);
}
}
};
PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Matchmaker/PlayerLeft", serializedJSON, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback);
}
示例6: BaseRequest
public BaseRequest (String method, String url, SuccessCallback successCallback, ErrorCallback errorCallback):base(method, url)
{
this.completedCallback = delegate(Request request) { onCompleteCallback(request); };;
this.successCallback = successCallback;
this.errorCallback = errorCallback;
form = AddParams();
}
示例7: SubmitScoreRequest
public SubmitScoreRequest (String url, String score, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例8: LoginFacebookRequest
public LoginFacebookRequest (String url, string token, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_TOKEN, token );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例9: GetHighScoresRequest
public GetHighScoresRequest (String url, String sessionKey, String level, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey );
hashtable.Add( GameConstants.REQUEST_KEY_LEVEL, level );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例10: GenerateAnonymousAcountRequest
public GenerateAnonymousAcountRequest (String url, string deviceId, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_DEVICE_ID, deviceId );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例11: SubmitRequestAcceptRequest
public SubmitRequestAcceptRequest (String url, string sessionKey, string requestIds, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey );
hashtable.Add( GameConstants.REQUEST_KEY_REQUEST_IDS, requestIds );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例12: CreatePhysics
private Physics CreatePhysics(ErrorCallback errorCallback = null)
{
if (Physics.Instantiated)
Assert.Fail("Physics is still created");
var foundation = new Foundation(errorCallback);
var physics = new Physics(foundation, checkRuntimeFiles: true);
return physics;
}
示例13: UpsertByKeyFields
internal static object UpsertByKeyFields(string tableName, DataStrategy dataStrategy, object entity, IEnumerable<string> keyFieldNames, bool isResultRequired, ErrorCallback errorCallback)
{
var record = UpdateCommand.ObjectToDictionary(entity);
var list = record as IList<IDictionary<string, object>>;
if (list != null) return dataStrategy.UpsertMany(tableName, list, keyFieldNames, isResultRequired, errorCallback);
var dict = record as IDictionary<string, object>;
var criteria = GetCriteria(keyFieldNames, dict);
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(tableName, criteria);
return dataStrategy.Upsert(tableName, dict, criteriaExpression, isResultRequired);
}
示例14: LoginRequest
public LoginRequest (String url, string userName, string password, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_USER_NAME, userName );
hashtable.Add( GameConstants.REQUEST_KEY_PASSWORD, password );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}
示例15: ShareStoryRequest
public ShareStoryRequest (String url, string uid, string type, string data, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback)
{
Hashtable hashtable = new Hashtable ();
hashtable.Add( GameConstants.REQUEST_KEY_UID, uid );
hashtable.Add( GameConstants.REQUEST_KEY_TYPE, type );
hashtable.Add( GameConstants.RESPONE_KEY_DATA, data );
string json = Json.Serialize(hashtable );
this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) );
this.AddWWWForm(this.form);
}