Skip to content

Commit

Permalink
dev phase 4.100 :D
Browse files Browse the repository at this point in the history
  • Loading branch information
weedeej committed Jan 16, 2022
1 parent c9d7b4c commit b4a8200
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ValorantCC/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color> SelectedColors;
private API ValCCAPI;
int SelectedIndex;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ValorantCC/SubWindow/ProfilesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Height="420">
<StackPanel Name="ShareablesContainer" HorizontalAlignment="Center">
<TextBlock Name="LoadingTxt" FontSize="32" Foreground="White" >L o a d i n g . . . :D</TextBlock>
</StackPanel>
</ScrollViewer>
</StackPanel>
Expand Down
61 changes: 57 additions & 4 deletions ValorantCC/SubWindow/ProfilesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}

Expand Down Expand Up @@ -83,7 +88,7 @@ private static async Task<bool> 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
Expand Down Expand Up @@ -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<UIElement> CreateRender(PublicProfile profile)
{
// This will be changed and will be replaced with more efficient method of rendering multiple settings.
Expand Down Expand Up @@ -180,25 +221,37 @@ private async Task<UIElement> 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);
Expand Down

0 comments on commit b4a8200

Please # to comment.