Beispiel #1
0
        private void Update()
        {
            if (mEnabled)
            {
                mCycleTimer.Update();
                this.transform.localEulerAngles = Vector3.Lerp(mStartAngle, this.TargetAngle, mCycleTimer.TimeElapsedNormalized);

                if (mCycleTimer.TimeReached)
                {
                    if (mCurrentLoop > 0)
                    {
                        // Still some loops left
                        mCurrentLoop--;
                        mCycleTimer.Start(this.CycleLengthSeconds);
                        this.transform.localEulerAngles = mStartAngle;
                    }
                    else if (mCurrentLoop == 0)
                    {
                        mEnabled = false;
                    }
                    else
                    {
                        // Otherwise, less-than-zero is infinite loop; just reset the angle
                        this.transform.localEulerAngles = mStartAngle;
                        mCycleTimer.Start(this.CycleLengthSeconds);
                    }
                }
            }
        }
Beispiel #2
0
 public override void Activate(object source, CogData data)
 {
     this.transform.localScale = this.DeactivatedScale;
     mInitialScale             = this.DeactivatedScale;
     mTargetScale  = this.ActivatedScale;
     mInitialColor = this.DeactivatedColor;
     mTargetColor  = this.ActivatedColor;
     mTimer.Start(this.DurationSeconds);
 }
Beispiel #3
0
 private void Start()
 {
     if (this.TimeToLiveSeconds > 0)
     {
         mStillAlive = true;
         mTimer.Start(this.TimeToLiveSeconds);
     }
     else
     {
         mStillAlive = false;
         mTimer.Start(this.DeathDuration);
     }
 }
Beispiel #4
0
 public override void Activate(object sender, CogData data)
 {
     if (this.TimeToLiveSeconds > 0)
     {
         mStillAlive = true;
         mTimer.Start(this.TimeToLiveSeconds);
     }
     else
     {
         mStillAlive = false;
         mTimer.Start(this.DeathDuration);
     }
 }
 private void Start()
 {
     if (this.PreChangeSeconds > 0)
     {
         mStillAlive = true;
         mTimer.Start(this.PreChangeSeconds);
     }
     else
     {
         mStillAlive = false;
         mTimer.Start(this.ChangeDurationSeconds);
     }
 }
Beispiel #6
0
        //Point last = new Point();

        private void DrawForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                UpdateTimer.Start();
                DrawTimer.Start();
                lasttime = DateTime.Now;
            }
            if (e.KeyCode == Keys.C)
            {
                UpdateTimer.Stop();
                DrawTimer.Stop();
            }
            if (e.KeyCode == Keys.D)
            {
                //camera.View = camera.View * Matrix4.Translate(0f, coeff, 0f);
                rocket.Move(new Vector3(rocket.Position.X + 10 * coeff, rocket.Position.Y, rocket.Position.Z));
            }
            if (e.KeyCode == Keys.A)
            {
                rocket.Move(new Vector3(rocket.Position.X - 10 * coeff, rocket.Position.Y, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, -coeff, 0f);
            }
            if (e.KeyCode == Keys.W)
            {
                rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y - 10 * coeff, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, 0f, coeff);
            }
            if (e.KeyCode == Keys.S)
            {
                rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y + 10 * coeff, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, 0f, -coeff);
            }
        }
        private void DialogWhitecap_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                UpdateTimer.Stop();
                InitBoard();
                UpdateTimer.Start();
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                UpdateTimer.Stop();

                try
                {
                    imagebuf.Save(string.Format("SS@{0}.png", DateTimeHelper.GetTimeStamp()), ImageFormat.Png);
                }
                catch (Exception)
                {
                    System.Media.SystemSounds.Exclamation.Play();
                }
                finally
                {
                    UpdateTimer.Start();
                }
            }
        }
