private void TextBox_RequestLink_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!TextBox_RequestLink.IsReadOnly)
            {
                if (TextBox_RequestLink.IsFocused && RequestDirectory != null)
                {
                    var RequestItem = new WebRequestItem();
                    RequestItem.Id   = RequestDirectory.WebRequestId;
                    RequestItem.Link = GeneralLogic.RequestLink;

                    Sender.SendToServer("WebRequestItem.Update.Link", RequestItem);
                }

                if (TextBox_RequestLink.IsFocused && GeneralLogic.RequestMethod == "GET")
                {
                    if (Timer_EditorRequestData_PropertyChanged != null && Timer_EditorRequestData_PropertyChanged.IsEnabled)
                    {
                        Timer_EditorRequestData_PropertyChanged.Stop();
                    }

                    Timer_EditorRequestData_PropertyChanged = CustomTimer.Create(delegate(object sender, EventArgs e)
                    {
                        if (GeneralLogic.RequestMethod != "GET")
                        {
                            return;
                        }

                        UpdateDataGrid_OnTextBox();
                    }, new TimeSpan(0, 0, 1));
                }
            }
        }
Ejemplo n.º 2
0
    public static IEnumerator StartHitstun()
    {
        HitStunEnabled = true;
        yield return(CustomTimer.Timer(.075f));        //Hitstun time

        HitStunEnabled = false;
    }
        /// <summary>
        /// Конструктор редактора.
        /// </summary>
        /// <param name="TabItemView">Собственный TAB компонент</param>
        public void Construct(HeaderedItemViewModel TabItemView)
        {
            this.TabItemView        = TabItemView;
            GeneralLogic.HeaderName = TabItemView.Header.ToString();

            Start();
            WindowActions();

            CustomTimer.Create(delegate(object sender, EventArgs e)
            {
                GeneralLogic.RequestMethod_SetComboBoxItem(ComboBox_RequestType);

                if (RequestDirectory != null)
                {
                    int NetworkUid = Guid.NewGuid().GetHashCode();

                    GeneralLogic.LoadRequestDirectory(this, NetworkUid);
                    LEditorNetworkActions.RequestParamsItemsGet_Confirm(this, NetworkUid);
                }
                else
                {
                    GeneralLogic.SetHeaderName(TabItemView);
                }
            }, new TimeSpan(0, 0, 0, 0, 500));
        }
    //Delay before the player can click to swing again.
    private IEnumerator DelayBetweenClick(float time)
    {
        //Debug.Log("Player can click.");
        yield return(CustomTimer.Timer(time));

        DelayHasPassed = true;
    }
Ejemplo n.º 5
0
        public void Returns_empty_timer_if_not_timer_metric()
        {
            var timer = new CustomTimer();
            var value = timer.GetValueOrDefault();

            value.Should().NotBeNull();
        }
Ejemplo n.º 6
0
    public static CustomTimer GetCustomTimer(string name)
    {
        CustomTimer customTimer = null;

        dicoCustomTimers.TryGetValue(name, out customTimer);
        return(customTimer);
    }
Ejemplo n.º 7
0
        //Set a delay before warping to check line of sight.
        private IEnumerator TimeBeforeWarping()
        {
            yield return(CustomTimer.Timer(.75f));

            TransitionToState(PetState.WarpToPlayer);
            TimeBetweenWarpsCoroutine = StartCoroutine(DelayBetweenWarping());
        }
Ejemplo n.º 8
0
 public GameEffect()
     : base("effect")
 {
     mActiveTimer = new CustomTimer();
     mLifeTimer   = new CustomTimer();
     mPlayState   = PLAY_STATE.PS_STOP;
 }
Ejemplo n.º 9
0
        public BreakTimerViewModel(IEventAggregator eventAggregator, IWindowManager windowManager)
        {
            _eventAggregator = eventAggregator;
            _windowManager   = windowManager;

            _timer = new CustomTimer(TimerTick);
        }
Ejemplo n.º 10
0
        //private IEnumerator AttackDelayTime()
        //{
        //    float rand = UnityEngine.Random.Range(.35f, 1.35f);
        //    yield return CustomTimer.Timer(rand);
        //    _canAttack = true;
        //    canStartAttackDelayTime = true;
        //}

        //Attack time before going back to followTarget.
        private IEnumerator AttackTime(float time)
        {
            yield return(CustomTimer.Timer(time));

            _canReposition     = true;
            CurrentAttackState = RaccoonAttackState.FollowTarget;
        }
