public virtual void Dispose() { if (IsDisposed) { return; } IsDisposed = true; if (DelayTimer != null) { DelayTimer.Stop(); DelayTimer = null; } Source = null; Map = null; EffectID = -1; Hue = 0; Speed = 0; Duration = 0; Render = EffectRender.Normal; Delay = TimeSpan.Zero; Callback = null; Sending = false; }
internal WaitForEventsAsyncResult(InstanceHandle handle, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { _handle = handle; _timeout = timeout; if (_timeout != TimeSpan.Zero && _timeout != TimeSpan.MaxValue) { //this.timer = new IOThreadTimer(WaitForEventsAsyncResult.timeoutCallback, this, false); _timer = new DelayTimer(WaitForEventsAsyncResult.s_timeoutCallback, this); } List <InstancePersistenceEvent> existingReadyEvents = _handle.StartWaiting(this, _timer, _timeout); if (existingReadyEvents == null) { if (_timeout == TimeSpan.Zero) { _handle.CancelWaiting(this); throw Fx.Exception.AsError(new TimeoutException(SR.WaitForEventsTimedOut(TimeSpan.Zero))); } } else { _readyEvents = existingReadyEvents; Complete(true); } }
protected virtual void DoApplyBuff(Mobile m) { if (m == null || m.Deleted || !ApplyBuff(m)) { return; } if (SoundID > 0) { m.PlaySound(SoundID); } if (EffectID > 0) { m.FixedParticles(EffectID, 10, 15, 5018, EffectLayer.Waist); } if (IconID > 0) { m.Send(new AddBuffPacket(m, new BuffInfo((BuffIcon)IconID, LabelNumber))); } if (DelayTimer != null && DelayTimer.Running) { DelayTimer.Stop(); } DelayTimer = Timer.DelayCall(BuffDuration, DoRemoveBuff, m); }
public override void OnGetInCard(ISFSObject data) { IsGetInBuZhangFinish = true; CurrSeat = data.GetInt(RequestKey.KeySeat); GetInMahJong(data); OnOperate(data); LeaveMahjongCnt--; //抓牌用户 听牌的 并且 当前无菜单提示 自动打牌 if (CurrSeat == PlayerSeat && IsTing[CurrSeat] && _switchGameOpreateMenu.IsForbiddenAll()) { OutCardDelayTimeIndex = DelayTimer.StartTimer( GameConfig.GetInCardRoteTime + GameConfig.GetInCardWaitTime + GameConfig.TingPaiWaitTime, () => EventDispatch.Dispatch((int)NetEventId.OnOutMahjong, new EventData(GetInMahjong))); } //自动打牌,抓啥打啥,仅测试用 if (CurrSeat == PlayerSeat && ziDongDaPai) { OutCardDelayTimeIndex = DelayTimer.StartTimer( GameConfig.GetInCardRoteTime + GameConfig.GetInCardWaitTime + GameConfig.TingPaiWaitTime, () => EventDispatch.Dispatch((int)NetEventId.OnOutMahjong, new EventData(GetInMahjong))); } //---------------------------*/ BuZhangGetInSeat = UtilDef.NullSeat; }
public void Prepare() { if (m_Contestants.Count > 1 && HaveUnoccupiedArena()) { foreach (Teams team in m_Contestants) { if (m_Tournament.Supplied) { foreach (Mobile m in team.getOwners()) { Manager.ItemsToBank((PlayerMobile)m); } } MoveTeam(team, m_NextArena.Map, m_NextArena.HoldingArea, "Entering the tournament grounds.", false); } // Broadcast "The tournament has begun." at the beginning of the tournament if (!m_TournamentStarted) { World.Broadcast(0x35, true, String.Format("The {0} tournament has begun.", m_Tournament.TeamSize)); m_TournamentStarted = true; } m_Matches = m_Bracket.SEGetRound(m_CurrentRound); DelayTimer delay = new DelayTimer(this, m_DelayStart); delay.Start(); } else { World.Broadcast(0x35, true, String.Format("The {0} tournament has been canceled due to lack of participants.", m_Tournament.TeamSize)); } }
public virtual void Send() { if (IsDisposed || Source == null || Sending) { return; } Sending = true; if (Delay > TimeSpan.Zero) { DelayTimer = Timer.DelayCall( Delay, () => { if (DelayTimer != null) { DelayTimer.Stop(); DelayTimer = null; } if (OnSend()) { OnAfterSend(); } }); } else { if (OnSend()) { OnAfterSend(); } } }
public List <MahjongItem> GetInMahjongWithRoat(int[] value) { List <MahjongItem> list = MahjongManager.Instance.GetMahjongList(value); var pos = Vector3.zero; if (MahjongList.Count > 0) { pos = MahjongList[MahjongList.Count - 1].transform.localPosition; } AddMahjong(list); foreach (MahjongItem item in list) { pos += new Vector3(MahjongManager.MagjongSize.x, 0, 0); item.transform.localPosition = pos; item.RotaTo(new Vector3(-90, 0, 0), Vector3.zero, GameConfig.GetInCardRoteTime, GameConfig.GetInCardWaitTime, () => { YxDebug.Log("补张的转动动画 完成"); }); } DelayTimer.StartTimer(GameConfig.GetInCardRoteTime + GameConfig.GetInCardWaitTime, () => { SortMahjongForHand(); SetMahjongPos(); YxDebug.Log("补张动画接受后排序"); }); return(list); }
public static Task <bool> DelayUntil(DateTime dueTime, CancellationToken cancellationToken = default(CancellationToken)) { var result = new DelayTimer(dueTime, cancellationToken); TimerManager <DelayTimer> .Register(result); return(result.Completion); }
public static void Schedule(this DelayTimer /*or whatever your timer class is*/ timer, Action action, int delay) { if (timer == null) { throw new ArgumentNullException("timer"); //null check needed because this method is not really an instance method } timer.Schedule(new MyTimerTask(action), delay); }
private void Start() { HP = MaxHP; gameManager = transform.root.GetComponent <GameManager>(); delayTimer = GetComponent <DelayTimer>(); delayTimer.SetTimerCapacity(2); DisableTarget(); }
private void Start() { thisTimer = GetComponent <DelayTimer>(); thisCollider = GetComponent <Collider>(); thisTimer.SetTimerCapacity(1); // delayTimerを予約 thisMeshRenderer.material = normalMaterial; }
public static Task DelayUntil(DateTime dueTime) { var result = new DelayTimer(dueTime); TimerManager <DelayTimer> .Register(result); return(result.Completion); }
public void CancelTimer() { if (_timer != null) { _timer.Cancel(); _timer = null; } }
/// <summary> /// Handle the update of the text for the control from any source, /// including the TextBox part and the Text dependency property. /// </summary> /// <param name="newText">The new text.</param> /// <param name="userInitiated">A value indicating whether the update /// is a user-initiated action. This should be a True value when the /// TextUpdated method is called from a TextBox event handler.</param> private void TextUpdated(string newText, bool userInitiated) { // Only process this event if it is coming from someone outside // setting the Text dependency property directly. if (IgnoreTextPropertyChange > 0) { IgnoreTextPropertyChange--; return; } if (newText == null) { newText = string.Empty; } // The TextBox.TextChanged event was not firing immediately and // was causing an immediate update, even with wrapping. If there is // a selection currently, no update should happen. if (IsTextCompletionEnabled && TextBox != null && TextBox.SelectionLength > 0 && TextBox.SelectionStart != TextBox.Text.Length) { return; } // Evaluate the conditions needed for completion. // 1. Minimum prefix length // 2. If a delay timer is in use, use it bool populateReady = newText.Length >= MinimumPrefixLength && MinimumPrefixLength >= 0; UserCalledPopulate = populateReady ? userInitiated : false; // Update the interface and values only as necessary UpdateTextValue(newText, userInitiated); if (populateReady) { IgnoreTextSelectionChange = true; if (DelayTimer != null) { DelayTimer.Start(); } else { PopulateDropDown(this, EventArgs.Empty); } } else { SearchText = null; SelectedItem = null; if (IsDropDownOpen) { IsDropDownOpen = false; } } }
// Use this for initialization public virtual void Start () { delayBeforTimer = new DelayTimer(); if (UseThisObject) { VisObject = this.gameObject; } //delayAfterTimer = new DelayTimer(DelayAfter); }
private void DurationTimer_Elapsed(object sender, ElapsedEventArgs e) { // Dispose previous DurationTimer.Dispose(); DurationTimer = null; // Wait for another ad DelayTimer.Start(); }
public void Clock() { SoundTimer.Tick(); DelayTimer.Tick(); lock (this) { ushort instruction = GetNextInstruction(); quit = ProcessInstruction(instruction); } }
private void ShowCopiedTextLabel(object sender, EventArgs e) { copiedAlertLabel.Visible = true; copiedAlertLabel.ForeColor = Color.Green; copiedAlertLabel.Text = "Copied!"; var t = new DelayTimer(); t.Interval = 5000; // it will Tick in 5 seconds t.Elapsed += this.HideInFiveSeconds; t.Start(); }
public void SetTimer(Action <object> callback, object state, TimeSpan timeout) { if (_timer != null) { throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.MustCancelOldTimer)); } _originalTimeout = timeout; //this.timer = new IOThreadTimer(callback, state, false); //this.timer.Set(timeout); _timer = new DelayTimer(callback, state, timeout); }
public void Stop() { // Stop timers DelayTimer.Stop(); if (DurationTimer != null) { DurationTimer.Stop(); DurationTimer.Dispose(); DurationTimer = null; } // Not visible Opacity = 0; }
public void Roll(Mobile from) { if (!m_Table.Contains(from)) { PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*{0} rolls {1}, {2}*", from.Name, Utility.Random(1, 6), Utility.Random(1, 6))); Timer t = new DelayTimer(from); m_Table[from] = t; t.Start(); } else from.SendAsciiMessage("You cannot use this again so soon"); }
private void FullScreen_Click(object sender, EventArgs e) { StopPlaying(); delay = (int)tfDelay.Value; InstrumentoPreview.Dock = DockStyle.Fill; InstrumentoPreview.Location = new Point((Width - InstrumentoPreview.Width) / 2, (Height - InstrumentoPreview.Height) / 2); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; DelayLabel.Text = tfDelay.Text; DelayLabel.Visible = true; DelayTimer.Start(); labelTransposicao.Visible = false; TransSemitones.Visible = false; }
private void Start() { delayTimer = GetComponent <DelayTimer>(); delayTimer.SetTimerCapacity(1); nameData = new NameData[transform.childCount]; Debug.Log(nameData); for (int i = 0; i < transform.childCount; i++) { nameData[i] = transform.GetChild(i).GetComponent <NameData>(); } ResetName(); }
private void Form_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Escape) { InstrumentoPreview.Dock = DockStyle.None; InstrumentoPreview.Location = new Point(12, 128); FormBorderStyle = FormBorderStyle.FixedDialog; WindowState = FormWindowState.Normal; DelayLabel.Visible = false; DelayTimer.Stop(); labelTransposicao.Visible = true; TransSemitones.Visible = true; StopPlaying(); } }
public MainForm() { InitializeComponent(); Text = $"{Application.ProductName} v{Application.ProductVersion} by {Application.CompanyName}"; notifyIcon1.Text = Application.ProductName; notifyIcon1.BalloonTipTitle = Application.ProductName; timer = new DelayTimer(1000); timer.OnNewState += Timer_OnNewState; timer.OnProgress += Timer_OnProgress; timer.OnNotSavedProjectNotify += Timer_OnNotSavedProjectNotify; LoadSettings(); }
public void Roll(Mobile from) { if (!m_Table.Contains(from)) { PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*{0} rolls {1}, {2}*", from.Name, Utility.Random(1, 6), Utility.Random(1, 6))); Timer t = new DelayTimer(from); m_Table[from] = t; t.Start(); } else { from.SendAsciiMessage("You cannot use this again so soon"); } }
public override void OnSendOverSortMahjong(float time, float wait, int laizi) { foreach (MahjongItem item in MahjongList) { item.RotaTo(new Vector3(-90, 0, 0), time); } DelayTimer.StartTimer(wait, () => { SetLaizi(laizi); foreach (MahjongItem item in MahjongList) { item.RotaTo(new Vector3(0, 0, 0), time); } }); }
public virtual void OnSendOverSortMahjong(float time, float wait, int laizi) { foreach (MahjongItem item in MahjongList) { item.RotaTo(new Vector3(-90, 0, 0), time); } DelayTimer.StartTimer(wait, () => { SortMahjongForHand(); SetMahjongPos(); foreach (MahjongItem item in MahjongList) { item.RotaTo(new Vector3(0, 0, 0), time); } }); }
public override void OnDoubleClick(Mobile from) { if (from.InRange(GetWorldLocation(), 2)) { if (!m_Table.Contains(from)) { PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*{0} rolls a {1}*", from.Name, Utility.Random(1, 3))); Timer t = new DelayTimer(from); m_Table[from] = t; t.Start(); } else from.SendAsciiMessage("You cannot use this again so soon"); } else from.SendAsciiMessage("You are to far away to use that!"); }
public TransformedCollection(INotifyCollectionChanged source, Func <IEnumerable <T>, IEnumerable <object> > transform) { if (!(source is IEnumerable <T>)) { throw new ArgumentException("source must be an IEnumerable<T>."); } this._source = (IEnumerable <T>)source; this._transform = transform; this._transformTimer = new DelayTimer(this.TransformItems, TimerDelay); this._setTimer = new DelayTimer(this.SetItems, TimerDelay); this._items = new List <T>(); this._depProps = new List <DependentProperty>(); this.SetItems(); this.TransformItems(); CollectionChangedEventManager.AddHandler(source, Source_CollectionChanged); }
protected virtual void DoRemoveBuff(Mobile from) { if (from == null || from.Deleted) { return; } if (RemoveBuff(from)) { from.Send(new RemoveBuffPacket(from, (BuffIcon)IconID)); if (DelayTimer != null && DelayTimer.Running) { DelayTimer.Stop(); } DelayTimer = null; } }
public void UpdateValues() { lblPC.Text = string.Format("0x{0:X2}", PC); lblI.Text = string.Format("0x{0:X2}", I); lblOpCode.Text = string.Format("0x{0:X2}", OpCode); lblCycle.Text = Cycle.ToString(); lblSP.Text = SP.ToString(); lblSoundTimer.Text = SoundTimer.ToString(); lblDelayTimer.Text = DelayTimer.ToString(); lbStackList.Items.Clear(); foreach (short sItem in Stack) { lbStackList.Items.Add(string.Format("0x{0:X4}", sItem)); } for (int i = 0; i < Registers.Length; i++) { ((Label)gbRegistersGroupBox.Controls["lblRegister_" + i]).Text = string.Format("0x{0:X2}", Registers[i]); } }
protected virtual void DoRemoveBuff(Mobile m) { if (m == null || m.Deleted || !RemoveBuff(m)) { return; } if (IconID > 0) { m.Send(new RemoveBuffPacket(m, (BuffIcon)IconID)); } if (DelayTimer != null && DelayTimer.Running) { DelayTimer.Stop(); } DelayTimer = null; }
public RestoreAutoPanMode() { m_timer = new DelayTimer(ResetPanMode); RestoreScale = double.NaN; }
public void Prepare() { if (m_Contestants.Count > 1 && HaveUnoccupiedArena()) { foreach (Teams team in m_Contestants) { if (m_Tournament.Supplied) foreach (Mobile m in team.getOwners()) Manager.ItemsToBank((PlayerMobile)m); MoveTeam(team, m_NextArena.Map, m_NextArena.HoldingArea, "Entering the tournament grounds.", false); } // Broadcast "The tournament has begun." at the beginning of the tournament if (!m_TournamentStarted) { World.Broadcast(0x35, true, String.Format("The {0} tournament has begun.", m_Tournament.TeamSize)); m_TournamentStarted = true; } m_Matches = m_Bracket.SEGetRound(m_CurrentRound); DelayTimer delay = new DelayTimer(this, m_DelayStart); delay.Start(); } else World.Broadcast(0x35, true, String.Format("The {0} tournament has been canceled due to lack of participants.", m_Tournament.TeamSize)); }
public MephitisCocoon( PlayerMobile target ) : base(0x10da) { Weight = 1.0; int nCocoonID = (int) ( 3 * Utility.RandomDouble() ); ItemID = 4314 + nCocoonID; // is this correct itemid? target.Frozen = true; target.Hidden = true; target.SendLocalizedMessage( 1042555 ); // You become entangled in the spider web. m_Timer = new DelayTimer( this, target ); m_Timer.Start(); }
public RestoreAutoPanMode() { m_timer = new DelayTimer(ResetPanMode); }