public void trackCompleted(Completable c) { float score = Mathf.Max(Mathf.Min(c.getScore().getScore() / 10f, 1f), 0f); Tracker.T.setVar("time", (DateTime.Now - times[c]).TotalSeconds); Tracker.T.completable.Completed(c.getId(), (CompletableTracker.Completable)c.getType(), true, score); }
private IObservable <IView> PopInternal(IView view, List <IView> history) { AssertCanPresent(null, null); StartChange(); var options = new Options { Direction = Direction.Backward }; var presentation = CreatePresentation(null, _view.Value, view?.GetType(), options); presentation.TargetView = view; var nav = StartNavigation(presentation); return(Completable .WhenAll( PerformTransition(presentation), nav.Parallel) .DoOnCompleted(() => { History.Value = history; CompleteNavigation(nav); CompleteChange(nav); }) .ThenReturn(view)); }
public void conditionChanged() { foreach (Completable c in trackingCompletables) { if (c.getProgress().updateMilestones()) { Tracker.T.completable.Progressed(c.getId(), (CompletableTracker.Completable)c.getType(), c.currentProgress()); } if (c.getEnd().getType() == Completable.Milestone.MilestoneType.CONDITION && c.getEnd().Update()) { trackCompleted(c); toRemove.Push(c); } } clearToRemove(); //Any completable starts when this condition changes? foreach (Completable completable in completables) { if (!trackingCompletables.Contains(completable) && completable.getStart().Update()) { trackingCompletables.Add(completable); times.Add(completable, DateTime.Now); Tracker.T.completable.Initialized(completable.getId(), (CompletableTracker.Completable)completable.getType()); Tracker.T.completable.Progressed(completable.getId(), (CompletableTracker.Completable)completable.getType(), 0); if (completable.getEnd() == null) { completeOnExit = completable; } } } }
public CompletableDataControl(Completable completable) { this.completable = completable; this.startDataControl = new MilestoneDataControl(completable.getStart()); this.endDataControl = new MilestoneDataControl(completable.getEnd()); this.progressDataControl = new ProgressDataControl(completable.getProgress()); this.scoreDataControl = new ScoreDataControl(completable.getScore()); }
private void OnTriggerEnter(Collider other) { Completable c = other.gameObject.GetComponent <Completable>(); if (c != null) { c.InTargetVicinity(this.transform.parent.gameObject); } }
public static ICompletable ToCompletable(this Tween This, bool completeTweenOnDispose = false) { This.Pause(); return(Completable.Create(subscriber => { This.Play(); This.OnComplete(subscriber.OnCompleted); return Disposable.Create(() => This.Kill(completeTweenOnDispose)); })); }
public static ICompletable MoveBy(this Transform This, Vector3 delta, float duration, IEaser easer = null) => Completable.Defer(() => { var source = This.localPosition; var target = source + delta; return(Range(duration, easer) .Lerp(source, target) .Do(x => This.localPosition = x) .AsCompletable()); });
public static ICompletable BindAsCompletable(this IBinder This, string source, Image target, bool isOptional = false, Loadzup.Options options = null, bool keepVisible = false, float?fadeDuration = null, bool isPriority = false) { if (source == null || target == null) { return(Completable.Empty()); } return(This.BindAsCompletable(new Uri(source), target, isOptional, options, keepVisible, fadeDuration, isPriority)); }
void UseItem() { if (transform.childCount > 1 && Input.GetKeyDown(actionButton)) { Completable c = transform.GetChild(1).GetComponent <Completable>(); if (c != null) { c.CheckForCompletion(); } } }
/// <summary> /// Player initialized a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> public void Initialized(string completableId, Completable type) { if (tracker.Utils.check <TargetXApiException>(completableId, "xAPI Exception: Target ID is null or empty. Ignoring.", "xAPI Exception: Target ID can't be null or empty.")) { tracker.Trace(new TrackerAsset.TrackerEvent(tracker) { Event = new TrackerAsset.TrackerEvent.TraceVerb(TrackerAsset.Verb.Initialized), Target = new TrackerAsset.TrackerEvent.TraceObject(type.ToString().ToLower(), completableId) }); } }
public CompletableController(Completable completable) { this.Completable = completable; this.startController = new MilestoneController(completable.getStart()); this.endController = new MilestoneController(completable.getEnd()); this.progressControllers = completable .getProgress() .getMilestones() .ConvertAll(c => new MilestoneController(c)); }
// ReSharper disable once UnusedParameter.Global public static ICompletable BindAsCompletable(this IBinder This, object source, IPresenter target) { if (source == null || target == null) { return(Completable.Empty()); } return(target .Present(source) .AutoDetach() .AsCompletable()); }
/// <summary> /// Player progressed a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="value">New value for the completable's progress.</param> /// <param name="type">Completable type.</param> public TrackerEvent Progressed(string completableId, Completable type, float value) { if (tracker.Utils.check <TargetXApiException>(completableId, "xAPI Exception: Target ID is null or empty. Ignoring.", "xAPI Exception: Target ID can't be null or empty.")) { tracker.setProgress(value); return(tracker.Trace(new TrackerEvent(tracker) { Event = new TrackerEvent.TraceVerb(Verb.Progressed), Target = new TrackerEvent.TraceObject(type.ToString().ToLower(), completableId) })); } return(null); }
public void AddMarker() { _liveSequence.Subscribe(); _liveSequence.Add(Completable.Never()); _liveSequence.AddAction(Assert.Fail); var instant = _liveSequence.AddInstant(); _liveSequence.AddAction(() => _value = 2); AssertValue(0); _liveSequence.SkipBefore(instant); AssertValue(2); }
/// <summary> /// Player completed a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> /// <param name="success">Completable success.</param> /// <param name="score">Completable score.</param> public void Completed(string completableId, Completable type, bool success, float score) { if (tracker.Utils.check <TargetXApiException>(completableId, "xAPI Exception: Target ID is null or empty. Ignoring.", "xAPI Exception: Target ID can't be null or empty.")) { tracker.setSuccess(success); tracker.setScore(score); tracker.Trace(new TrackerAsset.TrackerEvent(tracker) { Event = new TrackerAsset.TrackerEvent.TraceVerb(TrackerAsset.Verb.Completed), Target = new TrackerAsset.TrackerEvent.TraceObject(type.ToString().ToLower(), completableId) }); } }
public ICompletable Load() { if (IsCancelled) { _subject.Dispose(); return(Completable.Empty()); } return(_loadRequest .Do(_subject.OnNext, _subject.OnError, _subject.OnCompleted) .CatchIgnore() .AsCompletable()); }
protected ICompletable CancellationPoint() { if (Presentation.CancellationToken.IsCancellationRequested) { _performers .Where(x => x.State == PhaseState.Started) .Reverse() .ForEach(x => x.Cancel()); return(Completable.Throw(new PhaseCancelledException())); } return(Completable.Empty()); }
private ICompletable LoadLoadable(IView view) { try { return((view as ILoadable)?.Load()? .Catch <Exception>(ex => Completable.Throw(new LoadException($"Error in view.Load() of {view.GetType().Name}", ex))) ?? Completable.Empty()); } catch (Exception ex) { return(Completable.Throw(new LoadException($"Error in view.Load() of {view.GetType().Name}", ex))); } }
private IObservable <IView> NavigateAndCompletePush(Presentation presentation) { var nav = StartNavigation(presentation); return(Completable .WhenAll( Present(presentation), nav.Parallel) .DoOnCompleted(() => { History.Value = GetNewHistory(presentation.TargetView, presentation.Options.GetPushModeOrDefault()); CompleteNavigation(nav); }) .ThenReturn(presentation.TargetView)); }
/// <summary> /// Player completed a completable. /// Success = true /// Score = 1 /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> public void Completed(string completableId, Completable type) { if (tracker.Utils.check <TargetXApiException>(completableId, "xAPI Exception: Target ID is null or empty. Ignoring.", "xAPI Exception: Target ID can't be null or empty.")) { tracker.Trace(new TrackerAsset.TrackerEvent(tracker) { Event = new TrackerAsset.TrackerEvent.TraceVerb(TrackerAsset.Verb.Completed), Target = new TrackerAsset.TrackerEvent.TraceObject(type.ToString().ToLower(), completableId), Result = new TrackerAsset.TrackerEvent.TraceResult() { Success = true, Score = 1f } }); } }
public IDisposable Subscribe(ICompletableObserver observer) { try { _action?.Invoke(); } catch (Exception ex) { return(Completable .Throw(ex) .Subscribe(observer)); } observer.OnCompleted(); return(Disposable.Empty); }
/// <summary> /// Player completed a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> /// <param name="score">Completable score.</param> public TrackerEvent Completed(string completableId, Completable type, float score) { if (tracker.Utils.check <TargetXApiException>(completableId, "xAPI Exception: Target ID is null or empty. Ignoring.", "xAPI Exception: Target ID can't be null or empty.")) { tracker.setScore(score); return(tracker.Trace(new TrackerEvent(tracker) { Event = new TrackerEvent.TraceVerb(Verb.Completed), Target = new TrackerEvent.TraceObject(type.ToString().ToLower(), completableId), Result = new TrackerEvent.TraceResult() { Success = true } })); } return(null); }
public void targetChanged(IChapterTarget target) { //Complete if any scene is completed on exit. if (completeOnExit != null) { Tracker.T.completable.Completed(completeOnExit.getId(), CompletableTracker.Completable.Stage, true, completeOnExit.getScore().getScore()); completeOnExit = null; } //Buscamos en nuestra lista de completables si algun completable se completa o progresa al llegar aquí foreach (Completable toComplete in completables) { if (toComplete.getProgress().updateMilestones(target)) { Tracker.T.completable.Progressed(toComplete.getId(), (CompletableTracker.Completable)toComplete.getType(), toComplete.currentProgress()); } if (toComplete.getEnd().Update(target)) { trackCompleted(toComplete); toRemove.Push(toComplete); } } clearToRemove(); //Buscamos en nuestros completables si alguno se inicia con esta escena foreach (Completable completable in completables) { // TODO: // prevent levels overlaping. if (!trackingCompletables.Contains(completable) && completable.getStart().Update(target)) { trackingCompletables.Add(completable); times.Add(completable, DateTime.Now); Tracker.T.completable.Initialized(completable.getId(), (CompletableTracker.Completable)completable.getType()); Tracker.T.completable.Progressed(completable.getId(), (CompletableTracker.Completable)completable.getType(), 0); if (completable.getEnd() == null) { completeOnExit = completable; } } } }
protected override ICompletable Present(Presentation presentation) { if (Container == null) { throw new InvalidOperationException($"Must specify ContentContainer property of ContentControl {gameObject}"); } var sourceView = presentation.SourceView; var targetView = presentation.TargetView; var options = presentation.Options; PreHide(sourceView, options); PreShow(targetView, options); ReplaceView(Container, targetView); _view.Value = targetView; PostHide(sourceView, options); PostShow(targetView, options); return(Completable.Empty()); }
private void performAddElement(object sender, string id) { // If some value was typed and the identifier is valid if (!controller.isElementIdValid(id)) { id = controller.makeElementValid(id); } // Add thew new scene var newCompletable = new Completable(); newCompletable.setId(id); var score = new Completable.Score(); score.setMethod(Completable.Score.ScoreMethod.SINGLE); score.setType(Completable.Score.ScoreType.VARIABLE); newCompletable.setScore(score); completables.Add(newCompletable); completableDataControls.Add(new CompletableDataControl(newCompletable)); controller.IdentifierSummary.addId <Completable>(id); controller.DataModified(); }
public void Reset() { if (Completable.getRepeatable()) { if (Start != null) { Start.Reset(); } if (End != null) { End.Reset(); } completed = false; foreach (var milestoneController in progressControllers) { milestoneController.Reset(); } } }
public bool UpdateMilestones(IChapterTarget target) { if (completed) { return(false); } if (completeOnExit && target.getId() != Start.Milestone.getId()) { completed = true; CompletablesController.Instance.TrackCompleted(this, DateTime.Now - startTime); } else { var wasStarted = Started; completed = UpdateMilestones(milestone => milestone.Update(target)); if (wasStarted != Started && Completable.getEnd() == null) { completeOnExit = true; } } return(completed); }
/// <summary> /// Player completed a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> /// <param name="success">Completable success.</param> /// <param name="score">Completable score.</param> public void Completed(string completableId, Completable type, bool success, float score) { tracker.setSuccess(success); tracker.setScore(score); tracker.Trace(Tracker.Verb.Completed.ToString().ToLower(), type.ToString().ToLower(), completableId); }
/// <summary> /// Player completed a completable. /// Success = true /// Score = 1 /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> public void Completed(string completableId, Completable type) { tracker.setSuccess(true); tracker.setScore(1f); tracker.Trace(Tracker.Verb.Completed.ToString().ToLower(), type.ToString().ToLower(), completableId); }
/// <summary> /// Player initialized a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="type">Completable type.</param> public void Initialized(string completableId, Completable type) { tracker.Trace(Tracker.Verb.Initialized.ToString().ToLower(), type.ToString().ToLower(), completableId); }
public static object Add(this ISequencer This, Func <ICompletable> completableFactory) => This.Add(Completable.Defer(completableFactory));
protected ICompletable CreateTimer(int ticks) => Completable.Timer(TimeSpan.FromTicks(ticks), _scheduler);
/// <summary> /// Player progressed a completable. /// </summary> /// <param name="completableId">Completable identifier.</param> /// <param name="value">New value for the completable's progress.</param> /// <param name="type">Completable type.</param> public void Progressed(string completableId, Completable type, float value) { tracker.setProgress(value); tracker.Trace(Tracker.Verb.Progressed.ToString().ToLower(), type.ToString().ToLower(), completableId); }