コード例 #1
0
ファイル: UIUnityEvents.cs プロジェクト: sknchan/LegacyRust
    private static void TextClickDown(UICamera camera, UIInput input, UnityEngine.Event @event, UILabel label)
    {
        UITextPosition uITextPosition = ([email protected] ? camera.RaycastText(Input.mousePosition, label) : new UITextPosition());
        TextEditor     textEditor     = null;

        UIUnityEvents.ChangeFocus(camera, input, label);
        if (UIUnityEvents.GetTextEditor(out textEditor))
        {
            GUIUtility.hotControl = UIUnityEvents.controlID;
            UIUnityEvents.SetKeyboardControl();
            UIUnityEvents.MoveTextPosition(@event, textEditor, ref uITextPosition);
            int num = @event.clickCount;
            if (num == 2)
            {
                textEditor.SelectCurrentWord();
                textEditor.DblClickSnap(TextEditor.DblClickSnapping.WORDS);
                textEditor.MouseDragSelectsWholeWords(true);
            }
            else if (num == 3)
            {
                if (input.trippleClickSelect)
                {
                    textEditor.SelectCurrentParagraph();
                    textEditor.MouseDragSelectsWholeWords(true);
                    textEditor.DblClickSnap(TextEditor.DblClickSnapping.PARAGRAPHS);
                }
            }
            @event.Use();
        }
        else
        {
            Debug.LogError("Null Text Editor");
        }
        UIUnityEvents.TextSharedEnd(false, textEditor, @event);
    }
コード例 #2
0
ファイル: UIUnityEvents.cs プロジェクト: sknchan/LegacyRust
    internal static bool RequestKeyboardFocus(UIInput input)
    {
        if (input == UIUnityEvents.lastInput)
        {
            return(true);
        }
        if (UIUnityEvents.lastInput)
        {
            return(false);
        }
        if (!input.label || !input.label.enabled)
        {
            return(false);
        }
        UICamera uICamera = UICamera.FindCameraForLayer(input.label.gameObject.layer);

        if (!uICamera)
        {
            return(false);
        }
        if (!uICamera.SetKeyboardFocus(input))
        {
            return(false);
        }
        UIUnityEvents.ChangeFocus(uICamera, input, input.label);
        return(true);
    }