Beispiel #8
0
        public void Cast(Vector2 position, Vector2 endPosition, AttackableUnit target, AttackableUnit autoAttackTarget = null)
        {
            if (State == SpellStateEnum.STATE_READY)
            {
                if (Script != null)
                {
                    if (this.autoAttackTarget != null)
                    {
                        throw new Exception("wtf?");
                    }
                    this.autoAttackTarget = autoAttackTarget;
                    castPosition          = position;
                    this.target           = target;
                    castEndPosition       = endPosition;
                    var castTime = Record.GetCastTime();

                    if (castTime == 0)
                    {
                        OnChannelOver();
                    }
                    else
                    {
                        ChannelTimer = new UpdateTimer((long)(castTime * 1000));
                        ChannelTimer.Start();
                        State = SpellStateEnum.STATE_CHANNELING;
                    }
                    Script.OnStartCasting(position, endPosition, target);
                }
                else
                {
                    logger.Write("No script for spell:" + Record.Name, MessageState.WARNING);
                }
            }
        }
Beispiel #9
0
        private void StartUpdateTimer()
        {
            return; // dummying out

            CommonLog("Starting update timer");
            UpdateTimer.Start();
        }
    public void SetCameraMovementSettings(CameraMovementSettings cameraMovementSettings)
    {
        _cameraMovementSettings = cameraMovementSettings;

        this.cameraOffset = new Vector3(_cameraMovementSettings.offset.x, _cameraMovementSettings.offset.y, this.cameraOffset.z);

        float targetOrthographicSize = (targetScreenSize.y * .5f) / _cameraMovementSettings.zoomSettings.zoomPercentage;

        if (!Mathf.Approximately(Camera.main.orthographicSize, targetOrthographicSize))
        {
            Logger.Info("Start zoom to target size: " + targetOrthographicSize + ", current size: " + Camera.main.orthographicSize);
            if (_cameraMovementSettings.zoomSettings.zoomTime == 0f)
            {
                Camera.main.orthographicSize = targetOrthographicSize;
            }
            else
            {
                _zoomTimer = new ZoomTimer(_cameraMovementSettings.zoomSettings.zoomTime, Camera.main.orthographicSize, targetOrthographicSize, _cameraMovementSettings.zoomSettings.zoomEasingType);
                _zoomTimer.Start();
            }
        }

        Logger.Info("Camera movement set to: " + _cameraMovementSettings.ToString());
        Logger.Info("Camera size; current: " + Camera.main.orthographicSize + ", target: " + targetOrthographicSize);
    }
Beispiel #11
0
        private void OnChannelOver()
        {
            Script.OnFinishCasting(castPosition, castEndPosition, target);
            ChannelTimer = null;

            if (GetTotalCooldown() > 0f)
            {
                CooldownTimer = new UpdateTimer(GetTotalCooldown() * 1000f);
                CooldownTimer.Start();
                State = SpellStateEnum.STATE_COOLDOWN;
            }
            else
            {
                State = SpellStateEnum.STATE_READY;
            }

            castPosition    = new Vector2();
            castEndPosition = new Vector2();
            target          = null;

            if (onChannelOverAction != null)
            {
                onChannelOverAction();
                onChannelOverAction = null;
            }
        }
Beispiel #12
0
 //Method for initialization of states of app
 private void BatteryLoad(object sender, EventArgs e)
 {
     //Getting the state of time of the battery
     _manager.Init();
     if (_manager.Charging == "Online")
     {
         timeoutBox.Enabled = false;
     }
     UpdateBattery(null, null);
     //Setting the event of timer
     UpdateTimer.Tick    += UpdateBattery;
     UpdateTimer.Interval = 2000;
     UpdateTimer.Start();
     if (_manager.PreviousScreenTime > 300)
     {
         _manager.PreviousScreenTime = 300;
     }
     if (_manager.PreviousScreenTime == 0)
     {
         _manager.PreviousScreenTime = 1;
     }
     timeoutBox.SelectedIndex = timeoutBox.FindString(_manager.PreviousScreenTime.ToString());
     timeoutSeconds.Text      = (Int32.Parse(_manager.PreviousScreenTime.ToString()) * 60).ToString();
     timeoutLabel.Text        = "Время отключения дисплея " + timeoutBox.SelectedItem.ToString() + " минут.";
 }
