mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add support for emoij selection (#148)
This commit is contained in:
parent
5d94ca7944
commit
a740f99b50
@ -13,6 +13,7 @@ using System.Windows;
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using Bloxstrap.Enums;
|
using Bloxstrap.Enums;
|
||||||
|
using Bloxstrap.Extensions;
|
||||||
using Bloxstrap.Integrations;
|
using Bloxstrap.Integrations;
|
||||||
using Bloxstrap.Models;
|
using Bloxstrap.Models;
|
||||||
using Bloxstrap.Tools;
|
using Bloxstrap.Tools;
|
||||||
@ -915,6 +916,30 @@ namespace Bloxstrap
|
|||||||
await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\impact_water.mp3", "Empty.mp3");
|
await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\impact_water.mp3", "Empty.mp3");
|
||||||
await CheckModPreset(App.Settings.Prop.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
await CheckModPreset(App.Settings.Prop.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
||||||
|
|
||||||
|
// emoji presets are downloaded remotely from github due to how large they are
|
||||||
|
string emojiFontLocation = Path.Combine(Directories.Modifications, "content\\fonts\\TwemojiMozilla.ttf");
|
||||||
|
|
||||||
|
if (App.Settings.Prop.PreferredEmojiType == EmojiType.Default && App.State.Prop.CurrentEmojiType != EmojiType.Default)
|
||||||
|
{
|
||||||
|
if (File.Exists(emojiFontLocation))
|
||||||
|
File.Delete(emojiFontLocation);
|
||||||
|
|
||||||
|
App.State.Prop.CurrentEmojiType = EmojiType.Default;
|
||||||
|
}
|
||||||
|
else if (App.Settings.Prop.PreferredEmojiType != EmojiType.Default && App.State.Prop.CurrentEmojiType != App.Settings.Prop.PreferredEmojiType)
|
||||||
|
{
|
||||||
|
if (File.Exists(emojiFontLocation))
|
||||||
|
File.Delete(emojiFontLocation);
|
||||||
|
|
||||||
|
string remoteEmojiLocation = App.Settings.Prop.PreferredEmojiType.GetRemoteLocation();
|
||||||
|
|
||||||
|
var response = await App.HttpClient.GetAsync(remoteEmojiLocation);
|
||||||
|
await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew);
|
||||||
|
await response.Content.CopyToAsync(fileStream);
|
||||||
|
|
||||||
|
App.State.Prop.CurrentEmojiType = App.Settings.Prop.PreferredEmojiType;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (string file in Directory.GetFiles(modFolder, "*.*", SearchOption.AllDirectories))
|
foreach (string file in Directory.GetFiles(modFolder, "*.*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
// get relative directory path
|
// get relative directory path
|
||||||
|
11
Bloxstrap/Enums/EmojiType.cs
Normal file
11
Bloxstrap/Enums/EmojiType.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Bloxstrap.Enums
|
||||||
|
{
|
||||||
|
public enum EmojiType
|
||||||
|
{
|
||||||
|
Default,
|
||||||
|
Catmoji,
|
||||||
|
Windows11,
|
||||||
|
Windows10,
|
||||||
|
Windows8
|
||||||
|
}
|
||||||
|
}
|
34
Bloxstrap/Extensions/EmojiTypeEx.cs
Normal file
34
Bloxstrap/Extensions/EmojiTypeEx.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Bloxstrap.Enums;
|
||||||
|
|
||||||
|
namespace Bloxstrap.Extensions
|
||||||
|
{
|
||||||
|
static class EmojiTypeEx
|
||||||
|
{
|
||||||
|
public static IReadOnlyDictionary<string, EmojiType> Selections => new Dictionary<string, EmojiType>
|
||||||
|
{
|
||||||
|
{ "Default (Twemoji)", EmojiType.Default },
|
||||||
|
{ "Catmoji", EmojiType.Catmoji },
|
||||||
|
{ "Windows 11", EmojiType.Windows11 },
|
||||||
|
{ "Windows 10", EmojiType.Windows10 },
|
||||||
|
{ "Windows 8", EmojiType.Windows8 },
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyDictionary<EmojiType, string> Filenames => new Dictionary<EmojiType, string>
|
||||||
|
{
|
||||||
|
{ EmojiType.Catmoji, "Catmoji.ttf" },
|
||||||
|
{ EmojiType.Windows11, "Win1122H2SegoeUIEmoji.ttf" },
|
||||||
|
{ EmojiType.Windows10, "Win10April2018SegoeUIEmoji.ttf" },
|
||||||
|
{ EmojiType.Windows8, "Win8.1SegoeUIEmoji.ttf" },
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetRemoteLocation(this EmojiType emojiType)
|
||||||
|
{
|
||||||
|
if (emojiType == EmojiType.Default)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return $"https://github.com/NikSavchenk0/rbxcustom-fontemojis/raw/8a552f4aaaecfa58d6bd9b0540e1ac16e81faadb/{Filenames[emojiType]}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ namespace Bloxstrap.Models
|
|||||||
public bool UseOldCharacterSounds { get; set; } = false;
|
public bool UseOldCharacterSounds { get; set; } = false;
|
||||||
public bool UseOldMouseCursor { get; set; } = false;
|
public bool UseOldMouseCursor { get; set; } = false;
|
||||||
public bool UseDisableAppPatch { get; set; } = false;
|
public bool UseDisableAppPatch { get; set; } = false;
|
||||||
|
public EmojiType PreferredEmojiType { get; set; } = EmojiType.Default;
|
||||||
public bool DisableFullscreenOptimizations { get; set; } = false;
|
public bool DisableFullscreenOptimizations { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Bloxstrap.Enums;
|
||||||
|
|
||||||
namespace Bloxstrap.Models
|
namespace Bloxstrap.Models
|
||||||
{
|
{
|
||||||
public class State
|
public class State
|
||||||
{
|
{
|
||||||
public string VersionGuid { get; set; } = "";
|
public string VersionGuid { get; set; } = "";
|
||||||
|
public EmojiType CurrentEmojiType { get; set; } = EmojiType.Default;
|
||||||
public List<string> ModManifest { get; set; } = new();
|
public List<string> ModManifest { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
using System.ComponentModel;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
using Bloxstrap.Enums;
|
||||||
|
using Bloxstrap.Extensions;
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
namespace Bloxstrap.UI.Menu.ViewModels
|
namespace Bloxstrap.UI.Menu.ViewModels
|
||||||
@ -36,6 +40,14 @@ namespace Bloxstrap.UI.Menu.ViewModels
|
|||||||
set => App.Settings.Prop.UseDisableAppPatch = value;
|
set => App.Settings.Prop.UseDisableAppPatch = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<string, EmojiType> EmojiTypes => EmojiTypeEx.Selections;
|
||||||
|
|
||||||
|
public string SelectedEmojiType
|
||||||
|
{
|
||||||
|
get => EmojiTypes.FirstOrDefault(x => x.Value == App.Settings.Prop.PreferredEmojiType).Key;
|
||||||
|
set => App.Settings.Prop.PreferredEmojiType = EmojiTypes[value];
|
||||||
|
}
|
||||||
|
|
||||||
public bool DisableFullscreenOptimizationsEnabled
|
public bool DisableFullscreenOptimizationsEnabled
|
||||||
{
|
{
|
||||||
get => App.Settings.Prop.DisableFullscreenOptimizations;
|
get => App.Settings.Prop.DisableFullscreenOptimizations;
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
@ -107,6 +108,16 @@
|
|||||||
</ui:CardControl.Header>
|
</ui:CardControl.Header>
|
||||||
<ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" />
|
<ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" />
|
||||||
</ui:CardControl>
|
</ui:CardControl>
|
||||||
|
|
||||||
|
<ui:CardControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,8,0,0" Padding="16,13,16,12">
|
||||||
|
<ui:CardControl.Header>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock FontSize="14" Text="Preferred emoji type" />
|
||||||
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which type of emoji should Roblox use." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardControl.Header>
|
||||||
|
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding EmojiTypes.Keys, Mode=OneTime}" Text="{Binding SelectedEmojiType, Mode=TwoWay}" />
|
||||||
|
</ui:CardControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel x:Name="MiscellaneousOptions">
|
<StackPanel x:Name="MiscellaneousOptions">
|
||||||
|
Loading…
Reference in New Issue
Block a user