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); } }
public TileEditor(MapEditor map) { this.map = map; }
static void Main(string[] args) { var Editor = new MapEditor(); }
private void button1_Click(object sender, EventArgs e) { MapEditor m = new MapEditor(); m.ShowDialog(); }
static MapEditor() { instance = new MapEditor(); }