Beispiel #13
0
 private void _UpdateTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         // Redraw and continue the timer if we're visible, enabled and not in DesignMode
         // The timer is also disabled here because the Timer component seems to have an error (it will crashafter a while!?). Restarting the timer is a workaround.
         UpdateTimer.Stop();
         if (IsEnabled)
         {
             if (_LastPosition == Cursor.Position)
             {
                 // Refresh only if the position has changed
                 return;
             }
             // Remember the current cursor position
             _LastPosition = Cursor.Position;
             // Repaint everything
             Invalidate();
             // Release the event after the display has been updated
             OnDisplayUpdated();
         }
     }
     finally
     {
         // Restart the timer
         UpdateTimer.Start();
     }
 }
    public void SpawnNumber(int number, Color c)
    {
        GameObject damageNumber = pool.GetObject();

        ((RectTransform)damageNumber.transform).anchoredPosition = new Vector2(0, 0);
        TextMeshProUGUI tmpugui = damageNumber.GetComponent <TextMeshProUGUI>();

        tmpugui.SetText(number.ToString());
        tmpugui.faceColor = c;

        Color outline = Color.black;

        UpdateTimer ut = timers.Get();

        ut.Start(2,
                 () => { // finish
            pool.Return(damageNumber);
            timers.Return(ut);
        },
                 (percentComplete) => { // update
            c.a = 1 - percentComplete;
            tmpugui.faceColor    = c;
            outline.a            = c.a;
            tmpugui.outlineColor = outline;
        });
    }
Beispiel #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SplashScreen()
 {
     InitializeComponent();
     this.Opacity         = 0.0;
     UpdateTimer.Interval = TIMER_INTERVAL;
     UpdateTimer.Start();
 }
Beispiel #16
0
        /// <summary>
        /// Instance of the magnifying glass
        /// </summary>
        /// <param name="movingGlass">Create a moving glass if the user clicks on this one?</param>
        public MagnifyingGlass(bool movingGlass)
        {
            if (movingGlass)
            {
                // Moving glass is enabled
                _MovingGlass = new MovingMagnifyingGlass();
                MovingGlass.MagnifyingGlass.ShowPosition    = false;
                MovingGlass.MagnifyingGlass.DisplayUpdated += new DisplayUpdatedDelegate(MagnifyingGlass_DisplayUpdated);
                MovingGlass.MagnifyingGlass.Click          += new EventHandler(_MovingGlass_Click);
                MouseWheel    += new MouseEventHandler(MagnifyingGlass_MouseWheel);
                Cursor         = Cursors.SizeAll;
                UseMovingGlass = true;
            }

            #region Timer

            if (!DesignMode)
            {
                UpdateTimer.Enabled  = false;
                UpdateTimer.Tick    += UpdateTimer_Tick;
                UpdateTimer.Interval = 1;
                UpdateTimer.Start();
            }

            #endregion

            Click += new System.EventHandler(MagnifyingGlass_Click);
            CalculateSize();

            IncludeInConstructor();
        }
Beispiel #17
0
        // Starts everything here
        private void canvas_Paint(object sender, PaintEventArgs e)
        {
            // So the program doesnt start more than once
            if (gEngine == null && game == null)
            {
                // Starts graphics
                gEngine = new GEngine()
                {
                    g = canvas.CreateGraphics(), main = this
                };

                // Starts game
                game = new Game()
                {
                    gEngine = gEngine, main = this
                };

                // Gives game to gEngine
                gEngine.game = game;

                // Starts everything
                gEngine.Init();
                game.Init();

                // Starts updating game
                UpdateTimer.Start();
            }
        }
        public async void OnApplicationStart()
        {
            // Harmony
            Harmony = new HarmonyLib.Harmony(HarmonyId);
            Harmony.PatchAll(Assembly.GetExecutingAssembly());

            // Assets
            Sprites.Initialize();

            // HTTP client
            HttpClient = new HttpClient();
            HttpClient.DefaultRequestHeaders.Add("User-Agent", Plugin.UserAgent);
            HttpClient.DefaultRequestHeaders.Add("X-BSSB", "✔");

            // BS Events
            BSEvents.lateMenuSceneLoadedFresh += OnLateMenuSceneLoadedFresh;

            // Start update timer
            UpdateTimer.Start();

            // Detect platform
            // Note - currently (will be fixed in BS utils soon!): if the health warning is skipped (like in fpfc mode),
            //  this await will hang until a song is played, so the platform will be stuck on "unknown" til then
            await DetectPlatform();
        }
