UILabel.GetCharacterIndexAtPosition C# (CSharp) Méthode

GetCharacterIndexAtPosition() public méthode

Return the index of the character at the specified local position.
public GetCharacterIndexAtPosition ( Vector2 localPos ) : int
localPos Vector2
Résultat int
	public int GetCharacterIndexAtPosition (Vector2 localPos)
	{
		if (isValid)
		{
			string text = processedText;
			if (string.IsNullOrEmpty(text)) return 0;

			UpdateNGUIText(defaultFontSize, mWidth, mHeight);

			NGUIText.PrintCharacterPositions(text, mTempVerts, mTempIndices);

			if (mTempVerts.size > 0)
			{
				ApplyOffset(mTempVerts, 0);
				int retVal = NGUIText.GetClosestCharacter(mTempVerts, localPos);
				retVal = mTempIndices[retVal];

				mTempVerts.Clear();
				mTempIndices.Clear();
				return retVal;
			}
		}
		return 0;
	}

Same methods

UILabel::GetCharacterIndexAtPosition ( Vector3 worldPos ) : int

Usage Example

	static int GetCharacterIndexAtPosition(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Vector2, bool>(L, 2))
			{
				UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1);
				UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2);
				bool arg1 = LuaDLL.lua_toboolean(L, 3);
				int o = obj.GetCharacterIndexAtPosition(arg0, arg1);
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Vector3, bool>(L, 2))
			{
				UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1);
				UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2);
				bool arg1 = LuaDLL.lua_toboolean(L, 3);
				int o = obj.GetCharacterIndexAtPosition(arg0, arg1);
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: UILabel.GetCharacterIndexAtPosition");
			}
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
All Usage Examples Of UILabel::GetCharacterIndexAtPosition