public void OnFrame(float delta) { List <Action> actions; if (this.nextTickQueue.Count > 0) { lock (this.nextTickLock) { actions = this.nextTickQueue; this.nextTickQueue = this.lastTickQueue; this.lastTickQueue = actions; } for (int i = 0; i < actions.Count; i++) { try { actions[i](); } catch (Exception exception) { this.LogException("Exception while calling NextTick callback", exception); } } actions.Clear(); } this.libtimer.Update(delta); if (this.isInitialized) { Oxide.Core.ServerConsole.ServerConsole serverConsole = this.ServerConsole; if (serverConsole != null) { serverConsole.Update(); } else { } try { Action <float> action = this.onFrame; if (action != null) { action(delta); } else { } } catch (Exception exception2) { Exception exception1 = exception2; this.LogException(string.Concat(exception1.GetType().Name, " while invoke OnFrame in extensions"), exception1); } } }
/// <summary> /// Called every server frame, implemented by an engine-specific extension /// </summary> public void OnFrame(float delta) { // Call any callbacks queued for this frame if (nextTickQueue.Count > 0) { List <Action> queued; lock (nextTickLock) { queued = nextTickQueue; nextTickQueue = lastTickQueue; lastTickQueue = queued; } for (var i = 0; i < queued.Count; i++) { try { queued[i](); } catch (Exception ex) { LogException("Exception while calling NextTick callback", ex); } } queued.Clear(); } // Update libraries libtimer.Update(delta); // Don't update plugin watchers or call OnFrame in plugins until servers starts ticking if (!isInitialized) { return; } if (ServerConsole != null) { ServerConsole.Update(); } // Update extensions try { onFrame?.Invoke(delta); } catch (Exception ex) { LogException($"{ex.GetType().Name} while invoke OnFrame in extensions", ex); } }