Skip to content

Commit

Permalink
U.GG Aram, Fixes & Small Improvements
Browse files Browse the repository at this point in the history
- U.GG Aram
- Small visual changes
- Fixed some memory leak
- Update ReadMe
- Update Version.txt
- Fixed #19
  • Loading branch information
Rokuazery committed Nov 30, 2022
1 parent 9271103 commit bf3d68c
Show file tree
Hide file tree
Showing 92 changed files with 3,036 additions and 1,317 deletions.
11 changes: 4 additions & 7 deletions LoL Assist/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<Application x:Class="LoL_Assist_WAPP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
xmlns:converters="clr-namespace:LoL_Assist_WAPP.Converters"
StartupUri="MainWindow.xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand All @@ -12,9 +9,9 @@
<ResourceDictionary Source="DarkTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>-->
<ResourceDictionary Source="Colours.xaml"/>
<ResourceDictionary Source="DataTemplates.xaml"/>
<ResourceDictionary Source="Styles.xaml"/>
<ResourceDictionary Source="ResourceDictionaries/Theme.xaml"/>
<ResourceDictionary Source="ResourceDictionaries/DataTemplates.xaml"/>
<ResourceDictionary Source="ResourceDictionaries/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
33 changes: 28 additions & 5 deletions LoL Assist/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Windows.Controls;
using LoL_Assist_WAPP.ViewModels;
using System.Windows.Controls;
using LoL_Assist_WAPP.Models;
using LoL_Assist_WAPP.Utils;
using System.Diagnostics;
using System.Windows;
using System;
using LoLA;
using LoL_Assist_WAPP.Model;
using System.IO;

namespace LoL_Assist_WAPP
{
Expand All @@ -13,12 +15,30 @@ namespace LoL_Assist_WAPP
/// </summary>
public partial class App : Application
{
public App()
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue));
ToolTipService.InitialShowDelayProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(350));
}

#if DEBUG
private const int MAX_INSTANCES = 2;
#else
private const int MAX_INSTANCES = 1;
#endif

protected override void OnStartup(StartupEventArgs e)
{
RuneModel.Init();
GlobalConfig.s_Debug = true;

#if DEBUG
GlobalConfig.s_Debug = true;
#else
GlobalConfig.s_Debug = false;
#endif

//Console.Title = "LoL Assist - Debug Console";
ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue));

if (!GlobalConfig.s_Debug)
{
Expand All @@ -27,13 +47,16 @@ protected override void OnStartup(StartupEventArgs e)
}

var proccName = Process.GetCurrentProcess().ProcessName;
if (Process.GetProcessesByName(proccName).Length > 1)
if (Process.GetProcessesByName(proccName).Length > MAX_INSTANCES)
{
MessageBox.Show("LoL Assist is already running!", "LoL Assist",
MessageBoxButton.OK, MessageBoxImage.Warning);
Environment.Exit(0);
}

MainWindow mainWindow = new MainWindow();
mainWindow.Show();

base.OnStartup(e);
}
}
Expand Down
15 changes: 8 additions & 7 deletions LoL Assist/BuildEditorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LoL_Assist_WAPP" xmlns:view="clr-namespace:LoL_Assist_WAPP.View"
mc:Ignorable="d" MouseLeftButtonDown="Window_MouseLeftButtonDown" SnapsToDevicePixels="True"
MinHeight="463" MinWidth="650" Height="463" Width="650" MaxHeight="463" MaxWidth="650" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" Title="LoL Assist - Advanced Runes &amp; Spells Editor">
<!--Height="440" Width="585"-->
mc:Ignorable="d" SnapsToDevicePixels="True" x:Name="Wnd"
MinHeight="450" MinWidth="550" Height="450" Width="550" MaxHeight="450" MaxWidth="550" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" Title="LoL Assist - Advanced Runes &amp; Spells Editor">
<Window.InputBindings>
<MouseBinding MouseAction="LeftClick" Command="{Binding MoveWindowCommand}" CommandParameter="{Binding ElementName=Wnd}"/>
</Window.InputBindings>
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="0" CornerRadius="0" CaptionHeight="0" UseAeroCaptionButtons="False" ResizeBorderThickness="5"/>
</WindowChrome.WindowChrome>
Expand All @@ -23,7 +24,7 @@
Margin="7,0,0,0" FontWeight="DemiBold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Border VerticalAlignment="Bottom" Height="1" Background="{DynamicResource bBrushPrimary}" Margin="1.5,0"/>
<DockPanel HorizontalAlignment="Right">
<Button Template="{DynamicResource IconStyleButtonRed}" x:Name="CloseBtn" Tag="{DynamicResource XmarkIcon}" VerticalAlignment="Center" ToolTip="Close"
<Button Template="{DynamicResource IconStyleButtonRed}" x:Name="CloseBtn" Tag="{StaticResource XmarkIcon}" VerticalAlignment="Center" ToolTip="Close"
Margin="0,0,6,0" Click="CloseBtn_Click"/>
</DockPanel>
</Grid>
Expand Down Expand Up @@ -157,7 +158,7 @@
<Border Height="2" CornerRadius="1.5" Background="{DynamicResource aBrushSecondary}"/>

