예제 #1
0
        private void PrintWindow_TextProcessing(XmlNodeList printList)
        {
            sec = 0;
            for (int i = printStart; i < printList.Count; i++)
            {
                XmlNode printNode = printList[i];
                if (printNode.HasChildNodes)
                {
                    for (int j = lineStart; j < printNode.ChildNodes.Count; j++)
                    {
                        XmlNode line = printNode.ChildNodes[j];
                        switch (line.Name)
                        {
                        case "LC":
                            string innerCommand = line.InnerText.ToUpper().Replace(" ", "");
                            if (innerCommand == "WAITINPUT")
                            {
                                enterHandle   = EnterHandling.continueEvent;
                                printStart    = i;
                                lineStart     = j + 1;
                                Update_Active = false;
                                goto End;
                            }
                            else if (innerCommand.Contains("WAIT"))
                            {
                                enterHandle   = EnterHandling.skip;
                                sec           = int.Parse(innerCommand.Replace("WAIT", ""));
                                printStart    = i;
                                lineStart     = j + 1;
                                Update_Active = false;
                                timer2.Start();
                                goto End;
                            }
                            break;

                        default:
                            PrintWindow.Text += line.InnerText;
                            break;
                        }
                    }
                    lineStart = 0;
                }
                else
                {
                    PrintWindow.Text += printNode.InnerText;
                }
            }
            End : {  }
        }
예제 #2
0
        private void Process_CommandContent()
        {
Update_Start:
            switch (currentHandling)
            {
            case CommandHandling.Print:
                PrintList_Processed = eventProcessor.Print_PreProcess(command_ContentList, ref EI_Enabled);
                PrintWindow_TextProcessing(PrintList_Processed);
                break;

            case CommandHandling.Branch_Condition:
                command_ContentList = eventProcessor.Condition_Check(command_ContentList, out input_Available, out roll_Available);
                if (input_Available)
                {
                    currentHandling = CommandHandling.Branch_Input;
                    enterHandle     = EnterHandling.disabled;
                }
                else if (roll_Available)
                {
                    currentHandling = CommandHandling.Branch_Roll;
                }
                else
                {
                    currentHandling = CommandHandling.Branch_Result;
                }
                goto Update_Start;

            case CommandHandling.Branch_Input:
                eventProcessor.Input_SetTrigger(command_ContentList, ref enterHandle, ref Opt_type, ref Opt_TypeBox,
                                                ref Opt_A, ref Opt_B, ref Opt_C, ref Opt_D);
                break;

            case CommandHandling.Branch_Roll:
                command_ContentList = eventProcessor.Roll_Solve(command_ContentList, out result_Info);
                currentHandling     = CommandHandling.Branch_Result;
                goto Update_Start;

            case CommandHandling.Branch_Result:
                eventProcessor.Result_Solve(command_ContentList, ref result_Info, ref EI_Current, ref CI_Current, ref EI_Enabled);
                break;

            default:
                break;
            }
        }
예제 #3
0
 private void Game_Reset()
 {
     PrintWindow.Text    = "";
     Opt_TypeBox.Text    = "";
     Opt_A.Text          = "";
     Opt_B.Text          = "";
     Opt_C.Text          = "";
     Opt_D.Text          = "";
     Opt_TypeBox.Enabled = false;
     Opt_A.Enabled       = false;
     Opt_B.Enabled       = false;
     Opt_C.Enabled       = false;
     Opt_D.Enabled       = false;
     Opt_TypeBox.Visible = false;
     Opt_A.Visible       = false;
     Opt_B.Visible       = false;
     Opt_C.Visible       = false;
     Opt_D.Visible       = false;
     enterHandle         = EnterHandling.newEvent;
     PrintWindow_YValue  = 0;
 }
예제 #4
0
        public void Input_SetTrigger(XmlNodeList option_XmlList, ref EnterHandling enterHandle, ref Dictionary <string, string> Opt_type, ref RichTextBox Opt_TypeBox,
                                     ref Label Opt_A, ref Label Opt_B, ref Label Opt_C, ref Label Opt_D)
        {
            Opt_type.Clear();
            bool hasType = false;

            foreach (XmlNode option_SingleNode in option_XmlList)
            {
                XmlNode option_inputNode = option_SingleNode.SelectSingleNode("Input");
                if (option_inputNode.Attributes["Tag"].Value == "Click")
                {
                    switch (option_SingleNode.Attributes["Tag"].Value)
                    {
                    case "A":
                        Opt_A.Text    = option_inputNode.InnerText.Trim();
                        Opt_A.Visible = true;
                        Opt_A.Enabled = true;
                        break;

                    case "B":
                        Opt_B.Text    = option_inputNode.InnerText.Trim();
                        Opt_B.Visible = true;
                        Opt_B.Enabled = true;
                        break;

                    case "C":
                        Opt_C.Text    = option_inputNode.InnerText.Trim();
                        Opt_C.Visible = true;
                        Opt_C.Enabled = true;
                        break;

                    case "D":
                        Opt_D.Text    = option_inputNode.InnerText.Trim();
                        Opt_D.Visible = true;
                        Opt_D.Enabled = true;
                        break;

                    default:
                        throw new Exception("InputNode: " + option_SingleNode.Attributes["Tag"].Value + ": Is not a valid Tag in context");
                    }
                }
                else if (option_inputNode.Attributes["Tag"].Value == "Type")
                {
                    hasType = true;
                    string   option_Tag            = option_SingleNode.Attributes["Tag"].Value;
                    string   rawTypeConditions     = option_inputNode.InnerText.Replace(" ", "");
                    string[] option_typeConditions = rawTypeConditions.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string condition in option_typeConditions)
                    {
                        string pCondition = condition.ToUpper();

                        Opt_type.Add(pCondition, option_Tag);
                    }
                }
            }
            if (hasType)
            {
                if (!Opt_TypeBox.Enabled)
                {
                    enterHandle         = EnterHandling.confirmInput;
                    Opt_TypeBox.Enabled = true;
                    Opt_TypeBox.Visible = true;
                }
            }
        }
예제 #5
0
        private void Game_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.F10)
            {
                SafeGame();
            }

            if (e.KeyData == Keys.Enter)
            {
                switch (enterHandle)
                {
                case EnterHandling.newEvent:
                    Game_Reset();
ReHandle:
                    Update_Active = true;
                    lineStart     = 0;
                    printStart    = 0;
                    Update_CommandList();
                    Update_Command();
                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                    break;

                case EnterHandling.continueEvent:
                    PrintWindow_TextProcessing(PrintList_Processed);
                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                    enterHandle        = EnterHandling.newEvent;
                    goto ReHandle;

                case EnterHandling.confirmInput:
                    PrintWindow.Text = PrintWindow.Text.Replace(Type_ErrorMessage, " ");
                    string input = Opt_TypeBox.Text.Replace(" ", "");
                    input = input.ToUpper();

                    if (Opt_type.ContainsKey(input))
                    {
                        Input_ContentListUpdate(ref command_ContentList, Opt_type[input]);
                        currentHandling = update_CurrentHandling(roll_Available);
                        Process_CommandContent();
                        Game_Reset();
                        Update_CommandList();
                        Update_Command();
                        e.Handled          = true;
                        e.SuppressKeyPress = true;
                    }
                    else
                    {
                        Opt_TypeBox.Text  = "";
                        PrintWindow.Text += Type_ErrorMessage;
                    }
                    break;

                case EnterHandling.skip:
                    skip = true;
                    break;

                default:
                    break;
                }
            }
        }