diff --git a/Dialog/English.txt b/Dialog/English.txt index 8da496d..d872c2d 100644 --- a/Dialog/English.txt +++ b/Dialog/English.txt @@ -167,7 +167,7 @@ TAS_HELPER_PREDICTOR_MAIN_SWITCH= Main Switch TAS_HELPER_PREDICTOR_DESCRIPTION= Predict your future track, when tas is paused or frame-stepping,{n} AND any selected conditions of the following is satisfied. TAS_HELPER_TIMELINE_LENGTH= Timeline Length -TAS_HELPER_PREDICT_START_CONDITIONS= ----------------------- Conditions: ----------------------- +TAS_HELPER_PREDICT_START_CONDITIONS= Conditions TAS_HELPER_PREDICT_ON_FILE_CHANGE= Predict on Tas File Changed TAS_HELPER_PREDICT_ON_HOTKEY_PRESSED= Predict on Hotkey Pressed TAS_HELPER_PREDICT_ON_FRAME_STEP= Predict on Frame Stepping @@ -202,7 +202,7 @@ TAS_HELPER_STOP_PREDICT_WHEN_DEATH= Stop Prediction when TAS_HELPER_STOP_PREDICT_WHEN_KEYFRAME= Stop Prediction when Keyframe TAS_HELPER_USE_KEY_FRAME= Keyframe Main Switch TAS_HELPER_USE_KEY_FRAME_TIME= Show Index of Keyframe -TAS_HELPER_KEY_FRAME_FLAGS= ----------------------- Flags: ----------------------- +TAS_HELPER_KEY_FRAME_FLAGS= Flags TAS_HELPER_PREDICTOR_LINE_WIDTH= Polygonal Line Width TAS_HELPER_PREDICTOR_POINT_SIZE= Dot Size diff --git a/Dialog/Simplified Chinese.txt b/Dialog/Simplified Chinese.txt index 14cfcc7..b2c8c61 100644 --- a/Dialog/Simplified Chinese.txt +++ b/Dialog/Simplified Chinese.txt @@ -158,8 +158,7 @@ TAS_HELPER_TIMELINE_LENGTH= 时间线的长度 TAS_HELPER_PREDICT_ON_FILE_CHANGE= 条件: 当 TAS 文件内容变动 TAS_HELPER_PREDICT_ON_HOTKEY_PRESSED= 条件: 当按下快捷键 TAS_HELPER_PREDICT_ON_FRAME_STEP= 条件: 当 TAS 步进 -TAS_HELPER_PREDICT_START_CONDITIONS= ----------------------- 条件: ----------------------- - +TAS_HELPER_PREDICT_START_CONDITIONS= 条件 TAS_HELPER_PREDICTOR_FINISHED= 完成 TAS_HELPER_PREDICTOR_ONOFF= 开关 TAS_HELPER_PREDICTOR_KEYFRAME_1= 关键帧/1 @@ -190,7 +189,7 @@ TAS_HELPER_STOP_PREDICT_WHEN_DEATH= 死亡时终止预测 TAS_HELPER_STOP_PREDICT_WHEN_KEYFRAME= 关键帧处终止预测 TAS_HELPER_USE_KEY_FRAME= 关键帧的主开关 TAS_HELPER_USE_KEY_FRAME_TIME= 显示关键帧对应的时间点 -TAS_HELPER_KEY_FRAME_FLAGS= ----------------------- Flags: ----------------------- +TAS_HELPER_KEY_FRAME_FLAGS= Flags TAS_HELPER_PREDICTOR_LINE_WIDTH= 折线宽度 TAS_HELPER_PREDICTOR_POINT_SIZE= 点的大小 diff --git a/Source/Module/Menu/CustomColors.cs b/Source/Module/Menu/CustomColors.cs index 6d56ab5..c9404be 100644 --- a/Source/Module/Menu/CustomColors.cs +++ b/Source/Module/Menu/CustomColors.cs @@ -94,14 +94,14 @@ public static void ResetPredictorColor() { public static Color CameraTriggerColor { get => TasHelperSettings.CameraTriggerColor; set => TasHelperSettings.CameraTriggerColor = value; } public static TextMenu.Item CreateChangeColorItem(Func getter, Action setter, string name, TextMenu textMenu, bool inGame) { - TextMenu.Item item = new ButtonColorExt(name.ToDialogText(), getter).Pressed( + TextMenu.Item item = new ButtonColorExt(name.ToDialogText(), getter, inGame).Pressed(inGame ? () => { } + : () => { Audio.Play("event:/ui/main/savefile_rename_start"); textMenu.SceneAs().Goto() .Init(ColorToHex(getter()), value => setter(HexToColor(value, getter())), 9); }); - item.Disabled = inGame; return item; } @@ -162,6 +162,7 @@ public static void AddItemWithDescriptionAndCMD(TextMenu menu, List Predictor_CoarseScaleColor, value => Predictor_CoarseScaleColor = value, nameof(Predictor_CoarseScaleColor), defaultPredictorCoarseScaleColor); AddItemWithDescriptionAndCMD(menu, page, inGame, () => Predictor_EndpointColor, value => Predictor_EndpointColor = value, nameof(Predictor_EndpointColor), defaultPredictorEndpointColor); AddItemWithDescriptionAndCMD(menu, page, inGame, () => Predictor_KeyframeColor, value => Predictor_KeyframeColor = value, nameof(Predictor_KeyframeColor), defaultPredictorKeyframeColor); + page.Add(new HLine(Color.Gray)); return page; } @@ -211,6 +213,7 @@ public static void AddItemWithDescriptionAndCMD(TextMenu menu, List LoadRangeColliderColor, value => LoadRangeColliderColor = value, nameof(LoadRangeColliderColor), defaultLoadRangeColliderColor); AddItemWithDescriptionAndCMD(menu, page, inGame, () => CameraTargetColor, value => CameraTargetColor = value, nameof(CameraTargetColor), defaultCameraTargetColor); AddItemWithDescriptionAndCMD(menu, page, inGame, () => CameraTriggerColor, value => CameraTriggerColor = value, nameof(CameraTriggerColor), defaultCameraTriggerColor); + page.Add(new HLine(Color.Gray)); return page; } @@ -234,6 +237,7 @@ public static void AddItemWithDescriptionAndCMD(TextMenu menu, List cubecolorGetter, string icon = null) + public ButtonColorExt(string label, Func cubecolorGetter, bool inGame = false) #pragma warning restore CS8625 : base(label) { CubeColorGetter = cubecolorGetter; - Icon = icon; + Icon = ""; name = label; + InGame = inGame; } public override void Render(Vector2 position, bool highlighted) { Label = name + $": {ColorToHex(CubeColorGetter())}"; position += Offset; float num = Container.Alpha * Alpha; - Color color = (Disabled ? TextColorDisabled : highlighted ? Container.HighlightColor : TextColor) * num; + Color color = (InGame ? (highlighted ? TextColorHighlightDisabled : TextColorDisabled) : (highlighted ? Container.HighlightColor : TextColor)) * num; Color strokeColor = Color.Black * (num * num * num); bool flag = Container.InnerContent == TextMenu.InnerContentMode.TwoColumn && !AlwaysCenter; Vector2 textPosition = position + (flag ? Vector2.Zero : new Vector2(Container.Width * 0.5f, 0f)); @@ -935,7 +942,6 @@ public override void Render(Vector2 position, bool highlighted) { Vector2 cubePosition = textPosition + new Vector2(ActiveFont.Measure(Label).X + 30f, -height / 2f); Draw.Rect(cubePosition - new Vector2(4f, 4f), height + 8f, height + 8f, Color.Black); Draw.Rect(cubePosition, height, height, CubeColorGetter()); - DrawIcon(position, Icon, IconWidth, Height(), IconOutline, (Disabled ? Color.DarkSlateGray : highlighted ? Color.White : Color.LightSlateGray) * num, ref textPosition); ActiveFont.DrawOutline(Label, textPosition, justify, Scale, color, 2f, strokeColor); } } diff --git a/Source/Module/Menu/PredictorMenu.cs b/Source/Module/Menu/PredictorMenu.cs index da56543..b219a04 100644 --- a/Source/Module/Menu/PredictorMenu.cs +++ b/Source/Module/Menu/PredictorMenu.cs @@ -26,6 +26,15 @@ private static void AddDescriptionBothControl(this List page, Tex itemBelow.OnLeave += () => descriptionText.FadeVisible = false; } + private static Color hlineColor = Color.Lerp(Color.Gray, Color.Black, 0.2f); + + private static HLine CreateHLine() { + return new HLine(Color.Gray); + } + private static HLine CreateHLine(string text) { + return new HLine(hlineColor, 20f, 0f, text, 0.4f); + } + internal static List Create_PageOnOff(TextMenu menu, bool inGame) { List page = new List(); TextMenu.Item PredictItem; @@ -35,14 +44,11 @@ private static void AddDescriptionBothControl(this List page, Tex TasHelperSettings.TimelineLength = value; Predictor.PredictorCore.InitializeCachePeriod(); })); - - page.Add(new SubHeaderExt("Predict Start Conditions".ToDialogText()) { - TextColor = Color.Gray, - HeightExtra = 0f - }); + page.Add(CreateHLine("Predict Start Conditions".ToDialogText())); page.Add(new TextMenu.OnOff("Predict On Frame Step".ToDialogText(), TasHelperSettings.PredictOnFrameStep).Change(value => TasHelperSettings.PredictOnFrameStep = value)); page.Add(new TextMenu.OnOff("Predict On File Change".ToDialogText(), TasHelperSettings.PredictOnFileChange).Change(value => TasHelperSettings.PredictOnFileChange = value)); page.Add(new TextMenu.OnOff("Predict On Hotkey Pressed".ToDialogText(), TasHelperSettings.PredictOnHotkeyPressed).Change(value => TasHelperSettings.PredictOnHotkeyPressed = value)); + page.Add(CreateHLine()); return page; } @@ -52,10 +58,7 @@ private static void AddDescriptionBothControl(this List page, Tex page.Add(mainSwitchItem); page.AddDescriptionOnEnter(menu, mainSwitchItem, "Keyframe Description".ToDialogText()); page.Add(new TextMenu.OnOff("Use Key Frame Time".ToDialogText(), TasHelperSettings.UseKeyFrameTime).Change(value => TasHelperSettings.UseKeyFrameTime = value)); - page.Add(new SubHeaderExt("Key Frame Flags".ToDialogText()) { - TextColor = Color.Gray, - HeightExtra = 0f - }); + page.Add(CreateHLine("Key Frame Flags".ToDialogText())); TextMenu.Item gainLevelControlItem = new TextMenu.OnOff("Gain Level Control", TasHelperSettings.UseFlagGainLevelControl).Change(value => TasHelperSettings.UseFlagGainLevelControl = value); TextMenu.Item loseLevelControlItem = new TextMenu.OnOff("Lose Level Control", TasHelperSettings.UseFlagLoseLevelControl).Change(value => TasHelperSettings.UseFlagLoseLevelControl = value); @@ -70,26 +73,17 @@ private static void AddDescriptionBothControl(this List page, Tex page.Add(losePlayerControlItem); page.Add(new TextMenu.OnOff("Begin Engine Freeze", TasHelperSettings.UseFlagGainFreeze).Change(value => TasHelperSettings.UseFlagGainFreeze = value)); page.Add(new TextMenu.OnOff("End Engine Freeze", TasHelperSettings.UseFlagLoseFreeze).Change(value => TasHelperSettings.UseFlagLoseFreeze = value)); - + page.Add(CreateHLine()); return page; } internal static List Create_PageKeyframe_2(TextMenu menu, bool inGame) { List page = new List(); - page.Add(new SubHeaderExt("Key Frame Flags".ToDialogText()) { - TextColor = Color.Gray, - HeightExtra = 0f - }); - + page.Add(CreateHLine("Key Frame Flags".ToDialogText())); page.Add(new TextMenu.OnOff("Gain On Ground", TasHelperSettings.UseFlagGainOnGround).Change(value => TasHelperSettings.UseFlagGainOnGround = value)); - page.Add(new TextMenu.OnOff("Lose On Ground", TasHelperSettings.UseFlagLoseOnGround).Change(value => TasHelperSettings.UseFlagLoseOnGround = value)); - - page.Add(new TextMenu.OnOff("Gain Ultra", TasHelperSettings.UseFlagGainUltra).Change(value => TasHelperSettings.UseFlagGainUltra = value)); - page.Add(new TextMenu.OnOff("On Bounce", TasHelperSettings.UseFlagOnBounce).Change(value => TasHelperSettings.UseFlagOnBounce = value)); - TextMenu.Item onEntityStateItem = new TextMenu.OnOff("On Entity State", TasHelperSettings.UseFlagOnEntityState).Change(value => TasHelperSettings.UseFlagOnEntityState = value); page.Add(onEntityStateItem); page.AddDescriptionOnEnter(menu, onEntityStateItem, "Predictor On Entity State Description".ToDialogText()); @@ -104,7 +98,7 @@ private static void AddDescriptionBothControl(this List page, Tex page.Add(new TextMenu.OnOff("Refill Dash", TasHelperSettings.UseFlagRefillDash).Change(value => TasHelperSettings.UseFlagRefillDash = value)); page.Add(new TextMenu.OnOff("Respawn Point Change", TasHelperSettings.UseFlagRespawnPointChange).Change(value => TasHelperSettings.UseFlagRespawnPointChange = value)); page.Add(new TextMenu.OnOff("Dead", TasHelperSettings.UseFlagDead).Change(value => TasHelperSettings.UseFlagDead = value)); - + page.Add(CreateHLine()); return page; } @@ -118,6 +112,7 @@ private static void AddDescriptionBothControl(this List page, Tex page.AddDescriptionOnEnter(menu, fadeoutItem, "Only Apply To Hitbox".ToDialogText()); page.Add(new IntSlider("Predictor Line Width".ToDialogText(), 0, 20, TasHelperSettings.PredictorLineWidth).Change(value => TasHelperSettings.PredictorLineWidth = value)); page.Add(new IntSlider("Predictor Point Size".ToDialogText(), 0, 20, TasHelperSettings.PredictorPointSize).Change(value => TasHelperSettings.PredictorPointSize = value)); + page.Add(CreateHLine()); return page; } @@ -144,7 +139,7 @@ private static void AddDescriptionBothControl(this List page, Tex TextMenu.Item ultraSpeedItem = new IntSlider("Ultra Speed Lower Limit".ToDialogText(), 0, 325, TasHelperSettings.UltraSpeedLowerLimit).Change((value) => TasHelperSettings.UltraSpeedLowerLimit = value); page.Add(ultraSpeedItem); page.AddDescriptionOnEnter(menu, ultraSpeedItem, "Ultra Speed Lower Limit Description".ToDialogText()); - + page.Add(CreateHLine()); return page; } diff --git a/Source/Module/Menu/TASHelperMenu.cs b/Source/Module/Menu/TASHelperMenu.cs index 67c7ca3..3ea3d8a 100644 --- a/Source/Module/Menu/TASHelperMenu.cs +++ b/Source/Module/Menu/TASHelperMenu.cs @@ -96,7 +96,7 @@ private static EaseInSubMenu CreateSimplifiedGraphicSubMenu(TextMenu menu) { subMenu.Add(new TextMenu.OnOff("Spinner Dashed Border".ToDialogText(), TasHelperSettings.SimplifiedSpinnerDashedBorder).Change(value => TasHelperSettings.SimplifiedSpinnerDashedBorder = value)); subMenu.Add(new TextMenu.OnOff("Spinner_Ignore_TAS_UncollidableAlpha".ToDialogText(), TasHelperSettings.Ignore_TAS_UnCollidableAlpha).Change(value => TasHelperSettings.Ignore_TAS_UnCollidableAlpha = value)); subMenu.Add(new TextMenu.OnOff("ACH For Spinner".ToDialogText(), TasHelperSettings.ApplyActualCollideHitboxForSpinner).Change(value => TasHelperSettings.ApplyActualCollideHitboxForSpinner = value)); - subMenu.Add(new HLine()); + subMenu.Add(new HLine(Color.Gray)); TextMenu.Item simplifiedLightning; subMenu.Add(simplifiedLightning = new TextMenuExt.EnumerableSlider("Simplified Lightning".ToDialogText(), CreateSimplifiedGraphicsModeOptions(), TasHelperSettings.EnableSimplifiedLightningMode).Change(value => TasHelperSettings.EnableSimplifiedLightningMode = value)); subMenu.AddDescription(menu, simplifiedLightning, "Simplified Lightning Description".ToDialogText()); @@ -106,11 +106,12 @@ private static EaseInSubMenu CreateSimplifiedGraphicSubMenu(TextMenu menu) { TextMenu.Item ACH_LightningItem; subMenu.Add(ACH_LightningItem = new TextMenu.OnOff("ACH For Lightning".ToDialogText(), TasHelperSettings.ApplyActualCollideHitboxForLightning).Change(value => TasHelperSettings.ApplyActualCollideHitboxForLightning = value)); subMenu.AddDescription(menu, ACH_LightningItem, "ACH Warn Lightning".ToDialogText()); - subMenu.Add(new HLine()); + subMenu.Add(new HLine(Color.Gray)); TextMenu.Item simplifiedTrigger; subMenu.Add(simplifiedTrigger = new TextMenuExt.EnumerableSlider("Simplified Triggers".ToDialogText(), CreateSimplifiedGraphicsModeOptions(), TasHelperSettings.EnableSimplifiedTriggersMode).Change(value => TasHelperSettings.EnableSimplifiedTriggersMode = value)); subMenu.Add(new TextMenu.OnOff("Hide Camera Trigger".ToDialogText(), TasHelperSettings.HideCameraTriggers).Change(value => TasHelperSettings.HideCameraTriggers = value)); subMenu.Add(new TextMenu.OnOff("Hide Gold Berry".ToDialogText(), TasHelperSettings.HideGoldBerryCollectTrigger).Change(value => TasHelperSettings.HideGoldBerryCollectTrigger = value)); + subMenu.Add(new HLine(Color.Gray)); }); } @@ -405,7 +406,6 @@ public override float Height() { public override void Update() { base.Update(); TitleLerp = Calc.Clamp(TitleLerp + 10f * Math.Sign(TitleLerpTarget - TitleLerp) * Engine.DeltaTime, 0, 1); - } } @@ -593,10 +593,23 @@ public override void Update() { } public class HLine : TextMenu.Item { - public float margins; - public HLine(float margins = 0f) { + public Color lineColor; + + public float leftMargin; + + public float rightMargin; + + public string text; + + public float textHorizontalAlign; + + public HLine(Color color, float leftMargin = 20f, float rightMargin = 0f, string label = "", float textAlign = 0.5f) { Selectable = false; - this.margins = margins; + lineColor = color; + this.leftMargin = leftMargin; + this.rightMargin = rightMargin; + text = label; + textHorizontalAlign = textAlign; } public override float LeftWidth() { @@ -612,6 +625,18 @@ public override float Height() { } public override void Render(Vector2 position, bool highlighted) { - Monocle.Draw.Line(new Vector2(Container.X - Container.Width / 2f + margins, position.Y), new Vector2(Container.X + Container.Width / 2f - margins, position.Y), Color.Gray, 4f); + float left = Container.X - Container.Width / 2f + leftMargin; + float right = Container.X + Container.Width / 2f - rightMargin; + float y = position.Y; + if (text.IsNullOrEmpty()) { + Monocle.Draw.Line(new Vector2(left, y), new Vector2(right, y), lineColor, 4f); + } + else { + float textCenter = MathHelper.Lerp(left, right, textHorizontalAlign); + float haldWidth = ActiveFont.Measure(text).X / 2f * 0.6f + 10f; + ActiveFont.DrawOutline(text, new Vector2(textCenter, y), new Vector2(0.5f, 0.5f), Vector2.One * 0.6f, Color.Gray, 2f, Color.Black); + Monocle.Draw.Line(new Vector2(left, y), new Vector2(textCenter - haldWidth, y), lineColor, 4f); + Monocle.Draw.Line(new Vector2(textCenter + haldWidth, y), new Vector2(right, y), lineColor, 4f); + } } } \ No newline at end of file diff --git a/Source/Utils/HookHelper.cs b/Source/Utils/HookHelper.cs index 5b5fd20..342bf92 100644 --- a/Source/Utils/HookHelper.cs +++ b/Source/Utils/HookHelper.cs @@ -106,7 +106,7 @@ public static void ReturnZeroMethod(Type conditionType, string conditionMethodNa } public static class CILCodeHelper { - public static void CILCodeLogger(this ILCursor ilCursor, int logCount = 9999, bool useCommand = true) { + public static void CILCodeLogger(this ILCursor ilCursor, int logCount = 999999, bool useCommand = true) { // remember, Commands.Log can only work in Initialize() Celeste.Commands.Log("------------------------------"); Logger.Log(LogLevel.Debug, "TAS Helper", "---- CILCodeLogger ----"); @@ -138,7 +138,7 @@ public static void CILCodeLogger(this ILCursor ilCursor, int logCount = 9999, bo } } - public static void CILCodeLogger(this MethodBase methodBase, int logCount = 9999, bool useCommand = true) { + public static void CILCodeLogger(this MethodBase methodBase, int logCount = 999999, bool useCommand = true) { new ILHook(methodBase, il => { ILCursor cursor = new ILCursor(il); CILCodeLogger(cursor, logCount, useCommand); diff --git a/Source/Utils/ModUtils.cs b/Source/Utils/ModUtils.cs index 0a442ec..37f2c76 100644 --- a/Source/Utils/ModUtils.cs +++ b/Source/Utils/ModUtils.cs @@ -10,6 +10,7 @@ internal static class ModUtils { #pragma warning disable CS8603 public static Type GetType(string modName, string name, bool throwOnError = false, bool ignoreCase = false) { + // we need mod name = mod metadata name here, where e.g. assembly name = FrostTempleHelper, mod metadata name = FrostHelper return GetAssembly(modName)?.GetType(name, throwOnError, ignoreCase); } // check here if you dont know what's the correct name for a nested type / generic type