public override void OnJoin(IJoinGameCallInfo info) { ++this.CallsCount; try { this.CheckIJoinGameCallInfo(info); this.CheckBeforeOnJoin(); } catch (Exception e) { info.Fail(e.ToString()); return; } try { base.OnJoin(info); this.CheckAfterOnJoin(); } catch (Exception e) { this.PluginHost.BroadcastErrorInfoEvent(e.ToString(), info); } }
/// <summary> /// Callback for player joining the room /// </summary> /// <param name="info"></param> public override void OnJoin(IJoinGameCallInfo info) { base.OnJoin(info); if (PluginHost.GameActors.Count > NumberOfPlayers) { PluginHost.RemoveActor(info.ActorNr, 0, "Room is Full"); PluginHost.LogError("Game is full"); return; } if (IsGameStarted) { if (!joinAfterStart) { PluginHost.RemoveActor(info.ActorNr, 0, "Game already started"); return; } PluginHost.CreateOneTimeTimer( () => SyncPlayer(info), 200); } else { if ((PluginHost.GameActors.Count >= 2 && joinAfterStart) || (PluginHost.GameActors.Count >= NumberOfPlayers && !joinAfterStart)) { PluginHost.CreateOneTimeTimer( () => StartGame(), startDuration); } } }
public override void OnJoin(IJoinGameCallInfo info) { if (!this.PluginHost.GameId.EndsWith("OnJoinForgotCall")) { base.OnJoin(info); } }
/// <summary> /// Sync player to current game state /// </summary> /// <param name="info"></param> protected virtual void SyncPlayer(IJoinGameCallInfo info) { PluginHost.LogError("Sync player" + info.ActorNr); PluginHost.BroadcastEvent(new List <int> { info.ActorNr }, 0, (byte)Event.GameStart, new Dictionary <byte, object>() { { (byte)0, board.Hight }, { (byte)1, board.Width }, { 2, board.MineCount } }, CacheOperations.DoNotCache); foreach (Dictionary <byte, object> dic in board.AllReveald()) { PluginHost.BroadcastEvent(new List <int> { info.ActorNr }, 0, (byte)Event.SyncFields, dic, CacheOperations.DoNotCache); } foreach (Dictionary <byte, object> dic in board.AllFlags()) { PluginHost.BroadcastEvent(new List <int> { info.ActorNr }, 0, (byte)Event.SyncFlags, dic, CacheOperations.DoNotCache); } }
public override void OnJoin(IJoinGameCallInfo info) { Loger.LogTagFormat(Loger.TagPlugin, "OnJoin===============BEGIN"); Loger.LogTagFormat(Loger.TagPlugin, info.ToStr()); base.OnJoin(info); Loger.LogTagFormat(Loger.TagPlugin, "OnJoin---------------END"); }
public override void OnJoin(IJoinGameCallInfo info) { if (this.PluginHost.GameActors.Count == 2) { PluginHost.SetProperties(0, new Hashtable() { { (byte)254, false }, { (byte)253, false } }, null, true); } base.OnJoin(info); }
public override void OnJoin(IJoinGameCallInfo info) { this.PluginHost.LogInfo("Joined player " + info.ActorNr); //set ammo SetAmmo(info.ActorNr, 5); base.OnJoin(info); }
private void CheckIJoinGameCallInfo(IJoinGameCallInfo info) { this.CheckBaseInfo(info); Assert.AreNotEqual(0, info.ActorNr); Assert.IsNotNull(info.JoinParams); Console.Write(info.JoinParams.PublishCache); Console.Write(info.JoinParams.PublishJoinEvents); Console.Write(info.JoinParams.ResponseExtraParameters); CheckIJoinGameRequest(info.Request); }
public void OnJoin(IJoinGameCallInfo info) { try { this.Plugin.OnJoin(info); this.StrictModeCheck(info); } catch (Exception e) { this.ExceptionHanlder(info, e); } }
/// <summary> /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeJoin"/>. /// </summary> /// <param name="info">Data passed in the callback call.</param> void IGamePlugin.OnJoin(IJoinGameCallInfo info) { try { this.OnJoin(info); this.StrictModeCheck(info); } catch (Exception e) { ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e); CallFailSafe(info, e.ToString()); } }
public static string ToStr(this IJoinGameCallInfo info) { StringBuilder builder = new StringBuilder(); builder.AppendLine("IJoinGameCallInfo =========== BEGIN"); builder.AppendLine(string.Format("ICreateGameCallInfo.ActorNr={0}", info.ActorNr)); builder.AppendLine(info.JoinParams.ToStr()); builder.AppendLine(((ITypedCallInfo <IJoinGameRequest>)info).ToStr <IJoinGameRequest>()); builder.AppendLine(((ICallInfo)info).ToStr()); builder.AppendLine("IJoinGameCallInfo ----------- END"); return(builder.ToString()); }
public override void OnJoin(IJoinGameCallInfo info) { PluginHost.LogDebug(string.Format("OnJoin {0}", info)); base.OnJoin(info); Dictionary <byte, object> locateInfos = new Dictionary <byte, object>(PluginHost.GameActors.Count); foreach (var actor in PluginHost.GameActors) { locateInfos.Add((byte)actor.ActorNr, RandomLocate.GetRandomLocate()); } BroadcastEvent((byte)EventCode.FirstLocate, locateInfos); }
public override void OnJoin(IJoinGameCallInfo info) { if (this.PluginHost.GameId.Contains("SetOnJoinBeforeContinue")) { this.PluginHost.SetProperties(info.ActorNr, new Hashtable { { "xxx", true } }, null, true); } base.OnJoin(info); if (this.PluginHost.GameId.Contains("SetOnJoinAfterContinue")) { this.PluginHost.SetProperties(info.ActorNr, new Hashtable { { "xxx", true } }, null, true); } }
public override void OnJoin(IJoinGameCallInfo info) { var res = this.CheckBeforeOnJoin(); if (!string.IsNullOrEmpty(res)) { info.Fail(res); if (this.PluginHost.GameActors.Count != 1) { this.PluginHost.BroadcastErrorInfoEvent("this.PluginHost.GameActors.Count != 1", info); } return; } try { // this part is not used anymore //if (this.PluginHost.GameProperties.ContainsKey("BlockJoinEvents")) //{ // info.JoinParams.PublishJoinEvents = false; // info.JoinParams.ResponseExtraParameters = new Dictionary<byte, object>{{0, "Value0"}}; //} //var actor2 = this.PluginHost.GameActors[1]; //if(actor2.Properties.GetProperty("DoNotPublishCache") != null) //{ // info.JoinParams.PublishCache = false; //} base.OnJoin(info); this.CheckAfterOnJoin(); } catch (Exception e) { this.PluginHost.BroadcastErrorInfoEvent(e.ToString(), info); } }
public override void OnJoin(IJoinGameCallInfo info) { // no sync OnJoin support for now - since we already changed the room state when we get here. // to allow a clean sync (cancelable OnJoin) we need to // a. run all the pre-checks // b. call OnJoin with the expected new actornr // c. on continue - add peer to room if (!string.IsNullOrEmpty(this.gameJoinUrl)) { // remove for callAsync=false info.Continue(); this.PostJsonRequest( this.gameJoinUrl, new WebhooksRequest { Type = "Join", GameId = this.PluginHost.GameId, AppId = this.AppId, AppVersion = this.AppVersion, Region = this.Region, UserId = info.UserId, Nickname = info.Nickname, ActorNr = info.ActorNr, AuthCookie = info.AuthCookie, }, this.LogIfFailedCallback, info, callAsync: true); } else { info.Continue(); } }
/// <summary> /// Calls info.Fail /// </summary> /// <param name="info"></param> public void OnJoin(IJoinGameCallInfo info) { info.Fail(this.errorMsg); }
public override void OnJoin(IJoinGameCallInfo info) { this.onJoinEvent.Set(); info.Continue(); }
public override void OnJoin(IJoinGameCallInfo info) { base.OnJoin(info); }
public override void OnJoin(IJoinGameCallInfo info) { this.MethodBody(info, MethodBase.GetCurrentMethod().Name); }
private void OnJoinBeforeContinueFail(IJoinGameCallInfo info) { this.GenerateExceptionIf(info.Nickname, "OnJoinBeforeContinueFail"); }
protected override void SyncPlayer(IJoinGameCallInfo info) { base.SyncPlayer(info); }
/// <summary> /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeJoin"/>. /// </summary> /// <param name="info">Data passed in the callback call.</param> void IGamePlugin.OnJoin(IJoinGameCallInfo info) { this.OnJoin(info); }
public override void OnJoin(IJoinGameCallInfo info) { this.OnJoinBeforeContinueFail(info); base.OnJoin(info); this.OnJoinAfterContinueFail(info); }
/// <summary> /// Called when player needs to be syncronized /// </summary> /// <param name="info"></param> protected override void SyncPlayer(IJoinGameCallInfo info) { scoreManager.AddPlayer(info.ActorNr, 0); turnManager.AddActor(PluginHost.GameActors.ToList().Find(a => a.ActorNr == info.ActorNr)); base.SyncPlayer(info); }
public override void OnJoin(IJoinGameCallInfo info) { _stateController.OnJoin(info); }
/// <summary> /// Calls info.Continue(). Override to change. /// </summary> /// <param name="info">Data passed in the callback call.</param> public virtual void OnJoin(IJoinGameCallInfo info) { System.Diagnostics.Debug.Assert(this.PluginHost != null); info.Continue(); }
public override void OnJoin(IJoinGameCallInfo info) { base.OnJoin(info); m_InfoRoom.I_NumberOfPlayers++; }
private void OnJoinAfterContinueFail(IJoinGameCallInfo info) { this.GenerateExceptionIf(info.Nickname, "OnJoinAfterContinueFail"); }