Ejemplo n.º 11
0
    //Sets a delay to attack even if the pet isn't outside the reposition radius
    private IEnumerator AttackEnemyDelay()
    {
        yield return(CustomTimer.Timer(.75f));

        //Debug.Log("Attacking anyways");
        AttackCoroutine = StartCoroutine(AttackEnemy());
    }
        private void ChatSendMessage()
        {
            string Message = TextBox_Message.Text;

            if (Message.Trim() != string.Empty)
            {
                Chat PreMessage = new Chat();
                PreMessage.Message   = Message;
                PreMessage.ProjectId = ProjectData.SelectedProject.Id;

                if (!Sender.SendToServer("Chat.Messages.New", PreMessage))
                {
                    new AlertWindow("Ошибка", AlertWindow.AlertCode.SendToServer);
                }
                else
                {
                    TextBox_Message.IsEnabled = false;
                    Button_Send.IsEnabled     = false;

                    MessageDelay = CustomTimer.Create((object sender, EventArgs e) =>
                    {
                        new AlertWindow("Ошибка", "Превышено время ожидания ответа от сервера. Сообщение не отправлено.",
                                        () =>
                        {
                            if (this != null)
                            {
                                TextBox_Message.IsEnabled = true;
                                Button_Send.IsEnabled     = true;
                            }
                        });
                    }, new TimeSpan(0, 0, 3));
                }
            }
        }
Ejemplo n.º 13
0
    private IEnumerator Invincibility()
    {
        Invincible = true;
        yield return(CustomTimer.Timer(2f));

        Invincible = false;
    }
 public void Register(CustomTimer timer)
 {
     if (timer == null)
         throw new ArgumentNullException();
     Console.WriteLine("MicrowaveAlarm is now registered");
     timer.TimeIsUp += MicrowaveAlarmMsg;
 }
 public void Unregister(CustomTimer timer)
 {
     if (timer==null)
         throw new ArgumentNullException();
     Console.WriteLine("HandWatchAlarm is now unregistered");
     timer.TimeIsUp -= AlarmMsg;
 }
Ejemplo n.º 16
0
    private IEnumerator SetKnockedState()
    {
        currentState = EnemyState.Knocked;
        yield return(CustomTimer.Timer(.25f));

        currentState = EnemyState.Idle;
    }
Ejemplo n.º 17
0
        private IEnumerator ForceDeviationChange()
        {
            yield return(CustomTimer.Timer(.5f));

            _forcingMovementTowardsPlayer = false;
            _canChangeDeviation           = true;
        }
    //Time between swings
    private IEnumerator SwingTimer(float time)
    {
        yield return(CustomTimer.Timer(time));

        CanSwing = true;
        controller.TransitionToState(CharacterState.Default);
        DelayBetweenComboResetCoroutine = StartCoroutine(DelayBetweenComboReset(.25f));
    }
Ejemplo n.º 19
0
        //Random time between each reposition.
        private IEnumerator RepositionTime(float range1, float range2)
        {
            float rand = UnityEngine.Random.Range(range1, range2);

            yield return(CustomTimer.Timer(rand));

            _canReposition = true;
        }
 /// <summary>
 /// Compress image using fractal compression and using specified options.
 /// </summary>
 /// <param name="image"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public FractalCompressionResult CompressUsingFractalCompression(CustomImage image, FractalCompressionOptions options)
 {
     using (var timer = new CustomTimer("Fractal Compression"))
     {
         FractalCompression compression = new FractalCompression(options);
         return(compression.Compress(image));
     }
 }
Ejemplo n.º 21
0
 protected bool mInited;                                          // 是否已经初始化,子节点在初始化时需要先确保父节点已经初始化
 public SceneProcedure(GameScene gameScene)
 {
     mGameScene          = gameScene;
     mDelayCmdList       = new List <int>();
     mChildProcedureList = new Dictionary <Type, SceneProcedure>();
     mPrepareTimer       = new CustomTimer();
     mPrepareIntent      = null;
 }
Ejemplo n.º 22
0
    //Stop this coroutine if knocked.
    IEnumerator TargetPlayerDelay()
    {
        yield return(CustomTimer.Timer(1f));

        currentState = EnemyState.Random;
        lastdir      = -(target - transform.position).normalized;
        yield return(null);
    }
Ejemplo n.º 23
0
	void Awake () {
		if(instance == null)
			instance = this;
		else if(instance != this)
			Destroy(gameObject);
		_gameTimer = Time.timeSinceLevelLoad;
			
	}
Ejemplo n.º 24
0
 protected bool mDeadClient;                                                 // 该客户端是否已经断开连接或者心跳超时
 public NetClient(SocketConnectServer server)
 {
     mServer         = server;
     mHeartBeatTimer = new CustomTimer();
     mReceiveBuffer  = new DoubleBuffer <SocketPacket>();
     mRecvBytes      = new StreamBuffer(1024 * 1024);    // 默认开1MB的缓存
     mOutputBuffer   = new DoubleBuffer <byte[]>();
 }
Ejemplo n.º 25
0
    private IEnumerator CanShootDelay()
    {
        canShoot = false;
        yield return(CustomTimer.Timer(.5f));

        canShoot        = true;
        canStartBowHold = true;
    }
