public void Add() { m_Clocks.Add( this ); if ( m_Timer == null ) { m_Timer = new ClockTimer(); m_Timer.Start(); } }
public override IEnumerator NpcEnter() { Vector3 offset = new Vector3(Random.Range(-0.9f, 0.9f), 0, Random.Range(-0.1f, 0.1f)); float timeOffset = Random.Range(0, travelSecondsRandomMax) + extraTravelSecondsPerDifficultyLevel * LevelManager.Instance.settings.difficultyLevel; transform.position = LevelManager.Instance.startPosition.position; yield return(MoveUtil.MoveOverSeconds(transform.gameObject, LevelManager.Instance.orderPosition.position + offset, travelSeconds + timeOffset)); ClockTimer clock = (ClockTimer)Instantiate(clockPrefab, transform); clock.transform.localPosition = new Vector3(0, 0.6f, 0); clock.name = "clock"; clock.restart = false; clock.secondsToRun = failureSeconds + failureSecondsPerDifficultyLevel * LevelManager.Instance.settings.difficultyLevel; clock.ResetClock(); }
private void Play(GameMode mode) { Game = PoolGameFactory.Create(mode); Game.transform.parent = transform; // başka oyuncular da eklenebilir. var playerData = new PlayerDataContext("aliozer") { Name = "Ali" }; UIManager.AddPlayer(playerData); Game.AddPlayer(playerData); playerData = new PlayerDataContext("ezgi") { Name = "Ezgi", CuePrefabName = "BlueCue" }; UIManager.AddPlayer(playerData); Game.AddPlayer(playerData); foreach (var player in Game.GetPlayers()) { player.BallHit += Player_BallHit; player.ShotStarted += Player_ShotStarted; } Game.AddFinishingRule(new TotalPointFinishingRule(Game.GetPlayers(), 5)); // aşağıdaki gibi başka bitirme kuralları da eklenebilir. // Game.AddFinishingRule(new PlayerFirstMaxPointFinishingRule(CurrentGame.GetPlayers(), 25)); Game.ShotCompleted += Game_ShotCompleted; Game.Completed += Game_Completed; Game.Started += Game_Started; Game.ChangePlayer += Game_ChangePlayer; Game.Play(); ClockTimer.StartTime(); UIManager.GamePlayingState(); }
/* * the function below check the internet connection and update realtime database */ private void timer1_Tick(object sender, EventArgs e) { if (Sec % 15 == 0) { bool connection = NetworkInterface.GetIsNetworkAvailable(); if (connection == true) { ConnectionLable.Text = "Connected"; } else { ConnectionLable.Text = "Connection Lost"; } ConnectionLable.Refresh(); } if (Sec > 0) { Sec--; } else { if (Sec == 0 && Min == 0) { done = true; Sec = 59; Min = 14; } else { Min--; Sec = 59; } } ClockTimer.Text = Min.ToString("00") + ":" + Sec.ToString("00"); ClockTimer.Refresh(); if (done) { done = false; myfunction(); } }
private void LoadEnv() { _packedEnv = Instantiate(envPrefabs[PresentationData.in_EnvType]); inputManager.player = _packedEnv.transform.GetComponentInChildren <SlidesPlayer>(); inputManager.OnPracticeEnd += EndPractice; inputManager.OnExitVRScene += ExitEnv; timer = _packedEnv.transform.GetComponentInChildren <ClockTimer>(); timer.SetMaxTime((int)PresentationData.in_ExpectedTime); crowdSim.crowdConfigFileName = EnvInfoDict[PresentationData.in_EnvType].crowdConfigPath; crowdSim.crowdParent = _packedEnv.transform.Find("CrowdParentTransform"); recordWrapper.debugText = _packedEnv.transform.Find("RecordDebugText").GetComponent <TextMesh>(); slidesPlayer = _packedEnv.transform.GetComponentInChildren <SlidesPlayer>(); audioManager.room = _packedEnv.transform.GetComponentInChildren <CardboardAudioRoom>(); audioManager.miscBound = _packedEnv.transform.GetComponentInChildren <AudioBound>(); //tutManager.slidePlayer = inputManager.GetComponent<SlidesPlayer>(); //tutManager.timerPlayer = env.transform.GetComponentInChildren<clockTimer>(); }
private async Task RunTest(int count) { var targetTime = TimeSpan.FromMilliseconds(12312456); targetTime = targetTime + TimeSpan.FromMinutes(count); using (ClockTimer.Pin(targetTime)) { Task <TimeSpan> task1 = this.DelayedNow(true); Task <TimeSpan> task2 = this.DelayedNow(false); Task <TimeSpan> task3 = this.DelayedNow(true); TimeSpan[] dates = await Task.WhenAll(task1, task2, task3); Assert.All(dates, x => { Assert.Equal(targetTime, x); }); } // we move away from the pinned after the using statement var timer = ClockTimer.StartNew(); timer.Stop(); var now = timer.Elapsed; Assert.NotEqual(targetTime, now); using (ClockTimer.Pin(targetTime)) { Task <TimeSpan> task1 = this.DelayedNow(true); Task <TimeSpan> task2 = this.DelayedNow(false); Task <TimeSpan> task3 = this.DelayedNow(true); TimeSpan[] dates = await Task.WhenAll(task1, task2, task3); Assert.All(dates, x => { Assert.Equal(targetTime, x); }); } }
private void PauseButton_Click(object sender, EventArgs e) { ClockTimer.Stop(); StartButton.Text = "Resume"; }
private void StartButton_Click(object sender, EventArgs e) { ClockTimer.Start(); StartButton.Text = "Start"; }
void CheckActivities() { foreach (var activity in allProcessingActivies) { switch (activity.Value.activityType) { case ActivityType.Quest: { GameObject ActivityTimerGO = new GameObject(activity.Value.activityID.ToString()); ActivityTimerGO.transform.SetParent(transform.Find("ActivitiesList")); ClockTimer questTimer = ActivityTimerGO.AddComponent <ClockTimer>(); questTimer.activityInformation = activity.Value; break; } case ActivityType.Craft: { GameObject ActivityTimerGO = new GameObject(activity.Value.activityID.ToString()); ActivityTimerGO.transform.SetParent(transform.Find("ActivitiesList")); PointTimer craftTimer = ActivityTimerGO.AddComponent <PointTimer>(); craftTimer.activityInformation = (activity.Value); break; } case ActivityType.Build: { Builder builder = BuildingManager.Instance.AllBuildings.SingleOrDefault(b => b.ID == activity.Value.informationID); BuildTimer buildTimer = builder.representGameObject.GetComponent <BuildTimer>(); if (buildTimer) { buildTimer.activityInformation = activity.Value; buildTimer.UpdateNewFinishTime(); } break; } case ActivityType.Pregnancy: { GameObject ActivityTimerGO = new GameObject(activity.Value.activityID.ToString()); ActivityTimerGO.transform.SetParent(NotificationManager.Instance.gameObject.transform.Find("ActivitiesList")); ClockTimer questTimer = ActivityTimerGO.AddComponent <ClockTimer>(); questTimer.activityInformation = activity.Value; break; } case ActivityType.CharacterGrowing: { GameObject ActivityTimerGO = new GameObject(activity.Value.activityID.ToString()); ActivityTimerGO.transform.SetParent(NotificationManager.Instance.gameObject.transform.Find("ActivitiesList")); ClockTimer questTimer = ActivityTimerGO.AddComponent <ClockTimer>(); questTimer.activityInformation = activity.Value; break; } default: { Debug.LogWarning($"{activity.Value.activityType} is currently unhandled."); break; } } } }
public void OnActivityFinished(ActivityInformation activityInformation) { switch (activityInformation.activityType) { case ActivityType.Quest: { /// Update in Notification Panel break; } case ActivityType.Craft: { Resource resource = LoadManager.Instance.allResourceData.SingleOrDefault(r => r.Value.ID == activityInformation.informationID).Value; ItemManager.Instance.AddResource(resource.Name, 1); PointTimer craftTimer = NotificationManager.Instance.gameObject.transform.Find("ActivitiesList/" + activityInformation.activityID).GetComponent <PointTimer>(); Destroy(craftTimer.gameObject); RemoveActivity(activityInformation); break; } case ActivityType.Build: { RemoveActivity(activityInformation); break; } case ActivityType.Pregnancy: { Character femaleCharacter = CharacterManager.Instance.AllCharacters.SingleOrDefault(c => c.ID == activityInformation.informationID); Character maleCharacter = CharacterManager.Instance.AllCharacters.SingleOrDefault(c => c.ID == activityInformation.informationID2); femaleCharacter.workStatus = Character.WorkStatus.Working; CharacterManager.Instance.CreateChildCharacter(maleCharacter, femaleCharacter); ClockTimer timer = NotificationManager.Instance.gameObject.transform.Find("ActivitiesList/" + activityInformation.activityID).GetComponent <ClockTimer>(); Destroy(timer.gameObject); RemoveActivity(activityInformation); break; } case ActivityType.CharacterGrowing: { ClockTimer timer = NotificationManager.Instance.gameObject.transform.Find("ActivitiesList/" + activityInformation.activityID).GetComponent <ClockTimer>(); Destroy(timer.gameObject); RemoveActivity(activityInformation); Character character = CharacterManager.Instance.AllCharacters.SingleOrDefault(c => c.ID == activityInformation.informationID); character.workStatus = Character.WorkStatus.Idle; break; } default: { Debug.LogWarning($"{activityInformation.activityType} is currently unhandled."); break; } } }
public Taskbar() { InitializeComponent(); Width = SystemParameters.PrimaryScreenWidth; Top = SystemParameters.PrimaryScreenHeight - Height; Left = 0; IsVisibleChanged += Taskbar_IsVisibleChanged; //Visibility = Visibility.Hidden; InitialPopulateTaskbar(); ClockTimer.Elapsed += delegate { Dispatcher.Invoke(new Action(() => { ClockTime.Content = DateTime.Now.ToShortTimeString(); ClockDate.Content = DateTime.Now.ToShortDateString(); })); }; ClockTimer.Start(); ProgramWindow.WindowOpened += InsertCreatedWindow; ProgramWindow.WindowClosed += RemoveClosedWindow; _activeWindowTimer.Elapsed += delegate { Dispatcher.Invoke(new Action(() => { var active = MiscTools.GetForegroundWindow(); foreach (TaskbarGroupStackPanel t in Taskband.Children) { try { if (t.ForceCombine | (Config.GroupingMode == TaskbarGroupingMode.Combine)) { var isAnythingActive = false; foreach (var b in t.ProgramWindowsList) { if (b.Hwnd == active) { isAnythingActive = true; } } if (isAnythingActive) { t.RunningBackgroundButton.IsActiveWindow = true; } else { t.RunningBackgroundButton.IsActiveWindow = false; } } else { foreach (TaskItemButton b in t.Buttons.Children) { if ((b.Tag as ProgramWindow).Hwnd == active) { b.IsActiveWindow = true; } else { b.IsActiveWindow = false; } } } } catch (Exception ex) { Debug.WriteLine(ex); } } })); }; _activeWindowTimer.Start(); Debug.WriteLine(MainTools.GetFixedModule("Test Module").ModuleName + " FOUND!"); }
/// <summary> /// Starts the timer on form load /// </summary> private void ClockForm_Load(object sender, EventArgs e) { ClockTimer.Start(); }
/// <summary> /// Loads the main GUI form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Form1_Load(object sender, EventArgs e) { ClockTimer.Start(); DateLabel.Text = DateTime.Now.ToLongDateString(); TimeLabel.Text = DateTime.Now.ToLongTimeString(); }
private void FrmMain_Load(object sender, EventArgs e) { ClockTimer.Start(); mainMenuStrip.BackColor = Color.FromArgb(64, 64, 64); mainMenuStrip.ForeColor = Color.White; }
public override void OnDelete() { base.OnDelete(); m_Clocks.Remove( this ); if ( m_Clocks.Count == 0 ) { m_Timer.Stop(); m_Timer = null; } }
private void Recorder_ReplayStarted() { ClockTimer.Pause(); }
private void UIManager_QuitClick() { ClockTimer.StopTime(); Stop(); }
public DigitalClock(ClockTimer subject) { this.subject = subject; this.subject.Attach(this); }
public void OnClockTimerElapsed(ClockTimer clock) { LevelManager.Instance.waveRules.EndLevel(); }
/// <summary> /// Unsubscribing from an event /// </summary> /// <param name="timer"></param> public void Unregister(ClockTimer timer) { timer.TimerEvent -= Message; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 800); this.Text = "Tạo hoá đơn mới"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.CustomerNameLabel.Location = new System.Drawing.Point(10, 10); this.CustomerNameLabel.Size = new System.Drawing.Size(100, 30); this.CustomerNameLabel.Text = "Tên khách hàng:"; this.CustomerNameLabel.Font = LabelFont; this.Controls.Add(this.CustomerNameLabel); this.CustomerName.Location = new System.Drawing.Point(120, 10); this.CustomerName.Size = new System.Drawing.Size(200, 30); this.CustomerName.PlaceholderText = "Nhập tên khách hàng"; this.CustomerName.TextChanged += new System.EventHandler(this.CustomerNameTextChanged); this.Controls.Add(this.CustomerName); this.IsWorkerLabel.Location = new System.Drawing.Point(325, 10); this.IsWorkerLabel.Size = new System.Drawing.Size(30, 30); this.IsWorkerLabel.Text = "Thợ"; this.IsWorkerLabel.Font = LabelFont; this.Controls.Add(this.IsWorkerLabel); this.IsWorker.Location = new System.Drawing.Point(360, 10); this.IsWorker.Size = new System.Drawing.Size(30, 30); this.IsWorker.Checked = true; this.Controls.Add(this.IsWorker); this.CustomerInformationLabel.Location = new System.Drawing.Point(10, 45); this.CustomerInformationLabel.Size = new System.Drawing.Size(100, 30); this.CustomerInformationLabel.Text = "Thông tin:"; this.CustomerInformationLabel.Font = LabelFont; this.Controls.Add(this.CustomerInformationLabel); this.CustomerInformation.Location = new System.Drawing.Point(120, 45); this.CustomerInformation.Size = new System.Drawing.Size(200, 30); this.CustomerInformation.PlaceholderText = "Nhập thông tin khách hàng"; this.Controls.Add(this.CustomerInformation); this.CustomerDebtLabel.Location = new System.Drawing.Point(850, 10); this.CustomerDebtLabel.Size = new System.Drawing.Size(200, 30); this.CustomerDebtLabel.Text = "Nợ khách hàng"; this.CustomerDebtLabel.Font = LabelFont; this.Controls.Add(this.CustomerDebtLabel); this.DebtDataView.Location = new System.Drawing.Point(850, 45); this.DebtDataView.Size = new System.Drawing.Size(400, 200); this.DebtDataView.AllowUserToAddRows = false; this.DebtDataView.RowHeadersVisible = false; this.Controls.Add(this.DebtDataView); this.CustomerHistoryLabel.Location = new System.Drawing.Point(850, 250); this.CustomerHistoryLabel.Size = new System.Drawing.Size(200, 30); this.CustomerHistoryLabel.Text = "Lịch sử mua hàng"; this.CustomerHistoryLabel.Font = LabelFont; this.Controls.Add(this.CustomerHistoryLabel); this.CustomerHistoryView.Location = new System.Drawing.Point(850, 285); this.CustomerHistoryView.Size = new System.Drawing.Size(500, 200); this.CustomerHistoryView.AllowUserToAddRows = false; this.CustomerHistoryView.RowHeadersVisible = false; this.CustomerHistoryView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.CustomerHistoryViewCellContentClick); this.Controls.Add(this.CustomerHistoryView); this.InvoicePreview.Location = new System.Drawing.Point(850, 490); this.InvoicePreview.Size = new System.Drawing.Size(800, 400); this.Controls.Add(this.InvoicePreview); this.MHLabel.Location = new System.Drawing.Point(10, 80); this.MHLabel.Size = new System.Drawing.Size(50, 30); this.MHLabel.Text = "MH:"; this.MHLabel.Font = LabelFont; this.Controls.Add(this.MHLabel); this.MH.Location = new System.Drawing.Point(65, 80); this.MH.Size = new System.Drawing.Size(150, 30); this.MH.PlaceholderText = "Nhập tên mặt hàng"; this.MH.TextChanged += new System.EventHandler(this.MHTextChanged); this.Controls.Add(this.MH); this.QuantityLabels.Location = new System.Drawing.Point(220, 80); this.QuantityLabels.Size = new System.Drawing.Size(30, 30); this.QuantityLabels.Text = "SL:"; this.QuantityLabels.Font = LabelFont; this.Controls.Add(this.QuantityLabels); this.Quantity.Location = new System.Drawing.Point(255, 80); this.Quantity.Size = new System.Drawing.Size(50, 30); this.Quantity.PlaceholderText = "Nhập SL"; this.Controls.Add(this.Quantity); this.UnitLabel.Location = new System.Drawing.Point(310, 80); this.UnitLabel.Size = new System.Drawing.Size(40, 30); this.UnitLabel.Text = "ĐVT:"; this.UnitLabel.Font = LabelFont; this.Controls.Add(this.UnitLabel); this.Unit.Location = new System.Drawing.Point(355, 80); this.Unit.Size = new System.Drawing.Size(60, 30); this.Unit.PlaceholderText = "Nhập ĐVT"; this.Controls.Add(this.Unit); this.UnitPriceLabel.Location = new System.Drawing.Point(420, 80); this.UnitPriceLabel.Size = new System.Drawing.Size(30, 30); this.UnitPriceLabel.Text = "ĐG:"; this.UnitPriceLabel.Font = LabelFont; this.Controls.Add(this.UnitPriceLabel); this.UnitPrice.Location = new System.Drawing.Point(455, 80); this.UnitPrice.Size = new System.Drawing.Size(100, 30); this.UnitPrice.PlaceholderText = "Nhập ĐG"; this.Controls.Add(this.UnitPrice); this.NoticeLabel.Location = new System.Drawing.Point(560, 80); this.NoticeLabel.Size = new System.Drawing.Size(60, 30); this.NoticeLabel.Text = "Ghi chú:"; this.NoticeLabel.Font = LabelFont; this.Controls.Add(this.NoticeLabel); this.Notice.Location = new System.Drawing.Point(625, 80); this.Notice.Size = new System.Drawing.Size(100, 30); this.Notice.PlaceholderText = "Nhập ghi chú"; this.Controls.Add(this.Notice); this.AddButton.Location = new System.Drawing.Point(730, 80); this.AddButton.Size = new System.Drawing.Size(50, 30); this.AddButton.Text = "Thêm"; this.AddButton.Click += new System.EventHandler(this.AddButtonClick); this.Controls.Add(AddButton); this.InvoiceDataView.Location = new System.Drawing.Point(10, 115); this.InvoiceDataView.Size = new System.Drawing.Size(800, 500); this.InvoiceDataView.Columns.Add("Index", "STT"); this.InvoiceDataView.Columns.Add("IdWareHouse", "IdWareHouse"); this.InvoiceDataView.Columns["IdWareHouse"].Visible = false; this.InvoiceDataView.Columns.Add("GoodsCode", "Tên MH"); this.InvoiceDataView.Columns.Add("Quantity", "Số lượng"); this.InvoiceDataView.Columns.Add("Unit", "ĐVT"); this.InvoiceDataView.Columns.Add("UnitPrice", "Đơn giá"); this.InvoiceDataView.Columns.Add("Notice", "Ghi chú"); this.InvoiceDataView.Columns.Add("TotalPrice", "Thành tiền"); this.InvoiceDataView.AllowUserToAddRows = false; this.InvoiceDataView.RowHeadersVisible = false; this.InvoiceDataView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.InvoiceDataViewDeleteButton); this.InvoiceDataView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.InvoiceDataViewCellValueChanged); this.Controls.Add(this.InvoiceDataView); this.DepositLabel.Location = new System.Drawing.Point(10, 620); this.DepositLabel.Size = new System.Drawing.Size(100, 30); this.DepositLabel.Text = "Trả trước:"; this.DepositLabel.Font = LabelFont; this.Controls.Add(this.DepositLabel); this.Deposit.Location = new System.Drawing.Point(115, 620); this.Deposit.Size = new System.Drawing.Size(100, 30); this.Deposit.Text = "0"; this.Controls.Add(this.Deposit); this.TotalCostInvoiceLabel.Location = new System.Drawing.Point(10, 655); this.TotalCostInvoiceLabel.Size = new System.Drawing.Size(100, 30); this.TotalCostInvoiceLabel.Text = "Tổng cộng đơn hàng:"; this.TotalCostInvoiceLabel.Font = LabelFont; this.Controls.Add(this.TotalCostInvoiceLabel); this.TotalCostInvoice.Location = new System.Drawing.Point(115, 655); this.TotalCostInvoice.Text = "0"; this.Controls.Add(this.TotalCostInvoice); this.TotalCostPlusDebtLabel.Location = new System.Drawing.Point(10, 690); this.TotalCostPlusDebtLabel.Size = new System.Drawing.Size(100, 30); this.TotalCostPlusDebtLabel.Text = "Tổng cộng đơn hàng + nợ:"; this.TotalCostPlusDebtLabel.Font = LabelFont; this.Controls.Add(this.TotalCostPlusDebtLabel); this.TotalCostPlusDebt.Location = new System.Drawing.Point(115, 690); this.TotalCostPlusDebt.Text = "0"; this.Controls.Add(this.TotalCostPlusDebt); this.SaveButton.Location = new System.Drawing.Point(300, 655); this.SaveButton.Size = new System.Drawing.Size(100, 30); this.SaveButton.Text = "Lưu và in"; this.SaveButton.Click += new System.EventHandler(this.SaveButtonClick); this.Controls.Add(this.SaveButton); this.ClockLabel.Location = new System.Drawing.Point(500, 10); this.ClockLabel.Size = new System.Drawing.Size(200, 60); this.ClockLabel.Text = System.DateTime.Now.ToString("HH:mm:ss"); this.ClockLabel.Font = ClockFont; this.Controls.Add(this.ClockLabel); ClockTimer.Interval = 1000; ClockTimer.Tick += new System.EventHandler(this.ResetClock); ClockTimer.Start(); }
public RadarSettingControl() { InitializeComponent(); ActHelper.Initialize(); clock = new ClockTimer(); }
internal Task Handle(ClockTimer clockTimer) { _clockState.StopTimer(); _clockState.SetTimer(clockTimer.Name, clockTimer.DurationSeconds); return(Task.CompletedTask); }
/// <summary> /// Initializes all members. /// </summary> private void InitMembers() { clockTimer = new ClockTimer(); clockTimer.ClockTimerElapsed += UpdateClockWindow; }