示例#1
0
    //-------------------------------------------------------------------------------------------------

    //Here we determine which method is going to automatically be invoked when compilation ends without errors
    void AddCompilationSucceededHandler()
    {
        CSScriptEngine engine = new CSScriptEngine();

        engine.AddOnCompilationSucceededHandler(OnCompilationSucceededAction);

        engine.CompileCode("string warningCauser = \"This will result in warning, but compillation succeeds\";");

        engine.RemoveOnCompilationSucceededHandler(OnCompilationSucceededAction);
    }
        void OnEnable()
        {
            _engine.AddOnCompilationSucceededHandler(OnCompilationSucceededAction);
            _engine.AddOnCompilationFailedHandler(OnCompilationFailedAction);
            _engineRemote.AddOnCompilationSucceededHandler(OnCompilationSucceededAction);
            _engineRemote.AddOnCompilationFailedHandler(OnCompilationFailedAction);

            EventManager.Instance.AddListener <CompilationEvent>(OnCompileButton);
            EventManager.Instance.AddListener <ExecutionEvent>(OnExecuteButton);
            EventManager.Instance.AddListener <CompileTypeEvent>(OnCompileAndAddTypeButton);
            EventManager.Instance.AddListener <DeleteTypeEvent>(OnDeleteTypeButton);
            EventManager.Instance.AddListener <CurrentlyCompilingAnimationEvent>(OnAnimationToggleValueChanged);
            EventManager.Instance.AddListener <CurrentlyCompilingCodeEvent>(OnCodeToggleValueChanged);
        }
 void OnEnable()
 {
     _engine.AddOnCompilationFailedHandler(OnCompilationFailedAction);
     _engine.AddOnCompilationSucceededHandler(OnCompilationSucceededAction);
 }