Skip to content

Commit

Permalink
Update logo + Fix forced update warning layout
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-nyan authored and Cryotechnic committed Jun 17, 2024
1 parent 2c0a853 commit 3b8ed10
Show file tree
Hide file tree
Showing 15 changed files with 8,522 additions and 37 deletions.
Binary file modified CollapseLauncher/Assets/CollapseLauncherLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8,382 changes: 8,382 additions & 0 deletions CollapseLauncher/Classes/AnimatedVisuals/Lottie/NewLogoTitleIntro.cs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Animation;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
Expand Down
12 changes: 6 additions & 6 deletions CollapseLauncher/XAMLs/MainApp/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@
VerticalAlignment="Center"
Orientation="Horizontal">
<Image x:Name="GridBG_IconImg"
Width="24"
Height="24"
Margin="0,-1,0,0"
Width="Auto"
VerticalAlignment="Stretch"
Margin="-2,-2,0,-2"
Opacity="0.8"
Source="ms-appx:///Assets/CollapseLauncherLogo.png">
<Image.OpacityTransition>
Expand All @@ -350,13 +350,13 @@
</Image>
<StackPanel Name="GridBG_IconTitle"
Width="0"
Margin="8,-8,0,0"
Margin="6,-8,0,0"
VerticalAlignment="Center"
Opacity="0">
<StackPanel.OpacityTransition>
<ScalarTransition />
</StackPanel.OpacityTransition>
<TextBlock Margin="-6,0,0,0"
<TextBlock Margin="0,0,0,0"
HorizontalAlignment="Left"
FontSize="10"
FontWeight="Medium"
Expand All @@ -373,7 +373,7 @@
<StackPanel x:Name="PreviewBuildIndicator"
Grid.Column="4"
Grid.ColumnSpan="2"
Margin="-16,-12,0,0"
Margin="-10,-12,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="{ThemeResource AccentColor}"
Expand Down
24 changes: 24 additions & 0 deletions CollapseLauncher/XAMLs/MainApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
xmlns:customcontrol="using:CollapseLauncher.CustomControls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CollapseLauncher"
xmlns:helper="using:Hi3Helper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uiextension="using:CollapseLauncher.Extension"
xmlns:lottie="using:CollapseLauncher.AnimatedVisuals.Lottie"
SizeChanged="MainWindow_OnSizeChanged"
mc:Ignorable="d">
<Grid x:Name="MainWindowGridContainer">
Expand All @@ -17,6 +19,28 @@
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid x:Name="IntroAnimationGrid"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.RowSpan="3">
<AnimatedVisualPlayer x:Name="IntroAnimation"
AutoPlay="False"
Visibility="Collapsed">
<lottie:NewLogoTitleIntro/>
</AnimatedVisualPlayer>
<CheckBox x:Name="IntroSequenceToggle"
Visibility="Collapsed"
Margin="32,32,16,24"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
VerticalAlignment="Bottom"
Opacity="0.25"
Scale="0.85,0.85,0.85"
PointerEntered="IntroSequenceToggle_PointerEntered"
PointerExited="IntroSequenceToggle_PointerExited"
Content="{x:Bind helper:Locale.Lang._SettingsPage.IntroSequenceToggle}"
IsChecked="{x:Bind IsIntroEnabled, Mode=TwoWay}"/>
</Grid>
<Grid x:Name="RootFrameGrid"
Grid.Row="0"
Grid.RowSpan="3"
Expand Down
53 changes: 52 additions & 1 deletion CollapseLauncher/XAMLs/MainApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
using CollapseLauncher.Helper.Loading;
using CollapseLauncher.Pages;
using CollapseLauncher.Pages.OOBE;
using CommunityToolkit.WinUI.Animations;
using Hi3Helper;
using Hi3Helper.Shared.Region;
using Microsoft.UI.Composition;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media.Animation;
using System;
using System.Numerics;
using System.Threading.Tasks;
using Windows.UI;
using static CollapseLauncher.InnerLauncherConfig;
using static Hi3Helper.InvokeProp;
Expand All @@ -19,6 +24,8 @@ namespace CollapseLauncher
{
public sealed partial class MainWindow : Window
{
internal static bool IsForceDisableIntro = false;

public MainWindow() { }

public void InitializeWindowProperties(bool startOOBE = false)
Expand All @@ -32,6 +39,7 @@ public void InitializeWindowProperties(bool startOOBE = false)

if (IsFirstInstall || startOOBE)
{
IsForceDisableIntro = true;
WindowUtility.CurrentWindowTitlebarExtendContent = true;
WindowUtility.SetWindowSize(WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Width, WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Height);
WindowUtility.ApplyWindowTitlebarLegacyColor();
Expand All @@ -52,10 +60,29 @@ public void InitializeWindowProperties(bool startOOBE = false)
}
}

public void StartMainPage()
public async void StartMainPage()
{
WindowUtility.SetWindowSize(WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Width, WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Height);
bool isIntroEnabled = IsIntroEnabled && !IsForceDisableIntro;

if (isIntroEnabled)
{
WindowUtility.SetWindowBackdrop(WindowBackdropKind.Mica);
IntroSequenceToggle.Visibility = Visibility.Visible;
IntroAnimation.Visibility = Visibility.Visible;
IntroAnimation.PlaybackRate = 2.2d;
await IntroAnimation.PlayAsync(0, 0.0001d, false);
await Task.Delay(500);
await IntroAnimation.PlayAsync(0.0001d, 260d / 600d, false);
IntroAnimation.PlaybackRate = 1.5d;
await IntroAnimation.PlayAsync(260d / 600d, 600d / 600d, false);
IntroAnimation.Visibility = Visibility.Collapsed;
}

rootFrame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo());

if (isIntroEnabled) await Task.Delay(250);
WindowUtility.SetWindowBackdrop(WindowBackdropKind.None);
}