<TextBlock Text="file name:" VerticalAlignment="Center" Margin="0,0,0,3"/>
<TextBox Style="{DynamicResource FlatTextboxStyle}" Text="{Binding Path=FileName}" MaxLength="35" Tag="Enter file name..."
<TextBox Style="{DynamicResource FlatTextboxStyle}" Text="{Binding Path=FileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MaxLength="35" Tag="Enter file name..."
IsEnabled="{Binding ElementName=BuildNameList, Path=SelectedIndex, Converter={StaticResource IndexToBoolConverter}}"/>
</StackPanel>

Expand All @@ -183,7 +184,7 @@
<Border Height="2" CornerRadius="1.5" Background="{DynamicResource aBrushSecondary}"/>

<TextBlock Text="name:" VerticalAlignment="Center" Margin="0,0,0,3"/>
<TextBox Style="{DynamicResource FlatTextboxStyle}" Text="{Binding Path=RuneName}" MaxLength="20" Tag="Enter rune name..."
<TextBox Style="{DynamicResource FlatTextboxStyle}" Text="{Binding Path=RuneName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MaxLength="20" Tag="Enter rune name..."
IsEnabled="{Binding ElementName=BuildNameList, Path=SelectedIndex, Converter={StaticResource IndexToBoolConverter}}"/>

<TextBlock Text="primary path:" VerticalAlignment="Center" Margin="0,0,0,3"/>
Expand Down
25 changes: 10 additions & 15 deletions LoL Assist/BuildEditorWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using LoL_Assist_WAPP.ViewModel;
using LoL_Assist_WAPP.ViewModels;
using LoLA.Networking.LCU.Enums;
using System.Windows.Controls;
using LoL_Assist_WAPP.Model;
using LoL_Assist_WAPP.Models;
using LoL_Assist_WAPP.Views;
using System.Windows.Input;
using LoL_Assist_WAPP.View;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.Windows;
Expand All @@ -25,11 +25,6 @@ public BuildEditorWindow()
InitializeComponent();
DataContext = viewModel;
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
DragMove();
}

private void DeleteBtn_Click(object sender, RoutedEventArgs e)
{
Expand All @@ -47,7 +42,7 @@ private void DeleteBtn_Click(object sender, RoutedEventArgs e)
Utils.Animation.FadeOut(BackDrop, 0.13);
Utils.Animation.Margin(exitMsg, ConfigModel.r_MarginOpen, new Thickness(0, Height, 0, 0), 0.13);
};
Animate(exitMsg, new Thickness(0, Height, 0, 0), ConfigModel.r_MarginOpen, 0.13);
animate(exitMsg, new Thickness(0, Height, 0, 0), ConfigModel.r_MarginOpen, 0.13);
}
}

Expand All @@ -70,15 +65,15 @@ private void SearchFileGrid_MouseUp(object sender, MouseButtonEventArgs e)
{
var championBuildConfig = JsonConvert.DeserializeObject<ChampionBuild>(ImportFromPath);
if (championBuildConfig != null)
AnimateOpen(ImportPanel);
animateOpen(ImportPanel);
}
catch { saveStatus.Text = "Invalid Build Config"; }

}
}
}

private void CancelImportBtn_Click(object sender, RoutedEventArgs e) => AnimateClose(ImportPanel);
private void CancelImportBtn_Click(object sender, RoutedEventArgs e) => animateClose(ImportPanel);
private void ImportBtn_Click(object sender, RoutedEventArgs e)
{
var fileName = Path.GetFileName(ImportFromPath);
Expand All @@ -95,26 +90,26 @@ private void ImportBtn_Click(object sender, RoutedEventArgs e)
viewModel.SelectedGameMode = gameMode;
viewModel.SelectedBuildName = fileName;
viewModel.FetchBuild();
AnimateClose(ImportPanel);
animateClose(ImportPanel);
}
ImportChampionList.SelectedValue = null;
ImportGameModeList.SelectedValue = null;
}

#region Animations

