protected override void OnFirstRun(TickEventArgs args)
        {
            base.OnFirstRun(args);

            Hotkey = System.Windows.Forms.Keys.Insert;
            Mode   = KeyMode.Hold;
        }
示例#2
0
        protected override void OnFirstTick(TickEventArgs args)
        {
            base.OnFirstTick(args);

            ClientDll = WaitForModule("client_panorama.dll");
            EngineDll = WaitForModule("engine.dll");
#if DEBUG
            Program.Logger.Log("Performing SigScans...");
            Program.Offsets.SigScan();
            Program.Offsets.Save("offsets.json");
#endif
            Program.Logger.Log("Grabbing ClientClasses...");
            do
            {
                ClientClassParser.Parse();
                Thread.Sleep(500);
            } while (ClientClassParser.DataTables.Count == 0);
#if DEBUG
            Program.Logger.Log("Dumping ClientClasses...");
            ClientClassParser.DumpClassIDs();
            ClientClassParser.DumpNetVars(false, "netvars.txt");
            ClientClassParser.DumpNetVars(true, "netvars_full.txt");
            ClientClassParser.DumpNetVarsJson("netvars.json");
            ClientClassParser.DumpCppClasses("clientclasses.cpp");
#endif
            Program.Logger.Info("Helios is ready.");

            //Window window = null;
            //using (var frm = new UI.TestForm())
            //    window = ControlConverter.Convert(frm);

            //Overlay.Controls.Add(window);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        public override void Update(TickEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            // Animate
            base.Update(args);

            // Bounce off the left
            if (this.X < bounds.Left)
            {
                this.X = bounds.Left;
            }

            // Bounce off the top
            if (this.Y < bounds.Top)
            {
                this.Y = bounds.Top;
            }

            // Bounce off the bottom
            if (this.Y > bounds.Bottom)
            {
                this.Y = bounds.Bottom;
            }
            // Bounce off the right
            if (this.X > bounds.Right)
            {
                this.X = bounds.Right;
            }
        }
示例#4
0
 private void Events_Tick(object sender, TickEventArgs e)
 {
     if (init)
     {
         if (!introMusic)
         {
             introMusic  = true;
             musicThread = new Thread(() => AudioPlaybackThread(@"Music\Bully Intro Music.wav", 15));
             musicThread.Start();
         }
         intro.titleDraw();
         intro.marioDraw();
         if (intro.ended)
         {
             init        = introMusic = false;
             game        = true;
             level       = new GameLevel(video, @"Sprites\levels\level1", 1);
             musicThread = new Thread(() => AudioPlaybackThread(@"Music\Super MLG Bros. (Air Horn Remix).mp3", 30));
             musicThread.Start();
         }
     }
     else if (game)
     {
         if (!gameThread.IsBusy)
         {
             gameThread.RunWorkerAsync();
         }
     }
     SdlDotNet.Core.Timer.DelayTicks(60);
     video.Update();
 }
        // A tick has elasped so we need to do work
        private void EnvTick(object sender, TickEventArgs e)
        {
            if (_next == null)
            {
                var trains = _circuit.Trains;

                var differences =
                    trains.Where(x => _circuit.Trains.All(x1 => x1.Key != x.Key))
                    .Union(_circuit.Trains.Where(x => trains.All(x1 => x1.Key != x.Key)));
                foreach (var k in differences)
                {
                    _env.AllTrains.Remove(k.Value);
                }
            }

            _trains = _circuit.Trains;
            _blocks = _circuit.Blocks;


            // Randomly create broken blocks
            //if (Random.Next(Max) > Max * 0.999)
            //{
            //    IBlock broken;
            //    if (_blocks.TryGetValue(Random.Next(_blocks.Count - 1), out broken))
            //    {
            //        broken.State = StateEnum.BrokenTrackFailure;
            //        _updateBlocks.Add(broken.BlockID, broken);
            //    }
            //}

            PlcDoWork();
        }
示例#6
0
 protected virtual void AfterPluginsTick(TickEventArgs args)
 {
     if (Overlay != null)
     {
         Overlay.Renderer.Present();
     }
 }
示例#7
0
        void Events_Tick(object sender, TickEventArgs e)
        {
            //There should be an easier way to get the video data to SDL

            timeElapsed += (e.SecondsElapsed);
            while (timeElapsed > 1.0 / file.Header.Fps && frameQueue.Count > 0)
            {
                timeElapsed -= (float)(1.0f / file.Header.Fps);
                byte[] rgbData = frameQueue.Dequeue();

                if (surf == null)
                {
                    surf = GuiUtil.CreateSurface(rgbData, (ushort)file.Header.Width, (ushort)file.Header.Height,
                                                 32, (int)file.Header.Width * 4,
                                                 (int)0x00ff0000,
                                                 (int)0x0000ff00,
                                                 (int)0x000000ff,
                                                 unchecked ((int)0xff000000));
                }
                else
                {
                    surf.Lock();
                    Marshal.Copy(rgbData, 0, surf.Pixels, rgbData.Length);
                    surf.Unlock();
                    surf.Update();
                }

                EmitFrameReady();

                if (frameQueue.Count < (buffered_frames / 2) + 1)
                {
                    waitEvent.Set();
                }
            }
        }
