public IHttpActionResult GetFull(string id, int skip, int take, TimeLineEntry type) { TimelineModel model = new TimelineModel { User = repository.GetUser(id, true), TimelineEntries = new List <TimelineEntryModel>() }; // List <string> userIds = new List <string> { id }; userIds.AddRange(model.User.FollowingIds.Select(x => x.Id)); foreach (string userId in userIds) { List <ITimeLine> timeLine = repository.GetUserTimeLine(userId, skip, take, type); foreach (ITimeLine entry in timeLine) { var timelineEntryModel = GetTimelineEntryModel(entry); // Add to time line model model.TimelineEntries.Add(timelineEntryModel); } } // Order by date descending model.TimelineEntries = model.TimelineEntries.OrderByDescending(x => x.DateOfEntry).ToList(); return(Ok(model)); }
public IHttpActionResult Get(string id, int skip, int take, TimeLineEntry type) { List <ITimeLine> timeLine = repository.GetUserTimeLine(id, skip, take, type); TimelineModel model = ConstructTimelineModel(id, timeLine); return(Ok(model)); }
protected void AddTimeLabel(TimeLineEntry entry) { _timeLabel = Instantiate(_timeLine.EntryHudScriptableObject.TimeLabel, transform); var inputField = _timeLabel.GetComponent <InputField>(); inputField.SetTextWithoutNotify(TimeStampUtil.ToTimeStamp(entry.Time)); inputField.onEndEdit.AddListener((inputString) => SubmitTime(inputString)); }
public TimeLine(string userId, TimeLineEntry entryType, string timeLineRefId, string timeLineRefAlternateId, string message, string alternateUserId) { this.UserId = userId; this.AlternateUserId = alternateUserId; this.DateOfEntry = DateTime.Now.ToUniversalTime(); this.EntryType = entryType; this.TimeLineRefId = timeLineRefId; this.TimeLineRefAlternateId = timeLineRefAlternateId; this.Message = message; }
protected void ConstructEmptyEntry(TimeLineEntry entry) { if (entry.ParentEntry == null) { AddTimeLabel(entry); } var castMenu = Instantiate(_timeLine.EntryHudScriptableObject.CastLabel, transform); var castRect = castMenu.GetComponent <RectTransform>(); castRect.anchorMin = new Vector2(_margin.x, castRect.anchorMin.y); castRect.anchorMax = new Vector2(1f - _margin.y, castRect.anchorMax.y); var dropdown = castMenu.GetComponent <Dropdown>(); var options = _mainTimeLine.Mechanics.Keys.ToList(); var defaultOption = options.IndexOf(entry.Mechanic); dropdown.AddOptions(new List <string>() { "New Mechanic" }); dropdown.AddOptions(options); if (defaultOption != -1) { dropdown.SetValueWithoutNotify(defaultOption + 1); var windows = SetMechanic(entry.Mechanic); windows.Insert(0, castMenu); AlignParameterWidnows(windows); } dropdown.onValueChanged.AddListener((optionIndex) => { _entry.Parameters = new Dictionary <string, ParameterData>(); if (optionIndex == 0) { _entry.Parameters = null; _entry.Mechanic = CreateNewMechanic(); _timeLine.Redraw(); } else { var windows = SetMechanic(options[optionIndex - 1]); windows.Insert(0, castMenu); AlignParameterWidnows(windows); _timeLine.Redraw(); } }); }
private void CreateNewEffect(EffectKind effectKind) { EffectEntry newEffect = new EffectEntry(effectKind, GetEntryName()); TimeLineEntry entry = AddEntry(TimeSpan.Zero, TimeSpan.FromSeconds(1), GetEntryName(), newEffect); entry.PropertyChanged += Entry_PropertyChanged; tlEffects.SelectedItem = entry; SetSelectedColorByEffectType(effectKind); loadingInternally = true; try { effectBuilder.EffectEntry = newEffect; } finally { loadingInternally = false; } OnPropertyChanged(); }
internal override void SetEntryData(TimeLineEntry entry, TimeLineBehaviour timeLineBehaviour) { base.SetEntryData(entry, timeLineBehaviour); var iconSelector = GetComponentInChildren <ConditionalIconSelector>(); if (entry.ParentEntry == null) { iconSelector.SetState(ConditionalIconSelector.State.CHECK); ConstructComparisonEntry(entry); } else if (entry.ParentEntry.ParentEntry == null) { iconSelector.SetState(ConditionalIconSelector.State.TRUE); ConstructEmptyEntry(entry); } else { iconSelector.SetState(ConditionalIconSelector.State.FALSE); ConstructEmptyEntry(entry); } }
private void ConstructComparisonEntry(TimeLineEntry entry) { _entry.Parameters.TryGetValue(_lefthandString, out ParameterData lh); _entry.Parameters.TryGetValue(_righthandString, out ParameterData rh); _entry.Parameters.TryGetValue(_comparatorString, out ParameterData c); AddTimeLabel(entry); _leftHand = Instantiate(_timeLine.EntryHudScriptableObject.CastLabel, transform).GetComponent <Dropdown>(); var leftHandOptions = from val in _mainTimeLine.CustomRefrenceValues where val.Type <= ParameterType.POS orderby val.Type select val; List <string> lhOptionStrings = AsStringList(leftHandOptions); _leftHand.AddOptions(lhOptionStrings); if (_entry.Parameters.TryGetValue(_lefthandString, out ParameterData parameterDataLh)) { _leftHand.SetValueWithoutNotify(lhOptionStrings.IndexOf(parameterDataLh.RefrenceValue.Label)); DrawRightHand(parameterDataLh.RefrenceValue.Type); } else { DrawRightHand((ParameterType)256); } _leftHand.onValueChanged.AddListener((l) => { var leftHandOption = leftHandOptions.ElementAt(l); StoreParameter(leftHandOption, _lefthandString, new ParameterData() { IsRefrenceValue = true, RefrenceValue = leftHandOption, Value = null }); DrawRightHand(leftHandOption.Type); }); }
internal override void SetEntryData(TimeLineEntry entry, TimeLineBehaviour timeLineBehaviour) { base.SetEntryData(entry, timeLineBehaviour); if (entry.ParentEntry == null) { ConstructEmptyEntry(entry); return; } if (entry.Parameters.TryGetValue(_distParamString, out ParameterData parameterData)) { AlignParameterWidnows(new List <GameObject>() { InstantiateRefrenceValuePicker(parameterData, ParameterType.ANY) }); } else { ConstructEmptyEntry(entry); } var button = Instantiate(_timeLine.EntryHudScriptableObject.SwitchToValueParamButton, transform).GetComponent <Button>(); button.onClick.AddListener(() => { if (entry.Parameters.ContainsKey(_distParamString)) { entry.Parameters.Remove(_distParamString); } else { entry.Parameters.Add(_distParamString, new ParameterData()); } _timeLine.Redraw(); }); }
/// <summary> /// Retrieve the time line of a particular user paginated if requested /// </summary> /// <param name="userId">ID of the user</param> /// <param name="skip">Number of itms to skip</param> /// <param name="take"></param> /// <param name="type"></param> /// <returns></returns> public List <ITimeLine> GetUserTimeLine(string userId, int skip, int take, TimeLineEntry type) { List <ITimeLine> activity = new List <ITimeLine>(); IQueryable <TimeLine> queryTimeline; if (type == TimeLineEntry.All) { // Bring back all entry types queryTimeline = (from entry in timeLineCollection.AsQueryable() where entry.UserId == userId select entry).OrderByDescending(x => x.DateOfEntry).Skip(skip).Take(take); } else if (type == TimeLineEntry.Like) { queryTimeline = (from entry in timeLineCollection.AsQueryable() where entry.UserId == userId && (entry.EntryType == TimeLineEntry.Like || entry.EntryType == TimeLineEntry.LikeComment) select entry).OrderByDescending(x => x.DateOfEntry).Skip(skip).Take(take); } else { // Bring back specific entry types queryTimeline = (from entry in timeLineCollection.AsQueryable() where entry.UserId == userId && entry.EntryType == type select entry).OrderByDescending(x => x.DateOfEntry).Skip(skip).Take(take); } foreach (var entry in queryTimeline) { // Add the activity activity.Add(entry); } return(activity); }
public void AddNewTrigger(Spawner trigger) { if (triggers.Count > 0) { for (int i = triggers.Count - 1; i >= 0; i--) { if (triggers[i].trigger == null) { triggers.RemoveAt(i); } } } if (triggers.Exists(x => x.trigger == trigger)) { print("trigger exists"); return; } print("creating new trigger"); var te = new TimeLineEntry(trigger, time); triggers.Add(te); triggers.Sort((x, y) => x.time.CompareTo(y.time)); // TODO: blah }
internal virtual void SetEntryData(TimeLineEntry entry, TimeLineBehaviour timeLineBehaviour) { _createEntryWindowForType = new Dictionary <Type, CreateEntryWindowHandler> { { typeof(float), EntryWindowNum }, { typeof(Vector2), EntryWindowVec2 }, { typeof(string), EntryWindowString }, { typeof(RefrenceType <float>), EntryWindowNum }, { typeof(RefrenceType <Vector2>), EntryWindowVec2 }, { typeof(RefrenceType <string>), EntryWindowString } }; _mainTimeLine = FindObjectOfType <MainTimeLineBehaviour>(); _subElementBehaviour = FindObjectOfType <SubElementBehaviour>(); _entry = entry; _timeLine = timeLineBehaviour; GetComponentInChildren <Button>().onClick.AddListener(() => timeLineBehaviour.RemoveEntry(entry)); if (entry.IsParentingType()) { _margin = _marginWithIcon; } }
internal override void SetEntryData(TimeLineEntry entry, TimeLineBehaviour timeLineBehaviour) { base.SetEntryData(entry, timeLineBehaviour); ConstructEmptyEntry(entry); }
public TimeLineEntryMessage(TimeLineEntry timeLineEntry) { TimeLineEntry = timeLineEntry; }