private IContent CreateAndAssignIdentity(MappedIdentity mappedIdentity, Type modelType, string name) { // Find parent var parentLink = EntryPoint; if (modelType == typeof(YouTubeVideo)) { parentLink = SearchResultNode; } else if (modelType != typeof(YouTubeFolder)) { parentLink = new ContentReference(int.Parse(RemoveEndingSlash(mappedIdentity.ExternalIdentifier.Segments[2])), ProviderKey); } // Set content type and content type Id. var contentType = ContentTypeRepository.Load(modelType); var content = ContentFactory.CreateContent(contentType); content.ContentTypeID = contentType.ID; content.ParentLink = parentLink; content.ContentGuid = mappedIdentity.ContentGuid; content.ContentLink = mappedIdentity.ContentLink; content.Name = name; (content as IRoutable).RouteSegment = UrlSegment.GetUrlFriendlySegment(content.Name); var securable = content as IContentSecurable; securable.GetContentSecurityDescriptor().AddEntry(new AccessControlEntry(EveryoneRole.RoleName, AccessLevel.Read)); var versionable = content as IVersionable; if (versionable != null) { versionable.Status = VersionStatus.Published; } var changeTrackable = content as IChangeTrackable; if (changeTrackable != null) { changeTrackable.Changed = DateTime.Now; } return(content); }
public Stack <Content> InitializeContents() { List <Content> contentsList = new List <Content>(); Stack <Content> contentsStack = new Stack <Content>(); for (int i = 0; i < contentsType.Count; i++) { Content content = ContentFactory.CreateContent(contentsType[i].id, contentsType[i].type); content.CompleteEvent = contentsType[i].CompleteEvent; contentsList.Add(content); } Debug.Log(contentsList.Count); for (int i = 0; i < contentsList.Count; i++) { contentsStack.Push(contentsList[contentsList.Count - i - 1]); } contentsStack.Reverse(); return(contentsStack); }
//处理所有卡牌,根据卡牌展示内容 private void TrackerHandler(List <IListenerTracker> trackers) { //TODO 获取句式类型(可以是字母组词,可以是单词组句) content = ContentFactory.CreateContent(trackers); //将卡牌都传过去根据卡牌的排序和具体类型表现相应的结果 if (content != null) { content.OnChanged(trackers); lastCont = content; if (currCont != content) { currCont = content; currTrackers = trackers; } } else if (lastCont != null && trackers.Count == 5) { //Debug.Log("没有这个句子哦!"); UIManager.Instance.SetVisible(UIName.UISceneHint, true); UISceneHint.Instance.ShowStatementHint("none"); lastCont = null; } }
public void SetContents(Transform relatedObject, Content currentContent, int[] idsContentsToDisplay = null) { this.currentContent = currentContent; this.relatedContentTransform = relatedObject; if (idsContentsToDisplay != null) { contentToDisplay = new Content[idsContentsToDisplay.Length]; for (int i = 0; i < contentToDisplay.Length; i++) { Debug.Log("Contenu à display : " + idsContentsToDisplay[i]); contentToDisplay[i] = ContentFactory.CreateContent(idsContentsToDisplay[i], ContentType.SimpleText); //À l'affichage du dernier contenu relatif à la réponse if (i == contentToDisplay.Length - 1) { Debug.Log("Add listener"); UnityEditor.Events.UnityEventTools.AddPersistentListener(contentToDisplay[i].CompleteEvent, relatedContentTransform.GetComponent <ClosedQuestionHolder>().StartProgressiveFadeIn); UnityEditor.Events.UnityEventTools.AddPersistentListener(contentToDisplay[i].CompleteEvent, ReplaceContentAtBottom); //contentToDisplay[i].CompleteEvent.AddListener(relatedContentTransform.GetComponent<ClosedQuestionHolder>().StartProgressiveFadeIn); } } } }