public override INpcAction Execute(NpcState NpcState)
        {
            INpcAction action = null;

            try
            {
                _scope.SetVariable("curTarget", NpcState.Target);
                _scope.SetVariable("map", NpcState.MapState);
                var result = _rubyEngine.Execute(this.Content, _scope);
                _scope.RemoveVariable("curTarget");
                _scope.RemoveVariable("map");
                action = (INpcAction)result;
            }
            catch { }
            finally
            {
            }
            return(action);
        }
예제 #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            this.RootVisual = new MainPage();

            var runtime = Silverlight.DynamicEngine.CreateRuntime();
            _python = runtime.GetEngine("python");

            _scope = _python.CreateScope();
            _repl = Silverlight.Repl.Show(_python, _scope);
            _scope.SetVariable("app", this);

            try {
                test("Execute strings", "4", "2 + 2");
                test("Import .NET namespace", "hi", @"import System
            System.String('hi')");
                _python.Execute(@"import foo
            foo.test(app)
            foo.test_import(app)", _scope);
            } catch(Exception ex) {
                _repl.OutputBuffer.WriteLine("[FAIL]");
                _repl.OutputBuffer.Write(_python.GetService<Hosting.ExceptionOperations>().FormatException(ex));
            }
        }
예제 #3
0
 public void Execute(string code)
 {
     _engine.Execute(code);
 }
 public object Execute([を]string code)
 {
     var result = _engine.Execute(code, _scope);
     return result;
 }