private void InitializeAppWindowAndIntPtr()
Expand Down Expand Up @@ -182,5 +209,29 @@ private void MainWindow_OnSizeChanged(object sender, WindowSizeChangedEventArgs
// Recalculate non-client area size
WindowUtility.EnableWindowNonClientArea();
}

private bool IsIntroEnabled
{
get => LauncherConfig.IsIntroEnabled;
set => LauncherConfig.IsIntroEnabled = value;
}

private void IntroSequenceToggle_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{
Compositor curCompositor = this.Compositor;
UIElement element = sender as UIElement;
element.StartAnimationDetached(TimeSpan.FromSeconds(0.25),
curCompositor.CreateScalarKeyFrameAnimation("Opacity", 1f)
);
}

private void IntroSequenceToggle_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{
Compositor curCompositor = this.Compositor;
UIElement element = sender as UIElement;
element.StartAnimationDetached(TimeSpan.FromSeconds(0.25),
curCompositor.CreateScalarKeyFrameAnimation("Opacity", 0.25f)
);
}
}
}
21 changes: 11 additions & 10 deletions CollapseLauncher/XAMLs/MainApp/Pages/OOBE/OOBEStartUpMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
xmlns:innerConfig="using:Hi3Helper.Shared.Region"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:lottie="using:CollapseLauncher.AnimatedVisuals.Lottie"
Background="Transparent"
mc:Ignorable="d">
<Grid>
<AnimatedVisualPlayer x:Name="WelcomeLogoIntro"
Width="Auto"
AutoPlay="False"
HorizontalAlignment="Stretch">
<lottie:NewLogoTitleIntro/>
</AnimatedVisualPlayer>
<Grid x:Name="MainUI"
Visibility="Collapsed">
<Grid.ChildrenTransitions>
Expand All @@ -26,7 +33,7 @@
Source="ms-appx:///Assets/Images/PageBackground/StartupBackground2.png"
Stretch="UniformToFill" />
<Grid x:Name="ContainerGrid"
Margin="64"
Margin="48"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
Expand All @@ -42,7 +49,7 @@
HorizontalAlignment="Left"
Orientation="Horizontal">
<Image x:Name="GridBG_IconImg"
Width="128"
Width="160"
Margin="0,0,0,0"
Opacity="0.8"
PointerEntered="GridBG_Icon_PointerEntered"
Expand Down Expand Up @@ -170,7 +177,7 @@
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,24"
Margin="0,-48,0,24"
Visibility="Collapsed">
<StackPanel x:Name="SettingsCardContainer">
<TextBlock Margin="0,0,0,16"
Expand Down Expand Up @@ -303,7 +310,7 @@
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,-32"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Click="NextPageButton_Click"
Expand Down Expand Up @@ -348,12 +355,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image x:Name="WelcomeVLogo"
Height="128"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Opacity="0"
Source="ms-appx:///Assets/CollapseLauncherLogo.png" />
<StackPanel x:Name="WelcomeVCarouselGrid"
Grid.Row="1"
Grid.Column="0"
Expand Down
38 changes: 21 additions & 17 deletions CollapseLauncher/XAMLs/MainApp/Pages/OOBE/OOBEStartUpMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,39 @@ private async void RunIntroSequence()
TimeSpan logoAnimAppearanceDuration = TimeSpan.FromSeconds(0.5);
CreateIntroWelcomeTextStack(WelcomeVCarouselGrid);

