internal static void Dispatch()
        {
            if (InputEvent != null)
            {
                if (!InputEvent.ReadOnly)
                {
                    if (!InputEvent.Pressed)
                    {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
                        var state = KeyPressed();
                        if (state == EditState.Continue)
                        {
                            if (Keyboard.InputChanged)
                            {
                                if (Keyboard.InputString == "")
                                {
                                    return;
                                }
                                if (Keyboard.Nokey())
                                {
                                    InputEvent.OnInputChanged(IME.CurrentCompStr());
                                }
                                else
                                {
                                    InputEvent.OnInputChanged(Keyboard.InputString);
                                }
                            }
                        }
                        else if (state == EditState.Finish)
                        {
                            if (InputEvent.OnSubmit != null)
                            {
                                InputEvent.OnSubmit(InputEvent);
                            }
                        }
                        else if (state == EditState.NewLine)
                        {
                            InputEvent.OnInputChanged("\n");
                        }
#else
                        InputEvent.TouchInputChanged(Keyboard.TouchString);
                        if (Keyboard.status == TouchScreenKeyboard.Status.Done)
                        {
                            if (InputEvent.OnSubmit != null)
                            {
                                InputEvent.OnSubmit(InputEvent);
                            }
                            InputEvent.Refresh();
                            InputEvent = null;
                            return;
                        }
#endif
                    }
                }
                InputEvent.Refresh();
            }
        }
Exemple #2
0
        internal static void SubDispatch()
        {
            if (InputEvent != null)
            {
                if (!InputEvent.ReadOnly)
                {
                    if (!InputEvent.Pressed)
                    {
                        var state = KeyPressed();
                        if (state == EditState.Continue)
                        {
                            if (Keyboard.InputChanged)
                            {
                                if (Keyboard.InputString == "")
                                {
                                    return;
                                }
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
                                if (Keyboard.Nokey())
                                {
                                    InputEvent.OnInputChanged(IME.CurrentCompStr());
                                }
                                else
                                {
                                    InputEvent.OnInputChanged(Keyboard.InputString);
                                }
#else
                                InputEvent.TouchInputChanged(Keyboard.InputString);
#endif
                            }
                        }
                        else if (state == EditState.Finish)
                        {
                            if (InputEvent.OnSubmit != null)
                            {
                                InputEvent.OnSubmit(InputEvent);
                            }
                        }
                        else if (state == EditState.NewLine)
                        {
                            InputEvent.OnInputChanged(Environment.NewLine);
                        }
                    }
                }
                if (InputEvent.textInfo.LineChange > 0)
                {
                    InputEvent.textInfo.LineChange = 0;
                    if (InputEvent.LineChanged != null)
                    {
                        InputEvent.LineChanged(InputEvent);
                    }
                }
            }
        }