Skip to content

Commit

Permalink
Dev phase 4
Browse files Browse the repository at this point in the history
  • Loading branch information
weedeej committed Jan 6, 2022
1 parent e4b5492 commit c7c753f
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 13 deletions.
13 changes: 12 additions & 1 deletion ValorantCC/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public partial class MainWindow : Window

public MainWindow()
{
/**
* Note to myself, You were sleepy when you made this commit. Just test the app and see what you messed with.
* You probably messed with something here in main relating to the checkbox. goodluck debugging!
*/
// Create logging dir
if (!Directory.Exists(LoggingDir)) Directory.CreateDirectory(LoggingDir);
// Replace old logs
Expand Down Expand Up @@ -120,6 +124,7 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
sniper_dot_color.SelectedColor = Color.FromRgb(SelectedProfile.Sniper.CenterDotColor.R, SelectedProfile.Sniper.CenterDotColor.G, SelectedProfile.Sniper.CenterDotColor.B);

if (ValCCAPI != null) ValCCAPI.profile = SelectedProfile;
if (ValCCAPI != null && chkbxShareable.IsChecked) ValCCAPI.Set();
Crosshair_load();
}
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -326,7 +331,13 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e)

private void chkbxShareable_Click(object sender, RoutedEventArgs e)
{
if (LoggedIn) ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked;
if (!LoggedIn)
{
MessageBox.Show("You are not logged in!");
return;
}
ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked;
ValCCAPI.Set();
}
}
}
28 changes: 27 additions & 1 deletion ValorantCC/SubWindow/ProfilesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,40 @@
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>

<Image Source="../Resources/CrosshairBG5.png" Grid.ColumnSpan="3" Grid.Row="0" Stretch="Fill" Margin="2,0,2,2"/>
<Label Grid.Column="2" Grid.Row="0" Content="Deeej's Profile" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>

<Rectangle Fill="#FF404661" Height="auto" Grid.Row="1" Grid.ColumnSpan="3"/>
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="0" Content="Share" FontWeight="Bold" FontSize="12"/>
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="1" Content="Details" FontWeight="Bold" FontSize="12"/>
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="2" Content="Apply" FontWeight="Bold" FontSize="12"/>

<Grid x:Name="CH0_grid" Grid.Column="0">
<Grid>
<Rectangle x:Name="primeX1OT" Stroke="Black" StrokeThickness="1" Width="7" Height="3" Margin="20,0,0,0"/>
<Rectangle x:Name="primeX1" Fill="White" Width="6" Height="2" Margin="20,0,0,0"/>
<Rectangle x:Name="primeX2OT" Stroke="Black" StrokeThickness="1" Width="7" Height="3" Margin="0,0,20,0"/>
<Rectangle x:Name="primeX2" Fill="White" Width="6" Height="2" Margin="0,0,20,0"/>

<Rectangle x:Name="primeY1OT" Stroke="Black" StrokeThickness="1" Width="3" Height="7" Margin="0,0,0,20"/>
<Rectangle x:Name="primeY1" Fill="White" Width="2" Height="6" Margin="0,0,0,20"/>
<Rectangle x:Name="primeY2OT" Stroke="Black" StrokeThickness="1" Width="3" Height="7" Margin="0,20,0,0"/>
<Rectangle x:Name="primeY2" Fill="White" Width="2" Height="6" Margin="0,20,0,0"/>

<Rectangle x:Name="primeOLX1OT" Stroke="Black" StrokeThickness="1" Width="3" Height="3" Margin="30,0,0,0"/>
<Rectangle x:Name="primeOLX1" Fill="White" Width="2" Height="2" Margin="30,0,0,0"/>
<Rectangle x:Name="primeOLX2OT" Stroke="Black" StrokeThickness="1" Width="3" Height="3" Margin="0,0,30,0"/>
<Rectangle x:Name="primeOLX2" Fill="White" Width="2" Height="2" Margin="0,0,30,0"/>

<Rectangle x:Name="primeOLY1OT" Stroke="Black" StrokeThickness="1" Width="3" Height="3" Margin="0,0,0,30"/>
<Rectangle x:Name="primeOLY1" Fill="White" Width="2" Height="2" Margin="0,0,0,30"/>
<Rectangle x:Name="primeOLY2OT" Stroke="Black" StrokeThickness="1" Width="3" Height="3" Margin="0,30,0,0"/>
<Rectangle x:Name="primeOLY2" Fill="White" Width="2" Height="2" Margin="0,30,0,0"/>

