UILabel.GetUrlAtPosition C# (CSharp) Méthode

GetUrlAtPosition() public méthode

Retrieve the URL directly below the specified relative-to-label position.
public GetUrlAtPosition ( Vector2 localPos ) : string
localPos Vector2
Résultat string
	public string GetUrlAtPosition (Vector2 localPos) { return GetUrlAtCharacterIndex(GetCharacterIndexAtPosition(localPos)); }

Same methods

UILabel::GetUrlAtPosition ( Vector3 worldPos ) : string

Usage Example

Exemple #1
0
    void ClickLabelBack(GameObject go)
    {
        if (GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneType != SceneType.SCUFFLEFIELD)
        {
            GameCenter.messageMng.AddClientMsg(405);
            return;
        }
        string url = labText.GetUrlAtPosition(UICamera.lastWorldPosition);

        if (!string.IsNullOrEmpty(url))
        {
            string[] urlStr = url.Split('|');
            if (urlStr.Length == 3)
            {
                switch (urlStr[0])
                {
                case "0":
                    break;

                case "1":                //跳到一级界面
                    GUIType uiType = (GUIType)Enum.Parse(Type.GetType("GUIType"), urlStr[2]);
                    if (uiType == GUIType.NEWMALL && curEquipmentInfo != null)
                    {
                        GameCenter.buyMng.OpenBuyWnd(curEquipmentInfo);
                    }
                    else
                    {
                        GameCenter.uIMng.SwitchToUI(uiType);
                    }
                    ToolTipMng.CloseAllTooltip();
                    break;

                case "2":                //跳到二级界面
                    SubGUIType subUiType = (SubGUIType)Enum.Parse(Type.GetType("SubGUIType"), urlStr[2]);
                    GameCenter.uIMng.SwitchToSubUI(subUiType);
                    ToolTipMng.CloseAllTooltip();
                    break;

                case "3":
                    int npcID = 0;
                    if (int.TryParse(urlStr[2], out npcID))
                    {
                        ToolTipMng.CloseAllTooltip();
                        GameCenter.uIMng.SwitchToUI(GUIType.NONE);
                        GameCenter.taskMng.PublicTraceToNpc(npcID);
                    }
                    break;
                }
            }
            else
            {
                Debug.Log("数据错误!");
            }
        }
        Debug.Log("url:" + url);
    }
All Usage Examples Of UILabel::GetUrlAtPosition