Example #1
0
File: Form1.cs Project: jwk000/Maze
        void Restart()
        {
            ResetRooms();
            ResetRoomLine();

            //画笔颜色也改掉
            int r = RandGen.Next(80, 255);
            int g = RandGen.Next(80, 255);
            int b = RandGen.Next(80, 255);

            doorPen = new Pen(Color.FromArgb(r, g, b), 2);
            //随机选择一个算法,然后初始化并开始
            int alg = RandGen.Next(1, 4);

            //alg = 2;
            if (alg == 1)
            {
                A1Reset();
                Ticker = A1_Tick;
            }
            else if (alg == 2)
            {
                A2Reset();
                Ticker = A2_Tick;
            }
            else if (alg == 3)
            {
                A3Reset();
                Ticker = A3_Tick;
            }

            System.Threading.Thread.Sleep(1000);
            UITimer.Start();
        }
Example #2
0
File: Form1.cs Project: jwk000/Maze
        void A3_Tick()
        {
            if (NotVisitedRooms.Count == 0)
            {
                UITimer.Stop();
                Restart();
                return;
            }

            List <Room> nextReactor = new List <Room>();

            //随机门
            while (ReactorSrc.Count > 0)
            {
                int  idx  = RandGen.Next(0, ReactorSrc.Count);
                Room room = ReactorSrc[idx];
                ReactorSrc.RemoveAt(idx);
                for (int i = 0; i < 2; i++)
                {
                    int  doorid   = 0;
                    Room nextRoom = A3GetRoomByRandDoor(room, out doorid);
                    if (nextRoom == null)
                    {
                        continue;
                    }
                    OpenRoomDoor(room, doorid);
                    nextRoom._visited = true;
                    nextReactor.Add(nextRoom);
                    NotVisitedRooms.Remove(nextRoom);
                }
            }
            ReactorSrc = nextReactor;
        }
Example #3
0
 public void SetTimer()
 {
     UITimer.ResetAnimatorBools();
     UITimer.EnableAllDots();
     UITimer.amountOfEnabledDots = amountOfDots;
     UITimer.lastTime            = currentTime = timePerQuestion;
 }
Example #4
0
    public void Initialize()
    {
        if (frontGround == null)
        {
            frontGround = GameObject.Find("FrontGround").GetComponent <Image>();
        }
        if (IntroUI == null)
        {
            IntroUI = GameObject.FindObjectOfType <UIIntro>();
        }
        if (LoadingUI == null)
        {
            LoadingUI = GameObject.FindObjectOfType <UILoading>();
        }
        if (TimerUI == null)
        {
            TimerUI = GameObject.FindObjectOfType <UITimer>();
        }
        if (ScoreUI == null)
        {
            ScoreUI = GameObject.FindObjectOfType <UIScore>();
        }
        if (ResultUI == null)
        {
            ResultUI = GameObject.FindObjectOfType <UIResult>();
        }

        IntroUI.Initialize(this);
        LoadingUI.Initialize(this);
        TimerUI.Initialize(this);
        ScoreUI.Initialize(this);
        ResultUI.Initialize(this);
    }
Example #5
0
        Control StartStopButton(ProgressBar bar)
        {
            var control = new Button {
                Text = "Start Timer"
            };

            control.Click += delegate {
                if (timer == null)
                {
                    timer = new UITimer {
                        Interval = 0.5
                    };
                    timer.Elapsed += delegate {
                        if (bar.Value < bar.MaxValue)
                        {
                            bar.Value += 50;
                        }
                        else
                        {
                            bar.Value = bar.MinValue;
                        }
                    };
                    timer.Start();
                    control.Text = "Stop Timer";
                }
                else
                {
                    timer.Stop();
                    timer.Dispose();
                    timer        = null;
                    control.Text = "Start Timer";
                }
            };
            return(control);
        }
