示例#1
0
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            if (m_player == null)
            {
                SessionTimeoutMessage();
                return;
            }

            int tickCount = 0;

            if (fldUITickCount.Value.Length > 0)
            {
                int.TryParse(fldUITickCount.Value, out tickCount);
                fldUITickCount.Value = "";
            }

            if (fldUIMsg.Value.Length > 0)
            {
                string[] args = fldUIMsg.Value.Split(new[] { ' ' }, 2);
                switch (args[0])
                {
                case "command":
                    m_player.SendCommand(args[1], tickCount);
                    break;

                case "endwait":
                    m_player.EndWait();
                    break;

                case "endpause":
                    m_player.EndPause();
                    break;

                case "choice":
                    m_player.SetMenuResponse(args[1]);
                    break;

                case "choicecancel":
                    m_player.CancelMenu();
                    break;

                case "msgbox":
                    m_player.SetQuestionResponse(args[1]);
                    break;

                case "event":
                    SendEvent(args[1]);
                    break;

                case "tick":
                    m_player.Tick(tickCount);
                    break;

                case "save":
                    string unescapedHtml = args[1].Replace("&gt;", ">").Replace("&lt;", "<").Replace("&amp;", "&");
                    m_player.RequestSave(unescapedHtml);
                    break;
                }
                fldUIMsg.Value = "";
            }

            string output = m_player.ClearBuffer();

            m_buffer.OutputText(output);
            ClearJavaScriptBuffer();
        }