<Rectangle x:Name="primeDOTOT" Stroke="Black" StrokeThickness="1" Width="3" Height="3"/>
<Rectangle x:Name="primeDOT" Fill="White" Width="2" Height="2"/>
</Grid>
</Grid>
</Grid>
</Border>
<Border Background="#FF393B44" MinHeight="95" MaxHeight="95" MinWidth="330" MaxWidth="330" Margin="0,5">
Expand Down
118 changes: 107 additions & 11 deletions ValorantCC/SubWindow/ProfilesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static void InitialFetch(String sharecode = null)
}
else Shareables = ValCCApi.Fetch().data;


if (Shareables.Count == 0) return;
for (int i = 0; i < Shareables.Count; i++)
{
ShareableProfile currentShareable = Shareables[i];
Expand All @@ -80,26 +80,122 @@ private static void InitialFetch(String sharecode = null)
private void RenderProfiles()
{
UIElementCollection shareablesElement = ShareablesContainer.Children;
Border template = new Border()
{
Background = (Brush)bc.ConvertFromString("#FF393B44"),
MinHeight = 95,
MaxHeight = 95,
MinWidth = 330,
MaxWidth = 330,
Margin = new Thickness() { Bottom = 5, Top = 5, Left = 0, Right = 0 }
};
if (PublicProfiles.Count == 0) return;

for (int i = 0; i < PublicProfiles.Count; i++)
{
PublicProfile profile = PublicProfiles[i];
shareablesElement.Add(template);
shareablesElement.Add(CreateRender(profile));
}

}
private void btnSearchCode_Click(object sender, RoutedEventArgs e)
{
if (SearchCode.Text == null || SearchCode.Text == "") return;
InitialFetch(SearchCode.Text);
RenderProfiles();
}

private UIElement CreateRender(PublicProfile profile)
{
// This will be changed and will be replaced with more efficient method of rendering multiple settings.

// These first 2 vars can be put somewhere else but I didn't because lazy.
List<ImageSource> imageSources = new List<ImageSource>()
{
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG0.png")),
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG1.png")),
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG2.png")),
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG3.png")),
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG4.png")),
new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG5.png"))
};
Random rand = new Random();
// Main border
Border template = new Border()
{
Background = (Brush)bc.ConvertFromString("#FF393B44"),
MinHeight = 95,
MaxHeight = 95,
MinWidth = 330,
MaxWidth = 330,
Margin = new Thickness() { Bottom = 5, Top = 5, Left = 0, Right = 0 }
};
// First Grid and defintions
Grid Grid0 = new Grid();
ColumnDefinition gridCol0 = new ColumnDefinition();
ColumnDefinition gridCol1 = new ColumnDefinition();
ColumnDefinition gridCol2 = new ColumnDefinition();
RowDefinition gridRow0 = new RowDefinition() { Height = new GridLength(2.5, GridUnitType.Star) };
RowDefinition gridRow1 = new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) };
Grid0.ColumnDefinitions.Add(gridCol0);
Grid0.ColumnDefinitions.Add(gridCol1);
Grid0.ColumnDefinitions.Add(gridCol2);
Grid0.RowDefinitions.Add(gridRow0);
Grid0.RowDefinitions.Add(gridRow1);

// INner elements
Image bg = new Image()
{
Source = imageSources[rand.Next(0,5)],
Stretch = Stretch.Fill,
Margin = new Thickness() { Bottom = 2, Top = 0, Left = 2, Right = 2 }
};

Grid.SetRow(bg, 0);
Grid.SetColumn(bg, 0);
Grid.SetColumnSpan(bg, 3);

Label ownerName = new Label()
{
Content = profile.owner + "'s Profile",
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Right,
Foreground = Brushes.White
};
Grid.SetColumn(ownerName, 2);
Grid.SetRow(ownerName, 0);

Button shareButton = new Button()
{
Style = (Style)FindResource("RoundButton"),
Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 },
FontSize = 12,
FontWeight = FontWeights.Bold,
Content = "Share"
};
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"

};
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"
};
Grid.SetColumn(shareButton, 0);
Grid.SetRow(shareButton, 1);
Grid.SetColumn(detailsButton, 1);
Grid.SetRow(detailsButton, 1);
Grid.SetColumn(applyButton, 2);
Grid.SetRow(applyButton, 1);

Grid0.Children.Add(bg);
Grid0.Children.Add(ownerName);

Grid0.Children.Add(shareButton);
Grid0.Children.Add(detailsButton);
Grid0.Children.Add(applyButton);
template.Child = Grid0;
return template;
}
}
}

0 comments on commit c7c753f

Please # to comment.