public void activateButton(SimonItemsType item, bool activateFlag) { LightButton button; switch (item) { case SimonItemsType.Up: button = btnUp; break; case SimonItemsType.Down: button = btnDown; break; case SimonItemsType.Right: button = btnRight; break; case SimonItemsType.Left: button = btnLeft; break; default: button = btnUp; break; } if (activateFlag) { button.doPush(3000); } else { // button.doLightOff(); } }
public SimonController(ViewController view) { this.rnd = new Random(); this.view = view; this.level = 0; this.score = 0; this.inputItem = SimonItemsType.None; this.evInput = new ManualResetEventSlim(false); view.OnButtonDownEvent += OnButtonDownHandle; }
private void OnButtonDownHandle(object sender, OnButtonEventArgs e) { this.inputItem = e.item; this.evInput.Set(); }
private async void getInputItem() { evInput.Reset(); this.inputItem = SimonItemsType.None; await Task.Run(() => { evInput.Wait(10000); }); }
public OnButtonEventArgs(SimonItemsType item) { this.item = item; }
private void NoticeButtonDown(Simon.LightButton sender, SimonItemsType item) { sender.doPush(1000); if (OnButtonDownEvent != null) { OnButtonDownEvent(this, new OnButtonEventArgs(item)); } }