private void Animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
private void animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
{
Utils.Animation.FadeIn(BackDrop, time);
Utils.Animation.Margin(element, from, to, time);
}

private void AnimateOpen(FrameworkElement element, double time = 0.13)
private void animateOpen(FrameworkElement element, double time = 0.13)
{
Utils.Animation.FadeIn(BackDrop, time);
Utils.Animation.FadeIn(element, time);
}
private void AnimateClose(FrameworkElement element, double time = 0.13)
private void animateClose(FrameworkElement element, double time = 0.13)
{
Utils.Animation.FadeOut(BackDrop, time);
Utils.Animation.FadeOut(element, time);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Windows.Input;
using System;

namespace LoL_Assist_WAPP.ViewModel
namespace LoL_Assist_WAPP.Commands
{
public class Command : ICommand
public class Command: ICommand
{
private readonly Action<object> r_execute;
private readonly Func<object, bool> r_canExecute;
Expand Down
31 changes: 31 additions & 0 deletions LoL Assist/Commands/ItemInsertedCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using LoL_Assist_WAPP.ViewModels;
using System.Windows.Input;
using System;

namespace LoL_Assist_WAPP.Commands
{
public class ItemInsertedCommand: ICommand
{
private readonly ItemListViewModel _viewModel;
public ItemInsertedCommand(ItemListViewModel itemListingViewModel)
{
_viewModel = itemListingViewModel;
}

public void Execute(object parameter)
{
_viewModel.InsertItem(_viewModel.InsertedItemViewModel, _viewModel.TargetItemViewModel);
}

public event EventHandler CanExecuteChanged;

public bool CanExecute(object parameter)
{
return true;
}
protected void OnCanExecuteChanged()
{
this.CanExecuteChanged?.Invoke(this, new EventArgs());
}
}
}
31 changes: 31 additions & 0 deletions LoL Assist/Commands/ItemReceivedCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using LoL_Assist_WAPP.ViewModels;
using System.Windows.Input;
using System;

namespace LoL_Assist_WAPP.Commands
{
public class ItemReceivedCommand: ICommand
{
private readonly ItemListViewModel _viewModel;
public ItemReceivedCommand(ItemListViewModel itemListingViewModel)
{
_viewModel = itemListingViewModel;
}

public void Execute(object parameter)
{
_viewModel.AddItem(_viewModel.IncomingItemViewModel);
}

public event EventHandler CanExecuteChanged;

public bool CanExecute(object parameter)
{
return true;
}
protected void OnCanExecuteChanged()
{
this.CanExecuteChanged?.Invoke(this, new EventArgs());
}
}
}
31 changes: 31 additions & 0 deletions LoL Assist/Commands/ItemRemovedCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using LoL_Assist_WAPP.ViewModels;
using System.Windows.Input;
using System;

namespace LoL_Assist_WAPP.Commands
{
public class ItemRemovedCommand: ICommand
{
private readonly ItemListViewModel _viewModel;
public ItemRemovedCommand(ItemListViewModel itemListingViewModel)
{
_viewModel = itemListingViewModel;
}

public void Execute(object parameter)
{
_viewModel.RemoveItem(_viewModel.RemovedItemViewModel);
}

public event EventHandler CanExecuteChanged;

public bool CanExecute(object parameter)
{
return true;
}
protected void OnCanExecuteChanged()
{
this.CanExecuteChanged?.Invoke(this, new EventArgs());
}
}
}
37 changes: 37 additions & 0 deletions LoL Assist/Converters/ChampionToImageConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using LoLA.Networking.WebWrapper.DataDragon;
using LoLA.Networking.WebWrapper.DataDragon.Data;
using System.Windows.Media.Imaging;
using System.Windows.Data;
using System.IO;
using System;

namespace LoL_Assist_WAPP.Converters
{
public class ChampionToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
object result = null;
var path = DataDragonWrapper.GetChampionImagePath(Converter.ChampionNameToId(value.ToString()));

if (!string.IsNullOrEmpty(path) && File.Exists(path))
{
using (var stream = File.OpenRead(path))
{
var image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.StreamSource = stream;
image.EndInit();
result = image;
}
}
return result;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion LoL Assist/Converters/ProviderConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace LoL_Assist_WAPP.Converters
{
public static class ProviderConverter
{
// Test
// Hewwo
public static string ToName(Provider provider)
=> provider switch {
Provider.UGG => "U.GG",
Expand Down
25 changes: 0 additions & 25 deletions LoL Assist/DataTemplates.xaml

This file was deleted.

Loading

0 comments on commit bf3d68c

Please sign in to comment.