Example #1
0
        //
        // This is called once every main loop frame, outside of object context
        //
        public static void OnMainLoop(ulong frame)
        {
            OnScriptContextBegin?.Invoke();

            try
            {
                using (new Profiler($"{nameof(Entrypoints)}:TaskRunner"))
                {
                    _taskRunner.Process();
                }

                using (new Profiler($"{nameof(Entrypoints)}:Scheduler.Process()"))
                {
                    Scheduler.Process();
                }
            }
            catch (Exception ex)
            {
                Log.Write(LogGroup.Error, ex.ToMessageAndCompleteStacktrace());
            }

            OnScriptContextEnd?.Invoke();
        }
Example #2
0
        public int OnRunScript(string script, uint oidSelf)
        {
            ScriptHandleResult result = ScriptHandleResult.NotHandled;

            OnScriptContextBegin?.Invoke();

            try
            {
                foreach (IScriptDispatcher dispatcher in dispatchers)
                {
                    result = dispatcher.ExecuteScript(script, oidSelf);
                    if (result != ScriptHandleResult.NotHandled)
                    {
                        break;
                    }
                }
            }
            finally
            {
                OnScriptContextEnd?.Invoke();
            }

            return((int)result);
        }