private static void KillDiagonals(On.HeroController.orig_HeroDash orig, HeroController self) { InputHandler input = ReflectionHelper.GetAttr <HeroController, InputHandler>(HeroController.instance, "inputHandler"); if (input.inputActions.left.IsPressed || input.inputActions.right.IsPressed) { ref bool down_enabled = ref Mirror.GetFieldRef <OneAxisInputControl, bool>(input.inputActions.down, "Enabled"); bool orig_enabled = down_enabled; down_enabled = false; orig(self); down_enabled = orig_enabled; }
private static void KillDiagonals(On.HeroController.orig_HeroDash orig, HeroController self) { InputHandler input = ReflectionHelper.GetAttr <HeroController, InputHandler>(HeroController.instance, "inputHandler"); if (input.inputActions.left.IsPressed || input.inputActions.right.IsPressed) { bool downEnabled = ReflectionHelper.GetAttr <OneAxisInputControl, bool>(input.inputActions.down, "Enabled"); ReflectionHelper.SetAttr(input.inputActions.down, "Enabled", false); orig(self); ReflectionHelper.SetAttr(input.inputActions.down, "Enabled", downEnabled); } else { orig(self); } }
private static void OnNextChar(On.DialogueBox.orig_ShowNextChar orig, DialogueBox self) { TextMeshPro text = ReflectionHelper.GetAttr <DialogueBox, TextMeshPro>(self, "textMesh"); text.maxVisibleCharacters = text.textInfo.pageInfo[self.currentPage - 1].lastCharacterIndex + 1; }
private static string GetSavePath(int saveSlot, string ending) { return(Path.Combine(ReflectionHelper.GetAttr <DesktopPlatform, string>(Platform.Current as DesktopPlatform, "saveDirPath"), $"user{saveSlot}.{ending}")); }
public static T GetAttr <T>(this object obj, string name, bool instance = true) => ReflectionHelper.GetAttr <T>(obj, name, instance);