示例#8
0
 public void onTick(TickEventArgs e)
 {
     foreach (IStrategy strategy in mStrategyDictionary.Values)
     {
         strategy.onTick(e);
     }
 }
 void Events_Tick(object sender, TickEventArgs e)
 {
     s.Z  = rand.Next(100);
     s2.Z = rand.Next(100);
     screen.Fill(Color.Black);
     screen.Update(screen.Blit(manager));
 }
示例#10
0
        public static void TickHandler(object sender, TickEventArgs args) // every frame update
        {
            int halfh = s_height / 2;
            int halfw = s_width / 2;

            int xPortion_size = s_width / num_threads;

            // create threads
            List <Thread> t_List = new List <Thread>();

            for (int i = 0; i < num_threads; i++)
            {
                int    xstart = i * xPortion_size;
                int    xend   = Math.Min((xstart + xPortion_size), s_width);
                Thread worker = new Thread(() => OutObject.writePortion(xstart, xend + 1, halfh, halfw));
                worker.Start();
                t_List.Add(worker);
            }

            // join threads
            for (int i = 0; i < num_threads; i++)
            {
                t_List[i].Join(); // join the threads as they complete
            }

            if (outToPng)
            {
                OutObject.saveImage(outPath);
            }
            Events.QuitApplication();
        }
示例#11
0
        public override void Tick(TickEventArgs e)
        {
            base.Tick(e);
            if (t.ElapsedMilliseconds > 100)
            {
                t.Restart();

                if (isdown)
                {
                    _testLabel.Y -= 1;
                }
                else
                {
                    _testLabel.Y += 1;
                }
                if (_testLabel.Y < 1)
                {
                    isdown = true;
                }

                if (_testLabel.Bottom + 1 > this.Bottom)
                {
                    isdown = false;
                }
                _testLabel.Text = _testLabel.Y.ToString();
            }
        }
示例#12
0
        protected override void OnFirstRun(TickEventArgs args)
        {
            base.OnFirstRun(args);

            lastIn  = Program.Hack.Memory.BytesIn;
            lastOut = Program.Hack.Memory.BytesOut;
        }
示例#13
0
        private void Events_Tick(object sender, TickEventArgs e)
        {
            //Clear

            //Update
            americanSoldier.Update(activeLevel, collRight, collLeft, collUp, collDown, americanSoldier.Direction);
            //germanSoldier.Update(activeLevel, collRight, collLeft, collUp, collDown);

            collDown  = false; //if not false, can't walk
            collRight = false;
            collLeft  = false;
            collUp    = false;

            //detect collision with bullets and sprites
            UpdateBullets();

            //detect collision with User and sprite
            CollisionDetectonUser();

            for (int i = 0; i < germanSolderList.Count; i++)
            {
                germanSolderList[i].Update(activeLevel, collRight, collLeft, collUp, collDown, americanSoldier.Direction);
                germanSolderList[i].Draw();
            }

            //Draw
            DrawAll();

            //Update
            mVideo.Update();
        }
示例#14
0
        private void Events_Tick(object sender, TickEventArgs e)
        {
            // Update location of the ball
            ball.X += ballSpeedX;
            ball.Y += ballSpeedY;

            // Bounce the ball
            if (ball.Right > Video.Screen.Width)
            {
                ballSpeedX *= -1;
            }
            if (ball.Left < 0)
            {
                ballSpeedX *= -1;
            }
            if (ball.Top < 0)
            {
                ballSpeedY *= -1;
            }
            if (ball.Bottom > Video.Screen.Height)
            {
                ballSpeedY *= -1;
            }

            // Clear the screen
            Video.Screen.Fill(Color.Black);

            // Draw the ball
            Video.Screen.Blit(ball);

            // Update the screen
            Video.Screen.Update();
        }
        protected override void OnTick(object sender, TickEventArgs args)
        {
            base.OnTick(sender, args);

            if (_renderer.Sun == null)
            {
                return;
            }
            if (User32.IsKeyPressed(Keys.LMenu) || User32.IsKeyPressed(Keys.RMenu))
            {
                if (User32.IsKeyPressed(Keys.Left))
                {
                    _renderer.AutoRotateSun = false;
                    _renderer.Sun.Direction = _renderer.Sun.Direction + new Vector3(-args.DeltaTime, 0f, 0f);
                }

                if (User32.IsKeyPressed(Keys.Right))
                {
                    _renderer.AutoRotateSun = false;
                    _renderer.Sun.Direction = _renderer.Sun.Direction + new Vector3(args.DeltaTime, 0f, 0f);
                }

                if (User32.IsKeyPressed(Keys.Up))
                {
                    _renderer.AutoRotateSun = false;
                    _renderer.Sun.Direction = _renderer.Sun.Direction + new Vector3(0f, 0f, args.DeltaTime);
                }

                if (User32.IsKeyPressed(Keys.Down))
                {
                    _renderer.AutoRotateSun = false;
                    _renderer.Sun.Direction = _renderer.Sun.Direction + new Vector3(0f, 0f, -args.DeltaTime);
                }
            }
        }
 private void objTimer_Elapsed(object sender, EventArgs args)
 {
     _seconds -= 1;
     if (_seconds < 0)
     {
         _minutes -= 1;
         if (_minutes < 0)
         {
             StopTimer();
             _seconds = 0;
             _minutes = 0;
             if (Complete != null)
             {
                 Complete(this, EventArgs.Empty);
             }
         }
         else
         {
             _seconds = 59;
         }
     }
     if (Tick != null)
     {
         var myargs = new TickEventArgs
         {
             Seconds = _seconds,
             Minutes = _minutes,
             Display = _minutes.ToString("00") + ":" + _seconds.ToString("00")
         };
         Tick(this, myargs);
     }
 }
