This repository has been archived by the owner on May 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,685 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SimpleJSON; | ||
|
||
namespace NoStopMod.Helper.Abstraction | ||
{ | ||
interface SettingsBase | ||
{ | ||
void Load(ref JSONNode json); | ||
|
||
void Save(ref JSONNode json); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace NoStopMod.Helper | ||
{ | ||
class EventListener<T> | ||
{ | ||
|
||
public readonly List<Action<T>> listeners = new List<Action<T>>(); | ||
|
||
private readonly string errorMessage; | ||
|
||
public EventListener(string errorMessage) | ||
{ | ||
this.errorMessage = errorMessage; | ||
} | ||
|
||
public void Add(Action<T> listener) | ||
{ | ||
listeners.Add(listener); | ||
} | ||
|
||
public void Invoke(T value) | ||
{ | ||
for (int i = 0; i < listeners.Count; i++) | ||
{ | ||
try | ||
{ | ||
listeners[i].Invoke(value); | ||
} | ||
catch (Exception e) | ||
{ | ||
NoStopMod.mod.Logger.Error("Error on " + errorMessage + " : " + e.Message + ", " + e.StackTrace); | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using SimpleJSON; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace NoStopMod.Helper | ||
{ | ||
class JSONHelper | ||
{ | ||
|
||
public static JSONNode CreateEmptyNode() | ||
{ | ||
return JSON.Parse("{}"); | ||
} | ||
|
||
public static long ConvertLong(JSONNode node) | ||
{ | ||
return node.AsLong; | ||
} | ||
|
||
public static int ConvertInt(JSONNode node) | ||
{ | ||
return node.AsInt; | ||
} | ||
|
||
public static List<T> ReadArray<T>(ref JSONNode node, string name, Func<JSONNode, T> converter) | ||
{ | ||
JSONArray array = node[name].AsArray; | ||
|
||
List<T> results = new List<T>(array.Count); | ||
for (int i = 0; i < array.Count; i++) | ||
{ | ||
results.Add(converter.Invoke(array[i])); | ||
} | ||
return results; | ||
} | ||
|
||
public static JSONArray WriteArray<T>(List<T> list, Func<T, JSONNode> converter) | ||
{ | ||
JSONArray array = new JSONArray(); | ||
for (int i = 0; i < list.Count; i++) | ||
{ | ||
array.Add(converter.Invoke(list[i])); | ||
} | ||
return array; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace NoStopMod.Helper | ||
{ | ||
public class ReflectionField<T> | ||
{ | ||
private static FieldInfo fieldInfo; | ||
|
||
private readonly string[] fieldNames; | ||
|
||
public ReflectionField(params string[] fieldNames) | ||
{ | ||
this.fieldNames = fieldNames; | ||
} | ||
|
||
public FieldInfo GetFieldInfo(Type type) | ||
{ | ||
if (fieldInfo == null) | ||
{ | ||
for (int i=0;i < fieldNames.Count();i++) | ||
{ | ||
fieldInfo = type.GetField(fieldNames[i], | ||
BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | | ||
BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty); | ||
if (fieldInfo != null) break; | ||
} | ||
if (fieldInfo == null) | ||
{ | ||
NoStopMod.mod.Logger.Error("Cannot find fieldInfo : (type=" + type + ", name" + fieldNames + ")"); | ||
} | ||
} | ||
return fieldInfo; | ||
} | ||
|
||
public void SetValue(object obj, T value) | ||
{ | ||
GetFieldInfo(obj.GetType())?.SetValue(obj, value); | ||
} | ||
|
||
public T GetValue(object obj) | ||
{ | ||
return (T) GetFieldInfo(obj.GetType())?.GetValue(obj); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace NoStopMod.Helper | ||
{ | ||
class SimpleGUI | ||
{ | ||
|
||
public static void Toggle(ref bool previous, string message, Action<bool> callback) | ||
{ | ||
bool current = GUILayout.Toggle(previous, message); | ||
if (current != previous) | ||
{ | ||
previous = current; | ||
callback.Invoke(current); | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using UnityEngine; | ||
using UnityModManagerNet; | ||
|
||
namespace NoStopMod.HyperRabbit | ||
{ | ||
class HyperRabbitManager | ||
{ | ||
|
||
public static HyperRabbitSettings settings; | ||
|
||
public static void Init() | ||
{ | ||
NoStopMod.onGUIListener.Add(OnGUI); | ||
|
||
settings = new HyperRabbitSettings(); | ||
Settings.settings.Add(settings); | ||
} | ||
|
||
private static void OnGUI(UnityModManager.ModEntry modEntry) | ||
{ | ||
GUILayout.BeginHorizontal("HyperRabbit"); | ||
|
||
GUILayout.Label("Max otto tile per frame (5 + " + settings.maxTilePerFrame + ")"); | ||
|
||
settings.maxTilePerFrame = (int) GUILayout.HorizontalSlider(settings.maxTilePerFrame, 0, 100); | ||
|
||
GUILayout.EndHorizontal(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using HarmonyLib; | ||
|
||
namespace NoStopMod.HyperRabbit | ||
{ | ||
class HyperRabbitPatches | ||
{ | ||
|
||
[HarmonyPatch(typeof(scrController), "PlayerControl_Update")] | ||
private static class scrController_PlayerControl_Update_Patch | ||
{ | ||
public static void Postfix(scrController __instance) | ||
{ | ||
if (RDC.auto && scrController.isGameWorld) | ||
{ | ||
int num = HyperRabbitManager.settings.maxTilePerFrame; | ||
while (num > 0 && __instance.chosenplanet.AutoShouldHitNow()) | ||
{ | ||
__instance.keyBufferCount = 0; | ||
__instance.Hit(); | ||
num--; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using NoStopMod.Helper; | ||
using NoStopMod.Helper.Abstraction; | ||
using SimpleJSON; | ||
|
||
namespace NoStopMod.HyperRabbit | ||
{ | ||
class HyperRabbitSettings : SettingsBase | ||
{ | ||
public int maxTilePerFrame = 0; | ||
|
||
public void Load(ref JSONNode json) | ||
{ | ||
JSONNode node = json["HyperRabbit"]; | ||
|
||
maxTilePerFrame = node["maxTilePerFrame"].AsInt; | ||
} | ||
|
||
public void Save(ref JSONNode json) | ||
{ | ||
JSONNode node = JSONHelper.CreateEmptyNode(); | ||
node["maxTilePerFrame"].AsInt = maxTilePerFrame; | ||
|
||
json["HyperRabbit"] = node; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"Id": "NoStopMod", | ||
"DisplayName": "NoStopMod", | ||
"Author": "Luxus", | ||
"Version": "1.0.0", | ||
"ManagerVersion": "1.0.0", | ||
"Version": "1.2.3", | ||
"ManagerVersion": "0.23.4.0", | ||
"AssemblyName": "NoStopMod.dll", | ||
"EntryMethod": "NoStopMod.NoStopMod.Load" | ||
} | ||
"EntryMethod": "NoStopMod.NoStopMod.Load", | ||
"HomePage": "https://github.com/Luxusio/ADOFAI-NoStopMod", | ||
"Repository": "https://raw.githubusercontent.com/Luxusio/ADOFAI-NoStopMod/master/Repository.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using NoStopMod.InputFixer.HitIgnore.KeyLimiter; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace NoStopMod.InputFixer.HitIgnore | ||
{ | ||
class HitIgnoreManager | ||
{ | ||
private static Dictionary<String, bool[]> dictionary; | ||
|
||
public static bool scnCLS_searchMode; | ||
public static scrController.States scrController_state; | ||
|
||
public static void Init() | ||
{ | ||
if (GCS.sceneToLoad == null) GCS.sceneToLoad = "scnNewIntro"; | ||
|
||
dictionary = new Dictionary<string, bool[]>(); | ||
|
||
bool[] ignoreScnNewIntro = Enumerable.Repeat(false, 1024).ToArray(); | ||
dictionary["scnNewIntro"] = ignoreScnNewIntro; | ||
ignoreScnNewIntro[(int)KeyCode.BackQuote] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha0] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha1] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha2] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha3] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha4] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha5] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha6] = true; | ||
ignoreScnNewIntro[(int)KeyCode.Alpha7] = true; | ||
|
||
bool[] ignoreScnCLS = Enumerable.Repeat(false, 1024).ToArray(); | ||
dictionary["scnCLS"] = ignoreScnCLS; | ||
ignoreScnCLS[(int)KeyCode.S] = true; | ||
ignoreScnCLS[(int)KeyCode.Delete] = true; | ||
ignoreScnCLS[(int)KeyCode.F] = true; | ||
ignoreScnCLS[(int)KeyCode.O] = true; | ||
ignoreScnCLS[(int)KeyCode.Alpha7] = true; | ||
ignoreScnCLS[(int)KeyCode.UpArrow] = true; | ||
ignoreScnCLS[(int)KeyCode.DownArrow] = true; | ||
|
||
scnCLS_searchMode = false; | ||
|
||
if (scrController.instance != null) | ||
{ | ||
scrController_state = (scrController.States) scrController.instance.GetState(); | ||
} | ||
|
||
KeyLimiterManager.Init(); | ||
} | ||
|
||
public static bool shouldBeIgnored(KeyCode keyCode) | ||
{ | ||
if (keyCode == KeyCode.Escape) return true; | ||
if (KeyLimiterManager.isChangingLimitedKeys) | ||
{ | ||
KeyLimiterManager.UpdateKeyLimiter(keyCode); | ||
return true; | ||
} | ||
|
||
if (scrController_state != scrController.States.PlayerControl) | ||
{ | ||
return true; | ||
} | ||
|
||
bool[] ignoreScnCLS; | ||
if (dictionary.TryGetValue(GCS.sceneToLoad, out ignoreScnCLS)) | ||
{ | ||
if (GCS.sceneToLoad == "scnCLS" && scnCLS_searchMode) | ||
{ | ||
return true; | ||
} | ||
if(ignoreScnCLS[(int) keyCode]) return true; | ||
} | ||
|
||
if(KeyLimiterManager.settings.enable) | ||
{ | ||
return !KeyLimiterManager.IsKeyEnabled(keyCode); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.