public override void OnCloseGame(ICloseGameCallInfo info) { base.OnCloseGame(info); var state = this.PluginHost.GetSerializableGameState(); gameStates[this.PluginHost.GameId] = state; }
public override void OnCloseGame(ICloseGameCallInfo info) { base.OnCloseGame(info); var state = this.PluginHost.GetSerializableGameState(); WriteGameStateToFile(this.PluginHost.GameId, state); }
public override void OnCloseGame(ICloseGameCallInfo info) { Loger.LogTagFormat(Loger.TagPlugin, "OnCloseGame===============BEGIN"); Loger.LogTagFormat(Loger.TagPlugin, info.ToStr()); base.OnCloseGame(info); Loger.LogTagFormat(Loger.TagPlugin, "OnCloseGame---------------END"); }
public void OnCloseGame(ICloseGameCallInfo info) { try { this.Plugin.OnCloseGame(info); this.StrictModeCheck(info); } catch (Exception e) { this.ExceptionHanlder(info, e); } }
public static string ToStr(this ICloseGameCallInfo info) { StringBuilder builder = new StringBuilder(); builder.AppendLine("ICloseGameCallInfo =========== BEGIN"); builder.AppendLine(string.Format("ICloseGameCallInfo.ActorCount={0}", info.ActorCount)); builder.AppendLine(string.Format("ICloseGameCallInfo.FailedOnCreate={0}", info.FailedOnCreate)); builder.AppendLine(((ITypedCallInfo <ICloseRequest>)info).ToStr <ICloseRequest>()); builder.AppendLine(((ICallInfo)info).ToStr()); builder.AppendLine("ICloseGameCallInfo ----------- END"); return(builder.ToString()); }
/// <summary> /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeCloseGame"/>. /// </summary> /// <param name="info">Data passed in the callback call.</param> void IGamePlugin.OnCloseGame(ICloseGameCallInfo info) { try { this.OnCloseGame(info); this.StrictModeCheck(info); } catch (Exception e) { ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e); CallFailSafe(info, e.ToString()); } }
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(); }
public override void OnCloseGame(ICloseGameCallInfo info) { ++this.CallsCount; try { this.CheckICloseGameCallInfo(info); this.CheckBeforeOnCloseGame(); } catch (Exception e) { info.Fail(e.ToString()); return; } try { base.OnCloseGame(info); this.CheckAfterOnCloseGame(); } catch (Exception e) { this.PluginHost.BroadcastErrorInfoEvent(e.ToString(), info); } }
/// <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) { base.OnCloseGame(info); }
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) { base.OnCloseGame(info); var state = this.PluginHost.GetSerializableGameState(); gameStates[this.PluginHost.GameId] = state; }
public override void OnCloseGame(ICloseGameCallInfo info) { Thread.Sleep(2000); base.OnCloseGame(info); }
/// <summary> /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeCloseGame"/>. /// </summary> /// <param name="info">Data passed in the callback call.</param> void IGamePlugin.OnCloseGame(ICloseGameCallInfo info) { this.OnCloseGame(info); }
/// <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(); }
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 /// </summary> /// <param name="info"></param> public void OnCloseGame(ICloseGameCallInfo info) { info.Continue(); }
public override void OnCloseGame(ICloseGameCallInfo info) { this.httpListener.Stop(); base.OnCloseGame(info); }
private void CheckICloseGameCallInfo(ICloseGameCallInfo info) { this.CheckBaseInfo(info); Assert.AreEqual(0, info.ActorCount); Assert.AreEqual(0, info.Request.EmptyRoomTTL); }
/// <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(); }
public override void OnCloseGame(ICloseGameCallInfo info) { this.MethodBody(info, MethodBase.GetCurrentMethod().Name); }
public override void OnCloseGame(ICloseGameCallInfo info) { Thread.Sleep(2000); base.OnCloseGame(info); }
/// <summary> /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeCloseGame"/>. /// </summary> /// <param name="info">Data passed in the callback call.</param> void IGamePlugin.OnCloseGame(ICloseGameCallInfo info) { try { this.OnCloseGame(info); this.StrictModeCheck(info); } catch (Exception e) { ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e); CallFailSafe(info, e.ToString()); } }