示例#17
0
        void HandleTickNotify(bool realTime, short sStockIdx, int nPtr, int lTimehms, int nBid, int nAsk, int nClose, int nQty)
        {
            string code = symbolIndexCode[sStockIdx];

            if (InTime(code, lTimehms))
            {
                double symbolPoints = symbolIndexPoints[sStockIdx];

                var tick = new Tick
                {
                    order = nPtr,
                    time  = lTimehms,
                    bid   = nBid / symbolPoints,
                    offer = nAsk / symbolPoints,
                    price = nClose / symbolPoints,
                    qty   = nQty
                };

                var e = new TickEventArgs(code, tick, realTime);
                if (IsStock(code))
                {
                    NotifyStockTick?.Invoke(this, e);
                }
                else
                {
                    NotifyFuturesTick?.Invoke(this, e);
                }
            }
        }
示例#18
0
 private void ApplicationTickEventHandler(object sender, TickEventArgs args)
 {
     m_elapsed += args.SecondsElapsed;
     if (m_elapsed > m_step)
     {
         m_grid.Step();
         m_elapsed -= m_step;
     }
     for (int y = 0; y < m_grid.Data.GetLength(1); y++)
     {
         for (int x = 0; x < m_grid.Data.GetLength(0); x++)
         {
             int xa = x * m_xScale;
             int xb = (x * m_xScale) + m_xScale;
             int ya = y * m_yScale;
             int yb = (y * m_yScale) + m_yScale;
             if (m_grid.Data[x, y] == State.Red)
             {
                 m_video.Draw(new SdlDotNet.Graphics.Primitives.Box(new Point(xa, ya), new Point(xb, yb)), Color.Red, false, true);
             }
             else
             {
                 m_video.Draw(new SdlDotNet.Graphics.Primitives.Box(new Point(xa, ya), new Point(xb, yb)), Color.White, false, true);
             }
         }
     }
     m_video.Update();
 }
示例#19
0
        public override void Tick(TickEventArgs e)
        {
            base.Tick(e);

            DoMarker();

            /*
             * This is code pulled from a random project i have. Its not goanna get used, but its here
             * as a reference when i put in some form of selection code.
             *
             * //Rectangle rSize = TransferInfo.FontDraw.MeasureString(null, tText, DrawTextFormat.None,Color.White);
             * VisualPart = tText;
             * Sub_cursorPosition = SelPos;
             *
             *
             * if (rSize.Width >= tWidth)
             * //start choppin it up
             * {
             *
             *  while (TransferInfo.FontDraw.MeasureString(
             *      null, VisualPart.Substring(Sub_cursorPosition),
             *      DrawTextFormat.None, Color.White
             *      ).Width > tWidth)
             *  {
             *      VisualPart = VisualPart.Remove(0, 1);
             *      Sub_cursorPosition--;
             *  }
             *
             *
             *
             *
             * }*/
        }
示例#20
0
        protected virtual void OnTick(TickEventArgs args)
        {
            Process.Process.Refresh();
            if (!Process.IsRunning)
            {
                args.Stop = true;
                return;
            }


            if (first)
            {
                OnFirstTick(args);
            }

            if (ProcessInput())
            {
                Input.Update();
            }

            BeforePluginsTick(args);

            if (ProcessModules())
            {
                foreach (var mod in modules.OrderByDescending(x => x.Priority))
                {
                    mod.Update(args);
                }
            }

            AfterPluginsTick(args);
        }
