This commit is contained in:
末城via 2023-08-12 00:44:28 +08:00
parent 39824dd5a2
commit 0d33a86278
12 changed files with 127 additions and 51 deletions

View File

@ -105,28 +105,28 @@
Foreground="{DynamicResource DARKPrimary}" /> Foreground="{DynamicResource DARKPrimary}" />
</Grid> </Grid>
</Border> </Border>
<Menu VerticalAlignment="Bottom" Style="{DynamicResource ToolBarMenuStyle}" Width="500"> <Menu VerticalAlignment="Bottom" Style="{DynamicResource ToolBarMenuStyle}" Width="500" pu:MenuHelper.SubmenuItemsHorizontalContentAlignment="Center" pu:MenuHelper.TopLevelItemsHorizontalContentAlignment="Center">
<Menu.ItemsPanel> <Menu.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<UniformGrid Columns="5" /> <UniformGrid Columns="5" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</Menu.ItemsPanel> </Menu.ItemsPanel>
<MenuItem x:Name="MenuFeed" Header="{ll:Str 投喂}" HorizontalContentAlignment="Center" Padding="0" <MenuItem x:Name="MenuFeed" Header="{ll:Str 投喂}" Padding="0"
x:FieldModifier="public" /> x:FieldModifier="public" />
<MenuItem x:Name="MenuPanel" Header="{ll:Str 面板}" MouseEnter="MenuPanel_MouseEnter" <MenuItem x:Name="MenuPanel" Header="{ll:Str 面板}" MouseEnter="MenuPanel_MouseEnter"
MouseLeave="MenuPanel_MouseLeave" HorizontalContentAlignment="Center" Padding="0" /> MouseLeave="MenuPanel_MouseLeave" Padding="0" />
<MenuItem x:Name="MenuInteract" Header="{ll:Str 互动}" HorizontalContentAlignment="Center" Width="99" <MenuItem x:Name="MenuInteract" Header="{ll:Str 互动}" Width="99"
Padding="0"> Padding="0">
<MenuItem Header="{ll:Str 睡觉}" HorizontalContentAlignment="Center" Click="Sleep_Click" /> <MenuItem Header="{ll:Str 睡觉}" Click="Sleep_Click" />
<MenuItem x:Name="MenuStudy" Header="{ll:Str 学习}" HorizontalContentAlignment="Center" /> <MenuItem x:Name="MenuStudy" Header="{ll:Str 学习}" />
<MenuItem x:Name="MenuWork" Header="{ll:Str 工作}" HorizontalContentAlignment="Center" /> <MenuItem x:Name="MenuWork" Header="{ll:Str 工作}" />
<!--<MenuItem Header="说话" HorizontalContentAlignment="Center" IsEnabled="False" />--> <!--<MenuItem Header="说话" IsEnabled="False" />-->
</MenuItem> </MenuItem>
<MenuItem x:Name="MenuDIY" Header="{ll:Str 自定}" HorizontalContentAlignment="Center" x:FieldModifier="public" <MenuItem x:Name="MenuDIY" Header="{ll:Str 自定}" x:FieldModifier="public"
Padding="0" /> Padding="0" />
<MenuItem x:Name="MenuSetting" Header="{ll:Str 系统}" HorizontalContentAlignment="Center" <MenuItem x:Name="MenuSetting" Header="{ll:Str 系统}"
x:FieldModifier="public" Padding="0"> x:FieldModifier="public" Padding="0">
<MenuItem x:Name="MenuMODConfig" Header="{ll:Str MOD设置}" HorizontalContentAlignment="Center" <MenuItem x:Name="MenuMODConfig" Header="{ll:Str MOD设置}"
Visibility="Collapsed" x:FieldModifier="public" /> Visibility="Collapsed" x:FieldModifier="public" />
</MenuItem> </MenuItem>
</Menu> </Menu>

View File

