// Tick Event handler for the Timer control. Handle fade in and fade out and paint progress bar. private void UpdateTimer_Tick(object sender, System.EventArgs e) { lblStatus.Text = m_sStatus; // Calculate opacity if (m_dblOpacityIncrement > 0) // Starting up splash screen { m_iActualTicks++; if (this.Opacity < 1) { this.Opacity += m_dblOpacityIncrement; } } else // Closing down splash screen { if (this.Opacity > 0) { this.Opacity += m_dblOpacityIncrement; } else { StoreIncrements(); UpdateTimer.Stop(); this.Close(); } } }
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; }); }
/// <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(); }
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(); }
//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() + " минут."; }
public FloatingLayoutContainer(UpdateTimer mainTimer, LayoutContainer childLayout, float animationDuration, AnimationCompletedDelegate animationComplete) { this.mainTimer = mainTimer; this.childLayout = childLayout; this.animationDuration = animationDuration; this.animationComplete = animationComplete; }
// 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 void Dispose() { if (MouseInput != null) { MouseInput.LeftButtonDown -= new MouseInput.MouseHookCallback(OnLeftMouseDown); MouseInput.Uninstall(); } if (procDelegate != null) { UnsetHooks(); } if (UpdateTimer != null || SnapTimer != null) { UpdateTimer.Stop(); UpdateTimer.Dispose(); SnapTimer.Stop(); SnapTimer.Dispose(); } if (CurrentLog != null) { //Write Log to File on Exit? CurrentLog.LogEntries.Clear(); } }
public TransformedBulletScene(TransformedBulletSceneDefinition definition, UpdateTimer timer) : base(definition, timer) { transformSimObjectName = definition.TransformSimObjectName; positionBroadcasterName = definition.PositionBroadcasterName; factory.OnLinkPhase += factory_OnLinkPhase; }
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(); } } }
public void Dispose() { Stop(); ObservedProcess.ProcessOpened -= ObservedProcess_ProcessOpened; ObservedProcess.ProcessExited -= ObservedProcess_ProcessExited; UpdateTimer.Dispose(); }
private void UpdateTimer_Tick(Object sender, EventArgs e) { Int32 delay; do { if (!_actionEnumerator.MoveNext() || !_rover.Perform(_actionEnumerator.Current, out Update update)) { UpdateTimer.Stop(); UpdateStats(); Render(); beginRender.Enabled = true; _actionEnumerator.Dispose(); return; } _stats = _stats.Add(_actionEnumerator.Current, update); _state.Apply(update); delay = _actionEnumerator.Current.Instruction switch { Instruction.Move => 75, Instruction.CollectSample => 50, _ => 0 }; }while (delay == 0); UpdateTimer.Interval = delay; UpdateStats(); Render(); }
private void UpdateTimer_Tick(object sender, EventArgs e) { if (panel2.Width <= 100) { panel2.Width += 3; } else if (panel2.Width <= 200) { panel2.Width += 15; } else if (panel2.Width <= 400) { panel2.Width += 8; } else if (panel2.Width < 600) { panel2.Width += 20; } else if (panel2.Width >= 600) { UpdateTimer.Stop(); h = 1; opener(); } }
/// <summary> /// Constructor /// </summary> public SplashScreen() { InitializeComponent(); this.Opacity = 0.0; UpdateTimer.Interval = TIMER_INTERVAL; UpdateTimer.Start(); }
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 OnPositionUpdated(GameClient client, Position oldPosition, Position newPosition) { if (Timer == null) { Timer = new UpdateTimer(TimeSpan.FromMilliseconds(1)); } Timer.Reset(); //lets time movement speed. if (timer.ElapsedMilliseconds > 0) { MovementSpeed = (int)timer.ElapsedMilliseconds; } Console.WriteLine("Entity Moved {0},{1} -> {2},{3}", oldPosition.X, oldPosition.Y, newPosition.X, newPosition.Y); timer.Restart(); client.FieldMap.SetPassable(oldPosition); client.FieldMap.SetWall(newPosition); UpdatePath(client); }
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); }
//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); } }
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(); }
private void ImplementUpdate(DwarfTime gameTime, ChunkManager chunks) { UpdateTimer.Update(gameTime); if (UpdateTimer.HasTriggered) { GameComponent p = (GameComponent)Parent; var voxelBelow = new VoxelHandle(chunks, GlobalVoxelCoordinate.FromVector3(p.GlobalTransform.Translation + Vector3.Down * 0.25f)); if (voxelBelow.IsValid) { var shadowTarget = VoxelHelpers.FindFirstVoxelBelow(voxelBelow); if (shadowTarget.IsValid) { var h = shadowTarget.Coordinate.Y + 1; Vector3 pos = p.GlobalTransform.Translation; pos.Y = h; float scaleFactor = GlobalScale / (Math.Max((p.GlobalTransform.Translation.Y - h) * 0.25f, 1)); Matrix newTrans = OriginalTransform; newTrans *= Matrix.CreateScale(scaleFactor); newTrans.Translation = (pos - p.GlobalTransform.Translation) + new Vector3(0.0f, 0.1f, 0.0f); LightRamp = new Color(LightRamp.R, LightRamp.G, LightRamp.B, (int)(scaleFactor * 255)); Matrix globalRotation = p.GlobalTransform; globalRotation.Translation = Vector3.Zero; LocalTransform = newTrans * Matrix.Invert(globalRotation); } } UpdateTimer.HasTriggered = false; } }
public SplashScreen() { InitializeComponent(); UpdateTimer.Interval = 50; UpdateTimer.Start(); IsOpen = true; }
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); } } }
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; } }
public override bool OnInit() { coreConfig = new CoreConfig(startup.Name); //Create the log. logListener = new LogFileListener(); logListener.openLogFile(CoreConfig.LogFile); Log.Default.addLogListener(logListener); Log.ImportantInfo("Running from directory {0}", FolderFinder.ExecutableFolder); startup.ConfigureServices(services); BuildPluginManager(); //Create containers var scope = this.pluginManager.GlobalScope; //Build engine var pluginManager = scope.ServiceProvider.GetRequiredService <PluginManager>(); mainTimer = scope.ServiceProvider.GetRequiredService <UpdateTimer>(); var frameClearManager = scope.ServiceProvider.GetRequiredService <FrameClearManager>(); PerformanceMonitor.setupEnabledState(scope.ServiceProvider.GetRequiredService <SystemTimer>()); MyGUIInterface.Instance.CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true); MyGUIInterface.Instance.CommonResourceGroup.addResource(startup.GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true); startup.Initialized(this, pluginManager); if (Initialized != null) { Initialized.Invoke(this); } return(true); }
char oper; // Laskutoimitus valikoimasta + - * / void Start() { updTime = GameObject.Find("Timer Text").GetComponent <UpdateTimer> (); // Arvotaan numerot ja käynnistetään kello shuffle(); updTime.startTimer(period); }
private void UpdateTimer_Tick(object sender, EventArgs e) { try { statements = BL.ApplicationDataContext.Instance.Service.ProcessStatementsUpdate(); pbcPrint.Properties.Maximum = Statements.Count(n => n.ShouldPrint); pbcEmail.Properties.Maximum = Statements.Count(n => n.ShouldEmail); if (BindingSource.DataSource == null) { UpdateTimer.Stop(); Essential.BaseAlert.ShowAlert("Processing statements", "Statements processing complete.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Information); this.Close(); } else { lblPrintProgress.Text = string.Format("Printed {0} of {1}", Statements.Count(n => n.HasPrinted.HasValue), Statements.Count(n => n.ShouldPrint)); pbcPrint.EditValue = Statements.Count(n => n.HasPrinted.HasValue); lblEmailProgress.Text = string.Format("Mailed {0} of {1}", Statements.Count(n => n.HasMailed.HasValue), Statements.Count(n => n.ShouldEmail)); pbcEmail.EditValue = Statements.Count(n => n.HasMailed.HasValue); BindingSource.DataSource = statements; grdProgress.RefreshDataSource(); } } catch { UpdateTimer.Stop(); this.Close(); } }
public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { UpdateTimer.Update(gameTime); if (HasMoved && UpdateTimer.HasTriggered) { Body p = (Body)Parent; VoxelChunk chunk = chunks.ChunkData.GetVoxelChunkAtWorldLocation(p.GlobalTransform.Translation); if (chunk != null) { Vector3 g = chunk.WorldToGrid(p.GlobalTransform.Translation + Vector3.Down * 0.25f); int h = chunk.GetFilledVoxelGridHeightAt((int)g.X, (int)g.Y, (int)g.Z); if (h != -1) { Vector3 pos = p.GlobalTransform.Translation; pos.Y = h; pos += VertexNoise.GetNoiseVectorFromRepeatingTexture(pos + Vector3.Down * 0.25f); float scaleFactor = GlobalScale / (Math.Max((p.GlobalTransform.Translation.Y - h) * 0.25f, 1)); Matrix newTrans = OriginalTransform; newTrans *= Matrix.CreateScale(scaleFactor); newTrans.Translation = (pos - p.GlobalTransform.Translation) + new Vector3(0.0f, 0.1f, 0.0f); Tint = new Color(Tint.R, Tint.G, Tint.B, (int)(scaleFactor * 255)); LocalTransform = newTrans; } } UpdateTimer.HasTriggered = false; } base.Update(gameTime, chunks, camera); }
private void DialogWhitecap_DoubleClick(object sender, EventArgs e) { UpdateTimer.Stop(); colortheme = rand.Next(64); //colortheme = 21; Start(); }
private void StartUpdateTimer() { return; // dummying out CommonLog("Starting update timer"); UpdateTimer.Start(); }
public GameStateEngine(GameClient client) { Timer = new UpdateTimer(TimeSpan.FromMilliseconds(1)); _client = client; States = new List <GameState>(); States.Sort(); }