public HomeMenuModel() { _content1Property = new WProperty(typeof(object), null); _content2Property = new WProperty(typeof(object), null); _contentProperties = new[] { _content1Property, _content2Property }; _contentIndexProperty = new WProperty(typeof(int), 0); _selectedItemProperty = new WProperty(typeof(ListItem), null); _menuEditModelProperty = new WProperty(typeof(MenuEditModel), null); _updateEvent = new DelayedEvent(UPDATE_DELAY_MS); _updateEvent.OnEventHandler += OnUpdate; _selectedItemProperty.Attach(OnSelectedItemChanged); GetMediaListModel().Limit = CONTENT_LIST_LIMIT; GetAppListModel().Limit = CONTENT_LIST_LIMIT; _homeContent.Add(new Guid("80d2e2cc-baaa-4750-807b-f37714153751"), new MovieHomeContent()); _homeContent.Add(new Guid("30f57cba-459c-4202-a587-09fff5098251"), new SeriesHomeContent()); _homeContent.Add(new Guid("30715d73-4205-417f-80aa-e82f0834171f"), new AudioHomeContent()); _homeContent.Add(new Guid("55556593-9fe9-436c-a3b6-a971e10c9d44"), new ImageHomeContent()); _homeContent.Add(new Guid("A4DF2DF6-8D66-479a-9930-D7106525EB07"), new VideoHomeContent()); _homeContent.Add(new Guid("b4a9199f-6dd4-4bda-a077-de9c081f7703"), new TVHomeContent()); _homeContent.Add(new Guid("bb49a591-7705-408f-8177-45d633fdfad0"), new NewsHomeContent()); _homeContent.Add(new Guid("e34fdb62-1f3e-4aa9-8a61-d143e0af77b5"), new WeatherHomeContent()); _homeContent.Add(new Guid("873eb147-c998-4632-8f86-d5e24062be2e"), new LauncherHomeContent()); _homeContent.Add(new Guid("c33e39cc-910e-41c8-bffd-9eccd340b569"), new OnlineVideosHomeContent()); _homeContent.Add(new Guid("2ded75c0-5eae-4e69-9913-6b50a9ab2956"), new WebradioHomeContent()); // Home content for displaying a list of all other plugins _homeContent.Add(OtherPluginsAction.ACTION_ID, new OtherPluginsHomeContent(_otherMenuItems)); SubscribeToMessages(); }
private void ListBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { ListBoxItem item = ListBox.SelectedItem as ListBoxItem; Home.Background = new SolidColorBrush(Colors.Transparent); MyFrame.BackStack.Clear(); MyFrame.Navigate(typeof(HomePage), this, new SuppressNavigationTransitionInfo()); if (Home.IsSelected) { HomeEvent?.Invoke(); } else if (Today.IsSelected) { TodayEvent?.Invoke(); } else if (Upcoming.IsSelected) { UpcomingEvent?.Invoke(); } else if (Delayed.IsSelected) { DelayedEvent?.Invoke(); } else if (AssignedToOthers.IsSelected) { AssignedToOthersEvent?.Invoke(); } }
public override void OnUpdate() { if (DelayedEvent.WasSent(this.delayedEvent)) { base.Finish(); } }
private void OnEvtComplete(DelayedEvent evt) { evt.Triggered -= OnEvtComplete; activeEvents.Remove(evt); eventPool.ReleaseItem(evt); Debug.Log("Delayed event started at " + evt.startTime + " completed at "+ evt.endTime); }
private void DoBlendAnimation(GameObject go) { if (go == null) { return; } Animation animation = go.GetComponent <Animation>(); if (animation == null) { LogWarning("Missing Animation component on GameObject: " + go.name); Finish(); return; } AnimationState animationState = animation[animName.Value]; if (animationState == null) { LogWarning("Missing animation: " + animName.Value); Finish(); return; } float value = time.Value; animation.Blend(animName.Value, targetWeight.Value, value); if (finishEvent != null) { delayedFinishEvent = base.Fsm.DelayedEvent(finishEvent, animationState.length); } else { Finish(); } }
public override void OnEnter() { if (reset.Value) { eventIndex = 0; reset.Value = false; } var eventCount = State.Transitions.Length; if (eventCount > 0) { var fsmEvent = State.Transitions[eventIndex].FsmEvent; if (delay.Value < 0.001f) { Fsm.Event(fsmEvent); Finish(); } else { delayedEvent = Fsm.DelayedEvent(fsmEvent, delay.Value); } eventIndex++; if (eventIndex == eventCount) { eventIndex = 0; } } }
public override void OnEnter() { this.go = base.Fsm.GetOwnerDefaultTarget(this.gameObject); if (this.go == null) { base.Finish(); return; } PlayMakerFSM gameObjectFsm = ActionHelpers.GetGameObjectFsm(this.go, this.fsmName.Value); if (gameObjectFsm == null) { if (this.requireReceiver) { this.LogError("GameObject doesn't have FsmComponent: " + this.go.name + " " + this.fsmName.Value); } return; } if ((double)this.delay.Value < 0.001) { gameObjectFsm.Fsm.Event(this.sendEvent.Value); base.Finish(); } else { this.delayedEvent = gameObjectFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(this.sendEvent.Value), this.delay.Value); } }
private void OnEvtComplete(DelayedEvent evt) { evt.Triggered -= OnEvtComplete; activeEvents.Remove(evt); eventPool.ReleaseItem(evt); Debug.Log("Delayed event started at " + evt.startTime + " completed at " + evt.endTime); }
private void DoBlendAnimation(GameObject go) { if (go == null) { return; } Animation component = go.GetComponent <Animation>(); if (component == null) { this.LogWarning("Missing Animation component on GameObject: " + go.name); base.Finish(); return; } AnimationState animationState = component[this.animName.Value]; if (animationState == null) { this.LogWarning("Missing animation: " + this.animName.Value); base.Finish(); return; } float value = this.time.Value; component.Blend(this.animName.Value, this.targetWeight.Value, value); if (this.finishEvent != null) { this.delayedFinishEvent = base.Fsm.DelayedEvent(this.finishEvent, animationState.length); } else { base.Finish(); } }
protected AbstractSearchScreenData(string screen, string menuItemLabel, PlayableItemCreatorDelegate playableItemCreator, bool applyUserFilter = true) : base(screen, menuItemLabel, null, playableItemCreator, false) { _applyUserFilter = applyUserFilter; _delayedEvent = new DelayedEvent(Consts.TS_SEARCH_TEXT_TYPE.TotalMilliseconds); _delayedEvent.OnEventHandler += OnSearchTimerElapsed; }
public override void OnEnter() { var eventCount = State.Transitions.Length; if (eventCount > 0) { var fsmEvent = State.Transitions[eventIndex].FsmEvent; if (delay.Value < 0.001f) { Fsm.Event(fsmEvent); Finish(); } else { delayedEvent = Fsm.DelayedEvent(fsmEvent, delay.Value); } eventIndex++; if (eventIndex == eventCount) { eventIndex = 0; } } }
public static void AddListener(Action action, string key) { string path = $"{action.Method.DeclaringType?.FullName}.{action.Method.Name}"; DelayedEvent delayedEvent = new DelayedEvent() { path = path, key = key }; if (instance.delayedEvents.FindIndex(e => e.path == path) != -1) { Debug.LogError(path + " already be registered."); } else if (!action.Method.IsStatic) { Debug.LogError(path + " is not static method."); } else if (action.Method.Name.StartsWith("<")) { Debug.LogError(path + " is anonymous method."); } else { instance.delayedEvents.Add(delayedEvent); } }
public void GameUpdate() { //Loop through the array backwards to avoid dysnc for (int i = queue.Count - 1; i >= 0; i--) { //Get the event we are checking DelayedEvent call = queue[i]; //Add the passed time to this event call.currentTime += Time.deltaTime; //Debug.Log("Event Time: "+call.currentTime + "/" + call.maxTime); //Check if this events passed time is greater than its call time if (call.currentTime > call.maxTime) { //Debug.Log("Firing Event " + call.currentTime + "/"+call.maxTime); //Invoke each action in this event. foreach (UnityAction action in call.actions) { action.Invoke(); } //Remove it from the list queue.RemoveAt(i); } } }
void DoBlendAnimation(GameObject go) { if (go == null) return; if (go.animation == null) { LogWarning("Missing Animation component on GameObject: " + go.name); return; } AnimationState anim = go.animation[animName.Value]; if (anim == null) { LogWarning("Missing animation: " + animName.Value); return; } float timeValue = time.Value; go.animation.Blend(animName.Value, targetWeight.Value, timeValue); // TODO: doesn't work well with scaled time if (finishEvent != null) delayedFinishEvent = new DelayedEvent(Fsm, finishEvent, anim.length); else Finish(); }
public override void OnEnter() { go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { Finish(); return; } var sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value); if (sendToFsm == null) { if (requireReceiver) { LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value); } return; } if (delay.Value < 0.001) { sendToFsm.Fsm.Event(sendEvent.Value); Finish(); } else { delayedEvent = sendToFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value); } }
protected void Update() { if (this.delayedEvents.Count != 0) { this.delayedEventIdx = this.delayedEvents.Count - 1; while (this.delayedEventIdx >= 0) { if ((UnityEngine.Object) this.delayedEvents[this.delayedEventIdx].container == (UnityEngine.Object)null || (UnityEngine.Object) this.delayedEvents[this.delayedEventIdx].container.gameObject == (UnityEngine.Object)null) { this.delayedEvents.RemoveAt(this.delayedEventIdx); } else { this.delayedEvents[this.delayedEventIdx].timer -= Time.deltaTime; if (this.delayedEvents[this.delayedEventIdx].timer <= 0.0) { DelayedEvent delayedEvent = this.delayedEvents[this.delayedEventIdx]; delayedEvent.container.TriggerEvent(delayedEvent.eventName, delayedEvent.args); this.delayedEvents.RemoveAt(this.delayedEventIdx); } } this.delayedEventIdx--; } } }
public override void OnUpdate() { if (DelayedEvent.WasSent(delayedEvent)) { Finish(); } }
private void DoBlendAnimation(GameObject go) { if (go == null) { return; } Animation component = go.GetComponent<Animation>(); if (component == null) { this.LogWarning("Missing Animation component on GameObject: " + go.name); base.Finish(); return; } AnimationState animationState = component[this.animName.Value]; if (animationState == null) { this.LogWarning("Missing animation: " + this.animName.Value); base.Finish(); return; } float value = this.time.Value; component.Blend(this.animName.Value, this.targetWeight.Value, value); if (this.finishEvent != null) { this.delayedFinishEvent = base.Fsm.DelayedEvent(this.finishEvent, animationState.length); } else { base.Finish(); } }
/// <summary> /// Creates and initializes a new internal <see cref="_DeviceVolumeMonitor"/> instance. /// </summary> /// <param name="monitor">The DeviceVolumeMonitor instance that ownes this object.</param> public _DeviceVolumeMonitor(DeviceVolumeMonitor monitor) { _monitor = monitor; _knownDrives = GetCurrentDriveLetters(); _checkDrivesTimer = new DelayedEvent(2000); _checkDrivesTimer.OnEventHandler += CheckDrives; }
public override void OnEnter() { if (State.Transitions.Length == 0) return; delayedEvent = new DelayedEvent(Fsm, GetRandomEvent(), delay.Value); delayedEvent.Update(); }
public override void OnEnter() { go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value; if (go == null) { Finish(); return; } PlayMakerFSM sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value); if (sendToFsm == null) { if (requireReceiver) { LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value); } return; } delayedEvent = new DelayedEvent(sendToFsm, sendEvent.Value, delay.Value); delayedEvent.Update(); }
private void EventHandler(object sender, FileSystemEventArgs e) { try { var delayStr = eventDelay.TotalMilliseconds == 0 ? "no delay" : string.Format("will be delayed for {0}", eventDelay); if (e.ChangeType == WatcherChangeTypes.Created) { Util.WriteLog(string.Format("Created {0}, {1}", e.FullPath, delayStr)); } else if (e.ChangeType == WatcherChangeTypes.Changed) { Util.WriteLog(string.Format("Changed {0}, {1}", e.FullPath, delayStr)); } else if (e.ChangeType == WatcherChangeTypes.Deleted) { Util.WriteLog(string.Format("Deleted {0}, {1}", e.FullPath, delayStr)); } else if (e.ChangeType == WatcherChangeTypes.Renamed) { Util.WriteLog(string.Format("Renamed {0} to {1}, {2}", ((RenamedEventArgs)e).OldFullPath, e.FullPath, delayStr)); } if (filenameMatchRegexObj != null && !filenameMatchRegexObj.IsMatch(e.FullPath)) { Util.WriteLog(string.Format("File {0} does not match regex {1}. Skipping the file.", e.FullPath, filenameMatchRegex)); return; } // make sure that timer object gets inserted into DelayedEvent var msDelay = eventDelay.TotalMilliseconds < 10 ? 10 : (int)eventDelay.TotalMilliseconds; DelayedEvent delayedEvent; if (DelayedEvents.ContainsKey(e.FullPath)) { Util.WriteLog(string.Format("Delaying existing event for {0}", e.FullPath)); delayedEvent = DelayedEvents[e.FullPath]; delayedEvent.FileSystemEvent = e; delayedEvent.Timer.Change(msDelay, Timeout.Infinite); return; } // new event delayedEvent = new DelayedEvent(); DelayedEvents.Add(e.FullPath, delayedEvent); delayedEvent.FileSystemEvent = e; var timer = new Timer(EventHandlerTimerCallback, delayedEvent, msDelay, Timeout.Infinite); delayedEvent.Timer = timer; } catch (Exception ex) { Util.LogError(ex); } }
public override void OnUpdate() { DoSetFsmVariable(); if(!everyFrame) { if(DelayedEvent.WasSent(delayedEvent)) Finish(); } else Fsm.Event(eventTarget, sendEvent); }
public override void OnEnter() { if (State.Transitions.Length == 0) { return; } delayedEvent = new DelayedEvent(Fsm, GetRandomEvent(), delay.Value); delayedEvent.Update(); }
public override void OnEnter() { DoSetFsmVariable(); if(delay.Value < 0.001f) { Fsm.Event(eventTarget, sendEvent); if(!everyFrame) Finish(); } else delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value); }
public override void OnEnter() { if (this.delay.Value < 0.001f) { base.Fsm.Event(this.eventTarget, this.sendEvent); base.Finish(); } else { this.delayedEvent = base.Fsm.DelayedEvent(this.eventTarget, this.sendEvent, this.delay.Value); } }
public bool PreCondition(DelayedEvent delayedEvent) { var commandResult = ModuleTools.ExecuteCommand(preConditionCommand, delayedEvent, this, settings, ModuleBase.PREFIX_PRECONDITION); if (commandResult.Error != null) { Util.LogError(commandResult.Error); return(false); } Util.WriteLog(string.Format("ExitCode {0}, expected {1}", commandResult.ExitCode, preConditionExpectedExitCode)); return(commandResult.ExitCode == preConditionExpectedExitCode); }
protected void Init() { _currentContentIndexProperty = new WProperty(typeof(int), 0); _isContentFocusedProperty = new WProperty(typeof(bool), false); _focusedContentIndexProperty = new WProperty(typeof(int), -1); _content0ActionIdProperty = new WProperty(typeof(string), null); _content1ActionIdProperty = new WProperty(typeof(string), null); _updateEvent = new DelayedEvent(UPDATE_DELAY_MS); _updateEvent.OnEventHandler += OnUpdate; SubscribeToMessages(); }
public override void OnEnter() { if (delay.Value == 0f) { Fsm.Event(sendEvent); Finish(); } else { delayedEvent = new DelayedEvent(Fsm, sendEvent, delay.Value); } }
public override void OnEnter() { if (this.delay.Value < 0.001f) { base.Fsm.Event(this.eventTarget, this.sendEvent.Value); base.Finish(); } else { this.delayedEvent = base.Fsm.DelayedEvent(this.eventTarget, FsmEvent.GetFsmEvent(this.sendEvent.Value), this.delay.Value); } }
public override void OnEnter() { if (delay.Value == 0f) { Fsm.Event(eventTarget, sendEvent); Finish(); } else { delayedEvent = new DelayedEvent(Fsm, eventTarget, sendEvent, delay.Value); } }
public override void OnEnter() { if (delay.Value < 0.001f) { Fsm.Event(eventTarget, sendEvent); Finish(); } else { delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value); } }
private void ReSetZapTimer() { ShowZapOSD(); SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>(); if (_zapTimer == null) { _zapTimer = new DelayedEvent(settings.ZapTimeout * 1000); _zapTimer.OnEventHandler += ZapTimerElapsed; } _zapTimer.EnqueueEvent(this, EventArgs.Empty); }
private void ReSetSkipTimer() { ShowSkipOSD(); MediaModelSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <MediaModelSettings>(); if (_skipStepTimer == null) { _skipStepTimer = new DelayedEvent(settings.SkipStepTimeout * 1000); _skipStepTimer.OnEventHandler += SkipStepTimerElapsed; } _skipStepTimer.EnqueueEvent(this, EventArgs.Empty); }
public override void OnEnter() { if (delay.Value == 0f) { Debug.Log("sendEvent.Value " + sendEvent.Value ); Fsm.Event(eventTarget, sendEvent.Value); Finish(); } else { delayedEvent = new DelayedEvent(Fsm, eventTarget, sendEvent.Value, delay.Value); } }
public override void OnUpdate() { if (!everyFrame) { if (DelayedEvent.WasSent(delayedEvent)) { Finish(); } } else { Fsm.Event(eventTarget, sendEvent); } }
/// <summary> /// Sets or resets the zap timer. When the timer elapses, the new selected channel is tuned. /// </summary> private void ReSetSkipTimer() { ShowOSD(); UpdateRunningChannelPrograms(ChannelContext.Instance.Channels[_zapChannelIndex]); if (_zapTimer == null) { SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>(); _zapTimer = new DelayedEvent(settings.ZapTimeout * 1000); _zapTimer.OnEventHandler += ZapTimerElapsed; } // In case of new user action, reset the timer. _zapTimer.EnqueueEvent(this, EventArgs.Empty); }
public override void OnEnter() { if (delay.Value < 0.001f) { base.Fsm.Event(eventTarget, sendEvent); if (!everyFrame) { Finish(); } } else { delayedEvent = base.Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value); } }
public override void OnEnter() { if (delay.Value < 0.001f) { Fsm.Event(eventTarget, sendEvent.Value); if (!everyFrame) { Finish(); } } else { delayedEvent = Fsm.DelayedEvent(eventTarget, FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value); } }
public override void OnEnter() { int eventCount = State.Transitions.Length; if (eventCount > 0) { string eventName = State.Transitions[eventIndex].EventName; delayedEvent = new DelayedEvent(Fsm, eventName, delay.Value); delayedEvent.Update(); eventIndex++; if (eventIndex == eventCount) eventIndex = 0; } }
public void DoEvent() { if (!everyFrame && DelayedEvent.WasSent(delayedEvent)) { Finish(); } if (delay.Value < 0.001f) { Fsm.Event(eventTarget, sendEvent); } else { delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value); } }
public override void OnEnter() { if (State.Transitions.Length == 0) { return; } if (delay.Value < 0.001f) { Fsm.Event(GetRandomEvent()); Finish(); } else { delayedEvent = Fsm.DelayedEvent(GetRandomEvent(), delay.Value); } }
public override void OnEnter() { if (events.Length > 0) { int randomIndex = ActionHelpers.GetRandomWeightedIndex(weights); if (randomIndex != -1) { delayedEvent = new DelayedEvent(Fsm, events[randomIndex], delay.Value); delayedEvent.Update(); if (delayedEvent.Finished) Finish(); return; } } Finish(); }
public override void OnEnter() { if (base.State.Transitions.Length == 0) { return; } if (this.lastEventIndex == -1) { this.lastEventIndex = UnityEngine.Random.Range(0, base.State.Transitions.Length); } if (this.delay.Value < 0.001f) { base.Fsm.Event(this.GetRandomEvent()); base.Finish(); } else { this.delayedEvent = base.Fsm.DelayedEvent(this.GetRandomEvent(), this.delay.Value); } }
public override void OnEnter() { if (events.Length > 0) { int randomIndex = ActionHelpers.GetRandomWeightedIndex(weights); if (randomIndex != -1) { if (delay.Value < 0.001f) { Fsm.Event(events[randomIndex]); Finish(); } else { delayedEvent = Fsm.DelayedEvent(events[randomIndex], delay.Value); } return; } } Finish(); }
void DoBlendAnimation(GameObject go) { if (go == null) { return; } if (go.animation == null) { LogWarning("Missing Animation component on GameObject: " + go.name); Finish(); return; } var anim = go.animation[animName.Value]; if (anim == null) { LogWarning("Missing animation: " + animName.Value); Finish(); return; } var timeValue = time.Value; go.animation.Blend(animName.Value, targetWeight.Value, timeValue); // TODO: doesn't work well with scaled time if (finishEvent != null) { delayedFinishEvent = Fsm.DelayedEvent(finishEvent, anim.length); } else { Finish(); } }