示例#21
0
        private static void draw(object sender, TickEventArgs args)
        {
            IVideoSurface.Fill(Color.Black);                                      // flush background black

            Point HeaderPos  = new Point(5, 5);                                   // Point for header drawing
            var   HeaderText = myfont.Render("JAIMaker by XayrGA ", Color.White); // yay me.

            Video.Screen.Blit(HeaderText, HeaderPos);

            Point RAMPos = new Point(150, 5); // Point for header drawing

            var ramstring = string.Format("MEM: {0}MB ", me.PrivateMemorySize / (1024 * 1024));

            if (Root.currentProg != null && Root.currentBank != null)
            {
                ramstring = string.Format("MEM: {0}MB BNK: {1} PRG: {2}", me.PrivateMemorySize / (1024 * 1024), Root.currentBank.id, Root.ProgNumber);
            }

            var RAMText = myfont.Render(ramstring, Color.White); // yay me.

            Video.Screen.Blit(RAMText, RAMPos);

            RAMText.Dispose();
            HeaderText.Dispose();


            IVideoSurface.Update(); // Update the video surface.
        }
示例#22
0
        }//Constructor

        /// <summary>
        ///     Do Processing on Tick
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _env_Tick(object sender, TickEventArgs e)
        {
            //check for track if both tracks are not up.. if tracks are up.. dont check
            if (!(_redLoaded && _greenLoaded))
            {
                IsTrackUp();
            }

            if (_primaryTrackControllerRed == null)
            {
                _primaryTrackControllerRed = _env.PrimaryTrackControllerRed;
            }

            if (_primaryTrackControllerGreen == null)
            {
                _primaryTrackControllerGreen = _env.PrimaryTrackControllerGreen;
            }

            _tickCount++;
            if (_tickCount >= _rate)
            {
                //AddAutomaticUpdate();//no longer need this information as of Track Model Update
                _tickCount = 0;
                PopulateTrack();//add trains to track
            }
        }
示例#23
0
        private void Tick(object sender, TickEventArgs e)
        {
#if Release
            try
            {
#endif
            if (first)
            {
                new Thread(StartThread).Start();
                physicsTimer.Enabled = false;
                first = false;
                demo.AddObjects();
                lastTime = DateTime.Now;
            }
            else
            {
                physicsTimer.EndUpdate();
            }
            MeleeSound.PlaySounds();

            DrawGLScene();

            physicsTimer.BeginUpdate();

            Video.GLSwapBuffers();

#if Release
        }

        catch (Exception ex)
        {
            ErrorBox.DisplayError(ex);
        }
#endif
        }
        /// <summary>
        /// Handler for TickEvent of EventLoop. Will update keyframes of any animation and synchronize it with
        /// clients by setting the respective entity attribute
        /// </summary>
        /// <param name="sender">Sender of the event (EventLoop)</param>
        /// <param name="e">TickEvent args</param>
        private void HandleEventTick(Object sender, TickEventArgs e)
        {
            double frameDuration = e.TimeStamp.Subtract(LastTick).TotalMilliseconds;

            LastTick = e.TimeStamp;
            lock (RunningAnimationsForEntities)
            {
                foreach (KeyValuePair <Guid, Dictionary <string, KeyframeAnimation> >
                         animatedEntity in RunningAnimationsForEntities)
                {
                    string animationKeyframes = "";
                    foreach (KeyValuePair <string, KeyframeAnimation> runningAnimation in animatedEntity.Value)
                    {
                        float newKey = PerformTickForEntityAnimation(animatedEntity.Key,
                                                                     runningAnimation.Value,
                                                                     frameDuration);

                        animationKeyframes += runningAnimation.Key + ":" + newKey + ";";
                    }
                    Entity entity = World.Instance.FindEntity(animatedEntity.Key);
                    entity["animation"]["animationKeyframes"].Suggest(animationKeyframes);
                }
            }
            FinalizeFinishedAnimations();
        }
示例#25
0
        private void Tick(object sender, TickEventArgs e)
        {
            if (_disposing)
            {
                return;
            }

            if (_deviceRemoved &&
                _currentScene.SceneType != SceneType.Option && _currentScene.SceneType != SceneType.Title)
            {
                EnterScene(SceneType.Error,
                           new string[] { "デバイスが切断されました", "Returnを押して確認してください" });
            }
            else
            {
                try
                {
                    _currentScene.Process(null);
                    _currentScene.Draw(Video.Screen);
                    Video.Screen.Update();
                }
                catch (Exception ex)
                {
                    _currentScene.SetAlert(true, ex.Message);
                }
            }
            _deviceRemoved = false;
        }
示例#26
0
 /// <summary>
 /// All sprites are tickable, regardless if they actual do
 /// anything. This ensures that the functionality is there, to be
 /// overridden as needed.
 /// </summary>
 /// <param name="sender">Object that sent event</param>
 /// <param name="e">Event arguments</param>
 private void Update(object sender, TickEventArgs e)
 {
     foreach (Sprite s in this)
     {
         s.Update(e);
     }
 }