Beispiel #19
0
    void OnCameraMovementSettingsChanged()
    {
        CameraOffset = new Vector3(
            _cameraMovementSettingsManager.ActiveSettings.Offset.x,
            _cameraMovementSettingsManager.ActiveSettings.Offset.y,
            CameraOffset.z);

        var targetOrthographicSize = (TargetScreenSize.y * .5f) / _cameraMovementSettingsManager.ActiveSettings.ZoomSettings.ZoomPercentage;

        if (!Mathf.Approximately(Camera.main.orthographicSize, targetOrthographicSize))
        {
            Logger.Info("Start zoom to target size: " + targetOrthographicSize + ", current size: " + Camera.main.orthographicSize);

            if (_cameraMovementSettingsManager.ActiveSettings.ZoomSettings.ZoomTime == 0f)
            {
                Camera.main.orthographicSize = targetOrthographicSize;
            }
            else
            {
                _zoomTimer = new ZoomTimer(_cameraMovementSettingsManager.ActiveSettings.ZoomSettings.ZoomTime, Camera.main.orthographicSize, targetOrthographicSize, _cameraMovementSettingsManager.ActiveSettings.ZoomSettings.ZoomEasingType);

                _zoomTimer.Start();
            }
        }

        Logger.Info("Camera movement set to: " + _cameraMovementSettingsManager.ActiveSettings.ToString());

        Logger.Info("Camera size; current: " + Camera.main.orthographicSize + ", target: " + targetOrthographicSize);
    }
