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


C# IUIListObject类代码示例

本文整理汇总了C#中IUIListObject的典型用法代码示例。如果您正苦于以下问题:C# IUIListObject类的具体用法?C# IUIListObject怎么用?C# IUIListObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SetWorld

	void SetWorld(IUIListObject item)
	{
		Debug.Log("snapped item: "+item.Index);
		/*for (int i = 0; i < 5; i++)
		{
			//scrollLevels.GetItem(i).gameObject.SetActive(false);
			Debug.Log ("scrollGetItem: " + scrollLevels.GetItem(i).gameObject.name);
		}*/
		
		//Debug.Log ("scrollItem: " + item);
		actualWorld = item.Index +1;
		//Debug.Log ("actualWorldScroll: " + actualWorld);
		worldTitle.Text = worldTitles[actualWorld-1];
	}
开发者ID:uptopgames,项目名称:Minesweeper,代码行数:14,代码来源:LevelSelection.cs

示例2: InsertItem

	/// <summary>
	/// Inserts a list item at the specified position in the list.
	/// </summary>
	/// <param name="item">Reference to the item to be inserted into the list.</param>
	/// <param name="position">0-based index of the position in the list where the item will be placed.</param>
	public void InsertItem(IUIListObject item, int position)
	{
		InsertItem(item, position, null);
	}
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:9,代码来源:UIScrollList.cs

示例3: ScrollToItem

	/// <summary>
	/// Scrolls the list to the specified item in the specified
	/// number of seconds.
	/// </summary>
	/// <param name="item">The item to scroll to.</param>
	/// <param name="scrollTime">The number of seconds the scroll should last.</param>
	/// <param name="easing">The type of easing to be used for the scroll.</param>
	public void ScrollToItem(IUIListObject item, float scrollTime, EZAnimation.EASING_TYPE easing)
	{
		snappedItem = item;

		if (newItems.Count != 0)
		{
			if (itemsInserted)
				RepositionItems();
			else
				PositionNewItems();

			itemsInserted = false;
			newItems.Clear();
		}

		if (orientation == ORIENTATION.HORIZONTAL)
		{
			if(direction == DIRECTION.TtoB_LtoR)
				autoScrollPos = Mathf.Clamp01(item.transform.localPosition.x / amtOfPlay);
			else
				autoScrollPos = Mathf.Clamp01(-item.transform.localPosition.x / amtOfPlay);
		}
		else
		{
			if(direction == DIRECTION.TtoB_LtoR)
				autoScrollPos = Mathf.Clamp01(-item.transform.localPosition.y / amtOfPlay);
			else
				autoScrollPos = Mathf.Clamp01(item.transform.localPosition.y / amtOfPlay);
		}

		autoScrollInterpolator = EZAnimation.GetInterpolator(easing);
		autoScrollStart = scrollPos;
		autoScrollDelta = autoScrollPos - scrollPos;
		autoScrollDuration = scrollTime;
		autoScrollTime = 0;
		autoScrolling = true;

		// Do some state cleanup:
		scrollDelta = 0;
		isScrolling = false;

		if (itemSnappedDel != null)
			itemSnappedDel(snappedItem);
	}
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:51,代码来源:UIScrollList.cs

示例4: RemoveItem

	/// <summary>
	/// Removes the specified item.
	/// Remaining items are repositioned to fill
	/// the gap.
	/// The removed item is destroyed if 'destroy'
	/// is true. Otherwise, it is deactivated.
	/// </summary>
	/// <param name="index">Reference to the item to be removed.</param>
	public void RemoveItem(IUIListObject item, bool destroy)
	{
		for(int i=0; i<items.Count; ++i)
		{
			if(items[i] == item)
			{
				RemoveItem(i, destroy);
				return;
			}
		}
	}
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:19,代码来源:UIScrollList.cs

