public override void OnCreateGame(ICreateGameCallInfo info) { ++this.CallsCount; try { this.CheckICreateGameCallInfo(info); this.CheckBeforeCreateGame(); } catch (Exception e) { info.Fail(e.ToString()); return; } try { base.OnCreateGame(info); this.CheckAfterCreateGame(); } catch (Exception e) { var msg = e.ToString(); this.PluginHost.BroadcastErrorInfoEvent(msg, info); } }
public override void OnCreateGame(ICreateGameCallInfo info) { Dictionary <string, string> expectedHeaders = new Dictionary <string, string>(); // you can add as many as you want or even send them through unit test as actor or game properties expectedHeaders.Add("GameId", info.Request.GameId); expectedHeaders.Add("LobbyType", info.Request.LobbyType.ToString()); expectedHeaders.Add("ActorNr", info.Request.ActorNr.ToString()); expectedHeaders.Add("JoinMode", info.Request.JoinMode.ToString()); expectedHeaders.Add("AppId", AppId); expectedHeaders.Add("Region", Region); expectedHeaders.Add("AppVersion", AppVersion); expectedHeaders.Add("UserId", info.UserId); expectedHeaders.Add("Nickname", info.Nickname); StringBuilder url = new StringBuilder("https://httpbin.org/response-headers?"); foreach (var key in expectedHeaders.Keys) { url.AppendFormat("{0}={1}&", key, expectedHeaders[key]); } url.Remove(url.Length - 1, 1); HttpRequest request = new HttpRequest(); request.Url = url.ToString(); request.Callback = Callback; request.UserState = expectedHeaders; PluginHost.HttpRequest(request, info); }
public override void OnCreateGame(ICreateGameCallInfo info) { base.OnCreateGame(info); AccountId = info.Request.GameProperties["accountId"] as string; _isEndGame = false; GameEngine = new GameEngine.GameEngine(OnGameEngineMessage, new PhotonPluginLogger(base.PluginHost, OnGameEngineMessage)); }
private void LoadCallback(IHttpResponse httpResponse, object userState) { string errorMsg; WebhooksResponse response; ICreateGameCallInfo callInfo = (ICreateGameCallInfo)httpResponse.CallInfo; if (this.TryGetForwardResponse(httpResponse, out response, out errorMsg)) { if (response.ResultCode == 0) { if (response.State != null) { try { if (!this.PluginHost.SetGameState(response.State)) { callInfo.Fail(string.Format("Failed to load state from {0}.", httpResponse.Request.Url)); } else { this.SuccesfullLoaded = true; callInfo.Continue(); } } catch (Exception ex) { try { callInfo.Fail(string.Format("Failed to load state from {0} : Exception='{1}'", httpResponse.Request.Url, ex.Message)); } catch (Exception e) { this.ReportError(string.Format("Failed to load state from {0} : Exception='{1}'.", httpResponse.Request.Url, e)); } this.ReportError(string.Format("Failed to load state from {0} : Exception='{1}'.", httpResponse.Request.Url, ex)); } } else { // should only be tha case for join with CreateIfNotExists, (we should probably have a reload flag) this.PluginHost.LogDebug("Creating Game without loading any state - Rejoins will fail!"); this.SuccesfullLoaded = true; callInfo.Continue(); } } else { var msg = string.Format("Failed to load state from {0} : {1} {2}", httpResponse.Request.Url, response.ResultCode, response.Message); this.ReportError(msg); callInfo.Fail(msg); } } else { var msg = string.Format("Failed to load state from {0} : {1}", httpResponse.Request.Url, errorMsg); this.ReportError(msg); callInfo.Fail(msg); } }
/// <summary> /// Callback when room is created /// </summary> /// <param name="info"></param> public override void OnCreateGame(ICreateGameCallInfo info) { this.PluginHost.LogInfo(string.Format("OnCreateGame {0} by user {1}", info.Request.GameId, info.UserId)); info.Continue(); // same as base.OnCreateGame(info); System.Collections.Hashtable hashtable = info.OperationRequest.Parameters[248] as System.Collections.Hashtable; int hight = (int)hashtable["hight"]; int width = (int)hashtable["width"]; NumberOfPlayers = (int)hashtable["maxPlayers"]; firstSafe = (bool)hashtable["firstSafe"]; endOnExpload = (bool)hashtable["endOnExpload"]; joinAfterStart = (bool)hashtable["joinAfter"]; float mineRate = 0.1f; if (hashtable.ContainsKey("mineRate")) { mineRate = (float)(int)hashtable["mineRate"] / 100; } int mineCount = (int)(hight * width * mineRate); board = new Board(hight, width, mineCount); this.PluginHost.LogInfo(string.Format("GameCreated {0} by {1} with {2} mines. FirstSafe {3}, endOnExpload {4}, JoinAfterStart {5}", hight, width, board.MineCount, firstSafe, endOnExpload, joinAfterStart)); }
public override void OnCreateGame(ICreateGameCallInfo info) { SerializableGameState state; if (gameStates.TryGetValue(this.PluginHost.GameId, out state)) { this.PluginHost.SetGameState(state); } base.OnCreateGame(info); }
public override void OnCreateGame(ICreateGameCallInfo info) { Loger.LogTagFormat(Loger.TagPlugin, "OnCreateGame===============BEGIN"); Loger.LogTagFormat(Loger.TagPlugin, info.ToStr()); base.OnCreateGame(info); Loger.LogTagFormat(Loger.TagPlugin, "OnCreateGame---------------END"); }
public override void OnCreateGame(ICreateGameCallInfo info) { if (this.PluginHost.GameId.Contains("OnCreate")) { info.Request.GameProperties = info.Request.GameProperties ?? new System.Collections.Hashtable(); info.Request.GameProperties.Add(GameParameters.PlayerTTL, 2000); info.Request.GameProperties.Add(GameParameters.EmptyRoomTTL, 2000); } base.OnCreateGame(info); }
public override void OnCreateGame(ICreateGameCallInfo info) { this.SetupPlugin(info); if (this.doSyncHttpAndTimer) { info.Continue(); return; } this.MethodBody(info, MethodBase.GetCurrentMethod().Name); }
public override void OnCreateGame(ICreateGameCallInfo info) { SerializableGameState state; if (gameStates.TryGetValue(this.PluginHost.GameId, out state)) { this.PluginHost.SetGameState(state); } base.OnCreateGame(info); }
//Called by the first client who create the room public override void OnCreateGame(ICreateGameCallInfo info) { base.OnCreateGame(info); //Set a random integer as the room number Random rnd = new Random(); m_InfoRoom.I_RoomNumber = rnd.Next(1, 9999); m_InfoRoom.I_NumberOfPlayers++; }
public override void OnCreateGame(ICreateGameCallInfo info) { this.onCreateEvent.Set(); if (this.PluginHost.GameId.EndsWith("OnCreateForgotCall")) { return; } info.Continue(); }
public void OnCreateGame(ICreateGameCallInfo info) { try { this.Plugin.OnCreateGame(info); this.StrictModeCheck(info); } catch (Exception e) { this.ExceptionHanlder(info, e); } }
private void SetupPlugin(ICreateGameCallInfo info) { var config = (string)info.Request.GameProperties[ConfigKey]; this.PluginHost.LogDebug("Got next config '" + config + "' for game:" + info.Request.GameId); this.noCallback = config.Contains("NoCallback"); request = new HttpRequest { Async = config.Contains("Async"), Url = "https://wt-e4c18d407aa73a40e4182aaf00a2a2eb-0.run.webtask.io/realtime-webhooks-1.2/GameEvent", }; }
/// <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.OnCreateGame(ICreateGameCallInfo info) { try { this.OnCreateGame(info); this.StrictModeCheck(info); } catch (Exception e) { ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e); CallFailSafe(info, e.ToString()); } }
public static string ToStr(this ICreateGameCallInfo info) { StringBuilder builder = new StringBuilder(); builder.AppendLine("ICreateGameCallInfo =========== BEGIN"); builder.AppendLine(string.Format("ICreateGameCallInfo.CreateIfNotExists={0}", info.CreateIfNotExists)); builder.AppendLine(string.Format("ICreateGameCallInfo.IsJoin={0}", info.IsJoin)); builder.AppendLine(info.CreateOptions.ToStr <string, object>("ICreateGameCallInfo.CreateOptions")); builder.AppendLine(((ITypedCallInfo <IJoinGameRequest>)info).ToStr <IJoinGameRequest>()); builder.AppendLine(((ICallInfo)info).ToStr()); builder.AppendLine("ICreateGameCallInfo ----------- END"); return(builder.ToString()); }
public override void OnCreateGame(ICreateGameCallInfo info) { try { info.Continue(); var properties = info.Request.GameProperties; this.SetTimer(properties); } catch (Exception ex) { info.Fail(this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message); } }
public override void OnCreateGame(ICreateGameCallInfo info) { var state = ReadGameStateFromFile(this.PluginHost.GameId); if (state != null) { this.PluginHost.SetGameState(state); } else { this.PluginHost.LogDebug(string.Format("Failed to find file with state for game {0}", this.PluginHost.GameId)); } base.OnCreateGame(info); }
public override void OnCreateGame(ICreateGameCallInfo info) { try { info.Continue(); var properties = info.Request.GameProperties; this.SetTimer(properties); } catch (Exception ex) { info.Fail(this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message); } }
public override void OnCreateGame(ICreateGameCallInfo info) { const string stripedState = "{\"LobbyId\":null,\"LobbyType\":0,\"CustomProperties\":{},\"EmptyRoomTTL\":5000,\"PlayerTTL\":2147483647,\"CheckUserOnJoin\":false,\"DeleteCacheOnLeave\":true,\"SuppressRoomEvents\":false}"; var serializableGameState = Newtonsoft.Json.JsonConvert.DeserializeObject<SerializableGameState>(stripedState); if (!this.PluginHost.SetGameState(serializableGameState)) { info.Fail("Failed to load state"); } else { info.Continue(); } }
public override void OnCreateGame(ICreateGameCallInfo info) { const string stripedState = "{\"LobbyId\":null,\"LobbyType\":0,\"CustomProperties\":{},\"EmptyRoomTTL\":5000,\"PlayerTTL\":2147483647,\"CheckUserOnJoin\":false,\"DeleteCacheOnLeave\":true,\"SuppressRoomEvents\":false}"; var serializableGameState = Newtonsoft.Json.JsonConvert.DeserializeObject <SerializableGameState>(stripedState); if (!this.PluginHost.SetGameState(serializableGameState)) { info.Fail("Failed to load state"); } else { info.Continue(); } }
public override void OnCreateGame(ICreateGameCallInfo info) { if (this.PluginHost.GameId.Contains("SetOnCreateBeforeContinue")) { this.PluginHost.SetProperties(1, new Hashtable { { "xxx", true } }, null, true); } base.OnCreateGame(info); if (this.PluginHost.GameId.Contains("SetOnCreateAfterContinue")) { this.PluginHost.SetProperties(1, new Hashtable { { "xxx", true } }, null, true); } }
private void SetupPlugin(ICreateGameCallInfo info) { var config = (string)info.Request.GameProperties[ConfigKey]; callAfter = config.Contains("After"); callBefore = config.Contains("Before"); continueInCallback = config.Contains("ContinueInCallback"); this.logger = this.PluginHost.CreateLogger(typeof(AllMethosCallHttpTestPlugin).FullName); this.logger.Warn("Got next config '" + config + "' for game:" + info.Request.GameId); request = new HttpRequest { Async = config.Contains("Async"), Url = "https://wt-e4c18d407aa73a40e4182aaf00a2a2eb-0.run.webtask.io/realtime-webhooks-1.2/GameEvent", }; }
public override void OnCreateGame(ICreateGameCallInfo info) { base.OnCreateGame(info); SerializableGameState state; if (gameStates.TryGetValue(this.PluginHost.GameId, out state)) { if (this.PluginHost.SetGameState(state)) { this.PluginHost.BroadcastErrorInfoEvent("SetGameState after call to info.Continue succeeded"); } else { this.BroadcastEvent(123, null); } } }
public override void OnCreateGame(ICreateGameCallInfo info) { try { //before continue we expect the properties are NOT set if (this.PluginHost.GameProperties.ContainsKey("EventSize") || this.PluginHost.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are already set: EventSize or Interval"); } // we check the request contains the expected game properties if (!info.Request.GameProperties.ContainsKey("EventSize") || !info.Request.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are NOT set: EventSize or Interval"); } // we call explicit continue info.Continue(); // or implicit by calling the base function //base.OnCreateGame(info); // after calling continue, we expect PluginHost.GameProperties IS populated if (!this.PluginHost.GameProperties.ContainsKey("EventSize") || !this.PluginHost.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are NOT set: EventSize or Interval"); } var properties = this.PluginHost.GameProperties; this.SetTimer(properties); } catch (Exception ex) { var msg = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message; this.PluginHost.LogError(ex); if (info.IsNew) { info.Fail(msg); } else { this.PluginHost.BroadcastErrorInfoEvent(msg); } } }
public override void OnCreateGame(ICreateGameCallInfo info) { base.OnCreateGame(info); SerializableGameState state; if (gameStates.TryGetValue(this.PluginHost.GameId, out state)) { if (this.PluginHost.SetGameState(state)) { this.PluginHost.BroadcastErrorInfoEvent("SetGameState after call to info.Continue succeeded"); } else { this.BroadcastEvent(123, null); } } }
private void CreateGameCallback(IHttpResponse httpResponse, object userState) { string errorMsg; WebhooksResponse forwardResponse; ICreateGameCallInfo info = (ICreateGameCallInfo)httpResponse.CallInfo; if (!this.TryGetForwardResponse(httpResponse, out forwardResponse, out errorMsg)) { var msg = string.Format("Failed to create game on {0} : {1}", httpResponse.Request.Url, errorMsg); this.ReportError(msg); info.Fail(msg); } else { this.SuccesfullLoaded = true; info.Continue(); } }
public override void OnCreateGame(ICreateGameCallInfo info) { try { //before continue we expect the properties are NOT set if (this.PluginHost.GameProperties.ContainsKey("EventSize") || this.PluginHost.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are already set: EventSize or Interval"); } // we check the request contains the expected game properties if (!info.Request.GameProperties.ContainsKey("EventSize") || !info.Request.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are NOT set: EventSize or Interval"); } // we call explicit continue info.Continue(); // or implicit by calling the base function //base.OnCreateGame(info); // after calling continue, we expect PluginHost.GameProperties IS populated if (!this.PluginHost.GameProperties.ContainsKey("EventSize") || !this.PluginHost.GameProperties.ContainsKey("Interval")) { throw new Exception("Unexpected GameProperties are NOT set: EventSize or Interval"); } var properties = this.PluginHost.GameProperties; this.SetTimer(properties); } catch (Exception ex) { var msg = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message; this.PluginHost.LogError(ex); if(info.IsNew) info.Fail(msg); else this.PluginHost.BroadcastErrorInfoEvent(msg); } }
private void SetupPlugin(ICreateGameCallInfo info) { var config = (string)info.Request.GameProperties[ConfigKey]; this.doSyncHttpAndTimer = config.Contains("FromRaiseInfoHttpCallAndTimer"); if (!this.doSyncHttpAndTimer) { this.callAfter = config.Contains("After"); this.callBefore = config.Contains("Before"); this.continueInCallback = config.Contains("ContinueInCallback"); this.fromHttpCallback = config.Contains("FromHttpCallback"); } this.PluginHost.LogDebug("Got next config '" + config + "' for game:" + info.Request.GameId); request = new HttpRequest { Async = config.Contains("Async"), Url = "https://wt-e4c18d407aa73a40e4182aaf00a2a2eb-0.run.webtask.io/realtime-webhooks-1.2/GameEvent", }; }
public override void OnCreateGame(ICreateGameCallInfo info) { if (info.Request.GameId == "FirstCase" || info.Request.GameId == "SecondCase") { var callback = info.Request.GameId == "FirstCase" ? (HttpRequestCallback)this.HttpRequestCallbackForOnCreate : this.HttpRequestCallbackForOnCreate2; var async = info.Request.GameId == "FirstCase"; var request = new HttpRequest { Async = async, Url = "https://wt-e4c18d407aa73a40e4182aaf00a2a2eb-0.run.webtask.io/realtime-webhooks-1.2/GameEvent", Callback = callback, }; this.PluginHost.HttpRequest(request, info); } else { base.OnCreateGame(info); } }
public override void OnCreateGame(ICreateGameCallInfo info) { base.OnCreateGame(info); var state = ReadGameStateFromFile(this.PluginHost.GameId); if (state != null) { if (this.PluginHost.SetGameState(state)) { this.PluginHost.BroadcastErrorInfoEvent("SetGameState after call to info.Continue succeeded"); } else { this.BroadcastEvent(123, null); } } else { this.PluginHost.LogDebug(string.Format("Failed to find file with state for game {0}", this.PluginHost.GameId)); } }
private void CheckICreateGameCallInfo(ICreateGameCallInfo info) { this.CheckBaseInfo(info); Console.Write(info.CreateIfNotExists); Console.WriteLine(info.IsJoin); Assert.IsNotNull(info.CreateOptions); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.MaxPlayers.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.IsOpen.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.IsVisible.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.LobbyId.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.LobbyType.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.CustomProperties.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.EmptyRoomTTL.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.PlayerTTL.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.CheckUserOnJoin.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.DeleteCacheOnLeave.ToString())); Assert.IsTrue(info.CreateOptions.ContainsKey(HiveHostGameState.SuppressRoomEvents.ToString())); Assert.AreEqual(0, info.Request.ActorNr); Assert.IsNotNull(info.Request.ActorProperties); Assert.IsNotNull(info.Request.GameProperties); Assert.IsNotNull(info.Request.GameId); Assert.AreEqual("Default", info.Request.LobbyName); Assert.AreEqual(0, info.Request.LobbyType); Assert.AreEqual(0, info.Request.EmptyRoomLiveTime); Assert.IsFalse(info.Request.CreateIfNotExists); Assert.IsFalse(info.Request.BroadcastActorProperties); Assert.IsFalse(info.Request.DeleteCacheOnLeave); Assert.IsFalse(info.Request.SuppressRoomEvents); }
public override void OnCreateGame(ICreateGameCallInfo info) { this.onCreateEvent.Set(); if (this.PluginHost.GameId.EndsWith("OnCreateForgotCall")) { return; } info.Continue(); }
/// <summary> /// Calls info.Continue(). Override to change. /// </summary> /// <param name="info">Data passed in the callback call.</param> public virtual void OnCreateGame(ICreateGameCallInfo info) { System.Diagnostics.Debug.Assert(this.PluginHost != null); info.Continue(); }
/// <summary> /// Calls info.Continue(). Override to change. /// </summary> /// <param name="info">Data passed in the callback call.</param> public virtual void OnCreateGame(ICreateGameCallInfo info) { System.Diagnostics.Debug.Assert(this.PluginHost != null); info.Continue(); }
/// <summary> /// Calls info.Fail /// </summary> /// <param name="info"></param> public void OnCreateGame(ICreateGameCallInfo info) { info.Fail(this.errorMsg); }
public override void OnCreateGame(ICreateGameCallInfo info) { if (!info.IsJoin) { var url = this.gameCreatedUrl; if (this.IsPersistent) { this.PostJsonRequest( url, new WebhooksRequest { Type = "Create", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = 1, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.CreateGameCallback, info, callAsync: false); } else { if (!string.IsNullOrEmpty(url)) { this.PostJsonRequest( url, new WebhooksRequest { Type = "Create", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = 1, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.LogIfFailedCallback, info, callAsync: true); } this.SuccesfullLoaded = true; info.Continue(); } } else { this.PluginHost.LogDebug("OnCreateGame: Loading"); if (this.IsPersistent) { var url = !string.IsNullOrEmpty(this.gameLoadUrl) ? this.gameLoadUrl : this.gameCreatedUrl; this.PluginHost.LogDebug(string.Format( "OnCreateGame: sending http load game request: url={0} gameid={1} userid={2}", this.gameLoadUrl, this.PluginHost.GameId, info.UserId)); this.PostJsonRequest( url, new WebhooksRequest { Type = "Load", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = info.Request.ActorNr, CreateIfNotExists = info.CreateIfNotExists, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.LoadCallback, info, callAsync: false); } else { if (!info.CreateIfNotExists) { //TBD: thsi should never be called, maybe we should move this to base plugin throw new Exception("Join/Rejoin: missing CreateIfNotExists."); } this.SuccesfullLoaded = true; info.Continue(); } } }
public override void OnCreateGame(ICreateGameCallInfo info) { if (!info.IsJoin) { var url = this.gameCreatedUrl; if (this.IsPersistent) { this.PostJsonRequest( url, new WebhooksRequest { Type = "Create", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = 1, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.CreateGameCallback, info, callAsync: false); } else { if (!string.IsNullOrEmpty(url)) { this.PostJsonRequest( url, new WebhooksRequest { Type = "Create", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = 1, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.LogIfFailedCallback, info, callAsync: true); } this.SuccesfullLoaded = true; info.Continue(); } } else { this.PluginHost.LogDebug("OnCreateGame: Loading"); if (this.IsPersistent) { var url = !string.IsNullOrEmpty(this.gameLoadUrl) ? this.gameLoadUrl : this.gameCreatedUrl; this.PluginHost.LogDebug(string.Format( "OnCreateGame: sending http load game request: url={0} gameid={1} userid={2}", this.gameLoadUrl, this.PluginHost.GameId, info.UserId)); this.PostJsonRequest( url, new WebhooksRequest { Type = "Load", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = info.Request.ActorNr, CreateIfNotExists = info.CreateIfNotExists, CreateOptions = info.CreateOptions, AuthCookie = info.AuthCookie, }, this.LoadCallback, info, callAsync: false); } else { if (!info.CreateIfNotExists) { //TBD: thsi should never be called, maybe we should move this to base plugin throw new Exception("Join/Rejoin: missing CreateIfNotExists."); } this.SuccesfullLoaded = true; info.Continue(); } } }
public override void OnCreateGame(ICreateGameCallInfo info) { this.PluginHost.LogInfo($"OnCreateGame {info.Request.GameId} by user {info.UserId}"); info.Continue(); }
/// <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.OnCreateGame(ICreateGameCallInfo info) { try { this.OnCreateGame(info); this.StrictModeCheck(info); } catch (Exception e) { ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e); CallFailSafe(info, e.ToString()); } }