@ -81,7 +81,7 @@
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath> <HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
</Reference> </Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.3\lib\net462\Panuon.WPF.UI.dll</HintPath> <HintPath>..\packages\Panuon.WPF.UI.1.1.15.4\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -3,5 +3,5 @@
<package id="LinePutScript" version="1.9.2" targetFramework="net462" /> <package id="LinePutScript" version="1.9.2" targetFramework="net462" />
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" /> <package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" /> <package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.15.3" targetFramework="net462" /> <package id="Panuon.WPF.UI" version="1.1.15.4" targetFramework="net462" />
</packages> </packages>

View File

@ -99,7 +99,7 @@
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath> <HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
</Reference> </Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.3\lib\net462\Panuon.WPF.UI.dll</HintPath> <HintPath>..\packages\Panuon.WPF.UI.1.1.15.4\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />

View File

@ -3,5 +3,5 @@
<package id="LinePutScript" version="1.9.2" targetFramework="net462" /> <package id="LinePutScript" version="1.9.2" targetFramework="net462" />
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" /> <package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" /> <package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.15.3" targetFramework="net462" /> <package id="Panuon.WPF.UI" version="1.1.15.4" targetFramework="net462" />
</packages> </packages>

View File

@ -1,4 +1,5 @@
using System; using Panuon.WPF.UI;
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
@ -30,21 +31,43 @@ namespace VPet_Simulator.Windows
DependencyProperty.Register("ItemsMinHeight", typeof(double), typeof(AutoUniformGrid), new PropertyMetadata(double.NaN)); DependencyProperty.Register("ItemsMinHeight", typeof(double), typeof(AutoUniformGrid), new PropertyMetadata(double.NaN));
#endregion #endregion
public event RoutedEventHandler Changed
{
add { AddHandler(ChangedEvent, value); }
remove { RemoveHandler(ChangedEvent, value); }
}
public static readonly RoutedEvent ChangedEvent =
EventManager.RegisterRoutedEvent("Changed", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AutoUniformGrid));
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{ {
base.OnRenderSizeChanged(sizeInfo); base.OnRenderSizeChanged(sizeInfo);
var isChanged = false;
if (!double.IsNaN(ItemsMinWidth)) if (!double.IsNaN(ItemsMinWidth))
{ {
var columns = (int)Math.Floor(sizeInfo.NewSize.Width / ItemsMinWidth); var columns = (int)Math.Floor(sizeInfo.NewSize.Width / ItemsMinWidth);
if(Columns != columns)
{
isChanged = true;
}
SetCurrentValue(ColumnsProperty, columns); SetCurrentValue(ColumnsProperty, columns);
} }
if (!double.IsNaN(ItemsMinHeight)) if (!double.IsNaN(ItemsMinHeight))
{ {
var rows = (int)Math.Floor(sizeInfo.NewSize.Height / ItemsMinHeight); var rows = (int)Math.Floor(sizeInfo.NewSize.Height / ItemsMinHeight);
if(Rows != rows)
{
isChanged = true;
}
SetCurrentValue(RowsProperty, rows); SetCurrentValue(RowsProperty, rows);
} }
if(isChanged)
{
RaiseEvent(new RoutedEventArgs(ChangedEvent));
}
} }
} }

View File

