Пример #1
0
        /// <summary>
        /// Gets searchable property values for content
        /// </summary>
        /// <param name="contentData"></param>
        /// <param name="contentType"></param>
        /// <returns></returns>
        public static IEnumerable <string> GetSearchablePropertyValues(IContentData contentData, ContentType contentType)
        {
            if (contentType == null)
            {
                yield break;
            }

            foreach (PropertyDefinition current in from d in contentType.PropertyDefinitions
                     where d.Searchable || typeof(IPropertyBlock).IsAssignableFrom(d.Type.DefinitionType)
                     select d)
            {
                PropertyData   propertyData  = contentData.Property[current.Name];
                IPropertyBlock propertyBlock = propertyData as IPropertyBlock;

                if (propertyBlock != null)
                {
                    foreach (string current2 in GetSearchablePropertyValues(propertyBlock.Block, propertyBlock.BlockPropertyDefinitionTypeID))
                    {
                        yield return(current2);
                    }
                }
                else
                {
                    yield return(propertyData.ToWebString());
                }
            }

            yield break;
        }
Пример #2
0
        /// <inheritdoc/>
        public void SetBlock(int x, int y, int z, IPropertyBlock block)
        {
            cache = GetChunk(x, y, z);
            if (cache == null || !Check(x, y, z))
            {
                return;
            }

            cache.Blocks.SetBlock(x, y, z, block);
        }
Пример #3
0
            public void Reset()
            {
                WaitingForChatInput = false;
                PropertyOpen        = false;
                target      = null;
                MemberIndex = -1;
                Enabled     = true;
                AssocMember = null;

                CloseInput();
            }
Пример #4
0
        /// <summary>
        /// Opens the menu using the given target
        /// </summary>
        public void OpenMenu(IPropertyBlock target, QuickActionMenuState initialState = default(QuickActionMenuState))
        {
            if ((MenuState & QuickActionMenuState.Peek) == 0)
            {
                CloseMenu();

                if (initialState != default(QuickActionMenuState))
                {
                    MenuState = initialState;
                }

                Target = target;
                UpdateStateMain();
            }
        }
            private void UpdateText()
            {
                IPropertyBlock block = propertyWheelMenu.quickActionMenu.Target;

                summaryBuilder.Clear();
                summaryBuilder.Add("Build Vision\n", wheelHeaderFormat);
                block.GetSummary(summaryBuilder, bodyFormatCenter, bodyValueFormatCenter);

                ITextBuilder notificationBuidler = notificationText.TextBoard;

                if (notification != null && notificationTimer.ElapsedMilliseconds < notificationTime)
                {
                    notificationBuidler.Clear();
                    notificationBuidler.Append("\n", bodyFormatCenter);
                    notificationBuidler.Append(notification, bodyValueFormatCenter);

                    if (contNotification)
                    {
                        notification     = null;
                        contNotification = false;
                    }
                }
                else if ((MenuState & QuickActionMenuState.PropertyDuplication) > 0)
                {
                    textBuf.Clear();
                    textBuf.Append("Copying ");
                    textBuf.Append(block.Duplicator.GetSelectedEntryCount());
                    textBuf.Append(" of ");
                    textBuf.Append(block.Duplicator.GetValidEntryCount());
                    notificationBuidler.SetText(textBuf, bodyValueFormatCenter);
                }
                else
                {
                    notification = null;
                    notificationBuidler.Clear();
                    var target = propertyWheelMenu.quickActionMenu.Target;

                    if (!target.IsFunctional)
                    {
                        notificationBuidler.SetText("[Incomplete]", blockIncFormat.WithAlignment(TextAlignment.Center));
                    }
                }

                summaryLabel.TextBoard.SetText(summaryBuilder);
            }
Пример #6
0
        /// <inheritdoc/>
        public void SetBlock(int x, int y, int z, IPropertyBlock block)
        {
            cache = GetChunk(x, y, z);
            if (cache == null || !Check(x, y, z)) {
                return;
            }

            cache.Blocks.SetBlock(x, y, z, block);
        }
 public override void Reset()
 {
     MemberIndex = -1;
     BlockMember = null;
     target      = null;
 }
 /// <summary>
 /// Sets block property member
 /// </summary>
 public void SetMember(int index, IPropertyBlock target)
 {
     MemberIndex = index;
     this.target = target;
     BlockMember = target.BlockMembers[MemberIndex];
 }
Пример #9
0
 /// <inheritdoc/>
 public void SetBlock(int x, int y, int z, IPropertyBlock block)
 {
     cache.Blocks.SetBlock(x, y, z, block);
 }
Пример #10
0
 /// <inheritdoc/>
 public void SetBlock(int x, int y, int z, IPropertyBlock block)
 {
     SetID(x, y, z, block.ID);
     SetTileEntity(x, y, z, block.GetTileEntity().Copy());
 }