await WelcomeVLogo.StartAnimation(logoAnimAppearanceDuration,
currentCompositor.CreateScalarKeyFrameAnimation("Opacity", 1, 0),
currentCompositor.CreateVector3KeyFrameAnimation(
"Translation",
new Vector3(0, 0, 0),
new Vector3(0, 32, 0)));

await SpawnWelcomeText();
await WelcomeLogoIntro.PlayAsync(0, 0.0001d, false);
await Task.Delay(TimeSpan.FromSeconds(1));
await WelcomeLogoIntro.PlayAsync(0, 488d / 600d, false);

// Adding delay and make sure the CDN recommendation has already been loaded
// before hiding the intro sequence
while (_isLoadingCDNRecommendation)
{
await Task.Delay(250);
}
await WelcomeLogoIntro.PlayAsync(488d / 600d, 570d / 600d, false);
await WelcomeLogoIntro.StartAnimation(logoAnimAppearanceDuration,
currentCompositor.CreateVector3KeyFrameAnimation(
"Translation",
new Vector3(0, -138, 0),
WelcomeLogoIntro.Translation
));
await SpawnWelcomeText();

await Task.Delay(1000);

await SpawnWelcomeText(true);
await WelcomeVLogo.StartAnimation(logoAnimAppearanceDuration,
currentCompositor.CreateScalarKeyFrameAnimation("Opacity", 0, 1),
currentCompositor.CreateVector3KeyFrameAnimation(
"Translation",
new Vector3(0, 32, 0),
new Vector3(0, 0, 0)));
await WelcomeLogoIntro.StartAnimation(logoAnimAppearanceDuration,
currentCompositor.CreateScalarKeyFrameAnimation("Opacity", 0, 1),
currentCompositor.CreateVector3KeyFrameAnimation(
"Translation",
new Vector3(0, -32, 0),
WelcomeLogoIntro.Translation
));

OOBEAgreementMenuExtensions.oobeStartParentUI = this;
OverlayFrame.Navigate(typeof(OOBEAgreementMenu), null, new DrillInNavigationTransitionInfo());
WelcomeVLogo.Visibility = Visibility.Collapsed;
WelcomeLogoIntro.Visibility = Visibility.Collapsed;
WelcomeVCarouselGrid.Visibility = Visibility.Collapsed;
}