示例5: SetSelectedItem

	/// <summary>
	/// Sets the item at the specified index as the
	/// currently selected item.
	/// </summary>
	/// <param name="index">The zero-based index of the item.</param>
	public void SetSelectedItem(int index)
	{
		IUIListObject oldSel = selectedItem;

		if (index < 0 || index >= items.Count)
		{
			// Unset the previous selection:
			if (selectedItem != null)
				selectedItem.selected = false;

			selectedItem = null;

			// If the selected item changed,
			// notify our delegate:
			if (oldSel != selectedItem)
			{
				if (changeDelegate != null)
					changeDelegate(this);
			}

			return;
		}

		IUIListObject item = items[index];

		// Unset the previous selection:
		if (selectedItem != null)
			selectedItem.selected = false;

		selectedItem = item;
		item.selected = true;

		// If the selected item changed,
		// notify our delegate:
		if (oldSel != selectedItem)
		{
			if (changeDelegate != null)
				changeDelegate(this);
		}
	}
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:45,代码来源:UIScrollList.cs

示例6: GetXAlignRight

	protected float GetXAlignRight(IUIListObject item)
	{ return (viewableAreaActual.x * 0.5f) - item.BottomRightEdge.x; }
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:2,代码来源:UIScrollList.cs

示例7: GetXCentered

	protected float GetXCentered(IUIListObject item)
	{	return 0;	}
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:2,代码来源:UIScrollList.cs

示例8: InsertItem

	/// <summary>
	/// Inserts a list item at the specified position in the list.
	/// </summary>
	/// <param name="item">Reference to the item to be inserted into the list.</param>
	/// <param name="position">0-based index of the position in the list where the item will be placed.</param>
	/// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param>
	public void InsertItem(IUIListObject item, int position, string text)
	{
		InsertItem(item, position, text, false);
	}
开发者ID:juliancruz87,项目名称:transpp,代码行数:10,代码来源:UIScrollList.cs

