当前位置: 首页>>代码示例>>C#>>正文


C# IReorderableListAdaptor.GetItemHeight方法代码示例

本文整理汇总了C#中IReorderableListAdaptor.GetItemHeight方法的典型用法代码示例。如果您正苦于以下问题:C# IReorderableListAdaptor.GetItemHeight方法的具体用法?C# IReorderableListAdaptor.GetItemHeight怎么用?C# IReorderableListAdaptor.GetItemHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IReorderableListAdaptor的用法示例。


在下文中一共展示了IReorderableListAdaptor.GetItemHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawListContainerAndItems


//.........这里部分代码省略.........
					break;
			}

			ReorderableListGUI.IndexOfChangedItem = -1;

			// Draw list items!
			Rect itemPosition = new Rect(position.x + 2, firstItemY, position.width - 4, 0);
			float targetSlotPosition = position.yMax - s_DragItemPosition.height - 1;

			float lastMidPoint = 0f;
			float lastHeight = 0f;

			int count = adaptor.Count;
			for (int i = 0; i < count; ++i) {
				itemPosition.y = itemPosition.yMax;
				itemPosition.height = 0;

				if (_tracking) {
					// Does this represent the target index?
					if (i == s_TargetIndex) {
						targetSlotPosition = itemPosition.y;
						itemPosition.y += s_DragItemPosition.height;
					}

					// Do not draw item if it is currently being dragged.
					// Draw later so that it is shown in front of other controls.
					if (i == s_AnchorIndex)
						continue;

					lastMidPoint = itemPosition.y - lastHeight / 2f;
				}

				// Update position for current item.
				itemPosition.height = adaptor.GetItemHeight(i) + 4;
				lastHeight = itemPosition.height;

				if (_tracking && eventType == EventType.MouseDrag) {
					float midpoint = itemPosition.y + itemPosition.height / 2f;

					if (s_TargetIndex < i) {
						if (s_DragItemPosition.yMax > lastMidPoint && s_DragItemPosition.yMax < midpoint)
							newTargetIndex = i;
					}
					else if (s_TargetIndex > i) {
						if (s_DragItemPosition.y > lastMidPoint && s_DragItemPosition.y < midpoint)
							newTargetIndex = i;
					}

					/*if (s_DragItemPosition.y > itemPosition.y && s_DragItemPosition.y <= midpoint)
						newTargetIndex = i;
					else if (s_DragItemPosition.yMax > midpoint && s_DragItemPosition.yMax <= itemPosition.yMax)
						newTargetIndex = i + 1;*/
				}

				// The following may break use of tab key to navigate through controls :/
				if ((Flags & ReorderableListFlags.DisableClipping) == 0) {
					// Clip list item? Performance boost!
					if (itemPosition.yMax < _visibleRect.y - itemPosition.height) {
						// Let's try and trick Unity into maintaining tab key support...
						GUIUtility.GetControlID(FocusType.Keyboard, itemPosition);
						continue;
					}
					if (itemPosition.y > _visibleRect.yMax + itemPosition.height)
						break;
				}
开发者ID:mhfirdausi,项目名称:VGDSix,代码行数:66,代码来源:ReorderableListControl.cs

示例2: CalculateListHeight

		/// <summary>
		/// Calculate height of list control in pixels.
		/// </summary>
		/// <param name="adaptor">Reorderable list adaptor.</param>
		/// <returns>
		/// Required list height in pixels.
		/// </returns>
		public float CalculateListHeight(IReorderableListAdaptor adaptor) {
			FixStyles();

			float totalHeight = ContainerStyle.padding.vertical - 1;

			// Take list items into consideration.
			int count = adaptor.Count;
			for (int i = 0; i < count; ++i)
				totalHeight += adaptor.GetItemHeight(i);
			// Add spacing between list items.
			totalHeight += 4 * count;

			// Add height of footer buttons.
			if (HasFooterButtons)
				totalHeight += FooterButtonStyle.fixedHeight;

			return totalHeight;
		}
开发者ID:mhfirdausi,项目名称:VGDSix,代码行数:25,代码来源:ReorderableListControl.cs

示例3: DrawListContainerAndItems


//.........这里部分代码省略.........
     }
     }
     this.containerStyle.Draw(position, GUIContent.none, false, false, false, false);
     IL_1B7:
     ReorderableListGUI.indexOfChangedItem = -1;
     Rect rect = new Rect(position.x + 2f, num2, position.width - 4f, 0f);
     float targetSlotPosition = position.yMax - ReorderableListControl.s_DragItemPosition.height - 1f;
     float num3 = 0f;
     float num4 = 0f;
     int count = adaptor.Count;
     int i = 0;
     while (i < count)
     {
         rect.y = rect.yMax;
         rect.height = 0f;
         if (!this._tracking)
         {
             goto IL_286;
         }
         if (i == ReorderableListControl.s_TargetIndex)
         {
             targetSlotPosition = rect.y;
             rect.y = rect.y + ReorderableListControl.s_DragItemPosition.height;
         }
         if (i != ReorderableListControl.s_AnchorIndex)
         {
             num3 = rect.y - num4 / 2f;
             goto IL_286;
         }
         IL_415:
         i++;
         continue;
         IL_286:
         rect.height = adaptor.GetItemHeight(i) + 4f;
         num4 = rect.height;
         if (this._tracking && typeForControl == EventType.MouseDrag)
         {
             float num5 = rect.y + rect.height / 2f;
             if (ReorderableListControl.s_TargetIndex < i)
             {
                 if (ReorderableListControl.s_DragItemPosition.yMax > num3 && ReorderableListControl.s_DragItemPosition.yMax < num5)
                 {
                     num = i;
                 }
             }
             else
             {
                 if (ReorderableListControl.s_TargetIndex > i && ReorderableListControl.s_DragItemPosition.y > num3 && ReorderableListControl.s_DragItemPosition.y < num5)
                 {
                     num = i;
                 }
             }
         }
         if ((this.flags & ReorderableListFlags.DisableClipping) == (ReorderableListFlags)0)
         {
             if (rect.yMax < this._visibleRect.y - rect.height)
             {
                 GUIUtility.GetControlID(FocusType.Keyboard, rect);
                 goto IL_415;
             }
             if (rect.y > this._visibleRect.yMax + rect.height)
             {
                 break;
             }
         }
         this.DrawListItem(typeForControl, rect, adaptor, i);
开发者ID:fuboss,项目名称:aiProject,代码行数:67,代码来源:ReorderableListControl.cs

示例4: DrawListContainerAndItems


//.........这里部分代码省略.........

			ReorderableListGUI.IndexOfChangedItem = -1;

			// Draw list items!
			Rect itemPosition = new Rect(position.x + ContainerStyle.padding.left, firstItemY, position.width - ContainerStyle.padding.horizontal, 0);
			float targetSlotPosition = dragItemMaxY;

			_insertionIndex = 0;
			_insertionPosition = itemPosition.yMax;

			float lastMidPoint = 0f;
			float lastHeight = 0f;

			int count = adaptor.Count;
			for (int i = 0; i < count; ++i) {
				itemPosition.y = itemPosition.yMax;
				itemPosition.height = 0;

				lastMidPoint = itemPosition.y - lastHeight / 2f;

				if (_tracking) {
					// Does this represent the target index?
					if (i == s_TargetIndex) {
						targetSlotPosition = itemPosition.y;
						itemPosition.y += s_DragItemPosition.height;
					}

					// Do not draw item if it is currently being dragged.
					// Draw later so that it is shown in front of other controls.
					if (i == s_AnchorIndex)
						continue;

					// Update position for current item.
					itemPosition.height = adaptor.GetItemHeight(i) + 4;
					lastHeight = itemPosition.height;
				}
				else {
					// Update position for current item.
					itemPosition.height = adaptor.GetItemHeight(i) + 4;
					lastHeight = itemPosition.height;

					// Does this represent the drop insertion index?
					float midpoint = itemPosition.y + itemPosition.height / 2f;
					if (mousePosition.y > lastMidPoint && mousePosition.y <= midpoint) {
						_insertionIndex = i;
						_insertionPosition = itemPosition.y;
					}
				}

				if (_tracking && isMouseDragEvent) {
					float midpoint = itemPosition.y + itemPosition.height / 2f;

					if (s_TargetIndex < i) {
						if (s_DragItemPosition.yMax > lastMidPoint && s_DragItemPosition.yMax < midpoint)
							newTargetIndex = i;
					}
					else if (s_TargetIndex > i) {
						if (s_DragItemPosition.y > lastMidPoint && s_DragItemPosition.y < midpoint)
							newTargetIndex = i;
					}

					/*if (s_DragItemPosition.y > itemPosition.y && s_DragItemPosition.y <= midpoint)
						newTargetIndex = i;
					else if (s_DragItemPosition.yMax > midpoint && s_DragItemPosition.yMax <= itemPosition.yMax)
						newTargetIndex = i + 1;*/
				}
开发者ID:zorbathut,项目名称:gt_byg,代码行数:67,代码来源:ReorderableListControl.cs

示例5: CalculateListHeight

 public float CalculateListHeight(IReorderableListAdaptor adaptor)
 {
     this.FixStyles();
     float num = (float)(this.containerStyle.padding.vertical - 1);
     int count = adaptor.Count;
     for (int i = 0; i < count; i++)
     {
         num += adaptor.GetItemHeight(i);
     }
     num += (float)(4 * count);
     if (this.hasAddButton)
     {
         num += this.addButtonStyle.fixedHeight;
     }
     return num;
 }
开发者ID:fuboss,项目名称:aiProject,代码行数:16,代码来源:ReorderableListControl.cs


注:本文中的IReorderableListAdaptor.GetItemHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。