Skip to content

Commit

Permalink
feat: A setting to disable Studio update banner
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Oct 8, 2024
1 parent 6d7f063 commit 7810829
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CelesteTAS-EverestInterop/Dialog/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ TAS_CENTER_CAMERA_HORIZONTALLY_ONLY= Center Camera Horizontally Only
TAS_RESTORE_SETTINGS= Restore All Settings when TAS Stop
TAS_LAUNCH_STUDIO_AT_BOOT= Launch Studio at Boot
TAS_ATTEMPT_TO_CONNECT_TO_STUDIO= Attempt To Connect To Studio
TAS_SHOW_STUDIO_UPDATE_BANNER= Show Studio Update Banner
TAS_HIDE_FREEZE_FRAMES= Hide Freeze Frames during TAS
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_1=When a freeze frame is encountered, run it and continue to the next frame
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_2=before rendering. Applies only while a TAS is active.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static void Load() {
}
});

var t = Task.Run(async () => {
Task.Run(async () => {
// Wait for font / dialog to be loaded
while ((Engine.Scene is GameLoader loader && !loader.dialogLoaded) || !GFX.Loaded || Dialog.Languages == null || !Dialog.Languages.ContainsKey(Settings.EnglishLanguage) || Font == null) {
await Task.Delay(10).ConfigureAwait(false);
Expand All @@ -63,7 +63,7 @@ private static void Load() {
private static PixelFont Font => Dialog.Languages[Settings.EnglishLanguage].Font;
private static float FontFaceSize => Dialog.Languages[Settings.EnglishLanguage].FontFaceSize;

private const int BannerY = 60; // Same as speedrun timer
private const int BannerY = 150; // Slightly under the speedrun timer
private const int TextY = BannerY + 23;

private const float PaddingVerySmall = 16.0f;
Expand All @@ -81,7 +81,8 @@ private static void Load() {
private static int dotCount;

private static void Update() {
if (!loaded || !Dialog.Languages.ContainsKey(Settings.EnglishLanguage) || Font == null) {
if (!loaded || !TasSettings.ShowStudioUpdateBanner || !Dialog.Languages.ContainsKey(Settings.EnglishLanguage) || Font == null) {
bannerWidth = Calc.Approach(bannerWidth, 0.0f, BannerSpeed * Engine.RawDeltaTime);
return;
}

Expand Down Expand Up @@ -114,7 +115,7 @@ private static void Update() {
}

private static void Render() {
if (!loaded || !Dialog.Languages.ContainsKey(Settings.EnglishLanguage) || Font == null) {
if (!loaded || bannerWidth <= 0.001f || !Dialog.Languages.ContainsKey(Settings.EnglishLanguage) || Font == null) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions CelesteTAS-EverestInterop/Source/Module/CelesteTasMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ private static EaseInSubMenu CreateMoreOptionsSubMenu(TextMenu menu) {
StudioHelper.LaunchStudio();
}
}));
subMenu.Add(new TextMenu.OnOff("Show Studio Update Banner".ToDialogText(), TasSettings.ShowStudioUpdateBanner).Change(value =>
TasSettings.ShowStudioUpdateBanner = value));
subMenu.Add(new TextMenu.OnOff("Attempt To Connect To Studio".ToDialogText(), TasSettings.AttemptConnectStudio).Change(value => {
TasSettings.AttemptConnectStudio = value;
CommunicationWrapper.ChangeStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ public bool CenterCameraHorizontallyOnly {

public bool RestoreSettings { get; set; } = false;
public bool LaunchStudioAtBoot { get; set; } = false;
public bool ShowStudioUpdateBanner { get; set; } = true;

[YamlMember(Alias = "AttemptConnectStudio")]
public bool _AttemptConnectStudio { get; set; } = true;
Expand Down

0 comments on commit 7810829

Please sign in to comment.