private void OnPlayerTurn(AwaitingActionEventArgs e) { EventHandler <AwaitingActionEventArgs> handler = PlayerTurn; if (handler != null) { handler(this, e); } }
public void CancelPlayerAction(object sender, CancelActionEventArgs e) { if (e.player != this) { return; } // escapes events that are not targeted at this Player IsAwaitingAction = false; this.awaitingActionArgs = null; IsFoldAvailable = false; IsCheckAvailable = false; IsCallAvailable = false; IsRaiseAvailable = false; // update CurrentContribution if necessary, NOT REALLY WORKING CurrentContribution = e.contribution > 0 ? e.contribution : currentContribution; // used to immediately update 'canCheck/canRaise' CommandManager.InvalidateRequerySuggested(); }
/* AwaitingPlayerAction handler */ /* updates Player state to allow Player to make an Action * render UI * set MinRaise/ToCall/CurrentContribution/etc * */ public void AwaitPlayerAction(object sender, AwaitingActionEventArgs e) { if (e.player != this) { return; } // escapes events that are not targeted at this Player this.IsAwaitingAction = true; this.awaitingActionArgs = e; PotState ps = e.potState; this.populateActions(ps); // sets available Commands // WORKING MinRaise = ps.minRaise; ToCall = ps.toCall; BetAmount = ps.minRaise; // used to immediately update 'canCheck/canRaise' CommandManager.InvalidateRequerySuggested(); }