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)); } } }
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; }
public void Returns_empty_timer_if_not_timer_metric() { var timer = new CustomTimer(); var value = timer.GetValueOrDefault(); value.Should().NotBeNull(); }
public static CustomTimer GetCustomTimer(string name) { CustomTimer customTimer = null; dicoCustomTimers.TryGetValue(name, out customTimer); return(customTimer); }
//Set a delay before warping to check line of sight. private IEnumerator TimeBeforeWarping() { yield return(CustomTimer.Timer(.75f)); TransitionToState(PetState.WarpToPlayer); TimeBetweenWarpsCoroutine = StartCoroutine(DelayBetweenWarping()); }
public GameEffect() : base("effect") { mActiveTimer = new CustomTimer(); mLifeTimer = new CustomTimer(); mPlayState = PLAY_STATE.PS_STOP; }
public BreakTimerViewModel(IEventAggregator eventAggregator, IWindowManager windowManager) { _eventAggregator = eventAggregator; _windowManager = windowManager; _timer = new CustomTimer(TimerTick); }
//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; }
//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)); } } }
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; }
private IEnumerator SetKnockedState() { currentState = EnemyState.Knocked; yield return(CustomTimer.Timer(.25f)); currentState = EnemyState.Idle; }
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)); }
//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)); } }
protected bool mInited; // 是否已经初始化,子节点在初始化时需要先确保父节点已经初始化 public SceneProcedure(GameScene gameScene) { mGameScene = gameScene; mDelayCmdList = new List <int>(); mChildProcedureList = new Dictionary <Type, SceneProcedure>(); mPrepareTimer = new CustomTimer(); mPrepareIntent = null; }
//Stop this coroutine if knocked. IEnumerator TargetPlayerDelay() { yield return(CustomTimer.Timer(1f)); currentState = EnemyState.Random; lastdir = -(target - transform.position).normalized; yield return(null); }
void Awake () { if(instance == null) instance = this; else if(instance != this) Destroy(gameObject); _gameTimer = Time.timeSinceLevelLoad; }
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[]>(); }
private IEnumerator CanShootDelay() { canShoot = false; yield return(CustomTimer.Timer(.5f)); canShoot = true; canStartBowHold = true; }
//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; }
//Hitstun coroutine public IEnumerator HitstunCo() { PetStatev2 lastState = currentState; currentState = PetStatev2.Hitstun; yield return(CustomTimer.Timer(.075f)); currentState = lastState; }
//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; }
IEnumerator TypeSentenceAnim(string sentence) { dialogueText.text = ""; foreach (char letter in sentence.ToCharArray()) { dialogueText.text += letter; yield return(CustomTimer.Timer(.015f)); } }
//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"); }
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(); }
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(); }