private void SaveCallback(IHttpResponse request, object userState) { ICloseGameCallInfo info = (ICloseGameCallInfo)request.CallInfo; if (request.Status == HttpRequestQueueResult.Success) { this.PluginHost.LogDebug(string.Format("Http request to {0} - done.", info.ActorCount > 0 ? "save" : "close")); info.Continue(); return; } var msg = string.Format("Failed save game request on {0} : {1}", this.gameClosedUrl, request.Reason); this.ReportError(msg); info.Continue(); }
public override void OnCloseGame(ICloseGameCallInfo info) { this.onCloseEvent.Set(); if (this.PluginHost.GameId.EndsWith("OnCloseForgotCall")) { return; } if (this.PluginHost.GameId.EndsWith("ReinitGame")) { this.allowContinueEvent.WaitOne(); } var property = (string)this.PluginHost.GameProperties["key"]; if (property != null && (property == "OnCloseGameException" || property == "CloseFatalPlugin")) { throw new Exception("OnCloseGameException for test"); } info.Continue(); }
/// <summary> /// Calls info.Continue(). Override to change. /// </summary> /// <param name="info">Data passed in the callback call.</param> public virtual void OnCloseGame(ICloseGameCallInfo info) { System.Diagnostics.Debug.Assert(this.PluginHost != null); info.Continue(); }
/// <summary> /// Calls info.Continue /// </summary> /// <param name="info"></param> public void OnCloseGame(ICloseGameCallInfo info) { info.Continue(); }
public override void OnCloseGame(ICloseGameCallInfo info) { if (!this.SuccesfullLoaded) { this.PluginHost.LogDebug("Skipped further OnCloseGame: not succesfullyloaded."); info.Continue(); return; } if (this.IsPersistent) { this.PluginHost.LogDebug("OnCloseGame"); var state = info.ActorCount > 0 ? this.GetGameState() : null; var actors = new List <object>(); foreach (var actor in this.PluginHost.GameActors) { actors.Add(new Actor { ActorNr = actor.ActorNr, UserId = actor.UserId }); } this.PluginHost.LogDebug(string.Format("Http request to {0}", info.ActorCount > 0 ? "save" : "close")); this.PostJsonRequest( this.gameClosedUrl, new WebhooksRequest { Type = info.ActorCount > 0 ? "Save" : "Close", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, ActorCount = info.ActorCount, State = state, AuthCookie = null, }, this.SaveCallback, info, callAsync: false); } else { if (!string.IsNullOrEmpty(this.gameClosedUrl)) { this.PostJsonRequest( this.gameClosedUrl, new WebhooksRequest { Type = "Close", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, ActorCount = 0 }, this.LogIfFailedCallback, callAsync: false); } info.Continue(); } }
public override void OnCloseGame(ICloseGameCallInfo info) { if (!this.SuccesfullLoaded) { this.PluginHost.LogDebug("Skipped further OnCloseGame: not succesfullyloaded."); info.Continue(); return; } if (this.IsPersistent) { this.PluginHost.LogDebug("OnCloseGame"); var state = info.ActorCount > 0 ? this.GetGameState() : null; var actors = new List<object>(); foreach (var actor in this.PluginHost.GameActors) { actors.Add(new Actor { ActorNr = actor.ActorNr, UserId = actor.UserId }); } this.PluginHost.LogDebug(string.Format("Http request to {0}", info.ActorCount > 0 ? "save" : "close")); this.PostJsonRequest( this.gameClosedUrl, new WebhooksRequest { Type = info.ActorCount > 0 ? "Save" : "Close", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, ActorCount = info.ActorCount, State = state, AuthCookie = null, }, this.SaveCallback, info, callAsync: false); } else { if (!string.IsNullOrEmpty(this.gameClosedUrl)) { this.PostJsonRequest( this.gameClosedUrl, new WebhooksRequest { Type = "Close", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, ActorCount = 0 }, this.LogIfFailedCallback, callAsync: false); } info.Continue(); } }