Exemplo n.º 1
0
 void Update()
 {
     if (_typeSpeed.TryReset() && _stringIndex < _textToType.Length)
     {
         char currentChar = _textToType[_stringIndex];
         _textField.text += currentChar;
         _stringIndex++;
         // if (currentChar != ' ' || currentChar!='\n')
         //     _typeSound.Play();
         // Debug.Log(currentChar == ' ');
         if (currentChar != ' ' && currentChar != '\n')
         {
             _typeSound.Play();
         }
     }
     if (_stringIndex == _textToType.Length && !_typingEnded)
     {
         OnTypingEnd?.Invoke();
         _timeBeforeHideText.Reset();
         _typingEnded = true;
     }
     if (_typingEnded && _timeBeforeHideText.TryReset())
     {
         OnTextHidden?.Invoke();
         _textField.enabled = false;
     }
 }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            btnStart.Enabled = true;
            btnStop.Enabled  = false;


            btnStart.TouchUpInside += delegate {
                btnStart.Enabled = false;
                btnStop.Enabled  = true;
                timer            = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromSeconds(1), timer_tick);
            };

            btnStop.TouchUpInside += delegate {
                btnStart.Enabled = true;
                btnStop.Enabled  = false;
                timer.Invalidate();
            };

            btnReset.TouchUpInside += delegate {
                MyTimerLogic.Reset();
                lblDisplay.Text = MyTimerLogic.GetCurrentTickCount();
            };
        }
Exemplo n.º 3
0
 public void TypeText(string text)
 {
     _textToType        = text;
     _textField.enabled = true;
     _textField.text    = "";
     _typingEnded       = false;
     _typeSpeed.Reset();
 }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button   btnStart   = FindViewById <Button> (Resource.Id.btnStart);
            Button   btnStop    = FindViewById <Button> (Resource.Id.btnStop);
            Button   btnReset   = FindViewById <Button> (Resource.Id.btnReset);
            TextView lblDisplay = FindViewById <TextView>(Resource.Id.lblDisplay);

            btnStart.Enabled = true;
            btnStop.Enabled  = false;

            btnStart.Click += delegate {
                btnStart.Enabled = false;
                btnStop.Enabled  = true;
                timer.Start();
            };

            btnStop.Click += delegate {
                btnStart.Enabled = true;
                btnStop.Enabled  = false;
                timer.Stop();
            };

            btnReset.Click += delegate {
                MyTimerLogic.Reset();
                lblDisplay.Text = MyTimerLogic.GetCurrentTickCount();
            };

            timer.Elapsed += delegate {
                MyTimerLogic.SetTickElapsed();
                RunOnUiThread(delegate {
                    lblDisplay.Text = MyTimerLogic.GetCurrentTickCount();
                });
            };
        }
Exemplo n.º 5
0
 public void Restart()
 {
     _blinkPeriod.Reset();
     blink = true;
 }
Exemplo n.º 6
0
 public void StopGame()
 {
     execute = false;
     timer.Reset();
 }