protected IEnumerator <object> InitTimer() { var sleep = new Sleep(5.0); while (true) { yield return(sleep); foreach (var pname in ProcessNames) { foreach (var process in Process.GetProcessesByName(pname)) { if (!RunningProcessIds.Contains(process.Id)) { RunningProcessIds.Add(process.Id); NewProcesses.Enqueue(process); } else { process.Dispose(); } } } } }
public ActionResult Create([Bind( Include = "SleepId,StartSleep,EndSleep,MorningRating," + "EveningRating,Note,AmountOfSleep,UserId,QuickSleep")] Sleep sleep) { if (ModelState.IsValid) { TimeSpan hoursValidate = new TimeSpan(23, 59, 59); TimeSpan timeSpanTemp = sleep.EndSleep - sleep.StartSleep; if (Math.Abs(timeSpanTemp.Ticks) > hoursValidate.Ticks) { ViewBag.Message = "Sen nie może trwać więcej niż 24 godziny, " + "ani być ujemny."; return(View()); } var username = HttpContext.User.Identity.Name; var user = db.User.Where(x => x.Username == username).FirstOrDefault(); user.Sleep.Add(new Sleep(sleep)); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.UserId = new SelectList(db.User, "UserId", "Username", sleep.UserId); return(View(sleep)); }
public void Add(Sleep sleep) { var query = "INSERT INTO Sleep(DateTime, SleepType) VALUES(?,?)"; var command = _database.Instance.CreateCommand(query, sleep.DateTime, sleep.SleepType); command.ExecuteNonQuery(); }
private void FillCurrentDataWithFakeData() { var sleepToAdd = new Sleep(DateTime.Now.AddHours(-8), DateTime.Now, Enums.SleepQuality.ThreeStars, "Testing"); _currentSleepData.Clear(); _currentSleepData.Add(sleepToAdd); }
public async Task <ActionResult <String> > GetSleepByDate(String userId, DateTime date) { var usr = await userCollection.GetById(userId); if (usr == null) { return(NotFound()); } foreach (var i in usr.SleepIds) { var ci = await sleepCollection.GetById(i); if (ci == null) { continue; } if (isSameDay(date, ci.Date)) { return(ci.Id.ToString()); } } var ciNew = new Sleep(ObjectId.Empty, 0, 0, date, ObjectId.Empty); sleepCollection.InsertOne(ciNew); await this.AddSleepToUser(userId, ciNew.Id.ToString()); return(ciNew.Id.ToString()); }
public void ExitApp() { //隐藏窗口图标 try { Invoke(new Action(() => { NIMain.Visible = false; FormClosing -= MainForm_FormClosing; Close(); try { Application.Exit(); } catch { } try { Environment.Exit(Environment.ExitCode); } catch { } })); } catch { } //退出及强制退出 Task.Factory.StartNew(() => { Sleep.S(2); //延迟结束进程 Azylee.Core.ProcessUtils.ProcessTool.SleepKill(Process.GetCurrentProcess(), 3); }); }
public async CTask Do() { Status = -1; await Sleep.Until(2000, true); Status = 1; }
protected IEnumerator <object> RefreshFunctionNames(HeapRecording instance) { var sleep = new Sleep(0.05); // This sucks :( while (instance.Database.SymbolsByFunction == null) { yield return(sleep); } var result = new HashSet <string>(); var keys = instance.Database.SymbolsByFunction.GetAllKeys(); using (keys) yield return(keys); foreach (var key in keys.Result) { var text = key.Value as string; if (text != null) { result.Add(text); } } KnownFunctionNames = result; HeapFilter.AutoCompleteItems = result; }
private void WakeUpButton_Click(object sender, RoutedEventArgs e) { var sleepEnd = DateTime.Now; Sleep incompleteSleep = new Sleep(sleepStart, sleepEnd); Shell.Navigate(typeof(SleepSummaryView), incompleteSleep); }
private void NameChanger_Tick(object sender, EventArgs e) { WriteText("^1-- ^5N^7o ^5H^7ost ^5M^7od ^5M^7enu ^5B^7y ^5M^7rNiato ^1--\n\n^5Simple Mods\nPrestige Menu\nStats Menu\n^2-->^5Name Changer\n\n\n\n^2www.ihax.fr\n^3Facebook : ^1Guillaume ^2MrNiato"); if (Key_IsDown.DetectKey(Key_IsDown.Key.Cross)) { NameChanger.Stop(); N1.Start(); groupBox4.Enabled = true; } if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_DOWN)) { NameChanger.Stop(); HostMainMenu.Start(); groupBox4.Enabled = false; } if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_UP)) { NameChanger.Stop(); StatsMenu.Start(); groupBox4.Enabled = false; } if (Key_IsDown.DetectKey(Key_IsDown.Key.R3)) { NameChanger.Stop(); Sleep.Start(); groupBox4.Enabled = false; } }
public async Task <IActionResult> Edit(int id, [Bind("SleepId,UserId,Awake,Light,Deep,Rem,SleepDate")] Sleep sleep) { if (id != sleep.SleepId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sleep); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SleepExists(sleep.SleepId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", sleep.UserId); return(View(sleep)); }
/// <summary> /// 强制重启服务 /// </summary> public void Restart() { //端口号是0,玩个蛋 if (Project.Port == 0) { return; } if (!(ListTool.HasElements(Project.Versions) && Project.CurrentVersion != 0 && Project.LastVersion != 0)) { //不存在版本或错误的版本(版本为0),不启动工程 return; } Task.Factory.StartNew(() => { //停止服务 Stop(); //等待一下,防止未停止进程的情况发生 Sleep.S(3); //没有端口占用则正常启动 if (!GetProcess()) { Start(); } }); }
public override void Update() { // Check if agent hasn't finished walking between waypoints. if (agent.remainingDistance < 1) { // If agent has reached end of waypoint list, go back to the first one, otherwise move to the next one. if (currentIndex >= GameEnvironment.Singleton.Checkpoints.Count - 1) { currentIndex = 0; } else { currentIndex++; } agent.SetDestination(GameEnvironment.Singleton.Checkpoints[currentIndex].transform.position); // Set agents destination to position of next waypoint. } if (CanSeePlayer()) { nextState = new Pursue(npc, agent, anim, player); stage = EVENT.EXIT; // The next time 'Process' runs, the EXIT stage will run instead, which will then return the nextState. } if (OnAttack()) { nextState = new Sleep(npc, agent, anim, player); stage = EVENT.EXIT; } }
private async void WaitTime() { if (this.executionCount > this.MaximumQueueSize) { --this.executionCount; return; } try { await Task.Factory.StartNew(() => { Sleep.ThreadWaitSeconds(this.DisplaySeconds); }); if (this.executionCount <= 1) { base.Content = null; } } catch { base.Content = null; } finally { this.executionCount--; } }
private async void DeleteButton_OnClickedButton_OnClicked(object sender, EventArgs e) { var ci = CrossMultilingual.Current.CurrentCultureInfo; string confirmTitle = resmgr.Value.GetString("DeleteSleep", ci); string confirmMessage = resmgr.Value.GetString("DeleteSleepMessage", ci) + " ? "; string yes = resmgr.Value.GetString("Yes", ci); string no = resmgr.Value.GetString("No", ci); bool confirmDelete = await DisplayAlert(confirmTitle, confirmMessage, yes, no); if (confirmDelete) { _viewModel.IsBusy = true; _viewModel.EditMode = false; Sleep deletedSleep = await ProgenyService.DeleteSleep(_viewModel.CurrentSleep); if (deletedSleep.SleepId == 0) { _viewModel.EditMode = false; // Todo: Show success message } else { _viewModel.EditMode = true; // Todo: Show failed message } _viewModel.IsBusy = false; } }
private static void StartReadQueue() { //启动任务 Task.Factory.StartNew(() => { //设置退出条件 while (!ConnectCancelToken.IsCancellationRequested) { //如果队列中存在元素 if (Queue.Any()) { //循环进行操作 for (int i = 0; i < Queue.Count; i++) { try { Tuple <string, TcpDataModel> model = null; if (Queue.TryDequeue(out model)) { //读取成功后,进行相关处理 TxFunction.ExecuteMessage(model.Item1, model.Item2); } } catch { } } } Sleep.S(R.Tx.ReadQueueInterval); } }); }
public override void OnEvent(Sleep evnt) { if (BoltNetwork.isClient && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.Sleep) { Debug.Log("Go to sleep"); TheForest.Utils.Scene.HudGui.MpSleepLabel.gameObject.SetActive(false); LocalPlayer.Inventory.CurrentView = PlayerInventory.PlayerViews.World; if (!evnt.Aborted) { LocalPlayer.Stats.GoToSleep(); if (Grabber.FocusedItemGO) { ShelterTrigger component = Grabber.FocusedItemGO.GetComponent <ShelterTrigger>(); if (component && component.BreakAfterSleep) { base.StartCoroutine(component.DelayedCollapse()); } component.SendMessage("OnSleep", SendMessageOptions.DontRequireReceiver); } EventRegistry.Player.Publish(TfEvent.Slept, null); } else { LocalPlayer.Stats.GoToSleepFake(); } TheForest.Utils.Scene.HudGui.Grid.repositionNow = true; } }
public override int GetHashCode() { unchecked { var hashCode = _totalBalance.GetHashCode(); hashCode = (hashCode * 397) ^ AutoSleep.GetHashCode(); hashCode = (hashCode * 397) ^ SleepThreshold.GetHashCode(); hashCode = (hashCode * 397) ^ (Login != null ? Login.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Role != null ? Role.GetHashCode() : 0); hashCode = (hashCode * 397) ^ LicenseExpDate.GetHashCode(); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ConnectionID != null ? ConnectionID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sleep != null ? Sleep.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Alerts.GetHashCode(); hashCode = (hashCode * 397) ^ AllTrades.GetHashCode(); hashCode = (hashCode * 397) ^ AllTradesPro.GetHashCode(); hashCode = (hashCode * 397) ^ Chart.GetHashCode(); hashCode = (hashCode * 397) ^ Counter.GetHashCode(); hashCode = (hashCode * 397) ^ L2.GetHashCode(); hashCode = (hashCode * 397) ^ Logbook.GetHashCode(); hashCode = (hashCode * 397) ^ Trading.GetHashCode(); hashCode = (hashCode * 397) ^ FastOrder.GetHashCode(); hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0); hashCode = (hashCode * 397) ^ SleepThreshold.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitControl.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitLimit.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitLossLimit.GetHashCode(); return(hashCode); } }
private SleepData getSleepDataExt(string param2) { string param = Consts.GET_SLEEP_DATA + getParams(); try { String sleepInfo = webClient.Post(param, param2, CONTENT_TYPE); SleepData data = JsonConvert.DeserializeObject <SleepData>(sleepInfo); if (data == null || data.sleep == null) { data = new SleepData(); Sleep sleep = new Sleep(); data.sleep = sleep; } return(data); } catch (Exception ex) { if (currentTryRunNum == TRY_AGAIN_MUN) { FailRequestManager.mInstance.saveInFailList(mUserModel.UserID, Convert.ToDateTime(mSyncDay), param, (ex == null ? "" : ex.Message)); return(null); } else { currentTryRunNum++; return(getSleepDataExt(param2)); } } }
public async Task <IActionResult> PutSleep(int id, Sleep sleep) { if (id != sleep.SleepId) { return(BadRequest()); } _context.Entry(sleep).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SleepExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void OnGUI() { UpdateControllers(); Sleep.OnGUI(); Dead.OnGUI(); }
public static void doActionByTypes(ActionModel action) { if (action.actionType == config.actionTypes.lockComputer) { Lock.Computer(); } if (action.actionType == config.actionTypes.sleepComputer) { Sleep.Computer(); } if (action.actionType == config.actionTypes.turnOffMonitor) { TurnOff.Monitor(); } if (action.actionType == config.actionTypes.shutdownComputer) { ShutdownComputer(); } if (action.actionType == config.actionTypes.restartComputer) { RestartComputer(); } if (action.actionType == config.actionTypes.logOffWindows) { LogOff.Windows(); } }
public void GetTime() { var username = HttpContext.User.Identity.Name; var user = db.User.Where(x => x.Username == username).FirstOrDefault(); if (user.SleepTemporary.Any()) { var sTemp = user.SleepTemporary.LastOrDefault(); //walidacja 24h TimeSpan HOURS_VALIDATE = new TimeSpan(23, 59, 59); TimeSpan timeSpanTemp = DateTime.Now - sTemp.StartSleep; if (timeSpanTemp < HOURS_VALIDATE) { Sleep sleep = new Sleep(sTemp.StartSleep, DateTime.Now.ToLocalTime()); user.Sleep.Add(sleep); } db.SleepTemporary.Remove(sTemp); } else { SleepTemporary st = new SleepTemporary(); st.StartSleep = DateTime.Now; db.SleepTemporary.Add(st); user.SleepTemporary.Add(st); } db.SaveChanges(); }
private static async CTask OutsideFlow(Source <object> messages, Network network) { await Sleep.Until(1000); var accepts = network.OutgoingMessages.OfType <Accept>().Next(); messages.Emit(new Promise() { Ballot = 0 }); messages.Emit(new Promise() { Ballot = 0 }); messages.Emit(new Promise() { Ballot = 0 }); await accepts; await Sleep.Until(1000); messages.Emit(new Accepted() { }); messages.Emit(new Accepted() { }); messages.Emit(new Accepted() { }); }
public int counter; //なんターン継続する public override void Use(BattleCharacter owner, BattleCharacter target) { //状態異常を付与できない、効かない if (target.GetStatusEffect() != null) { BattleDirectorController.Instance.Message("なにもおきなかった"); return; } StatusEffect statusEffect = null; switch (effectType) { case StatusEffectType.どく: statusEffect = new Poison(target, counter); break; case StatusEffectType.まひ: statusEffect = new Palsy(target, counter); break; case StatusEffectType.すいみん: statusEffect = new Sleep(target, counter); break; case StatusEffectType.全て: break; default: break; } BattleDirectorController.Instance.AddStatusEffect(target, statusEffect); }
public Sleep[] GetSleepDuringSpan(DateTime start, DateTime end, string userId = null) { if (userId == null) { userId = _localStorage.GetCurrentUserId(); } var healthSleep = new HealthSleep[0]; var todaysSleep = new Sleep { DayId = DateTime.Today }; if (end.Date.Equals(DateTime.Today) && _localStorage.GetUserCurrentType() == UserType.Player) { end = end.AddDays(-1); healthSleep = HealthDataFetcher.Instance.GetSleepRecords(start, end); } var sleep = GetSleep(start, end, userId); if (!healthSleep.IsNullOrEmpty()) { todaysSleep = healthSleep.First().Map(); sleep.Add(todaysSleep); } return(sleep.ToArray()); }
public bool Play(int span) { bool b1 = Sleep.Play(span); bool b2 = Timing.Play(span); return(b1 || b2); }
private async void DisplayMouseHover() { try { RESLEEP: await Task.Factory.StartNew(() => { Sleep.ThreadWaitSeconds(this.sleepSeconds); }); bool[] isMouseOver = new bool[] { this.uxPopupContent.IsMouseOver, this.uxPopupContent.IsMouseOver, this.selectedTabHeader.IsMouseOver }; if (this.uxPopupContent.IsOpen && isMouseOver.All(m => !m)) { this.uxPopupContent.IsOpen = false; } else { goto RESLEEP; } } catch (Exception err) { #if DEBUG MessageBox.Show(TranslationDictionary.Translate(err.InnerExceptionMessage())); #endif // DO NOTHING } }
public static Composite GetBase() { Orders = Crafty.OrderForm.GetOrders(); // Get what we want to craft if (Orders.Count == 0) { Orders.Add(new Crafty.Order(0, "Orders Empty", 0, ClassJobType.Adventurer)); //Adding an item if it's blank. } //Pace the selector var sleep = new Sleep(400); //Animation Locked var animationLocked = new Decorator(condition => CraftingManager.AnimationLocked, new Sleep(1000)); //Currently Synthing var continueSynth = new Decorator(condition => CraftingManager.IsCrafting, Strategy.GetComposite()); //Orders Empty Check var ordersEmpty = new Decorator(condition => CheckOrdersEmpty(), StopBot("Looks like we've completed all the orders!")); //Incorrect Job var correctJob = new Decorator(condition => Character.ChangeRequired(GetJob()), Character.ChangeJob()); //Recipe not Selected var selectRecipe = new Decorator(condition => IsRecipeSet(GetID()), new ActionRunCoroutine(action => SetRecipeTask(GetID()))); //Can't Craft the item //var cantCraft = new Decorator(condition => CanICraftIt(), StopBot("Can't craft the item " + GetName() + ". Stopping!")); //Begin crafting var beginCrafting = BeginSynthAction(); //Base Composite that we'll return return new PrioritySelector(sleep, animationLocked, continueSynth, ordersEmpty, correctJob, selectRecipe, beginCrafting); /* var setRecipeCoroutine = new ActionRunCoroutine(r=> SetRecipeTask(Orders[0].ItemId)); var setRecipe = new Decorator(s=>IsRecipeSet(Orders[0].ItemId), setRecipeCoroutine); var canCast = new Decorator(s => CraftingManager.AnimationLocked, new Sleep(1000)); var canCraft = new Decorator(s => CanICraftIt(), StopBot("Can't Craft the item. Stopping!")); var beginSynth = new Action(a => { Character.CurrentRecipeLvl = CraftingManager.CurrentRecipe.RecipeLevel; Mend.Available = true; CraftingLog.Synthesize(); Orders[0].Qty--; Logging.Write("Crafting " + Orders[0].ItemName + ". Remaining: " + Orders[0].Qty); while(Orders[0].Qty == 0)Orders.RemoveAt(0); }); var continueSynth = new Decorator(s => CraftingManager.IsCrafting, Strategy.GetComposite()); var correctJob = new Decorator(s => Character.ChangeRequired(Orders[0].Job), Character.ChangeJob(Orders[0].Job)); return new PrioritySelector(new Sleep(350), canCast, setRecipe, continueSynth, correctJob, canCraft, beginSynth); */ }
public void TestSleep() { var sleep = new Sleep(); sleep.Execute(_tamagotchi); Assert.IsTrue(_tamagotchi.Sleep >= 15 && _tamagotchi.Sleep <= 35); }
public async Task <ActionResult <SleepDto> > Add(SleepCreationDto item) { var na = new Sleep(ObjectId.Empty, item.HoSG, item.HoSC, item.Date, ObjectId.Empty); await sleepCollection.InsertOneAsync(na); return(CreatedAtRoute(nameof(GetSingleSleep), new { id = na.Id }, new SleepDto(na.Id.ToString(), na.HoSG, na.HoSC, na.Date))); }
public static Composite ChangeJob() { var closewindow = new Action(a => CraftingLog.Close()); var wait = new Sleep(4000); var windowcheck = new Decorator(condition => CraftingLog.IsOpen, closewindow); var changegearset = new Action(a => { Logging.Write("Changing to gearset number: " + Crafty.OrderForm.GetJobGearSet(CraftyComposite.GetJob())); ChatManager.SendChat("/gs change " + Crafty.OrderForm.GetJobGearSet(CraftyComposite.GetJob())); }); return new Sequence(windowcheck, wait, changegearset); }
public override void UseAbility(Unit target) { base.UseAbility (target); Effect eff1 = new Sleep ("Deep Slumber (sleep)", duration, effectLib.getIcon("Deep Slumber").sprite); Effect eff2 = new DamageRecievedEffect ("Deep Slumber (dmg)", duration, damageMod, 1, effectLib.getIcon("Deep Slumber").sprite); target.ApplyEffect(eff1); target.ApplyEffect(eff2); target.AddTrigger (new RemoveEffect ("Deep Slumber (sleep)", myCaster, TriggerType.Hit, eff1, effectLib, duration, effectLib.getIcon("Deep Slumber").sprite)); target.AddTrigger (new RemoveEffect ("Deep Slumber (dmg)", myCaster, TriggerType.Hit, eff2, effectLib, duration, effectLib.getIcon("Deep Slumber").sprite)); myCaster.GetComponent<AudioSource> ().PlayOneShot (effectLib.getSoundEffect ("Deep Slumber")); }
protected IEnumerator<object> InitTimer() { var sleep = new Sleep(5.0); while (true) { yield return sleep; foreach (var pname in ProcessNames) { foreach (var process in Process.GetProcessesByName(pname)) { if (!RunningProcessIds.Contains(process.Id)) { RunningProcessIds.Add(process.Id); NewProcesses.Enqueue(process); } else { process.Dispose(); } } } } }
protected IEnumerator<object> AutoCaptureTask() { var sleep = new Sleep(0.1); while ((Instance == null) || (!Instance.Running)) yield return sleep; sleep = new Sleep(CaptureCheckIntervalSeconds); const long captureInterval = (long)(CaptureMaxIntervalSeconds * Time.SecondInTicks); long lastPaged = 0, lastWorking = 0, lastCaptureWhen = 0; bool shouldCapture; while (AutoCapture.Checked && Instance.Running) { Instance.Process.Refresh(); var pagedDelta = Math.Abs(Instance.Process.PagedMemorySize64 - lastPaged); var workingDelta = Math.Abs(Instance.Process.WorkingSet64 - lastWorking); var deltaPercent = Math.Max( pagedDelta * 100 / Math.Max(Instance.Process.PagedMemorySize64, lastPaged), workingDelta * 100 / Math.Max(Instance.Process.WorkingSet64, lastWorking) ); var elapsed = Time.Ticks - lastCaptureWhen; shouldCapture = (deltaPercent >= CaptureMemoryChangeThresholdPercentage) || (elapsed > captureInterval); if (shouldCapture) { lastPaged = Instance.Process.PagedMemorySize64; lastWorking = Instance.Process.WorkingSet64; lastCaptureWhen = Time.Ticks; yield return Instance.CaptureSnapshot(); } yield return sleep; } }
protected IEnumerator<object> RefreshFunctionNames(HeapRecording instance) { var sleep = new Sleep(0.05); // This sucks :( while (instance.Database.SymbolsByFunction == null) yield return sleep; var result = new HashSet<string>(); var keys = instance.Database.SymbolsByFunction.GetAllKeys(); using (keys) yield return keys; foreach (var key in keys.Result) { var text = key.Value as string; if (text != null) result.Add(text); } KnownFunctionNames = result; HeapFilter.AutoCompleteItems = result; }
void Awake() { S = this; }
// For some reason reiniting is flaky :( public IEnumerator<object> InitGateways() { DestroyEndpoints(); Endpoints.Clear(); EndpointSettings[] endpoints = null; using (var q = Database.BuildQuery("SELECT * FROM jabber.endpoints")) yield return q.ExecuteArray<EndpointSettings>().Bind(() => endpoints); foreach (var settings in endpoints) Endpoints[settings.Name] = null; if (endpoints.Length == 0) yield break; using (var lw = new LoadingWindow()) { lw.SetStatus("Connecting", null); lw.Text = "Jabber Gateway"; lw.Show(); float? current = null; float stepSize = (1.0f / endpoints.Length); var sleep = new Sleep(0.25f); foreach (var settings in endpoints) { lw.SetStatus(String.Format("Connecting endpoint {0}", settings.Name), current); Console.Write("Initializing endpoint '{0}'... ", settings.Name); var f = Endpoint.Connect( this, settings, (s) => lw.SetProgress(current + (s * stepSize)) ); yield return f; if (f.Error != null) { Console.WriteLine("failed: {0}", f.Error); Scheduler.OnTaskError(f.Error); } else { Console.WriteLine("initialized."); } current = current.GetValueOrDefault(0.0f) + stepSize; lw.SetProgress(current); yield return sleep; } lw.SetStatus("Ready", 1.0f); lw.Close(); } }
public override void potionEffect(MyCharacterController user, MyCharacterController target) { var buff = new Sleep(target, BasisParameter.EffectPoint); target.registerBuff(buff); }
private void HandleBotStart(IBot bot) { foreach (var hook in TreeHooks.Instance.Hooks) { //Stealing Hook if (hook.Key.Contains("VendorRun")) { //Traversing the Behavior Tree using magic var dec = hook.Value[0] as Decorator; var prio = dec.Children[0] as PrioritySelector; //Building the new Identify Mechanic var children = new Composite[4]; //Decorator to check if any items that we need to identify are left CanRunDecoratorDelegate itemsLeftToIdentify = context => ZetaDia.Me.Inventory.Backpack.Any(HasToIdentify); //Sleep for a bit (1000ms) children[0] = new Sleep(1000); //Start Identify children[1] = new Zeta.TreeSharp.Action(new ActionSucceedDelegate(IdentifyItem)); //Sleep for Identify Duration children[2] = new Sleep(0x1388); //Return children[3] = new Zeta.TreeSharp.Action(ctx => RunStatus.Success); prio.Children[2] = new Decorator(itemsLeftToIdentify, new PrioritySelector(children)); } } }
protected IEnumerator<object> SendTask() { var sleep = new Sleep(SendInterval); Dictionary<string, object> prefs = new Dictionary<string, object>(); yield return Preferences.GetAll().Bind(() => prefs); List<string> allItems = new List<string>(); var oldQueue = Queue; Queue = new BlockingQueue<string>(); if (oldQueue != null) Queue.EnqueueMultiple(oldQueue.DequeueAll()); while (true) { var nextItem = Queue.Dequeue(); using (nextItem) yield return nextItem; yield return sleep; allItems.Clear(); allItems.Add(nextItem.Result); allItems.AddRange(Queue.DequeueAll()); yield return new Start( Send(prefs, allItems.ToArray()), TaskExecutionPolicy.RunAsBackgroundTask ); } }