Beispiel #1
0
 private static void TextDrag(UICamera camera, UIInput input, UnityEngine.Event @event, UILabel label)
 {
     if (input == UIUnityEvents.lastInput && camera == UIUnityEvents.lastInputCamera)
     {
         UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         if (UIUnityEvents.controlID == GUIUtility.hotControl)
         {
             UITextPosition uITextPosition = camera.RaycastText(Input.mousePosition, label);
             if (@event.shift)
             {
                 UIUnityEvents.MoveTextPosition(@event, textEditor, ref uITextPosition);
             }
             else
             {
                 UIUnityEvents.SelectTextPosition(@event, textEditor, ref uITextPosition);
             }
             @event.Use();
         }
         UIUnityEvents.TextSharedEnd(false, textEditor, @event);
     }
 }
Beispiel #2
0
    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);
    }
Beispiel #3
0
 private static void TextKeyUp(UICamera camera, UIInput input, UnityEngine.Event @event, UILabel label)
 {
     if (input == UIUnityEvents.lastInput && camera == UIUnityEvents.lastInputCamera)
     {
         UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         UIUnityEvents.TextSharedEnd(false, textEditor, @event);
     }
 }
Beispiel #4
0
 private static void TextClickUp(UICamera camera, UIInput input, UnityEngine.Event @event, UILabel label)
 {
     if (input == UIUnityEvents.lastInput && camera == UIUnityEvents.lastInputCamera)
     {
         UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         if (UIUnityEvents.controlID != GUIUtility.hotControl)
         {
             Debug.Log(string.Concat(new object[] { "Did not match ", UIUnityEvents.controlID, " ", GUIUtility.hotControl }));
         }
         else
         {
             textEditor.MouseDragSelectsWholeWords(false);
             GUIUtility.hotControl = 0;
             @event.Use();
             UIUnityEvents.SetKeyboardControl();
         }
         UIUnityEvents.TextSharedEnd(false, textEditor, @event);
     }
 }
Beispiel #5
0
 private static void TextKeyDown(UICamera camera, UIInput input, UnityEngine.Event @event, UILabel label)
 {
     if (input == UIUnityEvents.lastInput && camera == UIUnityEvents.lastInputCamera)
     {
         UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         if (!UIUnityEvents.GetKeyboardControl())
         {
             Debug.Log(string.Concat("Did not ", @event));
             return;
         }
         bool flag = false;
         if (!UIUnityEvents.TextEditorHandleEvent(@event, textEditor))
         {
             KeyCode keyCode = @event.keyCode;
             if (keyCode == KeyCode.Tab)
             {
                 return;
             }
             if (keyCode == KeyCode.None)
             {
                 char chr = @event.character;
                 if (chr == '\t')
                 {
                     return;
                 }
                 bool flag1 = false;
                 flag1 = chr == '\n';
                 if (flag1 && !input.inputMultiline && [email protected])
                 {
                     UIUnityEvents.submit = true;
                 }
                 else if (label.font)
                 {
                     BMFont bMFont  = label.font.bmFont;
                     BMFont bMFont1 = bMFont;
                     if (bMFont != null)
                     {
                         if (flag1 || chr != 0 && bMFont1.ContainsGlyph(chr))
                         {
                             textEditor.Insert(chr);
                             flag = true;
                         }
                         else if (chr == 0)
                         {
                             if (Input.compositionString.Length > 0)
                             {
                                 textEditor.ReplaceSelection(string.Empty);
                                 flag = true;
                             }
                             @event.Use();
                         }
                     }
                 }
             }
         }
         else
         {
             @event.Use();
             flag = true;
         }
         UIUnityEvents.TextSharedEnd(flag, textEditor, @event);
     }
 }