示例#27
0
 protected void RadAjaxTimer_Messages_Tick(object sender, TickEventArgs e)
 {
     if (Барс.ВебЯдро.аботающиеПользователи.СообщениеАдминистратора.ЕстьСообщение)
     {
         Panel_AdminMessages.Controls.Add(new LiteralControl("<script type='text/javascript'>alert('" + Барс.ВебЯдро.аботающиеПользователи.СообщениеАдминистратора.ПолныйТекстСообщения + "')</script>"));
     }
 }
示例#28
0
 void OnTick(object sender, TickEventArgs e)
 {
     lock (this.synchronizer)
     {
         var quote = e.Tick;
         this.symbolToLevel2[quote.Symbol] = quote;
     }
 }
示例#29
0
 protected override void OnTick(object sender, TickEventArgs args)
 {
     base.OnTick(sender, args);
     if (Form.Focused)
     {
         Helper.OnTick(Kn5ObjectRenderer, args.DeltaTime);
     }
 }
 //A ticker is running to update the sprites constantly.
 //This method will fill the screen with black to clear it of the sprites.
 //Then it will Blit all of the sprites to the screen.
 //Then it will refresh the screen and display it.
 private void Tick(object sender, TickEventArgs args)
 {
     screen.Fill(Color.Black);
     screen.Draw(line, Color.White);
     screen.Blit(this.comboBoxNamespaces);
     screen.Blit(this.listBoxDemos);
     screen.Update();
 }
示例#31
0
        private void OnTick(object sender, TickEventArgs e)
        {
            _timespan -= e.Delta;

            if (_timespan < 0) {
                Debug.Assert(TimeElapsed != null);
                TimeElapsed(this, EventArgs.Empty);
            }
        }
示例#32
0
        public virtual void ReiseCompleteEvent()
        {
            var args = new TickEventArgs(Interval);

            var handler = Complete;
            if (handler != null)
            {
                handler(this, args);
            }
        }
示例#33
0
        private void ComboBox_Paint(Control sender, TickEventArgs e)
        {
            if(SelectedControl == null) return;

            int borderLength = Border?.BorderLenght ?? 0;

            _selectText = new Rectangle((int)(DrawabledLocation.X + _arrow.Location.X + _arrow.Size.X),
                (int)(DrawabledLocation.Y + borderLength), (int)(Size.X - _arrow.Size.X),
                (int)(Size.Y - borderLength));

            TextControlBase f = SelectedControl as TextControlBase;
            if (f != null)
            {
                f.Background.AlgorithmDrawable(e.Graphics, e.GameTime, _selectText);
                f.TextBrush.AlgorithmDrawable(e.Graphics, e.GameTime, _selectText);
            }
            else
                e.Graphics.DrawString(_arrow.TextBrush.Font, SelectedControl.Name, _selectText.Location.ConvertToVector(), _arrow.TextBrush.Color);
        }
示例#34
0
        void FlipPage(object sender, TickEventArgs e)
        {
            totalElapsed += e.TicksElapsed;

            if (totalElapsed < millisDelay)
                return;

            totalElapsed = 0;
            AdvanceToNextPage ();
        }
示例#35
0
 static void SpriteManagerPainterTick(object sender, TickEventArgs args)
 {
     for (int i = 0; i < sprites.Count; i ++) {
         Sprite s = sprites[i];
         if (s.Tick (args.TicksElapsed) == false) {
             Console.WriteLine ("removing sprite!!!!");
             sprites.RemoveAt (i);
         }
     }
 }
示例#36
0
        void Events_Tick(object sender, TickEventArgs e)
        {
            //There should be an easier way to get the video data to SDL

            timeElapsed += (e.SecondsElapsed);
            while (timeElapsed > 1.0 / file.Header.Fps && frameQueue.Count > 0)
            {
                timeElapsed -= (float)(1.0f / file.Header.Fps);
                byte[] rgbData = frameQueue.Dequeue();

                if (surf == null) {
                    surf = GuiUtil.CreateSurface (rgbData, (ushort)file.Header.Width, (ushort)file.Header.Height,
                                      32, (int)file.Header.Width * 4,
                                      (int)0x00ff0000,
                                      (int)0x0000ff00,
                                      (int)0x000000ff,
                                      unchecked ((int)0xff000000));
                }
                else {
                    surf.Lock();
                    Marshal.Copy(rgbData, 0, surf.Pixels, rgbData.Length);
                    surf.Unlock();
                    surf.Update();
                }

                EmitFrameReady ();

                if (frameQueue.Count < (buffered_frames / 2) + 1)
                    waitEvent.Set ();
            }
        }
