Ejemplo n.º 1
0
        public static void StartScript(string script, List <int> identEnts)
        {
            var scriptEngine = new JScriptEngine();
            var collection   = new HostTypeCollection(Assembly.LoadFrom("scripthookvdotnet.dll"),
                                                      Assembly.LoadFrom("scripts\\NativeUI.dll"));

            scriptEngine.AddHostObject("API", collection);
            scriptEngine.AddHostObject("host", new HostFunctions());
            scriptEngine.AddHostObject("script", new ScriptContext());
            scriptEngine.AddHostType("Enumerable", typeof(Enumerable));
            scriptEngine.AddHostType("List", typeof(IList));
            scriptEngine.AddHostType("KeyEventArgs", typeof(KeyEventArgs));
            scriptEngine.AddHostType("Keys", typeof(Keys));

            foreach (var obj in identEnts)
            {
                var name = PropStreamer.Identifications[obj];
                if (MapEditor.IsPed(new Prop(obj)))
                {
                    scriptEngine.AddHostObject(name, new Ped(obj));
                }
                else if (MapEditor.IsVehicle(new Prop(obj)))
                {
                    scriptEngine.AddHostObject(name, new Vehicle(obj));
                }
                else if (MapEditor.IsProp(new Prop(obj)))
                {
                    scriptEngine.AddHostObject(name, new Prop(obj));
                }
            }

            try
            {
                scriptEngine.Execute(script);
            }
            catch (ScriptEngineException ex)
            {
                LogException(ex);
            }
            finally
            {
                lock (ScriptEngines)
                    ScriptEngines.Add(scriptEngine);
            }
        }
Ejemplo n.º 2
0
 public TileEditor(MapEditor map)
 {
     this.map = map;
 }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     var Editor = new MapEditor();
 }
Ejemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     MapEditor m = new MapEditor();
     m.ShowDialog();
 }
Ejemplo n.º 5
0
 static MapEditor()
 {
     instance = new MapEditor();
 }