Beispiel #1
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);
     }
 }