Ejemplo n.º 26
0
    //When a path can't be created to the enemy...
    private IEnumerator CantReachEnemyDelay()
    {
        CanReachEnemy = false;
        currentState  = PetStatev2.Wait;
        //Debug.Log("Entered wait state");
        yield return(CustomTimer.Timer(.75f));

        currentState = PetStatev2.Idle;
    }
Ejemplo n.º 27
0
    //Hitstun coroutine
    public IEnumerator HitstunCo()
    {
        PetStatev2 lastState = currentState;

        currentState = PetStatev2.Hitstun;
        yield return(CustomTimer.Timer(.075f));

        currentState = lastState;
    }
Ejemplo n.º 28
0
        //Transition to default state while in midair after x amount of time.
        //private IEnumerator TimeBeforeFallingStateCoroutine()
        //{
        //    yield return CustomTimer.Timer(.1f);
        //    TransitionToState(RaccoonState.Default);
        //}
        //Greyed out for now until we can tell the raccoon to go back to its last state after falling.

        //Reaction time to detect something.
        private IEnumerator DetectionReactionTime()
        {
            float reactionTime = .35f;

            yield return(CustomTimer.Timer(reactionTime));

            TransitionToState(RaccoonState.Alerted);
            _canStartReactionTime = true; //Reset
        }
 public void Unregister(CustomTimer timer)
 {
     if (timer == null)
     {
         throw new ArgumentNullException();
     }
     Console.WriteLine("HandWatchAlarm is now unregistered");
     timer.TimeIsUp -= AlarmMsg;
 }
Ejemplo n.º 30
0
 IEnumerator TypeSentenceAnim(string sentence)
 {
     dialogueText.text = "";
     foreach (char letter in sentence.ToCharArray())
     {
         dialogueText.text += letter;
         yield return(CustomTimer.Timer(.015f));
     }
 }
Ejemplo n.º 31
0
    //Hitstun coroutine
    public IEnumerator HitstunCo()
    {
        //PlayerState lastState = currentState;
        SetState(PlayerState.Hitstun, true);
        yield return(CustomTimer.Timer(.075f));

        SetState(PlayerState.Hitstun, false);
        Debug.Log("Hitstun ended");
    }
Ejemplo n.º 32
0
 private static void GameOnOnIngameUpdate(EventArgs args)
 {
     if (LastGameState != Game.GameState)
     {
         OnGameStatusChange(Game.GameState);
         LastGameState = Game.GameState;
     }
     CustomTimer.Cycle();
 }
 static void Main(string[] args)
 {
     CustomTimer customTimer=new CustomTimer();
     MicrowaveAlarm microwaveAlarm=new MicrowaveAlarm(customTimer);
     HandWatchAlarm handWatchAlarm=new HandWatchAlarm(customTimer);
     customTimer.StartTimer(5);
     Thread.Sleep(5500);
     microwaveAlarm.Unregister(customTimer);
     customTimer.StartTimer(3);
     Thread.Sleep(3500);
     handWatchAlarm.Unregister(customTimer);
     Console.ReadKey();
 }
Ejemplo n.º 34
0
        static void Main(string[] args)
        {
            Random random = new Random();

            CustomTimer timer = new CustomTimer();

            Console.WriteLine("ICacheManager<int, int>");
            for (int j = 0; j < 10; ++j)
            {
                ICacheManager<int, int> cacheManager = new CacheManager<int, int>();

                timer.Start();

                // No concurrency insertions
                for (int i = 0; i < 1000000; ++i)
                {
                    cacheManager.AddEntry(random.Next(int.MaxValue), i);
                }

                timer.StopAndReport();

                GC.Collect(2);
                GC.WaitForFullGCComplete();
            }
            Console.WriteLine("");

            Console.WriteLine("ICacheManager<int, string>");
            for (int j = 0; j < 10; ++j)
            {
                ICacheManager<int, string> cacheManager = new CacheManager<int, string>();

                timer.Start();

                // No concurrency insertions
                for (int i = 0; i < 1000000; ++i)
                {
                    cacheManager.AddEntry(random.Next(int.MaxValue), "dummy string " + i);
                }

                timer.StopAndReport();

                GC.Collect(2);
                GC.WaitForFullGCComplete();
            }
            Console.WriteLine("");

            Console.WriteLine("ICacheManager<int, string, int>");
            for (int j = 0; j < 10; ++j)
            {
                ICacheManager<int, string, int> cacheManager = new CacheManager<int, string, int>();

                timer.Start();

                // No concurrency insertions
                for (int i = 0; i < 1000000; ++i)
                {
                    cacheManager.AddEntry(random.Next(int.MaxValue), "dummy string " + i);
                }

                timer.StopAndReport();

                GC.Collect(2);
                GC.WaitForFullGCComplete();
            }
            Console.WriteLine("");

            Console.ReadLine();
        }