/// <summary> /// Handler for the event triggered from VMEODGameshowBuzzerPlayerPlugin, which occurs when a player presses their buzzer in their UIEOD. (Subscribed Event) /// </summary> /// <param name="buzzingPlayer">The server handler (VMEODGameshowBuzzerPlayerPlugin) belonging to the buzzing player (VMEODClient)</param> private void PlayerBuzzedHandler(VMEODGameshowBuzzerPlayerPlugin buzzingPlayer) { lock (PlayerBuzzerLock) { // player buzzes first if (BuzzerEnabled) { ChangeBuzzerState(VMEODGameshowBuzzerStates.Engaged); _AnsweringPlayerIndex = GetPlayerIndex(buzzingPlayer); if (_AnsweringPlayerIndex > -1) { // alert the buzzing player buzzingPlayer.ActivateMyBuzzer(1); // alert the host MyClient.Send("BuzzerEOD_Buzzed", BitConverter.GetBytes(_AnsweringPlayerIndex)); // execute Simantics event for host avatar to face buzzing player avatar Controller.SendOBJEvent(new Model.VMEODEvent((short)VMEODGameshowHostPluginEvents.Acknolwedge_Buzzer, buzzingPlayer.MyClient?.Avatar?.ObjectID ?? 0)); } else { // error: who is this player? } } // player buzzes, but not quite first (before _EngagedTimer runs out) else if (_BuzzerState.Equals(VMEODGameshowBuzzerStates.Engaged)) { buzzingPlayer.ActivateMyBuzzer(0); } } }
private int GetPlayerIndex(VMEODGameshowBuzzerPlayerPlugin player) { int playerIndex = -1; lock (PlayerConfigLock) { lock (ConnectedContestants) playerIndex = Array.IndexOf(ConnectedContestants, player); } return(playerIndex); }
protected void SyncHandler(VMEODGameshowBuzzerPlayerPlugin syncToPlayer) { SyncEvent?.Invoke(syncToPlayer); }
protected void PlayerBuzzedEventHandler(VMEODGameshowBuzzerPlayerPlugin buzzingPlayerPlugin) { PlayerBuzzed?.Invoke(buzzingPlayerPlugin); }
protected void SyncExecutor(VMEODGameshowBuzzerPlayerPlugin evoker) { ExecuteQueuedEvents(); }
private void PlayerSyncHandler(VMEODGameshowBuzzerPlayerPlugin plugin) { Controller.SendOBJEvent(new VMEODEvent((short)VMEODGameshowPlayerPluginEvents.Change_My_Score, new short[] { MyScore })); }