Example #6
0
        private void lstRegionTimers_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (lstRegionTimers.SelectedItems.Count < 1)
            {
                return;
            }

            Point  mousePos = e.GetPosition(null);
            Vector diff     = _startTimerLstPoint - mousePos;

            if (e.LeftButton == MouseButtonState.Pressed &&
                (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
                 Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
                )
            {
                ListBox     listView     = sender as ListBox;
                ListBoxItem listViewItem = UiSearchHelper.FindAnchestor <ListBoxItem>((DependencyObject)e.OriginalSource);
                if (null == listViewItem)
                {
                    return;
                }

                UITimer timer = (UITimer)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);

                // Initialize the drag & drop operation
                DataObject dragData = new DataObject(CommConst.DRAGED_TIMER_DATA, timer);
                DragDrop.DoDragDrop(lstRegionTimers, dragData, DragDropEffects.Move);
            }
        }
        /// <summary>
        /// 依据相机配置链接相机
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public bool Connectted(CameraConfig config, Module module, Camera cam)
        {
            try
            {
                this.CameraConfig = config;
                if (camera != null)
                {
                    UITimer.Stop();
                    camera.Acquisition.Unconfigure();
                    camera.Dispose();
                }

                camera        = new ImaqdxSession(config.Name);
                this.Exposure = config.DefaultExp;
                this.Gain     = config.DefaultGain;
                this.Timeout  = 1000;

                for (int i = 0; i < config.Mat2D.Count; ++i)
                {
                    config.Mat2D[i].LoadCalib(PathDefine.sPathCamera + $"{module}-{cam}-{i}.bmp");
                }

                bOpen = true;
            }
            catch (Exception ex)
            {
                bOpen = false;
                throw new Exception($"相机[{config.Name}]初始化失败!!! 原因[{ex.StackTrace}]");
            }

            return(bOpen);
        }
Example #8
0
        //初始化窗口
        void InitForm()
        {
            //窗口全屏
            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition   = FormStartPosition.CenterScreen;
            this.ClientSize      = Screen.PrimaryScreen.Bounds.Size;

            mSceneLeftX  = mSceneMargen;
            mSceneUpY    = mSceneMargen;
            mSceneRightX = ClientSize.Width - mSceneMargen;
            mSceneDownY  = ClientSize.Height - mSceneMargen;

            //窗口背景
            this.BackColor = Color.Black;
            //隐藏鼠标
            Cursor.Hide();
            this.ShowInTaskbar = false;
            //双帧缓冲打开
            this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            this.UpdateStyles();
            //定时器
            UITimer.Enabled  = true;
            UITimer.Interval = mRunSpeed;
            UITimer.Tick    += UITimer_Tick;
            UITimer.Start();
        }
Example #9
0
 private void StartTimerTick()
 {
     StopTimerTick();
     UiTimer = new UITimer();
     UiTimer.TimerTickEvent += OnUITimerTick;
     UiTimer.Start(TimerInfo.RemainingTime, TimeSpan.FromSeconds(1));
 }
Example #10
0
 protected override void StartTimer()
 {
     fTimer          = new UITimer();
     fTimer.Interval = TimerInterval / 1000;
     fTimer.Elapsed += TimerElapsed;
     fTimer.Start();
 }
Example #11
0
 public void WindowFromPointShouldReturnWindowUnderPoint()
 {
     ManualForm("Move your mouse, it should show the title of the window under the mouse pointer",
                form =>
     {
         var content = new Panel {
             MinimumSize = new Size(100, 100)
         };
         var timer = new UITimer {
             Interval = 0.5
         };
         timer.Elapsed += (sender, e) =>
         {
             var window      = Window.FromPoint(Mouse.Position);
             content.Content = $"Window: {window?.Title}";
         };
         timer.Start();
         form.Closed += (sender, e) =>
         {
             timer.Stop();
         };
         form.Title = "Test Form";
         return(content);
     }
                );
 }
