コード例 #1
0
ファイル: ScriptHive.cs プロジェクト: resonancellc/OpenXP
        //we need an actual value copy for temporary modification in the script editor
        public ScriptHive Clone()
        {
            ScriptHive clone = new ScriptHive();

            foreach (Script s in Scripts)
            {
                clone.AddScript(s.Clone());
            }
            return(clone);
        }
コード例 #2
0
        public DialogScriptEditor()
        {
            InitializeComponent();
            //setup scintilla
            scintilla.Lexer = ScintillaNET.Lexer.Ruby;

            scintilla.StyleResetDefault();
            scintilla.Styles[Style.Default].Font = "Consolas";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();

            scintilla.Styles[ScintillaNET.Style.Ruby.Default].Font          = "Consolas";
            scintilla.Styles[ScintillaNET.Style.Ruby.CommentLine].Font      = "Consolas";
            scintilla.Styles[ScintillaNET.Style.Ruby.Default].Size          = 10;
            scintilla.Styles[ScintillaNET.Style.Ruby.CommentLine].ForeColor = Color.ForestGreen;
            scintilla.Styles[ScintillaNET.Style.Ruby.Pod].ForeColor         = Color.ForestGreen;
            scintilla.Styles[ScintillaNET.Style.Ruby.Number].ForeColor      = Color.DarkRed;
            scintilla.Styles[ScintillaNET.Style.Ruby.Word].ForeColor        = Color.Navy;
            scintilla.Styles[ScintillaNET.Style.Ruby.WordDemoted].ForeColor = Color.Violet;
            scintilla.Styles[ScintillaNET.Style.Ruby.String].ForeColor      = Color.Purple;
            scintilla.Styles[ScintillaNET.Style.Ruby.Character].ForeColor   = Color.Indigo;
            scintilla.Styles[ScintillaNET.Style.Ruby.Operator].ForeColor    = Color.SteelBlue;
            scintilla.Styles[ScintillaNET.Style.Ruby.Regex].ForeColor       = Color.OrangeRed;
            scintilla.Styles[ScintillaNET.Style.Ruby.Global].ForeColor      = Color.DarkSlateGray;
            scintilla.Styles[ScintillaNET.Style.Ruby.Symbol].ForeColor      = Color.Olive;
            scintilla.SetKeywords(0, @"BEGIN END __ENCODING__ __END__ __FILE__ __LINE__ alias and begin break case class def defined? do else elsif end ensure false for if in module next nil not or redo rescue return self super then true undef unless until when while yield");
            //scintilla.SetKeywords(1, @"Audio Graphics Input RPG Bitmap Color Font Plane Rect Sprite Table Tilemap Tone Viewport Window RGSSError");

            scintilla.EdgeColumn       = 80;
            scintilla.EdgeMode         = ScintillaNET.EdgeMode.Line;
            scintilla.EdgeColor        = Color.Gray;
            scintilla.Margins[0].Width = 16;
            scintilla.TextChanged     += scintilla_TextChanged;

            FormClosed += DialogScriptEditor_FormClosed;
            listBoxScripts.SelectedIndexChanged += ListBoxScripts_SelectedIndexChanged;
            Scripts = Editor.Project.CreateTemporaryScriptHive();
            //if the script hive is empty, let's add a blank script so that there is a starting point
            if (Scripts.Scripts.Count == 0)
            {
                Scripts.AddScript(new Script(0, "", ""));
            }

            //quickload first script
            textBoxScriptName.Text = Scripts.Scripts[0].Name;
            scintilla.Text         = Scripts.Scripts[0].Contents;
            scintilla.Focus();
            scintilla.CurrentPosition = Scripts.Scripts[0].lastPosition;

            RefreshScriptList();
            listBoxScripts.SelectedIndex = 0;

            textBoxScriptName.TextChanged += TextBoxScriptName_TextChanged;
        }
コード例 #3
0
ファイル: Ruby.cs プロジェクト: Glitchfinder/OpenXP
 public void PopulateScriptHive(ScriptHive hive)
 {
     try
     {
         List <dynamic> scrArray = ToList(rbhelper.load_scripts());
         foreach (dynamic scr in scrArray)
         {
             hive.AddScript(new Script((int)scr[0], scr[1].ToString(), GameData.DataHelper.Inflate(((IronRuby.Builtins.MutableString)scr[2]).ConvertToBytes())));
         }
     }
     catch (Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Message);
     }
 }