From b4a820014884c928056bc019b8519e4b9056aa2e Mon Sep 17 00:00:00 2001 From: weedeej Date: Sun, 16 Jan 2022 17:55:14 +0800 Subject: [PATCH] dev phase 4.100 :D --- ValorantCC/MainWindow.xaml.cs | 4 +- ValorantCC/SubWindow/ProfilesWindow.xaml | 1 + ValorantCC/SubWindow/ProfilesWindow.xaml.cs | 61 +++++++++++++++++++-- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs index fc4d07c..83d90c0 100644 --- a/ValorantCC/MainWindow.xaml.cs +++ b/ValorantCC/MainWindow.xaml.cs @@ -22,7 +22,7 @@ public partial class MainWindow : Window Processor DataProcessor = new Processor(); BrushConverter bc = new BrushConverter(); public AuthResponse AuthResponse; - CrosshairProfile SelectedProfile; + public CrosshairProfile SelectedProfile; List SelectedColors; private API ValCCAPI; int SelectedIndex; @@ -156,7 +156,7 @@ private void profiles_TextChanged(object sender, TextChangedEventArgs e) profiles.SelectedIndex = SelectedIndex; } - private void Crosshair_load() + public void Crosshair_load() { //Primary Crosshair_Parser.dot_redraw(primeDOT, primeDOTOT, SelectedProfile.Primary); diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml b/ValorantCC/SubWindow/ProfilesWindow.xaml index 3851dcd..34021a4 100644 --- a/ValorantCC/SubWindow/ProfilesWindow.xaml +++ b/ValorantCC/SubWindow/ProfilesWindow.xaml @@ -14,6 +14,7 @@ + L o a d i n g . . . :D diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs index c73a0b8..a8dee76 100644 --- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs +++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs @@ -26,7 +26,9 @@ namespace ValorantCC public struct PublicProfile { public String owner { get; set; } + public String sharecode { get; set; } public CrosshairProfile settings { get; set; } + public int ID { get; set; } } public partial class ProfilesWindow : Window @@ -40,13 +42,16 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI) { InitializeComponent(); main = (MainWindow) Application.Current.MainWindow; + selected = current; ValCCApi = ValCCAPI; bc = new BrushConverter(); } private async void Border_Loaded(object sender, RoutedEventArgs e) { + LoadingTxt.Visibility = Visibility.Visible; await InitialFetch(); + LoadingTxt.Visibility = Visibility.Collapsed; await RenderProfiles(); } @@ -83,7 +88,7 @@ private static async Task InitialFetch(String sharecode = null) { continue; } - PublicProfiles.Add(new PublicProfile() { owner = currentShareable.displayName, settings = profile }); + PublicProfiles.Add(new PublicProfile() { owner = currentShareable.displayName, settings = profile, sharecode = currentShareable.shareCode, ID = i }); } //Change this delay for the async backend @@ -114,6 +119,42 @@ private async void btnSearchCode_Click(object sender, RoutedEventArgs e) await RenderProfiles(); } + public void shareBtnClicked(object sender, RoutedEventArgs e) + { + String shareCode = ((Button)sender).Name.Split('_')[1]; + Clipboard.SetText(shareCode); + MessageBox.Show("\"" + shareCode + "\" has been copied to clipboard!"); + } + + public void detailsBtnClicked(object sender, RoutedEventArgs e) + { + PublicProfile pressedPubProfile = PublicProfiles[Int32.Parse(((Button)sender).Name.Split('_')[1])]; + CrosshairProfile pressedProfile = pressedPubProfile.settings; + MessageBox.Show($"{pressedPubProfile.owner}'s Profile: {pressedProfile.ProfileName}\nPrimary:\n\tInner Lines: {pressedProfile.Primary.InnerLines.Opacity}, {pressedProfile.Primary.InnerLines.LineLength}, {pressedProfile.Primary.InnerLines.LineThickness}, {pressedProfile.Primary.InnerLines.LineOffset}\n\tOuter Lines: {pressedProfile.Primary.OuterLines.Opacity}, {pressedProfile.Primary.OuterLines.LineLength}, {pressedProfile.Primary.OuterLines.LineThickness}, {pressedProfile.Primary.OuterLines.LineOffset}\n\nADS:\n\tInner Lines: {pressedProfile.aDS.InnerLines.Opacity}, {pressedProfile.aDS.InnerLines.LineLength}, {pressedProfile.aDS.InnerLines.LineThickness}, {pressedProfile.aDS.InnerLines.LineOffset}\n\tOuter Lines: {pressedProfile.aDS.OuterLines.Opacity}, {pressedProfile.aDS.OuterLines.LineLength}, {pressedProfile.aDS.OuterLines.LineThickness}, {pressedProfile.aDS.OuterLines.LineOffset}"); + } + + public void applyBtnClicked(object sender, RoutedEventArgs e) + { + PublicProfile pressedPubProfile = PublicProfiles[Int32.Parse(((Button)sender).Name.Split('_')[1])]; + CrosshairProfile pressedProfile = pressedPubProfile.settings; + selected.aDS = pressedProfile.aDS; + selected.Primary = pressedProfile.Primary; + selected.Sniper = pressedProfile.Sniper; + selected.bUseAdvancedOptions = pressedProfile.bUseAdvancedOptions; + selected.bUseCustomCrosshairOnAllPrimary = pressedProfile.bUseCustomCrosshairOnAllPrimary; + selected.bUsePrimaryCrosshairForADS = pressedProfile.bUsePrimaryCrosshairForADS; + + main.primary_color.SelectedColor = new Color() { R = selected.Primary.Color.R, G = selected.Primary.Color.G, B = selected.Primary.Color.B, A = selected.Primary.Color.A }; + main.ads_color.SelectedColor = new Color() { R = selected.aDS.Color.R, G = selected.aDS.Color.G, B = selected.aDS.Color.B, A = selected.aDS.Color.A }; + + main.prim_outline_color.SelectedColor = new Color() { R = selected.Primary.OutlineColor.R, G = selected.Primary.OutlineColor.G, B = selected.Primary.OutlineColor.B, A = selected.Primary.OutlineColor.A }; + main.ads_outline_color.SelectedColor = new Color() { R = selected.aDS.OutlineColor.R, G = selected.aDS.OutlineColor.G, B = selected.aDS.OutlineColor.B, A = selected.aDS.OutlineColor.A }; + + main.sniper_dot_color.SelectedColor = new Color() { R = selected.Sniper.CenterDotColor.R, G = selected.Sniper.CenterDotColor.G, B = selected.Sniper.CenterDotColor.B, A = selected.Sniper.CenterDotColor.A }; + main.SelectedProfile = selected; + main.Crosshair_load(); + } + private async Task CreateRender(PublicProfile profile) { // This will be changed and will be replaced with more efficient method of rendering multiple settings. @@ -180,25 +221,37 @@ private async Task CreateRender(PublicProfile profile) Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 }, FontSize = 12, FontWeight = FontWeights.Bold, - Content = "Share" + Content = "Share", + Cursor = Cursors.Hand, + Name = "A_"+profile.sharecode+"_shareBtn", }; + shareButton.Click += shareBtnClicked; + Button detailsButton = new Button() { Style = (Style)FindResource("RoundButton"), Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 }, FontSize = 12, FontWeight = FontWeights.Bold, - Content = "Details" + Content = "Details", + Cursor = Cursors.Hand, + Name = "A_" + profile.ID.ToString() + "_detailsBtn" }; + detailsButton.Click += detailsBtnClicked; + Button applyButton = new Button() { Style = (Style)FindResource("RoundButton"), Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 }, FontSize = 12, FontWeight = FontWeights.Bold, - Content = "Apply" + Content = "Apply", + Cursor = Cursors.Hand, + Name = "A_" + profile.ID.ToString() + "_applyBtn" }; + applyButton.Click += applyBtnClicked; + Grid.SetColumn(shareButton, 0); Grid.SetRow(shareButton, 1); Grid.SetColumn(detailsButton, 1);