示例#1
0
        public override void RecieveCommandInput(char command)//IME will handle key event first, so these method just for english input(if it is using IME, we need to notify TSF)
        {
            switch (command)
            {
            case '\b':
                if (acp.End == acp.Start && acp.Start > 0) //if not, means it alradey have something selected, we just delete it
                {
                    acp.Start--;                           //it selected nothing, reduce end to delete a char
                }
                if (acp.End != acp.Start)
                {
                    ReplaceSelection("");
                    if (Game1.gameMode != 3)
                    {
                        Game1.playSound("tinyWhip");
                        return;
                    }
                }
                OnBackspacePressed?.Invoke(this);
                break;

            case '\r':
            case '\t':
                base.RecieveCommandInput(command);
                break;

            default:
                break;
            }
        }
示例#2
0
        public virtual void RecieveCommandInput(char command)//IME will handle key event first, so these method just for english input(if it is using IME, we need to notify TSF)
        {
            switch (command)
            {
            case '\b':
                if (acp.End == acp.Start && acp.Start > 0) //if not, means it alradey have something selected, we just delete it
                {
                    acp.Start--;                           //it selected nothing, reduce end to delete a char
                }
                if (acp.End != acp.Start)
                {
                    ReplaceSelection("");
#if TSF
                    if (Game1.keyboardDispatcher.Subscriber == this)
                    {
                        Game1.tsf.onTextChange();    //not changed by IME, should notify
                        Game1.tsf.onSelChange();
                    }
#endif
                    if (Game1.gameMode != 3)
                    {
                        Game1.playSound("tinyWhip");
                        return;
                    }
                }
                OnBackspacePressed?.Invoke(this);
                break;

            case '\r':
                OnEnterPressed?.Invoke(this);
                break;

            case '\t':
                OnTabPressed?.Invoke(this);
                break;

            default:
                break;
            }
        }