Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Runtime.Moveset != null && Runtime.Moveset.Game.Scripts.ContainsKey(crc))
            {
                // need to split into lines
                string[]   line   = richTextBox1.Text.Split('\n');
                ACMDScript script = new ACMDScript(crc);
                int        index  = 0;
                try
                {
                    foreach (string str in line)
                    {
                        if (str.Equals(""))
                        {
                            continue;
                        }
                        ACMDCompiler.CompileSingleCommand(str); // try to compile
                        index++;
                    }
                    foreach (ACMDCommand s in ACMDCompiler.CompileCommands(line))
                    {
                        script.Add(s);
                        index++;
                    }

                    Runtime.Moveset.Game.Scripts[crc] = script;
                } catch (Exception)
                {
                    HighlightLine(richTextBox1, index, Color.Red);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (Owner.MovesetManager != null && cb_section.SelectedIndex >= 0)
            {
                // need to split into lines
                string[]   line   = richTextBox1.Text.Split('\n');
                ACMDScript script = new ACMDScript(crc);
                int        index  = 0;
                try
                {
                    foreach (string str in line)
                    {
                        if (str.Equals(""))
                        {
                            continue;
                        }
                        ACMDCompiler.CompileSingleCommand(str); // try to compile
                        index++;
                    }
                    foreach (ACMDCommand s in ACMDCompiler.CompileCommands(line))
                    {
                        script.Add(s);
                        index++;
                    }

                    SortedList <uint, SALT.Moveset.IScript> scriptList = null;
                    if (cb_section.Text.Equals("GAME"))
                    {
                        scriptList = Owner.MovesetManager.Game.Scripts;
                    }
                    else if (cb_section.Text.Equals("SOUND"))
                    {
                        scriptList = Owner.MovesetManager.Sound.Scripts;
                    }
                    else if (cb_section.Text.Equals("EXPRESSION"))
                    {
                        scriptList = Owner.MovesetManager.Expression.Scripts;
                    }
                    else if (cb_section.Text.Equals("EFFECT"))
                    {
                        scriptList = Owner.MovesetManager.Effect.Scripts;
                    }

                    //Update script if it already exists
                    if (scriptList.ContainsKey(crc))
                    {
                        scriptList[crc] = script;
                    }

                    if (cb_section.Text.Equals("GAME"))
                    {
                        Owner.ACMDScript = new ForgeACMDScript(script);
                        Owner.ACMDScript.processToFrame(0);
                    }
                } catch (Exception)
                {
                    HighlightLine(richTextBox1, index, Color.Red);
                }
            }
        }
Esempio n. 3
0
 private void DoNewline()
 {
     if (SelectionStart.X < Lines[SelectionStart.Y].Length)
     {
         string str = Lines[SelectionStart.Y].Text.Substring(SelectionStart.X);
         Lines[SelectionStart.Y].Text = Lines[SelectionStart.Y].Text.Remove(SelectionStart.X);
         Lines.Insert(SelectionStart.Y + 1, new Line(str, this));
         _list.Insert(SelectionStart.Y + 1, null);
         CaretNextLine();
     }
     else if (SelectionStart.X == Lines[SelectionStart.Y].Length)
     {
         Lines.Insert(SelectionStart.Y + 1, new Line(string.Empty, this));
         if (SelectionStart.Y + 1 > _list.Count)
         {
             _list.Add(null);
         }
         else
         {
             _list.Insert(SelectionStart.Y + 1, null);
         }
         CaretNextLine();
     }
     TextChanged(new EventArgs());
     Invalidate();
 }