Beispiel #20
0
        public MainUi()
        {
            InitializeComponent();
            _alarmsList = new List <Alarm>();

            //Stops the panel flickering - Credit: https://stackoverflow.com/questions/8046560/how-to-stop-flickering-c-sharp-winforms
            typeof(Panel).InvokeMember("DoubleBuffered",
                                       BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                                       null, MainPanel, new object[] { true });

            try
            {
                var config       = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var alarmStrings = config.AppSettings.Settings["Alarms"].Value.Split(';');
                foreach (var alarmString in alarmStrings)
                {
                    if (!string.IsNullOrWhiteSpace(alarmString))
                    {
                        var a = Alarm.Parse(alarmString);
                        _alarmsList.Add(a);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(@"Error loading alarms from file");
            }
            UpdateTimer.Interval = 50;
            MainPanel.BackColor  = Color.FromArgb(255, 0, 0);


            UpdateAlarmsList();
            UpdateTimer.Start();
        }
 public SplashScreen()
 {
     InitializeComponent();
     UpdateTimer.Interval = 50;
     UpdateTimer.Start();
     IsOpen = true;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public SplashScreen()
 {
     InitializeComponent();
     this.Opacity         = 0.0;
     UpdateTimer.Interval = TIMER_INTERVAL;
     UpdateTimer.Start();
     this.ClientSize = this.BackgroundImage.Size;
 }
Beispiel #23
0
 void ConnectButton_Click(object sender, EventArgs e)
 {
     SerialNumberTextBox.Enabled = false;
     Log("Connecting...");
     UpdateTimer.Start();
     StopConnectingButton.Enabled = true;
     ConnectButton.Enabled        = false;
 }
Beispiel #24
0
        public Spectrograph()
        {
            InitializeComponent();

            _soundIn = new WasapiLoopbackCapture();
            _soundIn.Initialize();

            var soundInSource = new SoundInSource(_soundIn);
            var singleBlockNotificationStream = new SingleBlockNotificationStream(soundInSource);

            _source = singleBlockNotificationStream.ToWaveSource();

            if (!Directory.Exists(_loopbackDir))
            {
                Directory.CreateDirectory(_loopbackDir);
            }

            _writer = new WaveWriter(_loopbackDir + "/loopback.wav", _source.WaveFormat);

            byte[] buffer = new byte[_source.WaveFormat.BytesPerSecond / 2];
            soundInSource.DataAvailable += (s, e) =>
            {
                int read;
                while ((read = _source.Read(buffer, 0, buffer.Length)) > 0)
                {
                    _writer.Write(buffer, 0, read);
                }
            };

            _lineSpectrumProvider = new BasicSpectrumProvider(_source.WaveFormat.Channels, _source.WaveFormat.SampleRate, fftSize);
            _spectrogramProvider  = new BasicSpectrumProvider(_source.WaveFormat.Channels, _source.WaveFormat.SampleRate, fftSize);

            singleBlockNotificationStream.SingleBlockRead += SingleBlockNotificationStream_SingleBlockRead;
            _soundIn.Start();

            _lineSpectrum = new LineSpectrum(fftSize)
            {
                SpectrumProvider = _lineSpectrumProvider,
                UseAverage       = true,
                BarCount         = 22,
                BarSpacing       = 1,
                IsXLogScale      = true,
                ScalingStrategy  = ScalingStrategy.Sqrt
            };
            _oscilloscope = new Oscilloscope();
            _spectrogram  = new Spectrogram(fftSize)
            {
                SpectrumProvider = _spectrogramProvider,
                UseAverage       = true,
                BarCount         = (int)fftSize,
                BarSpacing       = 0,
                IsXLogScale      = true,
                ScalingStrategy  = ScalingStrategy.Sqrt
            };
            _keyboardVisualizer = new KeyboardVisualizer();

            UpdateTimer.Start();
        }
Beispiel #25
0
        private void BatteryLoad(object sender, EventArgs e)
        {
            _batteryManager.Init();
            UpdateBattery(null, null);

            UpdateTimer.Tick    += UpdateBattery;
            UpdateTimer.Interval = 2000;
            UpdateTimer.Start();
        }
Beispiel #26
0
        public LoadingForm()
        {
            InitializeComponent();
            this.ClientSize = this.BackgroundImage.Size;

            this.Opacity         = .0;
            UpdateTimer.Interval = TIMER_INTERVAL;
            UpdateTimer.Start();
        }
Beispiel #27
0
        private void Start()
        {
            mEnabled     = true;
            mCurrentLoop = this.LoopCount;
            mCycleTimer  = new UpdateTimer(Common.TimeScale.Scaled);
            mStartAngle  = this.transform.localEulerAngles;

            mCycleTimer.Start(this.CycleLengthSeconds);
        }
Beispiel #28
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SplashScreen(string title, string remark)
 {
     InitializeComponent();
     this.title.Text      = title;
     this.remark.Text     = remark;
     this.Opacity         = 0.0;
     UpdateTimer.Interval = TIMER_INTERVAL;
     UpdateTimer.Start();
     SplashScreenXMLStorage.ms_StoredValues = title + ".xml";
 }
 /// <summary>
 /// Handles a scan starting.
 /// </summary>
 void state_ScanStarted(object sender, EventArgs ea)
 {
     _scanning = true;
     try {
         this.Invoke(new Action(() => {
             SetScanButtonScanning();
             UpdateTimer.Start();
         }));
     } catch (InvalidOperationException exc) { Console.WriteLine(exc); }
 }
Beispiel #30
0
        private void einstellungenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Settings settings = new Settings();

            if (settings.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
            {
                UpdateTimer.Interval = RBTVSendeplanCS.Properties.Settings.Default.UpdateInterval * 1000 * 60;
                UpdateTimer.Start();
            }
        }