Пример #11
0
 /// <inheritdoc/>
 public void SetBlock(int x, int y, int z, IPropertyBlock block)
 {
     cache.Blocks.SetBlock(x, y, z, block);
 }
 internal static IEnumerable <PropertyData> GetSearchableProperties(this IContentData contentData, IPropertyDefinitionRepository propertyDefinitionRepository, IEnumerable <ContentReference> referenceChain)
 {
     if (contentData != null)
     {
         IContent contentDataAsIContent = contentData as IContent;
         if (contentDataAsIContent == null || !Enumerable.Any <ContentReference>(Enumerable.Where <ContentReference>(referenceChain, (Func <ContentReference, bool>)(x => x.CompareToIgnoreWorkID(contentDataAsIContent.ContentLink)))))
         {
             foreach (PropertyData propertyData1 in contentData.Property)
             {
                 if (propertyData1.IsPropertyData)
                 {
                     PropertyInfo typeProperty = RuntimeModelExtensions.GetOriginalType((object)contentData).GetProperty(propertyData1.Name);
                     if (!(typeProperty == (PropertyInfo)null) && CustomAttributeExtensions.GetCustomAttribute <JsonIgnoreAttribute>((MemberInfo)typeProperty) == null)
                     {
                         PropertyContentArea contentAreaProperty = propertyData1 as PropertyContentArea;
                         PropertyDefinition  propertyDefinition  = propertyDefinitionRepository.Load(propertyData1.PropertyDefinitionID);
                         if (propertyDefinition.Searchable && contentAreaProperty == null)
                         {
                             yield return(propertyData1);
                         }
                         IPropertyBlock blockProperty = propertyData1 as IPropertyBlock;
                         if (blockProperty != null)
                         {
                             BlockData block = blockProperty.Block;
                             IPropertyDefinitionRepository  propertyDefinitionRepository1 = propertyDefinitionRepository;
                             IEnumerable <ContentReference> referenceChain1;
                             if (contentDataAsIContent == null)
                             {
                                 referenceChain1 = referenceChain;
                             }
                             else
                             {
                                 referenceChain1 = Enumerable.Concat <ContentReference>(referenceChain, (IEnumerable <ContentReference>) new ContentReference[1]
                                 {
                                     contentDataAsIContent.ContentLink
                                 });
                             }
                             foreach (PropertyData propertyData2 in ContentExtensions.GetSearchableProperties((IContentData)block, propertyDefinitionRepository1, referenceChain1))
                             {
                                 yield return(propertyData2);
                             }
                         }
                         if (contentAreaProperty != null)
                         {
                             ContentArea contentArea = contentAreaProperty.Value as ContentArea;
                             if (contentArea != null)
                             {
                                 foreach (PropertyData propertyData2 in Enumerable.SelectMany <IContent, PropertyData>(Enumerable.Where <IContent>(contentArea.Contents, (Func <IContent, bool>)(x =>
                                 {
                                     return(true);
                                 })), (Func <IContent, IEnumerable <PropertyData> >)(x =>
                                 {
                                     IContent content = x;
                                     IPropertyDefinitionRepository propertyDefinitionRepository1 = propertyDefinitionRepository;
                                     IEnumerable <ContentReference> referenceChain1;
                                     if (contentDataAsIContent == null)
                                     {
                                         referenceChain1 = referenceChain;
                                     }
                                     else
                                     {
                                         referenceChain1 = Enumerable.Concat <ContentReference>(referenceChain, (IEnumerable <ContentReference>) new ContentReference[1]
                                         {
                                             contentDataAsIContent.ContentLink
                                         });
                                     }
                                     return(ContentExtensions.GetSearchableProperties((IContentData)content, propertyDefinitionRepository1, referenceChain1));
                                 })))
                                 {
                                     yield return(propertyData2);
                                 }
                                 if (!propertyDefinition.ExistsOnModel)
                                 {
                                     foreach (IContent content in Enumerable.Where <IContent>(contentArea.Contents, (Func <IContent, bool>)(x =>
                                     {
                                         return(true);
                                     })))
                                     {
                                         foreach (PropertyInfo propertyInfo in typeof(IContent).GetProperties(BindingFlags.Instance | BindingFlags.Public))
                                         {
                                             yield return((PropertyData) new PropertyString(propertyInfo.GetValue((object)content, (object[])null).ToString()));
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #13
0
 /// <inheritdoc/>
 public void SetBlock(int x, int y, int z, IPropertyBlock block)
 {
     SetID(x, y, z, block.ID);
     SetTileEntity(x, y, z, block.GetTileEntity().Copy());
 }
Пример #14
0
 public void SetMember(IPropertyBlock target, IBlockMember member, int index)
 {
     this.target = target;
     MemberIndex = index;
     AssocMember = member;
 }