Expand Down Expand Up @@ -610,7 +614,7 @@ private void InitializeTextContainerSize(int? indexOfKey = null, bool isNeedShri
new Vector3(isInSmallMode ? (float)SmallWindowFactor - 0.2f : (float)SmallWindowFactor - 0.1f);

TimeSpan animDuration = TimeSpan.FromMilliseconds(500);
int titleTextXOffset = isInSmallMode ? 70 : 88;
int titleTextXOffset = isInSmallMode ? 90 : 100;

if (IsLastLogoShrinkMode == shrink)
{
Expand Down Expand Up @@ -646,7 +650,7 @@ private void InitializeTextContainerSize(int? indexOfKey = null, bool isNeedShri
LastTitleTextInitialScale),
currentCompositor.CreateVector3KeyFrameAnimation(
"Translation",
new Vector3(titleTextXOffset, -128, 0),
new Vector3(titleTextXOffset, -168, 0),
new Vector3(0, 0, 0))),
CollapseLogoContainer.StartAnimation(animDuration,
currentCompositor
Expand Down
5 changes: 5 additions & 0 deletions CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
TextWrapping="Wrap"
Visibility="Collapsed" />
</StackPanel>
<ToggleSwitch Margin="0,4"
Header="{x:Bind helper:Locale.Lang._SettingsPage.IntroSequenceToggle}"
IsOn="{x:Bind IsIntroEnabled, Mode=TwoWay}"
OffContent="{x:Bind helper:Locale.Lang._Misc.Disabled}"
OnContent="{x:Bind helper:Locale.Lang._Misc.Enabled}" />
<ToggleSwitch Margin="0,4"
Header="{x:Bind helper:Locale.Lang._SettingsPage.EnableAcrylicEffect}"
IsOn="{x:Bind IsAcrylicEffectEnabled, Mode=TwoWay}"
Expand Down
6 changes: 6 additions & 0 deletions CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ private bool IsConsoleEnabled
}
}

private bool IsIntroEnabled
{
get => LauncherConfig.IsIntroEnabled;
set => LauncherConfig.IsIntroEnabled = value;
}

private bool IsMultipleInstanceEnabled
{
get => LauncherConfig.IsMultipleInstanceEnabled;
Expand Down
4 changes: 3 additions & 1 deletion CollapseLauncher/XAMLs/MainApp/Pages/UpdatePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@
Foreground="{ThemeResource TextFillColorInverse}"
Glyph="&#xf071;" />
<TextBlock Grid.Column="1"
Margin="32,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
FontWeight="SemiBold"
Foreground="{ThemeResource TextFillColorInverse}"
HorizontalTextAlignment="Center"
Text="{x:Bind helper:Locale.Lang._UpdatePage.UpdateForcedHeader}" />
Text="{x:Bind helper:Locale.Lang._UpdatePage.UpdateForcedHeader}"
TextWrapping="Wrap" />
<FontIcon Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Expand Down
9 changes: 8 additions & 1 deletion Hi3Helper.Core/Classes/Shared/Region/LauncherConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ public static bool IsShowRegionChangeWarning
set => SetAndSaveConfigValue("ShowRegionChangeWarning", value);
}

public static bool IsIntroEnabled
{
get => GetAppConfigValue("IsIntroEnabled").ToBoolNullable() ?? true;
set => SetAndSaveConfigValue("IsIntroEnabled", value);
}

private static bool? _cachedIsInstantRegionChange = null;
public static bool IsInstantRegionChange
{
Expand Down Expand Up @@ -315,7 +321,8 @@ public static bool IsInstantRegionChange
{ "EnableWaifu2X", false },
{ "BackgroundAudioVolume", 0.5d },
{ "BackgroundAudioIsMute", true },
{ "UseInstantRegionChange", true }
{ "UseInstantRegionChange", true },
{ "IsIntroEnabled", true }
};
#endregion
}
Expand Down
1 change: 1 addition & 0 deletions Hi3Helper.Core/Lang/Locale/LangSettingsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public sealed class LangSettingsPage
public string AppThemes_Dark { get; set; } = LangFallback?._SettingsPage.AppThemes_Dark;
public string AppCDNRepository { get; set; } = LangFallback?._SettingsPage.AppCDNRepository;
public string AppThemes_ApplyNeedRestart { get; set; } = LangFallback?._SettingsPage.AppThemes_ApplyNeedRestart;
public string IntroSequenceToggle { get; set; } = LangFallback?._SettingsPage.IntroSequenceToggle;
public string AppWindowSize { get; set; } = LangFallback?._SettingsPage.AppWindowSize;
public string AppWindowSize_Normal { get; set; } = LangFallback?._SettingsPage.AppWindowSize_Normal;
public string AppWindowSize_Small { get; set; } = LangFallback?._SettingsPage.AppWindowSize_Small;
Expand Down
Loading

0 comments on commit 3b8ed10

Please sign in to comment.