@ -97,6 +97,9 @@
<Reference Include="CSCore, Version=1.2.1.2, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL"> <Reference Include="CSCore, Version=1.2.1.2, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
<HintPath>..\packages\CSCore.1.2.1.2\lib\net35-client\CSCore.dll</HintPath> <HintPath>..\packages\CSCore.1.2.1.2\lib\net35-client\CSCore.dll</HintPath>
</Reference> </Reference>
<Reference Include="Facepunch.Steamworks.Win64, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Facepunch.Steamworks.2.3.3\lib\net46\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.9.2\lib\net462\LinePutScript.dll</HintPath> <HintPath>..\packages\LinePutScript.1.9.2\lib\net462\LinePutScript.dll</HintPath>
</Reference> </Reference>
@ -110,7 +113,7 @@
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath> <HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
</Reference> </Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.3\lib\net462\Panuon.WPF.UI.dll</HintPath> <HintPath>..\packages\Panuon.WPF.UI.1.1.15.4\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
@ -126,6 +129,9 @@
<Reference Include="System.Xaml"> <Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework> <RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="Update, Version=2.4.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Update.2.4.7\lib\net40\Update.exe</HintPath>
</Reference>
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
@ -231,11 +237,6 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x64'">
<Reference Include="Facepunch.Steamworks.Win64, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Facepunch.Steamworks.2.3.3\lib\net46\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
@ -278,9 +279,6 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="steam_api64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Resource Include="vpeticon.ico"> <Resource Include="vpeticon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
@ -314,5 +312,8 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="steam_api64.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -238,22 +238,33 @@
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>
<Grid Margin="10" Grid.Column="1"> <Grid Margin="10"
<ScrollViewer x:Name="PageDetail"> Grid.Column="1">
<ItemsControl x:Name="IcCommodity" VerticalAlignment="Top"> <Grid.RowDefinitions>
<ItemsControl.ItemsPanel> <RowDefinition />
<ItemsPanelTemplate> <RowDefinition Height="Auto" />
<local:AutoUniformGrid ItemsMinWidth="250" /> </Grid.RowDefinitions>
</ItemsPanelTemplate> <ItemsControl x:Name="IcCommodity"
</ItemsControl.ItemsPanel> SizeChanged="AutoUniformGrid_SizeChanged">
<ItemsControl.ItemTemplate> <ItemsControl.ItemsPanel>
<DataTemplate> <ItemsPanelTemplate>
<ContentControl Height="140" Margin="0,0,10,10" Content="{Binding}" <local:AutoUniformGrid VerticalAlignment="Top"
ContentTemplate="{StaticResource CommodityDataTemplate}" /> ItemsMinWidth="250"
</DataTemplate> Changed="AutoUniformGrid_Changed"/>
</ItemsControl.ItemTemplate> </ItemsPanelTemplate>
</ItemsControl> </ItemsControl.ItemsPanel>
</ScrollViewer> <ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Height="140"
Margin="0,0,10,10"
Content="{Binding}"
ContentTemplate="{StaticResource CommodityDataTemplate}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<pu:Pagination x:Name="pagination" Grid.Row="1"
Style="{DynamicResource StandardPaginationStyle}"
CurrentPageChanged="pagination_CurrentPageChanged"/>
</Grid> </Grid>
</Grid> </Grid>
</pu:WindowX> </pu:WindowX>

View File

