Ejemplo n.º 1
0
 object readStr(object[] args)
 {
     mReader     = new RTSWaitForValueR <string>(this);
     mReaderName = "";
     return(mReader);
 }
Ejemplo n.º 2
0
 object readStrWithName(object[] args)
 {
     mReader     = new RTSWaitForValueR <string>(this);
     mReaderName = args[0] == null ? "" : args[0].ToString();
     return(mReader);
 }
Ejemplo n.º 3
0
        bool ProcessKeyCode(Event ev)
        {
            bool ctrl  = ev.control;
            bool shift = ev.shift;
            bool alt   = ev.alt;
            bool clt   = ctrl || alt;

            if (ev.keyCode == KeyCode.BackQuote)
            {
                if (clt)
                {
                    ev.Use();
                    Open = !Open;
                    return(true);
                }
            }
            if (!Open)
            {
                return(false);
            }
            switch (ev.keyCode)
            {
            case KeyCode.LeftArrow:
                ev.Use();
                if (clt)
                {
                    ireader.MoveSelector(ireader.LineStart - ireader.SelectStart, shift);
                }
                else if (ireader.SelectStart != ireader.SelectEnd && !shift)
                {
                    ireader.MoveSelector(Mathf.Min(ireader.SelectStart, ireader.SelectEnd) - ireader.SelectStart, shift);
                }
                else
                {
                    ireader.MoveSelector(-1, shift);
                }
                //assistant.Close();
                return(true);

            case KeyCode.RightArrow:
                ev.Use();
                if (clt)
                {
                    ireader.MoveSelector(ireader.FixedLineEnd - ireader.SelectStart, shift);
                }
                else if (ireader.SelectStart != ireader.SelectEnd && !shift)
                {
                    ireader.MoveSelector(Mathf.Max(ireader.SelectStart, ireader.SelectEnd) - ireader.SelectStart, shift);
                }
                else
                {
                    ireader.MoveSelector(1, shift);
                }
                //assistant.Close();
                return(true);

            case KeyCode.UpArrow:
                ev.Use();
                if (clt)
                {
                    NextCmd(-1);
                }
                else
                {
                    ireader.MoveSelectorLine(-1, shift);
                }
                return(true);

            case KeyCode.DownArrow:
                ev.Use();
                if (clt)
                {
                    NextCmd(1);
                }
                else
                {
                    ireader.MoveSelectorLine(1, shift);
                }
                assistant.Close();
                return(true);

            case KeyCode.Backspace:
                ev.Use();
                ireader.Backspace();
                assistant.Close();
                return(true);

            case KeyCode.Tab:
                ev.Use();
                if (ireader.SelectLength == 0)
                {
                    assistant.Assistant(ireader, mEngine);
                }
                if (assistant.HasAssistant)
                {
                    assistant.NextAssistant(ireader);
                }
                return(true);

            case KeyCode.Return:
                ev.Use();
                if ((clt && ctrlExecute) || (!ctrlExecute && !clt))
                {
                    if (mReader != null)
                    {
                        mReader.value = ireader.Text;
                        mReader.StopWait();
                        PutLog(Level.debug, ireader.Text, false);
                        ireader.Text = null;
                        mReader      = null;
                        mReaderName  = "";
                    }
                    else
                    {
                        string s = ireader.Text == null ? null : ireader.Text.Trim();

                        if (!string.IsNullOrEmpty(s))
                        {
                            int threadId = 0;
                            if (s.StartsWith(">"))
                            {
                                threadId = -1;
                                s        = s.Substring(1);
                            }
                            else if (s.StartsWith("<"))
                            {
                                int off = s.IndexOf('>');
                                int tid;
                                if (off > 0 && int.TryParse(s.Substring(1, off - 1), out tid))
                                {
                                    threadId = tid;
                                    s        = s.Substring(off + 1);
                                }
                            }
                            if (Execute(s, threadId))
                            {
                                logDebug(s);
                                PutCmd(ireader.Text);
                                ireader.Text = null;
                            }
                        }
                    }
                }
                else
                {
                    ireader.Insert("\n");
                }
                return(true);

            default:
                bool p = ProcessQuickKey(ev.keyCode, shift, ctrl);
                if (p)
                {
                    ev.Use();
                }
                if (ev.keyCode != KeyCode.None && assistant.HasAssistant)
                {
                    assistant.Release(ireader);
                }
                return(p);
            }
        }