Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
            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);
                }
            }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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));
            }
        }
Ejemplo n.º 6
0
        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();
                }
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
 }
Ejemplo n.º 10
0
 private void Start()
 {
     HP          = MaxHP;
     gameManager = transform.root.GetComponent <GameManager>();
     delayTimer  = GetComponent <DelayTimer>();
     delayTimer.SetTimerCapacity(2);
     DisableTarget();
 }
Ejemplo n.º 11
0
    private void Start()
    {
        thisTimer    = GetComponent <DelayTimer>();
        thisCollider = GetComponent <Collider>();
        thisTimer.SetTimerCapacity(1); // delayTimerを予約

        thisMeshRenderer.material = normalMaterial;
    }
Ejemplo n.º 12
0
        public static Task DelayUntil(DateTime dueTime)
        {
            var result = new DelayTimer(dueTime);

            TimerManager <DelayTimer> .Register(result);

            return(result.Completion);
        }
Ejemplo n.º 13
0
 public void CancelTimer()
 {
     if (_timer != null)
     {
         _timer.Cancel();
         _timer = null;
     }
 }
Ejemplo n.º 14
0
        /// <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();
        }
Ejemplo n.º 17
0
Archivo: CPU.cs Proyecto: LesCol/Chip8
 public void Clock()
 {
     SoundTimer.Tick();
     DelayTimer.Tick();
     lock (this) {
         ushort instruction = GetNextInstruction();
         quit = ProcessInstruction(instruction);
     }
 }
Ejemplo n.º 18
0
        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();
        }
Ejemplo n.º 19
0
            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;
        }
Ejemplo n.º 21
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");
 }
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
    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();
    }
Ejemplo n.º 24
0
 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();
     }
 }
Ejemplo n.º 25
0
        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();
        }
Ejemplo n.º 26
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");
     }
 }
Ejemplo n.º 27
0
        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);
                }
            });
        }
Ejemplo n.º 28
0
        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);
                }
            });
        }
Ejemplo n.º 29
0
        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);
        }
Ejemplo n.º 31
0
        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;
            }
        }
Ejemplo n.º 32
0
 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]);
     }
 }
Ejemplo n.º 33
0
        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;
		}
Ejemplo n.º 35
0
        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));
        }
Ejemplo n.º 36
0
            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);
		}