public static bool EyeProxyQuantumMoon_ChangeQuantumState(EyeProxyQuantumMoon __instance, ref bool __result, bool skipInstantVisibilityCheck) { if (!QSBWorldSync.AllObjectsReady) { return(true); } var qsbEyeProxyQuantumMoon = __instance.GetWorldObject <QSBEyeProxyQuantumMoon>(); if (TimeLoop.GetSecondsRemaining() > 0f && Random.value > 0.3f) { __instance._moonStateRoot.SetActive(false); qsbEyeProxyQuantumMoon.SendMessage(new EyeProxyMoonStateChangeMessage(false, -1f)); __result = true; return(false); } __instance._moonStateRoot.SetActive(true); for (var i = 0; i < 20; i++) { var angle = Random.Range(0f, 360f); __instance.transform.localEulerAngles = new Vector3(0f, angle, 0f); if (skipInstantVisibilityCheck || !__instance.CheckVisibilityInstantly()) { qsbEyeProxyQuantumMoon.SendMessage(new EyeProxyMoonStateChangeMessage(true, angle)); __result = true; return(false); } } __result = true; return(false); }
public MainWindow() { InitializeComponent(); myDelegate = new TimeLoop(updateData); string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { cmbPorts.Items.Add(port); } foreach (string delimiter in delimitmarkup) { cmbDelimiter.Items.Add(delimiter); } cmbDelimiter.SelectedIndex = 0; testdatalst = new List <double>(); stopwatch = new Stopwatch(); serialMonitor = new SerialPort(); serialMonitor.BaudRate = 9600; serialMonitor.Handshake = System.IO.Ports.Handshake.None; serialMonitor.Parity = Parity.None; serialMonitor.DataBits = 8; serialMonitor.StopBits = StopBits.One; serialMonitor.ReadTimeout = 200; serialMonitor.WriteTimeout = 50; _microStopwatch = new MicroLibrary.MicroStopwatch(); _microTimer = new MicroLibrary.MicroTimer(); }
private static void OnPlayerDeath(DeathType deathType) { var cc = Locator.GetPlayerController(); var boundSector = GetBoundSector(); var boundSectorName = boundSector.GetName(); var relativePos = boundSector.transform.InverseTransformPoint(cc.transform.position); tracking.TrackedDeaths.Add(new DeathTracking.Death { ProfileName = ActiveProfile, SectorName = boundSectorName, DeathType = deathType, LoopCount = TimeLoop.GetLoopCount(), SecondsElapsed = TimeLoop.GetSecondsElapsed(), PositionX = relativePos.x, PositionY = relativePos.y, PositionZ = relativePos.z }); Debug.Log($"Death: {boundSectorName}"); }
public void Start() { try { int loopTime = 0; if (!int.TryParse(loopInterval, out loopTime)) { WriteLog.Write("数据统计服务:运行间隔时间获取失败,请检查是否配置了‘StatisticsServiceInterval’项"); } if (!DateTime.TryParse(staticticsTime, out runTime)) { WriteLog.Write("数据统计服务:运行间隔时间获取失败,请检查是否配置了‘StatisticsServiceRunTime’项"); } enterOutLogStatictics = new Code.EnterOutLogStatistics(); roomFlowStatictics = new Code.RoomFlowStatistics(); roomUsageStatictics = new Code.RoomUsageStatistics(); terminalFlowStatistics = new Code.TerminalFlowStatistics(); terminalUsageStatictics = new Code.TerminalUsageStatistics(); advertUsageStatistics = new Code.AdvertUsageStatistics(); //时间循环启动 timeLoop = new TimeLoop(loopTime); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); } catch (Exception ex) { WriteLog.Write(string.Format("数据统计服务:服务执行遇到错误:{0}", ex.Message)); } }
/// <summary> /// 时间开始 /// </summary> public void ShowTimeRun() { timeGetStatus = new TimeLoop(30000); timeGetStatus.TimeTo += timeDateTimeShow_TimeTo; showGetStatus = new Thread(timeGetStatus.TimeStrat); showGetStatus.Start(); }
/// <summary> /// 时间开始 /// </summary> public void ShowTimeRun() { SyncServerTime(); timeDateTimeShow = new TimeLoop(1000); timeDateTimeShow.TimeTo += timeDateTimeShow_TimeTo; showTimeThread = new Thread(timeDateTimeShow.TimeStrat); showTimeThread.Start(); }
public void StartNewWithZeroPeriodShoultThrowArgumentException(int period) { // Arrange var timeLoop = new TimeLoop(); // Act // Assert Assert.Throws(typeof(ArgumentException), () => { timeLoop.StartNew(id => { }, period); }); }
public void LastSeatRun() { _LastSeatCount = TerminalOperatorService.LastSeatCount(ClientObject.ClientSetting.DeviceSetting.Rooms); OnPropertyChanged("LastSeat"); MyLastSeatSumTime = new TimeLoop(30 * 1000); MyLastSeatSumTime.TimeTo += MyLastSeatSumTime_TimeTo; MyLastSeatSum = new Thread(timeDateTimeShow.TimeStrat); MyLastSeatSum.Start(); }
public void StartNewWithNullActionShoultThrowArgumentNullException() { // Arrange var timeLoop = new TimeLoop(); // Act // Assert Assert.Throws(typeof(ArgumentNullException), () => { timeLoop.StartNew(null, 10); }); }
/// <summary> /// 执行图片切换 /// </summary> private void GetAdvertImage() { try { if (ClientObject.UserGuide != null) { for (int i = 0; i < ClientObject.UserGuide.ImageFilePath.Count; i++) { try { UserGuideImage.Add(new BitmapImage(new Uri(Apppath + "UserGuide\\" + ClientObject.UserGuide.ImageFilePath[i], UriKind.RelativeOrAbsolute))); } catch (Exception ex) { WriteLog.Write("加载使用手册图片" + ClientObject.UserGuide.ImageFilePath[i] + "失败:" + ex.Message); } } } for (int i = 0; i < ClientObject.PromotionAdvert.Count; i++) { try { PromotionImage.Add(new BitmapImage(new Uri(Apppath + "PromotionImage\\" + ClientObject.PromotionAdvert[i].AdImagePath, UriKind.RelativeOrAbsolute))); } catch (Exception ex) { WriteLog.Write("加载校园推广图片" + ClientObject.PromotionAdvert[i].AdImagePath + "失败:" + ex.Message); ClientObject.PromotionAdvert.RemoveAt(i); i--; } } for (int i = 0; i < ClientObject.SchoolNote.Count; i++) { try { SchoolNoteImage.Add(new BitmapImage(new Uri(Apppath + "NoteImage\\" + ClientObject.SchoolNote[i].NoteImagePath, UriKind.RelativeOrAbsolute))); } catch (Exception ex) { WriteLog.Write("加载学校通知图片" + ClientObject.SchoolNote[i].NoteImagePath + "失败:" + ex.Message); ClientObject.SchoolNote.RemoveAt(i); i--; } } NowTap = AdType.SchoolNotice; ImgTime = new TimeLoop(10 * 1000); ImgTime.TimeTo += ImgTime_TimeTo; ImgTimeStop = new TimeLoop(10 * 1000); ImgTimeStop.TimeTo += ImgTimeStop_TimeTo; } catch (Exception ex) { WriteLog.Write("获取广告图片失败:" + ex.Message); } }
public void StartNewWithValidActionAndPeriodShouldReturnGuid() { // Arrange var timeLoop = new TimeLoop(); // Act var result = timeLoop.StartNew(id => { }, 10); // Assert Assert.Equal(typeof(Guid), result.GetType()); }
public void StopWithoutTimerShouldReturnFalse() { // Arrange var timeLoop = new TimeLoop(); // Act var result = timeLoop.Stop(Guid.Empty); // Assert Assert.Equal(false, result); }
public void ShowTimeRun() { NowDateTime = ServiceDateTime.Now; timeDateTimeShow = new TimeLoop(1000); timeDateTimeShow.TimeTo += timeDateTimeShow_TimeTo; showTimeThread = new Thread(timeDateTimeShow.TimeStrat); showTimeThread.Start(); timeDateTimeSync = new TimeLoop(300000); timeDateTimeSync.TimeTo += timeDateTimeSync_TimeTo; syncTimeThread = new Thread(timeDateTimeSync.TimeStrat); syncTimeThread.Start(); }
public void Initialise(GameVM gameVM) { _gameVM = gameVM; _timeloop = gameVM.Game.GameLoop; OnPropertyChanged(nameof(TickLength)); OnPropertyChanged(nameof(TickMultiplier)); OnPropertyChanged(nameof(TickFreq)); OnPropertyChanged(nameof(CurrentGameDate)); _timeloop.GameGlobalDateChangedEvent += OnTimeDateChange; }
public void StopWithTimerShouldReturnTrue() { // Arrange var timeLoop = new TimeLoop(); // Act var loopId = timeLoop.StartNew(id => { }, 10); var result = timeLoop.Stop(loopId); // Assert Assert.Equal(true, result); }
/// <summary> /// 定时转字符串 /// </summary> /// <returns>字符串</returns> public override string ToString() { List <string> tr = new List <string>(); tr.Add(TimedMode.ToString()); tr.Add(TimeLoop.ToString()); tr.Add(TimeDate.ToString()); tr.Add(Mark); tr.Add(StartTime.ToString()); tr.Add(EndTime.ToString()); tr.Add(Status.ToString()); return(string.Join("|", tr.ToArray())); }
public void Start() { int loopTime = 0; if (!int.TryParse(loopInterval, out loopTime)) { WriteLog.Write("读者信息同步:运行间隔时间获取失败,请检查是否配置了‘MonitorServiceInterval’项"); } monitorService = new Code.SeatDataOperation(); monitorService.ClearSeat(); timeLoop = new TimeLoop(loopTime); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); }
static void Main(string[] args) { int loopTime = 0; if (!int.TryParse(loopInterval, out loopTime)) { WriteLog.Write("运行间隔时间获取失败,请检查是否配置了‘CheckTimes’项"); } timeLoop = new TimeLoop(loopTime); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); Console.WriteLine(CurrentTime + "监控服务程序启动"); Console.ReadLine(); }
static void Main(string[] args) { Display("解释程序启动"); int loopTime = 0; if (!int.TryParse(loopInterval, out loopTime)) { SeatManage.SeatManageComm.WriteLog.Write("运行间隔时间获取失败,请检查是否配置了‘CheckTimes’项"); Console.WriteLine("运行间隔时间获取失败,请检查是否配置了‘CheckTimes’项"); } timeLoop = new TimeLoop(loopTime); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); Console.ReadLine(); }
private void OnEvent(MonoBehaviour behaviour, Events ev) { bool flag = behaviour.GetType() == typeof(Flashlight) && ev == Events.AfterStart; bool flag2 = flag; if (flag2) { this.SaveGame(); base.ModHelper.Console.WriteLine(": Starting time loop..."); TimeLoop.SetTimeLoopEnabled(true); base.ModHelper.Console.WriteLine(": Setting isTimeFlowing to false..."); typeof(TimeLoop).GetAnyField("_isTimeFlowing").SetValue(null, false); base.ModHelper.Console.WriteLine(string.Format(": Sand-loop timescale set to {0}x", StopTime._debugTimeScale)); base.ModHelper.Console.WriteLine(string.Format(": Sand-loop length set to {0} minutes.", StopTime._LoopLength)); this._isStarted = true; } }
TimeLoop timeLoop;//循环时间 /// <summary> /// 点击刷卡 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGetNo_Copy_Click(object sender, RoutedEventArgs e) { if (IsWork) { return; } if (btnGetNo_Copy.Content.ToString() == "点击刷卡") //判断如果按钮文字如果是“点击刷卡”就开始读卡操作 { StartRead(); //读卡 StopRead(); //停止读卡 StartRead(); //读卡 timeLoop = new TimeLoop(1000); //初始化定时器,1000表示一秒 timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); //注册定时器触发的动作函数 timeLoop.TimeStrat(); //定时器开始工作 IsWork = true; //布尔值表示工作 } }
void OnTriggerEnter(Collider other) { if (other.name == "BlackHole(Clone)") { if (isReverser == true) { timeStart = other.GetComponent <TimeLoop>(); timeStart.Rewind(); } if (isDisintegrater == true) { shootRelease = other.GetComponent <BlackHole>(); shootRelease.enabled = false; StartCoroutine(TurnOn()); } } }
public void Start() { try { //监控服务启动 SeatServerWatch = new WatchOperate(); SeatServerWatch.ServiceStartOperate(); //标示读者库更新 ReaderInfoUpdated = false; //时间循环启动 timeLoop = new TimeLoop(15000); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); } catch (Exception ex) { WriteLog.Write(string.Format("服务执行遇到错误:{0}", ex.Message)); } }
/// <summary> /// 执行图片切换 /// </summary> public void ImageChangeRun() { try { SchoolNotices = SystemObject.GetInstance().SchoolNote; PromotionAd = SystemObject.GetInstance().PromotionAdvert; UserGuide = SystemObject.GetInstance().UserGuide; noticeNum = 0; promotionNum = 0; guideNum = 0; if (UserGuide != null && UserGuide.ImageFilePath.Count > 0) { NowShowImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(Apppath + "UserGuide\\" + UserGuide.ImageFilePath[guideNum], UriKind.RelativeOrAbsolute)); NowTap = AdType.None; } if (PromotionAd.Count > 0) { NowShowImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(Apppath + "PromotionImage\\" + PromotionAd[promotionNum].AdImagePath, UriKind.RelativeOrAbsolute)); NowTap = AdType.PromotionAd; } if (SchoolNotices.Count > 0) { NowShowImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(Apppath + "NoteImage\\" + SchoolNotices[noticeNum].NoteImagePath, UriKind.RelativeOrAbsolute)); NowTap = AdType.SchoolNotice; } BtnVisible(); if (ImageSwitch != null) { ImageSwitch(this, new EventArgs()); } ImgTime = new TimeLoop(10 * 1000); ImgTime.TimeTo += ImgTime_TimeTo; ImgTimeStop = new TimeLoop(10 * 1000); ImgTimeStop.TimeTo += ImgTimeStop_TimeTo; ImgTime.TimeStrat(); } catch (Exception ex) { WriteLog.Write("消息滚动启动失败:" + ex.Message); } }
private SystemObject() { //设置定时器,间隔10s执行一次阅览室设置更新 timeloop = new TimeLoop(20000); timeloop.TimeTo += timeloop_TimeTo; try { _RegulationRulesSet = GetRegulationRulesSetting(); _clientSetting = GetClientSet(); if (_clientSetting == null) { return; } _BackgroundImagesResource = GetBitmapImageResource(_clientSetting.DeviceSetting); timeloop.TimeStrat(); } catch { throw; } }
public void SaveConfig() { iniWrite(ConfigSection, "ID", ID, ConfigFile); iniWrite(ConfigSection, "Token", Token, ConfigFile); iniWrite(ConfigSection, "Domain", Domain, ConfigFile); iniWrite(ConfigSection, "TimeLoop", TimeLoop.ToString(), ConfigFile); iniWrite(ConfigSection, "ServiceName", ServiceName, ConfigFile); iniWrite(ConfigSection, "LogFile", LogFile, ConfigFile); iniWrite(ConfigSection, "LogIPChange", LogIPChange.ToString(), ConfigFile); iniWrite(ConfigSection, "LogNotify", LogNotify.ToString(), ConfigFile); string subdomain = ""; foreach (string cHost in Hosts) { if (cHost.Trim().Length > 0) { subdomain += cHost + ","; } } iniWrite(ConfigSection, "Host", subdomain.Trim(','), ConfigFile); }
public void Start() { try { int loopTime = 0; if (!int.TryParse(loopInterval, out loopTime)) { WriteLog.Write("读者信息同步:运行间隔时间获取失败,请检查是否配置了‘ReaderSyncServiceInterval’项"); } //监控服务启动 readerSync = new Code.ReaderSync(); //标示读者库更新 readerInfoUpdated = false; //时间循环启动 timeLoop = new TimeLoop(loopTime); timeLoop.TimeTo += new EventHandler(timeLoop_TimeTo); timeLoop.TimeStrat(); } catch (Exception ex) { WriteLog.Write(string.Format("读者信息同步:服务执行遇到错误:{0}", ex.Message)); } }
public void CheckCodeRun() { MyCheckCodeTime = new TimeLoop(10 * 1000); MyCheckCodeTime.TimeTo += MyCheckCodeTime_TimeTo; MyCheckCodeTime.TimeStrat(); }
public override void OnReceiveRemote() => TimeLoop.SetSecondsRemaining(0);
private void OnGUI() { if (_playerController == null || _playerForceDetector == null) { this._playerForceDetector = Locator.GetPlayerForceDetector(); this._playerController = Locator.GetPlayerController(); if (_playerController == null || _playerForceDetector == null) { return; } } float num = 400f; if (GUIMode.IsHiddenMode() || PlayerState.UsingShipComputer()) { return; } if (inputHUD == 1) { GUI.Label(new Rect(10f + num, 10f, 200f, 20f), "Time Scale: " + Mathf.Round(Time.timeScale * 100f) / 100f); GUI.Label(new Rect(10f + num, 25f, 200f, 20f), string.Concat(new object[] { "Time Remaining: ", Mathf.Floor(TimeLoop.GetSecondsRemaining() / 60f), ":", Mathf.Round(TimeLoop.GetSecondsRemaining() % 60f * 100f / 100f) })); GUI.Label(new Rect(10f + num, 40f, 200f, 20f), "Loop Count: " + TimeLoop.GetLoopCount()); GUI.Label(new Rect(10f + num, 55f, 90f, 40f), "PauseFlags: "); GUI.Label(new Rect(100f + num, 55f, 50f, 40f), "MENU\n" + ((!OWTime.IsPaused(OWTime.PauseType.Menu)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(150f + num, 55f, 50f, 40f), "LOAD\n" + ((!OWTime.IsPaused(OWTime.PauseType.Loading)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(200f + num, 55f, 50f, 40f), "READ\n" + ((!OWTime.IsPaused(OWTime.PauseType.Reading)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(250f + num, 55f, 50f, 40f), "SLP\n" + ((!OWTime.IsPaused(OWTime.PauseType.Sleeping)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(300f + num, 55f, 50f, 40f), "INIT\n" + ((!OWTime.IsPaused(OWTime.PauseType.Initializing)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(350f + num, 55f, 50f, 40f), "STRM\n" + ((!OWTime.IsPaused(OWTime.PauseType.Streaming)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(400f + num, 55f, 50f, 40f), "SYS\n" + ((!OWTime.IsPaused(OWTime.PauseType.System)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(10f + num, 85f, 200f, 20f), "Input Mode: " + OWInput.GetInputMode().ToString()); this._inputModeArray = OWInput.GetInputModeStack(); GUI.Label(new Rect(10f + num, 100f, 200f, 20f), "Input Mode Stack: "); int num2 = 150; int num3 = 0; while (num3 < this._inputModeArray.Length && this._inputModeArray[num3] != InputMode.None) { GUI.Label(new Rect((float)num2 + num, 100f, 200f, 20f), this._inputModeArray[num3].ToString()); num2 += 75; num3++; } GUI.Label(new Rect(10f + num, 115f, 300f, 20f), "Net Force Accel: " + Mathf.Round(this._playerForceDetector.GetForceAcceleration().magnitude * 100f) / 100f); GUI.Label(new Rect(210f + num, 115f, 300f, 20f), "G-Force: " + Mathf.Round(this._gForce * 100f) / 100f); GUI.Label(new Rect(10f + num, 130f, 200f, 20f), "Load Time: " + LoadTimeTracker.GetLatestLoadTime()); if (DynamicResolutionManager.isEnabled) { GUI.Label(new Rect(10f + num, 145f, 200f, 20f), "Resolution Scale: " + DynamicResolutionManager.currentResolutionScale); } GUI.Label(new Rect(10f + num, 160f, 200f, 20f), "Player Speed: " + (Locator.GetCenterOfTheUniverse().GetOffsetVelocity() + Locator.GetPlayerBody().GetVelocity()).magnitude.ToString()); GUI.Label(new Rect(210f + num, 160f, 200f, 20f), "Player Accel: " + Locator.GetPlayerBody().GetAcceleration().magnitude.ToString()); if (Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>()) { GUI.Label(new Rect(10f + num, 175f, 200f, 20f), string.Concat(new object[] { "Jetpack Max Accel: ", Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>().GetMaxTranslationalThrust().ToString(), "/", Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>().GetBoostMaxThrust().ToString() })); } if (Locator.GetShipBody().GetComponent <ShipThrusterModel>()) { GUI.Label(new Rect(210f + num, 175f, 200f, 20f), "Ship Max Accel: " + Locator.GetShipBody().GetComponent <ShipThrusterModel>().GetMaxTranslationalThrust().ToString()); } GUI.Label(new Rect(10f + num, 190f, 400f, 20f), string.Concat(new object[] { "Inspector layer: ", rayMask, " ", LayerMask.LayerToName(rayMask) })); if (GetWarpOWRigidbody()) { GUI.Label(new Rect(10f + num, 205f, 400f, 20f), string.Concat(new string[] { "Warp Body: ", GetWarpOWRigidbody().gameObject.name, " layer: ", GetWarpOWRigidbody().gameObject.layer.ToString(), " ", LayerMask.LayerToName(GetWarpOWRigidbody().gameObject.layer) })); } if (hit.collider) { GUI.Label(new Rect(10f + num, 220f, 400f, 20f), string.Concat(new string[] { "Latest hit layer: ", hit.collider.gameObject.layer.ToString(), " ", LayerMask.LayerToName(hit.collider.gameObject.layer) })); GUI.Label(new Rect(10f + num, 235f, 600f, 20f), "Name: " + hit.collider.gameObject.name + " Distance: " + (hit.point - Locator.GetPlayerBody().transform.position).magnitude.ToString()); } /*if (PadEZ.PadManager.GetActiveController()!=null) * { * GUI.Label(new Rect(10f + num, 250f, 600f, 20f), PadEZ.PadManager.GetActiveController().GetIndex().ToString() + " " + PadEZ.PadManager.GetActiveController().GetPadType().ToString() +" "+ UnityEngine.Input.GetJoystickNames()[PadEZ.PadManager.GetActiveController().GetIndex()]); * }*/ } if (inputHUD == 2) { GUI.Label(new Rect(10f, 10f, 300f, 2500f), ReadInputManager.ReadCommandInputs(false)); } if (inputHUD == 3) { GUI.Label(new Rect(0f, 0f, 300f, 2500f), ReadInputManager.ReadCommandInputs(false)); GUI.Label(new Rect(300f, 0f, 300f, 2500f), ReadInputManager.ReadCommandInputs(true)); } if (inputHUD == 4) { GUI.Label(new Rect(0f, 0f, 500f, 2500f), ReadInputManager.ReadInputAxes()); GUI.Label(new Rect(500f, 0f, 500f, 2500f), ReadInputManager.ReadRawInputManagerButtons()); } }