private void CPUWindow_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.F5: RunButton.Focus(); RunButton_Click(sender, null); break; case Keys.F6: StepButton.Focus(); StepButton_Click(sender, null); break; case Keys.F7: StepOverButton.Focus(); StepOverButton_Click(sender, null); break; } }
public void AddStep(StepButton step) => schedule(() => StepsContainer.Add(step));
public void RunAllSteps(Action onCompletion = null, Action <Exception> onError = null, Func <StepButton, bool> stopCondition = null, StepButton startFromStep = null) { // schedule once as we want to ensure we have run our LoadComplete before attempting to execute steps. // a user may be adding a step in LoadComplete. Schedule(() => { stepRunner?.Cancel(); foreach (var step in StepsContainer.FlowingChildren.OfType <StepButton>()) { step.Reset(); } actionIndex = startFromStep != null ? StepsContainer.IndexOf(startFromStep) + 1 : -1; actionRepetition = 0; runNextStep(onCompletion, onError, stopCondition); }); }
static void Main() { Clutter.Application.Init (); Stage = new Stage (); Stage.Title = "Deal!"; Stage.Add (new Texture ("Pixmaps/Table.png")); Stage.SetSize (800, 480); Stage.KeyPressEvent += HandleKeyPress; Texture C = new Texture ("Pixmaps/Coin.png"); C.SetSize (50, 50); C.SetPosition (35, 405); Stage.Add (C); Bet = 0; BetButton = new BetButton (); BetButton.ButtonPressEvent += IncreaseBet; Stage.Add (BetButton); DealButton = new DealButton (); DealButton.ButtonPressEvent += NewGame; Stage.Add (DealButton); StepButton = new StepButton (); StepButton.ButtonPressEvent += NextStep; Stage.Add (StepButton); Stack = new Stack (); Stack.Decrease (20); ScoreText = new Text ("Droid Sans Bold 21", "" + Stack.GetAmount()); ScoreText.SetColor (new Clutter.Color (0xff, 0xff, 0xff, 0xff)); ScoreText.SetPosition (100, 413); Stage.Add (ScoreText); Coins = new Coin [5]; Coins [0] = new Coin (); Coins [1] = new Coin (); Coins [2] = new Coin (); Coins [3] = new Coin (); Coins [4] = new Coin (); for (int i = 0; i < 5; i++) { Coins [i].SetPosition (35, 405); Stage.Add (Coins [i]); } Deck = new Deck (); PlayerHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ()); OpponentHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ()); SetupAnimation (); Stage.ShowAll(); Clutter.Application.Run (); }
private void Start() { thisButton = GetComponentInParent <StepButton>(); i_thisButon = thisButton.GetComponent <IPhysicsInteract>(); }