示例#37
0
        private void TextBox_Paint(Control sendred, TickEventArgs e)
        {
            if (Text == null || Font == null) return;
            Point location = new Point(DrawabledLocation.X.ToInt(), DrawabledLocation.Y.ToInt());
            Point size;
            location.X += 3;
            _iterationPaint = 0;
            for (; _iterationPaint < Text.Length; _iterationPaint++)
            {
                if (Focused && _positionCoretka == _iterationPaint)
                {
                    e.Graphics.FillRectangle(location.ConvertToVector(), _coretkaSize, CoretkaInfo.Color);
                    location.X += CoretkaInfo.Size + 1;
                }

                // set Parameters draw Text
                _paintChar = Text[_iterationPaint];
                size = Font.MeasureString(_paintChar.ToString()).ConvertToPoint();
                TextBrush.Text = _paintChar.ToString();

                TextBrush.AlgorithmDrawable(e.Graphics, e.GameTime, new Rectangle(location.X, location.Y, size.X, size.Y));// draw text from Algoritme Brush

                location.X += size.X;
            }
            if (!Focused || _positionCoretka != _iterationPaint) return;
            e.Graphics.FillRectangle(location.ConvertToVector(), new Vector2(CoretkaInfo.Size, Size.Y), CoretkaInfo.Color);
            location.X += CoretkaInfo.Size + CoretkaInfo.Size;
        }
示例#38
0
文件: Label.cs 项目: pzaps/CrossGFX
 public override void Tick(IWindow window, TickEventArgs e)
 {
     if(this.Value.Modified) {
         this.ResetTextPosition();
         this.MaxSize = Value.Size;
         this.Value.Modified = false;
     }
 }
 private void objTimer_Elapsed(object sender, EventArgs args)
 {
     _seconds -= 1;
     if (_seconds < 0)
     {
         _minutes -= 1;
         if (_minutes < 0)
         {
             StopTimer();
             _seconds = 0;
             _minutes = 0;
             if (Complete != null)
             {
                 Complete(this, EventArgs.Empty);
             }
         }
         else
         {
             _seconds = 59;
         }
     }
     if (Tick != null)
     {
         var myargs = new TickEventArgs
             {
                 Seconds = _seconds,
                 Minutes = _minutes,
                 Display = _minutes.ToString("00") + ":" + _seconds.ToString("00")
             };
         Tick(this, myargs);
     }
 }
示例#40
0
文件: TextBox.cs 项目: pzaps/CrossGFX
 public override void Tick(IWindow window, TickEventArgs e)
 {
     base.Tick(window, e);
     if (this.HasFocus)
         if (e.Tick > this.lastTickCheck + 500) {
             this.caretVisible = !this.caretVisible;
             this.lastTickCheck = e.Tick;
         }
 }
示例#41
0
        private void Tick(object sender, TickEventArgs e)
        {
            foreach (HashElement element in _hash.Values) {
                if (element.Target.IsRunning) {
                    for (int i = 0; i < element.Actions.Count; ++i) {
                        Action action = element.Actions[i];
                        action.Step(e.Delta);

                        if (action.IsDone) {
                            element.Actions.Remove(action);
                            --i;
                        }
                    }
                }
            }
        }
示例#42
0
文件: Control.cs 项目: pzaps/CrossGFX
 public override void Tick(IWindow window, TickEventArgs e)
 {
     base.Tick(window, e);
 }
示例#43
0
 public override void Tick(IWindow window, TickEventArgs e)
 {
     if(this.Target == null) return;
     if(this.lastOffset != this.Target.Offset) {
         this.ResetThumb();
         this.lastOffset = this.Target.Offset;
     }
     if(this.lastMaxSize != this.Target.MaxSize) {
         this.ResetThumb();
         this.lastMaxSize = this.Target.MaxSize;
     }
 }
示例#44
0
 private void Panel_Paint(Control sender, TickEventArgs e)
 {
     Background?.AlgorithmDrawable(e.Graphics, e.GameTime, this);
     Border?.AlgorithmDrawable(e.Graphics, e.GameTime, this);
 }
示例#45
0
        /// <summary>
        /// Констрктор для Базовой Инициализации
        /// </summary>
        /// <param name="window">Окно в котором будут Отображаться Контролы</param>
        internal static void ControlInicializer(IWindow window)
        {
            if (Graphics == null) Graphics = window.Graphics2D;
            if (Window == null) Window = window;

            _ticks = new TickEventArgs(Window, null);
            _mouseEventArgs = new MouseEventArgs();
            _keyEventArgs = new KeyEventArgs();
        }
示例#46
0
 /// <summary>
 /// If the node's checkbox has been either ticked or not, update all child nodes' checkboxes as well.
 /// </summary>
 /// <param name="obj">The object that fired the event.</param>
 /// <param name="e">The event arguments.</param>
 private void OnCheckboxTicked(object obj, TickEventArgs e)
 {
     NodeTickedInvoke(e.IsChecked);
 }