@ -35,6 +35,8 @@ namespace VPet_Simulator.Windows
MainWindow mw; MainWindow mw;
private bool AllowChange = false; private bool AllowChange = false;
private Switch _puswitch; private Switch _puswitch;
private int _columns;
private int _rows;
public winBetterBuy(MainWindow mw) public winBetterBuy(MainWindow mw)
{ {
@ -133,7 +135,12 @@ namespace VPet_Simulator.Windows
} }
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
IcCommodity.ItemsSource = ordered; var totalCount = ordered.Count();
var pageSize = _rows * _columns;
pagination.MaxPage = (int)Math.Ceiling(totalCount * 1.0 / pageSize);
var currentPage = Math.Max(0, Math.Min(pagination.MaxPage, pagination.CurrentPage) - 1);
pagination.CurrentPage = currentPage + 1;
IcCommodity.ItemsSource = ordered.Skip(pageSize * currentPage).Take(pageSize);
}); });
}); });
} }
@ -153,10 +160,10 @@ namespace VPet_Simulator.Windows
//} //}
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{ {
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta); //var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
eventArg.RoutedEvent = UIElement.MouseWheelEvent; //eventArg.RoutedEvent = UIElement.MouseWheelEvent;
eventArg.Source = sender; //eventArg.Source = sender;
PageDetail.RaiseEvent(eventArg); //PageDetail.RaiseEvent(eventArg);
} }
private void BtnBuy_Click(object sender, RoutedEventArgs e) private void BtnBuy_Click(object sender, RoutedEventArgs e)
{ {
@ -252,7 +259,12 @@ namespace VPet_Simulator.Windows
private void Search() private void Search()
{ {
OrderItemSource((Food.FoodType)LsbCategory.SelectedIndex, LsbSortRule.SelectedIndex, LsbSortAsc.SelectedIndex == 0, _searchTextBox.Text); var searchText = "";
if (_searchTextBox != null)
{
searchText = _searchTextBox.Text;
}
OrderItemSource((Food.FoodType)LsbCategory.SelectedIndex, LsbSortRule.SelectedIndex, LsbSortAsc.SelectedIndex == 0, searchText);
} }
private void TbTitleSearch_Loaded(object sender, RoutedEventArgs e) private void TbTitleSearch_Loaded(object sender, RoutedEventArgs e)
@ -292,5 +304,33 @@ namespace VPet_Simulator.Windows
{ {
mw.Set["betterbuy"].SetBool("noautoclose", _puswitch.IsChecked.Value); mw.Set["betterbuy"].SetBool("noautoclose", _puswitch.IsChecked.Value);
} }
private void AutoUniformGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
var rows = Math.Max(0, (int)Math.Floor(IcCommodity.ActualHeight / 150d));
if (rows != _rows)
{
_rows = rows;
Search();
}
_rows = rows;
}
private void AutoUniformGrid_Changed(object sender, RoutedEventArgs e)
{
var uniformGrid = e.OriginalSource as AutoUniformGrid;
var columns = uniformGrid.Columns;
if (columns != _columns)
{
_columns = columns;
Search();
}
_columns = columns;
}
private void pagination_CurrentPageChanged(object sender, SelectedValueChangedRoutedEventArgs<int> e)
{
Search();
}
} }
} }

View File

@ -19,7 +19,7 @@
pu:TabControlHelper.ItemsCornerRadius="4" pu:TabControlHelper.ItemsCornerRadius="4"
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}" pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}" pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}"
pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}" pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}" pu:TabControlHelper.CanHeaderPanelScroll="True"
Foreground="{DynamicResource PrimaryText}" SelectionChanged="MainTab_SelectionChanged"> Foreground="{DynamicResource PrimaryText}" SelectionChanged="MainTab_SelectionChanged">
<TabControl.ContentTemplate> <TabControl.ContentTemplate>
<DataTemplate> <DataTemplate>

View File

@ -109,7 +109,7 @@ namespace VPet_Simulator.Windows
if (mw.Set.Diagnosis) if (mw.Set.Diagnosis)
RBDiagnosisYES.IsChecked = true; RBDiagnosisYES.IsChecked = true;
List<int> cbDiagnosis = new List<int> { 200, 500, 1000, 2000, 5000, 10000, 20000 } List<int> cbDiagnosis = new List<int> { 200, 500, 1000, 2000, 5000, 10000, 20000 };
int ds = cbDiagnosis.IndexOf(mw.Set.DiagnosisInterval); int ds = cbDiagnosis.IndexOf(mw.Set.DiagnosisInterval);
if (ds == -1) if (ds == -1)
ds = 1; ds = 1;
@ -957,7 +957,7 @@ namespace VPet_Simulator.Windows
mw.Main.MsgBar.SetPlaceIN(); mw.Main.MsgBar.SetPlaceIN();
} }
private void numBackupSaveMaxNum_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e) private void numBackupSaveMaxNum_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double?> e)
{ {
if (!AllowChange) if (!AllowChange)
return; return;

View File

@ -8,5 +8,6 @@
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" /> <package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" /> <package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.15.3" targetFramework="net462" /> <package id="Panuon.WPF.UI" version="1.1.15.4" targetFramework="net462" />
<package id="Update" version="2.4.7" targetFramework="net462" />
</packages> </packages>