GetCharacterIndexAtPosition() public method

Return the index of the character at the specified local position.
public GetCharacterIndexAtPosition ( Vector2 localPos ) : int
localPos Vector2
return int
Esempio n. 1
0
	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);
		}
	}
Esempio n. 2
0
    /// <summary>
    /// 获得对应链接值
    /// </summary>
    /// <param name="pos"></param>
    /// <returns></returns>
    virtual public string GetNameAtPosition(Vector3 pos)
    {
        if (m_label != null)
        {
            int characterIndex = m_labelName.GetCharacterIndexAtPosition(pos);
            //string name = m_labelName.GetUrlAtCharacterIndex(characterIndex);
            string text = m_labelName.text;

            if (characterIndex != -1 && characterIndex < text.Length)
            {
                int linkStart = text.LastIndexOf("]", characterIndex);

                if (linkStart != -1)
                {
                    linkStart += 1;
                    int linkEnd = text.IndexOf("[", linkStart);

                    if (linkEnd != -1)
                    {
                        int closingStatement = text.IndexOf("[/url]", linkEnd);
                        if (closingStatement == -1 || closingStatement >= characterIndex)
                        {
                            return(text.Substring(linkStart, linkEnd - linkStart));
                        }
                    }
                }
            }
            return(string.Empty);
        }
        else
        {
            return(string.Empty);
        }
    }
Esempio n. 3
0
    static int GetCharacterIndexAtPosition(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UILabel), typeof(LuaTable)))
        {
            UILabel obj  = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");
            Vector2 arg0 = LuaScriptMgr.GetVector2(L, 2);
            int     o    = obj.GetCharacterIndexAtPosition(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UILabel), typeof(LuaTable)))
        {
            UILabel obj  = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");
            Vector3 arg0 = LuaScriptMgr.GetVector3(L, 2);
            int     o    = obj.GetCharacterIndexAtPosition(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UILabel.GetCharacterIndexAtPosition");
        }

        return(0);
    }
Esempio n. 4
0
	/// <summary>
	/// Helper function that retrieves the index of the character under the mouse.
	/// </summary>

	protected int GetCharUnderMouse ()
	{
		Vector3[] corners = label.worldCorners;
		Ray ray = UICamera.currentRay;
		Plane p = new Plane(corners[0], corners[1], corners[2]);
		float dist;
		return p.Raycast(ray, out dist) ? mDrawStart + label.GetCharacterIndexAtPosition(ray.GetPoint(dist)) : 0;
	}
Esempio n. 5
0
    protected int GetCharUnderMouse()
    {
        //IL_000c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0011: Unknown result type (might be due to invalid IL or missing references)
        //IL_001b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0027: Unknown result type (might be due to invalid IL or missing references)
        //IL_0033: Unknown result type (might be due to invalid IL or missing references)
        //IL_003f: Unknown result type (might be due to invalid IL or missing references)
        //IL_005a: Unknown result type (might be due to invalid IL or missing references)
        Vector3[] worldCorners = label.worldCorners;
        Ray       currentRay   = UICamera.currentRay;
        Plane     val          = default(Plane);

        val._002Ector(worldCorners[0], worldCorners[1], worldCorners[2]);
        float num = default(float);

        return(val.Raycast(currentRay, ref num) ? (mDrawStart + label.GetCharacterIndexAtPosition(currentRay.GetPoint(num), false)) : 0);
    }
Esempio n. 6
0
    public static int GetCharacterIndexAtPosition(IntPtr l)
    {
        int result;

        try
        {
            int total = LuaDLL.pua_gettop(l);
            if (LuaObject.matchType(l, total, 2, typeof(Vector2)))
            {
                UILabel uILabel = (UILabel)LuaObject.checkSelf(l);
                Vector2 localPos;
                LuaObject.checkType(l, 2, out localPos);
                int characterIndexAtPosition = uILabel.GetCharacterIndexAtPosition(localPos);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, characterIndexAtPosition);
                result = 2;
            }
            else if (LuaObject.matchType(l, total, 2, typeof(Vector3)))
            {
                UILabel uILabel2 = (UILabel)LuaObject.checkSelf(l);
                Vector3 worldPos;
                LuaObject.checkType(l, 2, out worldPos);
                int characterIndexAtPosition2 = uILabel2.GetCharacterIndexAtPosition(worldPos);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, characterIndexAtPosition2);
                result = 2;
            }
            else
            {
                LuaObject.pushValue(l, false);
                LuaDLL.pua_pushstring(l, "No matched override function to call");
                result = 2;
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Esempio n. 7
0
 static public int GetCharacterIndexAtPosition(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(UnityEngine.Vector2), typeof(bool)))
         {
             UILabel             self = (UILabel)checkSelf(l);
             UnityEngine.Vector2 a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetCharacterIndexAtPosition(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.Vector3), typeof(bool)))
         {
             UILabel             self = (UILabel)checkSelf(l);
             UnityEngine.Vector3 a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetCharacterIndexAtPosition(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 8
0
    protected int GetCharUnderMouse()
    {
        Vector3[] worldCorners = label.worldCorners;
        Ray       currentRay   = UICamera.currentRay;
        float     enter;

        return(new Plane(worldCorners[0], worldCorners[1], worldCorners[2]).Raycast(currentRay, out enter) ? (mDrawStart + label.GetCharacterIndexAtPosition(currentRay.GetPoint(enter), precise: false)) : 0);
    }