示例#1
0
        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();
            }
        }
示例#2
0
        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;
        }
示例#3
0
 private void OnButtonDownHandle(object sender, OnButtonEventArgs e)
 {
     this.inputItem = e.item;
     this.evInput.Set();
 }
示例#4
0
 private async void getInputItem()
 {
     evInput.Reset();
     this.inputItem = SimonItemsType.None;
     await Task.Run(() => {
         evInput.Wait(10000);
     });
 }
示例#5
0
 public OnButtonEventArgs(SimonItemsType item)
 {
     this.item = item;
 }
示例#6
0
        private void NoticeButtonDown(Simon.LightButton sender, SimonItemsType item)
        {
            sender.doPush(1000);

            if (OnButtonDownEvent != null)
            {
                OnButtonDownEvent(this, new OnButtonEventArgs(item));
            }
        }