示例#47
0
        static void Tick(object sender, TickEventArgs e)
        {
            total_elapsed += e.TicksElapsed;

            if (total_elapsed < millis)
                return;

            if (paused == 0)
                Redraw ();
        }
示例#48
0
 protected virtual void OnTick(TickEventArgs args)
 {
     var h = Tick;
     if (h != null)
         h(this, args);
 }
示例#49
0
        public void ScrollTick(object sender, TickEventArgs e)
        {
            scroll_elapsed += e.TicksElapsed;

            if (scroll_elapsed < 20)
                return;

            scroll_elapsed = 0;

            if (horiz_delta == 0 && vert_delta == 0)
                return;

            int old_topleft_x = topleft_x;
            int old_topleft_y = topleft_y;

            topleft_x += horiz_delta;
            topleft_y += vert_delta;

            ClipTopLeft ();

            if (old_topleft_x == topleft_x
                && old_topleft_y == topleft_y)
                return;

            SpriteManager.SetUpperLeft (topleft_x, topleft_y);
            mapRenderer.SetUpperLeft (topleft_x, topleft_y);

            UpdateCursor ();

            Painter.Invalidate (new Rectangle (new Point (0,0),
                               new Size (Painter.SCREEN_RES_X, 375)));
        }
示例#50
0
 private void Button_Paint(Control sender, TickEventArgs e)
 {
     TextBrush?.AlgorithmDrawable(e.Graphics, e.GameTime, this);
 }
示例#51
0
        public void Tick(object sender, TickEventArgs e)
        {
            TriggerAction[] actions = triggerData.Triggers[0].Actions;

            if (current_action == actions.Length)
                return;

            totalElapsed += e.TicksElapsed;

            /* if we're presently waiting, make sure
               enough time has gone by.  otherwise
               return */
            if (totalElapsed < sleepUntil)
                return;

            totalElapsed = 0;

            while (current_action < actions.Length) {
                TriggerAction action = actions[current_action];

                current_action ++;

                switch (action.Action) {
                case 0: /* no action */
                    break;
                case 1:
                    sleepUntil = (int)action.Delay;
                    return;
                case 2:
                    GuiUtil.PlaySound (screen.Mpq, prefix + "\\" + scenario.GetMapString ((int)action.WavIndex));
                    sleepUntil = (int)action.Delay;
                    return;
                case 3:
                    screen.SetTransmissionText (scenario.GetMapString ((int)action.TextIndex));
                    break;
                case 4:
                    screen.SetObjectives (scenario.GetMapString ((int)action.TextIndex));
                    break;
                case 5:
                    Console.WriteLine ("show portrait:");
                    Console.WriteLine ("location = {0}, textindex = {1}, wavindex = {2}, delay = {3}, group1 = {4}, group2 = {5}, unittype = {6}, action = {7}, switch = {8}, flags = {9}",
                               action.Location,
                               action.TextIndex,
                               action.WavIndex,
                               action.Delay,
                               action.Group1,
                               action.Group2,
                               action.UnitType,
                               action.Action,
                               action.Switch,
                               action.Flags);
                    screen.ShowPortrait ((int)action.UnitType, (int)action.Group1);
                    Console.WriteLine (scenario.GetMapString ((int)action.TextIndex));
                    break;
                case 6:
                    screen.HidePortrait ((int)action.Group1);
                    break;
                case 7:
                    Console.WriteLine ("Display Speaking Portrait(Slot, Time)");
                    Console.WriteLine (scenario.GetMapString ((int)action.TextIndex));
                    break;
                case 8:
                    Console.WriteLine ("Transmission(Text, Slot, Time, Modifier, Wave, WavTime)");
                    screen.SetTransmissionText (scenario.GetMapString ((int)action.TextIndex));
                    screen.HighlightPortrait ((int)action.Group1);
                    GuiUtil.PlaySound (screen.Mpq, prefix + "\\" + scenario.GetMapString ((int)action.WavIndex));
                    sleepUntil = (int)action.Delay;
                    return;
                default:
                    break;
                }
            }
        }
示例#52
0
 private void TextBox_Invalidate(Control sendred, TickEventArgs e)
 {
     if (!Focused) return;
     _animTime += (float)e.GameTime.ElapsedGameTime.TotalMilliseconds;
     if (_animTime < AnimColldown) return;
     if (CoretkaInfo.Color.A < 10) _isPlus = true;
     if (CoretkaInfo.Color.A > 250) _isPlus = false;
     _coretka.Color.A = (byte)(_coretka.Color.A + (_isPlus ? 10 : -10));
     _animTime = 0f;
 }
示例#53
0
 void stateTicker_Tick(object sender, TickEventArgs e)
 {
     Galaxy.Tick();
 }