Example #12
0
        public FileViewerManager()
        {
            this.Timer = new UITimer {
                Interval = 30
            };
            this.Timer.Elapsed += this.Update;
            //Timer.Start();
            string temp_path;

            try
            {
                if (!Directory.Exists(temp_path = Path.Combine(Path.GetTempPath(), Definitions.TempDir)))
                {
                    Directory.CreateDirectory(temp_path);
                }
                else
                {
                    foreach (string file in Directory.GetFiles(temp_path))
                    {
                        File.Delete(file);
                    }
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
Example #13
0
        void GameOver(bool isWin)
        {
            //重绘整个窗口
            this.Invalidate(new Rectangle(0, 0, this.Size.Width, this.Size.Height));

            UITimer.Stop();
            DialogResult ret;

            if (isWin)
            {
                ret = MessageBox.Show("你找到了所有雷,点击重试重玩", "You Are Winner", MessageBoxButtons.RetryCancel);
            }
            else
            {
                ret = MessageBox.Show("你踩到了雷,重来一次吗?", "Game Over", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }

            if (ret == DialogResult.Retry)
            {
                RestartGame();
            }
            else
            {
                Close();
            }
        }
Example #14
0
        protected override void OnUnLoad(EventArgs e)
        {
            base.OnUnLoad(e);

            timer?.Stop();
            timer = null;
        }
Example #15
0
 public MainViewModel() : base()
 {
     Status         = new NetPingStatus();
     timer          = new UITimer(OnlineTimerTick);
     timer.Interval = 1;
     LoadSettings();
 }
Example #16
0
    /*********************
    * ALL OTHER FUNCTIONS
    *********************/
    public void SetupRound()
    {
        // Link all objects
        m_HUD = GameObject.Find("HUD");
        m_HUD.transform.Find("ScoreIndicators").GetComponent <ScoreUIManager>().Init();
        m_AI_Manager = GameObject.FindGameObjectWithTag(GLOBAL_VALUES.TAG_AI_MANAGER).GetComponent <AI_Manager>();
        uiClock      = GameObject.Find("ClockTimer").GetComponent <UITimer>();

        source          = m_HUD.GetComponent <AudioSource>();
        m_ItemManager   = m_HUD.gameObject.GetComponent <ItemManager>();
        m_SaleManager   = new SaleManager(m_ItemManager);
        m_CameraManager = new CameraManager(this, m_GameManager);
        m_CameraManager.SetActiveCamera(GameObject.Find("Main Camera").GetComponent <Camera>());
        m_CameraManager.SetupScene();
        m_UIClock_Text = GameObject.Find("TimerText").GetComponent <Text>();
        m_ScoreScreen  = new ScoreScreenManager(this, m_GameManager);
        SpawnPlayers();
        m_ClockAnimation = false;
        m_Countdown      = GameObject.Find("CountDown");
        m_Countdown.SetActive(false);
        m_EndLights = new List <SpinningLight>();
        foreach (GameObject light in GameObject.FindGameObjectsWithTag("LIGHTS_END"))
        {
            m_EndLights.Add(light.GetComponent <SpinningLight>());
        }
        m_endlightsStarted = false;
        foreach (AgentManager a in m_GameManager.Get_Players())
        {
            //a.Get_Powerup_Manager().Setup_Camera_Manager(m_CameraManager);
            a.Setup_Item_Manager(m_ItemManager);
            a.GetPunchControl().SetEffectColour();
        }
        SetupComplete = true;
    }
Example #17
0
 void SetupIceColours()
 {
     if (!allowBlink)
     {
         blinkOn = true;
         ViewerControl.Invalidate();
         return;
     }
     if (CharacterDocument.ICEColours)
     {
         if (blinkTimer != null)
         {
             blinkTimer.Stop();
             blinkTimer.Dispose();
             blinkTimer = null;
             InvalidateBlinkingCharacters();
         }
     }
     else if (blinkTimer == null && HasViewer)
     {
         blinkTimer          = new UITimer();
         blinkTimer.Interval = 0.25;
         blinkTimer.Elapsed += delegate
         {
             blinkOn = !blinkOn;
             InvalidateBlinkingCharacters();
         };
         blinkTimer.Start();
     }
 }
Example #18
0
        public PreviewEditorView(Control editor, Func <string> getCode)
        {
            Editor       = editor;
            this.getCode = getCode;

            Orientation      = Orientation.Vertical;
            FixedPanel       = SplitterFixedPanel.None;
            RelativePosition = 0.4;

            previewPanel = new Panel();
            errorPanel   = new Panel {
                Padding = new Padding(5), Visible = false, BackgroundColor = new Color(Colors.Red, .4f)
            };

            Panel1 = new StackLayout
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Items =
                {
                    new StackLayoutItem(previewPanel, expand: true),
                    errorPanel
                }
            };
            Panel2 = editor;

            timer = new UITimer {
                Interval = RefreshTime
            };
            timer.Elapsed += Timer_Elapsed;
        }
Example #19
0
 public EtoTimerBase(Action <object> callback)
 {
     _timer = new UITimer();
     Change(0, Timeout.Infinite);
     _timer.Elapsed += Elapsed(null, callback);
     _timer.Start();
 }
Example #20
0
        private void GvSelectionChanged(object sender, EventArgs e)
        {
            var id = GetSlectedWorkflowId();
            var wf = GetWorkflow(id);

            if (_timer != null && _timer.Started)
            {
                _timer.Stop();
                _timer.Dispose();
            }

            if (wf != null && wf.IsEnabled)
            {
                _timer = new UITimer {
                    Interval = 0.5
                };
                _timer.Elapsed += (s, ea) => UpdateButtons(id, false);
                _timer.Start();

                UpdateButtons(id, true);
            }
            else
            {
                UpdateButtons(id, true);
            }
        }
Example #21
0
File: Form1.cs Project: jwk000/Maze
        //每次进行计算的步骤
        void A1_TickOnce(A1Thread th)
        {
            if (th.CurrentStep1 == A1Step.GetNotVisitedRoom)
            {
                if (NotVisitedRooms.Count == 0)
                {
                    //结束生成
                    UITimer.Stop();
                    Restart();
                    return;
                }
                int idx = RandGen.Next(0, NotVisitedRooms.Count);
                idx = 0;
                th.CurrentStepRoom          = NotVisitedRooms[idx];
                th.CurrentStepRoom._visited = true;
                NotVisitedRooms.Remove(th.CurrentStepRoom);
                th.LastStepRooms.Clear();
                th.LastStepRooms.Add(th.CurrentStepRoom);
                th.CurrentStep1 = A1Step.VisitNextRoom;
            }

            if (!A1_VisitNextRoom(th))
            {
                th.CurrentStep1 = A1Step.GetNotVisitedRoom;
            }
        }
 public ImageContentManager(UIPlatform platform)
 {
     timImageLoadMonitor = platform.CreateUITimer();
     //TODO: review here****
     timImageLoadMonitor.Interval = 50;//30 ms check state
     timImageLoadMonitor.Tick    += TimImageLoadMonitor_Tick;
     timImageLoadMonitor.Enabled  = true;
 }
Example #23
0
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);

                _searchTimer          = new UITimer();
                _searchTimer.Interval = .4;
                _searchTimer.Elapsed += _searchRefresh;
            }
Example #24
0
        private void createTurnIndicator()
        {
            GameObject gameObject = Object.Instantiate(turnIndicatorPrefab);

            turnIndicator         = gameObject.GetComponent <UITimer>();
            turnIndicatorAnimator = gameObject.GetComponent <Animator>();
            turnIndicator.gameObject.SetActive(value: false);
        }
Example #25
0
        public EUITimer(double msInterval, EventHandler elapsedHandler)
        {
            fElapsedHandler = elapsedHandler;

            fInnerTimer          = new UITimer();
            fInnerTimer.Interval = msInterval / 1000;
            fInnerTimer.Elapsed += ElapsedEventHandler;
        }
Example #26
0
 public EtoTimerBase(Action <object> callback, object state, TimeSpan dueTime, TimeSpan period)
 {
     _timer = new UITimer();
     ChangeDue(dueTime.TotalSeconds);
     ChangeInterval(dueTime.TotalSeconds);
     _timer.Elapsed += Elapsed(state, callback);
     _timer.Start();
 }
Example #27
0
 public EtoTimerBase(Action <object> callback, object state, long dueTime, long period)
 {
     _timer = new UITimer();
     ChangeDue(dueTime / 1000);
     ChangeInterval(period / 1000);
     _timer.Elapsed += Elapsed(state, callback);
     _timer.Start();
 }
Example #28
0
    // Use this for initialization
    void Start()
    {
        timeout = GetComponent <UITimer>();

        win  = false;
        lose = false;

        OnHitTaken += TakeHit;
    }
Example #29
0
 protected override void StopTimer()
 {
     if (fTimer != null)
     {
         fTimer.Stop();
         fTimer.Dispose();
         fTimer = null;
     }
 }
Example #30
0
    public void Initialize(GameObject _object)
    {
        sequenceObject = _object;
        SequenceTimer  = sequenceObject.GetComponent <UITimer>();

        sequenceObject.GetComponent <ButtonSequenceScript>().buttonSequence = this;

        SequenceTimer.TargetTime = SequenceTime;
    }
		/// <summary>Call this to begin a marquee.</summary>
		public void Start(){
			
			if(Active){
				return;
			}
			
			Active=true;
			
			// Start our timer:
			Timer=new UITimer(false,ScrollDelay,OnTick);
			
			Element.Run("onstart");
			
		}
		/// <summary>Call this to stop a scrolling marquee.</summary>
		public void Stop(){
			
			if(!Active){
				return;
			}
			
			Active=false;
			
			// Stop and clear the timer:
			Timer.Stop();
			
			Timer=null;
			
			Element.Run("onstop");
			
		}
Example #33
0
		public void clearInterval(UITimer timer){
			if(timer!=null){
				timer.Stop();
			}
		}