public void OnTick(object sender, EventArgs e) { try { //long firstTime = Watch.ElapsedMilliseconds; GlobalSubtitle = ""; DebugInfo = ""; if (!ModActive) { Script.Wait(1); return; } CheckCurrentModState(); //---------------------------------------------------------------------------------- if (!ModRunning) { return; } if (DebugMode) { UpdateDebugStuff(); } if (XBoxController.IsControllerConnected()) { ProcessXBoxControllerInput(); } CheckForKeysHeldDown(); CheckForKeysReleased(); ProcessHooks(); if (TestAction) { ThisWillRunEveryFrame(); } //long elapsedTime = Watch.ElapsedMilliseconds - firstTime; //DebugInfo += "\n Loop Time(" + elapsedTime + " ms) "; ShowScreenInfo(); } catch (Exception exc) { UI.Notify("VRope Runtime Error:\n" + GetErrorMessage(exc) + "\nMod execution halted."); DeleteAllHooks(); ModRunning = false; ModActive = false; } }
public static void CheckCurrentModState() { ModRunning = (Game.Player.Exists() && !FirstTime && Game.Player.IsAlive && Game.Player.CanControlCharacter); if (FirstTime && Game.IsScreenFadedIn) { Script.Wait(500); UI.Notify(MOD_NAME + " " + GetModVersion() + "\nby " + MOD_DEVELOPER, true); if (XBoxController.IsControllerConnected()) { UI.Notify("XBox controller detected.", false); } FirstTime = false; } }