示例#54
0
        public HighPrecisionTimer(int intervalMs, bool startRunning = true)
        {
            log.Info("Starting HighPrecisionTimer with {0} ms interval", intervalMs);

            if (intervalMs < 1)
                throw new ArgumentOutOfRangeException();
            System.Diagnostics.Trace.Assert(intervalMs >= 10, "Not reliable/tested, may use too much CPU");

            this.IntervalMs = intervalMs;
            this.cancelSource = new CancellationTokenSource();
            this.taskComplete = new ManualResetEvent(false);

            #if PROFILE
            // Used to report timing accuracy for 1 sec, running total
            tickTiming = new CircularBuffer.CircularBuffer<int>(1000 / intervalMs, true);
            execTiming = new CircularBuffer.CircularBuffer<long>(1000 / intervalMs, true);
            #endif

            var watch = System.Diagnostics.Stopwatch.StartNew();
            long durationMs = 0;
            long totalTicks = 0;
            long nextStop = intervalMs;
            #if PROFILE
            long lastReport = 0;
            #endif

            this.task = new Task(() =>
                {
                    var eventArgs = new TickEventArgs();

                    while (!this.cancelSource.IsCancellationRequested)
                    {
                        long msLeft = nextStop - watch.ElapsedMilliseconds;
                        if (msLeft <= 0)
                        {
                            durationMs = watch.ElapsedMilliseconds;
                            totalTicks = durationMs / intervalMs;

            #if PROFILE
                            var execWatch = System.Diagnostics.Stopwatch.StartNew();
            #endif
                            var handler = Tick;
                            if (handler != null)
                            {
                                eventArgs.Duration = TimeSpan.FromMilliseconds(durationMs);
                                eventArgs.TotalTicks = totalTicks;
                                handler(this, eventArgs);
                                if (eventArgs.Cancel)
                                    break;
                            }
            #if PROFILE
                            execWatch.Stop();
                            execTiming.Put(execWatch.ElapsedTicks);
                            tickTiming.Put((int)(durationMs - nextStop));

                            if (durationMs - lastReport >= 1000)
                            {
                                // Report
                                log.Debug("HighPTimer  avg: {0:F1}  best: {1}  worst: {2}   MaxExec: {3:N1}ms",
                                    tickTiming.Average(), tickTiming.Min(), tickTiming.Max(),
                                    TimeSpan.FromTicks(execTiming.Max()).TotalMilliseconds);

                                lastReport = durationMs;
                            }
            #endif

                            // Calculate when the next stop is. If we're too slow on the trigger then we'll skip ticks
                            nextStop = intervalMs * (watch.ElapsedMilliseconds / intervalMs + 1);
                            continue;
                        }
                        else if (msLeft < 16)
                        {
                            System.Threading.SpinWait.SpinUntil(() => watch.ElapsedMilliseconds >= nextStop);
                            continue;
                        }

                        System.Threading.Thread.Sleep(1);
                    }

                    this.taskComplete.Set();
                }, cancelSource.Token, TaskCreationOptions.LongRunning);

            if (startRunning)
                this.task.Start();
        }
示例#55
0
        public void CursorTick(object sender, TickEventArgs e)
        {
            totalElapsed += e.TicksElapsed;

            if (totalElapsed < millisDelay)
                return;

            totalElapsed = 0;
            current_frame ++;
            Painter.Invalidate (new Rectangle (x - hot_x, y - hot_y, grp.Width, grp.Height));
        }
示例#56
0
 /// <summary>
 /// If any node has been ticked.
 /// </summary>
 /// <param name="obj">The object that fired the event.</param>
 /// <param name="e">The event arguments.</param>
 private void OnChildNodeTicked(object obj, TickEventArgs e)
 {
     //If someone has hooked up a delegate to the event, fire it.
     if (Ticked != null) { Ticked(obj, e); }
 }
示例#57
0
        void LoadingFlasher(object sender, TickEventArgs e)
        {
            totalElapsed += e.TicksElapsed;

            if ((Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_ON_DURATION)) ||
                (!Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_OFF_DURATION)) )
                return;

            Console.WriteLine ("Flashing");

            Elements[LOADING_ELEMENT_INDEX].Visible = !Elements[LOADING_ELEMENT_INDEX].Visible;

            totalElapsed = 0;
        }
示例#58
0
 /// <summary>
 /// Вызывает делегат Отрисовки кадра Контрола
 /// Внимание! Переопределив его, вы должны реализовать отрисовку внутрених Контролов самостоятельно.
 /// Что бы заставить рисоваться контролов нужно вызвать метод: InvokePaint();
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnPaint(TickEventArgs e)
 {
     Paint?.Invoke(this, e);
     for (int i = 0; i < Controls.Count; i++) Controls[i].Draw(e.GameTime);
 }
示例#59
0
 /// <summary>
 /// Вызывает делегат Обновления кадра Контрола
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnInvalidate(TickEventArgs e)
 {
     Invalidate?.Invoke(this, e);
 }