示例9: ClearListSync

	public void ClearListSync(bool destroy)
	{
		RemoveItemsFromContainer();

		List<IUIListObject> listDestroy = new List<IUIListObject>();

		selectedItem = null;
		lastClickedControl = null;

		for (int i = 0; i < items.Count; ++i)
		{
			// Move them out of the mover object
			// and into the root of the scene
			// hierarchy:
			items[i].transform.parent = null;

#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9
			items[i].gameObject.SetActive(false);
#else
			items[i].gameObject.SetActiveRecursively(false);
#endif

			if (destroy)
				listDestroy.Add(items[i]);
		}

		if (destroy)
		{
			foreach (IUIListObject item in listDestroy)
			{
				if (item.gameObject != null)
					Destroy(item.gameObject);
			}
		}

		visibleItems.Clear();
		items.Clear();
		PositionItems();
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:39,代码来源:UIScrollList.cs

示例10: AddItem

	/// <summary>
	/// Adds an item to the end of the list.
	/// NOTE: For proper appearance, list items should each 
	/// be of uniform width when the list is vertical, and of 
	/// uniform height when the list is horizontal. Besides
	/// that, list items can vary in size.
	/// </summary>
	/// <param name="item">Reference to the list item to be added.</param>
	/// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param>
	public void AddItem(IUIListObject item, string text)
	{
		InsertItem(item, items.Count, text);
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:13,代码来源:UIScrollList.cs

示例11: InsertItem

	/// <summary>
	/// Inserts a list item at the specified position in the list.
	/// </summary>
	/// <param name="item">Reference to the item to be inserted into the list.</param>
	/// <param name="position">0-based index of the position in the list where the item will be placed.</param>
	/// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param>
	public void InsertItem(IUIListObject item, int position, string text)
	{
		IUIListObject lastItem;
		float contentDelta;

		// Make sure Start() has already run:
		if (!m_started)
			Start();

		// See if the item needs to be enabled:
		if(activateWhenAdding)
			if (!((Component)item).gameObject.active)
				((Component)item).gameObject.SetActiveRecursively(true);

		// Put the item in the correct layer:
		item.gameObject.layer = gameObject.layer;

		// Add the item to our container:
		if (container != null)
			container.AddChild(item.gameObject);


		//-------------------------------------
		// Position our item:
		//-------------------------------------
		item.transform.parent = mover.transform;
#if AUTO_ORIENT_ITEMS
		item.transform.localRotation = Quaternion.identity;
#endif
#if AUTO_SCALE_ITEMS
		item.transform.localScale = Vector3.one;
#endif
		// Go ahead and get the item in the mover's plane
		// on the local Z-axis.  This must be done here
		// before anything that follows because if we are
		// using a perspective camera and these are newly
		// created items, their Start() will be called for
		// the first time when FindOuterEdges() is called
		// either by us, or by the Text property, and if
		// the item isn't already positioned relative to
		// the camera, then its size will be calculated
		// wrong.
		item.transform.localPosition = Vector3.zero;


		if(text != null)
			item.Text = text;

		item.SetList(this);

		// Compute the edges of the item:
		item.FindOuterEdges();
		item.UpdateCollider();
		

		// Clamp our position:
		position = Mathf.Clamp(position, 0, items.Count);

		// Hide the item by default:
		item.Hide(true);
		if (!item.Managed)
			item.gameObject.SetActiveRecursively(false);

		// See if we can just add it to the end:
		if(position == items.Count)
		{
			if (orientation == ORIENTATION.HORIZONTAL)
			{

				if (items.Count > 0)
				{
					lastItem = items[items.Count - 1];
					item.transform.localPosition = new Vector3(lastItem.transform.localPosition.x + lastItem.BottomRightEdge.x + itemSpacing - item.TopLeftEdge.x, 0);
				}
				else
				{
					item.transform.localPosition = new Vector3((viewableArea.x * -0.5f) - item.TopLeftEdge.x + itemSpacing, 0);
				}

				contentDelta = item.BottomRightEdge.x - item.TopLeftEdge.x + itemSpacing;
			}
			else
			{
				if (items.Count > 0)
				{
					lastItem = items[items.Count - 1];
					item.transform.localPosition = new Vector3(0, lastItem.transform.localPosition.y + lastItem.BottomRightEdge.y - itemSpacing - item.TopLeftEdge.y);
				}
				else
				{
					item.transform.localPosition = new Vector3(0, (viewableArea.y * 0.5f) - item.TopLeftEdge.y - itemSpacing);
				}
				contentDelta = item.TopLeftEdge.y - item.BottomRightEdge.y + itemSpacing;
			}
//.........这里部分代码省略.........
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:101,代码来源:UIScrollList.cs

示例12: SetSelectedItem

	/// <summary>
	/// Sets the item at the specified index as the
	/// currently selected item.
	/// </summary>
	/// <param name="index">The zero-based index of the item.</param>
	public void SetSelectedItem(int index)
	{
		if (index < 0 || index >= items.Count)
			return;

		IUIListObject item = items[index];

		if (selectedItem != null)
			selectedItem.selected = false;

		selectedItem = item;
		item.selected = true;
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:18,代码来源:UIScrollList.cs

示例13: GetYAlignTop

	protected float GetYAlignTop(IUIListObject item)
	{ return (viewableAreaActual.y * 0.5f) - item.TopLeftEdge.y; }
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:2,代码来源:UIScrollList.cs

示例14: RemoveItem

	/// <summary>
	/// Removes the specified item.
	/// Remaining items are repositioned to fill
	/// the gap.
	/// The removed item is destroyed if 'destroy'
	/// is true. Otherwise, it is deactivated.
	/// </summary>
	/// <param name="item">Reference to the item to be removed.</param>
	/// <param name="destroy">Whether or not to destroy the item being removed.</param>
	public void RemoveItem(IUIListObject item, bool destroy)
	{
		RemoveItem(item, destroy, false);
	}
开发者ID:juliancruz87,项目名称:transpp,代码行数:13,代码来源:UIScrollList.cs

示例15: GetYAlignBottom

	protected float GetYAlignBottom(IUIListObject item)
	{ return (viewableAreaActual.y * -0.5f) - item.BottomRightEdge.y; }
开发者ID:nbolabs,项目名称:KnifeLi,代码行数:2,代码来源:UIScrollList.cs


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