mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-22 18:41:26 -07:00
The option was only introduced because Roblox's installation path wasn't static. Now that it is, this option doesn't need to exist anymore, and it isn't an issue for people to just set it manually now.
100 lines
4.1 KiB
C#
100 lines
4.1 KiB
C#
using System.Windows;
|
|
using System.Windows.Input;
|
|
|
|
using Microsoft.Win32;
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
using Bloxstrap.Models.SettingTasks;
|
|
|
|
namespace Bloxstrap.UI.ViewModels.Settings
|
|
{
|
|
public class ModsViewModel : NotifyPropertyChangedViewModel
|
|
{
|
|
private void OpenModsFolder() => Process.Start("explorer.exe", Paths.Modifications);
|
|
|
|
private readonly Dictionary<string, byte[]> FontHeaders = new()
|
|
{
|
|
{ "ttf", new byte[4] { 0x00, 0x01, 0x00, 0x00 } },
|
|
{ "otf", new byte[4] { 0x4F, 0x54, 0x54, 0x4F } },
|
|
{ "ttc", new byte[4] { 0x74, 0x74, 0x63, 0x66 } }
|
|
};
|
|
|
|
private void ManageCustomFont()
|
|
{
|
|
if (!String.IsNullOrEmpty(TextFontTask.NewState))
|
|
{
|
|
TextFontTask.NewState = "";
|
|
}
|
|
else
|
|
{
|
|
var dialog = new OpenFileDialog
|
|
{
|
|
Filter = $"{Strings.Menu_FontFiles}|*.ttf;*.otf;*.ttc"
|
|
};
|
|
|
|
if (dialog.ShowDialog() != true)
|
|
return;
|
|
|
|
string type = dialog.FileName.Substring(dialog.FileName.Length-3, 3).ToLowerInvariant();
|
|
|
|
if (!FontHeaders.ContainsKey(type) || !File.ReadAllBytes(dialog.FileName).Take(4).SequenceEqual(FontHeaders[type]))
|
|
{
|
|
Frontend.ShowMessageBox(Strings.Menu_Mods_Misc_CustomFont_Invalid, MessageBoxImage.Error);
|
|
return;
|
|
}
|
|
|
|
TextFontTask.NewState = dialog.FileName;
|
|
}
|
|
|
|
OnPropertyChanged(nameof(ChooseCustomFontVisibility));
|
|
OnPropertyChanged(nameof(DeleteCustomFontVisibility));
|
|
}
|
|
|
|
public ICommand OpenModsFolderCommand => new RelayCommand(OpenModsFolder);
|
|
|
|
public Visibility ChooseCustomFontVisibility => !String.IsNullOrEmpty(TextFontTask.NewState) ? Visibility.Collapsed : Visibility.Visible;
|
|
|
|
public Visibility DeleteCustomFontVisibility => !String.IsNullOrEmpty(TextFontTask.NewState) ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
public ICommand ManageCustomFontCommand => new RelayCommand(ManageCustomFont);
|
|
|
|
public ModPresetTask OldDeathSoundTask { get; } = new("OldDeathSound", @"content\sounds\ouch.ogg", "Sounds.OldDeath.ogg");
|
|
|
|
public ModPresetTask OldAvatarBackgroundTask { get; } = new("OldAvatarBackground", @"ExtraContent\places\Mobile.rbxl", "OldAvatarBackground.rbxl");
|
|
|
|
public ModPresetTask OldCharacterSoundsTask { get; } = new("OldCharacterSounds", new()
|
|
{
|
|
{ @"content\sounds\action_footsteps_plastic.mp3", "Sounds.OldWalk.mp3" },
|
|
{ @"content\sounds\action_jump.mp3", "Sounds.OldJump.mp3" },
|
|
{ @"content\sounds\action_get_up.mp3", "Sounds.OldGetUp.mp3" },
|
|
{ @"content\sounds\action_falling.mp3", "Sounds.Empty.mp3" },
|
|
{ @"content\sounds\action_jump_land.mp3", "Sounds.Empty.mp3" },
|
|
{ @"content\sounds\action_swim.mp3", "Sounds.Empty.mp3" },
|
|
{ @"content\sounds\impact_water.mp3", "Sounds.Empty.mp3" }
|
|
});
|
|
|
|
public EmojiModPresetTask EmojiFontTask { get; } = new();
|
|
|
|
public EnumModPresetTask<Enums.CursorType> CursorTypeTask { get; } = new("CursorType", new()
|
|
{
|
|
{
|
|
Enums.CursorType.From2006, new()
|
|
{
|
|
{ @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "Cursor.From2006.ArrowCursor.png" },
|
|
{ @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "Cursor.From2006.ArrowFarCursor.png" }
|
|
}
|
|
},
|
|
{
|
|
Enums.CursorType.From2013, new()
|
|
{
|
|
{ @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "Cursor.From2013.ArrowCursor.png" },
|
|
{ @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "Cursor.From2013.ArrowFarCursor.png" }
|
|
}
|
|
}
|
|
});
|
|
|
|
public FontModPresetTask TextFontTask { get; } = new();
|
|
}
|
|
}
|