mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
好友之间送食品/礼物
This commit is contained in:
parent
9d344ef42c
commit
e3ff6fb564
@ -169,6 +169,12 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// 当创建/加入新的多人联机窗口(访客表)时触发
|
||||
/// </summary>
|
||||
event Action<IMPWindows> MutiPlayerHandle;
|
||||
/// <summary>
|
||||
/// 显示吃东西(夹层)动画
|
||||
/// </summary>
|
||||
/// <param name="graphName">夹层动画名</param>
|
||||
/// <param name="imageSource">被夹在中间的图片</param>
|
||||
void DisplayFoodAnimation(string graphName, ImageSource imageSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using VPet_Simulator.Core;
|
||||
using static VPet_Simulator.Core.GraphInfo;
|
||||
using static VPet_Simulator.Windows.Interface.MPMessage;
|
||||
@ -72,4 +73,10 @@ public interface IMPFriend
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示吃东西(夹层)动画
|
||||
/// </summary>
|
||||
/// <param name="graphName">夹层动画名</param>
|
||||
/// <param name="imageSource">被夹在中间的图片</param>
|
||||
void DisplayFoodAnimation(string graphName, ImageSource imageSource);
|
||||
}
|
||||
|
@ -132,9 +132,10 @@ public struct MPMessage
|
||||
/// </summary>
|
||||
public bool EnableFunction { get; set; }
|
||||
/// <summary>
|
||||
/// 食物
|
||||
/// 食物/物品
|
||||
/// </summary>
|
||||
public Food Food { get; set; }
|
||||
[Line()]
|
||||
public Food Item { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 交互类型
|
||||
|
@ -2019,7 +2019,28 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示吃东西动画
|
||||
/// </summary>
|
||||
bool showeatanm = true;
|
||||
/// <summary>
|
||||
/// 显示吃东西(夹层)动画
|
||||
/// </summary>
|
||||
/// <param name="graphName">夹层动画名</param>
|
||||
/// <param name="imageSource">被夹在中间的图片</param>
|
||||
public void DisplayFoodAnimation(string graphName, ImageSource imageSource)
|
||||
{
|
||||
if (showeatanm)
|
||||
{//显示动画
|
||||
showeatanm = false;
|
||||
Main.Display(graphName, imageSource, () =>
|
||||
{
|
||||
showeatanm = true;
|
||||
Main.DisplayToNomal();
|
||||
Main.EventTimer_Elapsed();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if NewYear
|
||||
|
@ -25,6 +25,8 @@ using System.Windows.Interop;
|
||||
using LinePutScript.Converter;
|
||||
using static VPet_Simulator.Windows.Interface.MPMessage;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using ToolBar = VPet_Simulator.Core.ToolBar;
|
||||
|
||||
namespace VPet_Simulator.Windows;
|
||||
/// <summary>
|
||||
@ -33,7 +35,7 @@ namespace VPet_Simulator.Windows;
|
||||
public partial class MPFriends : WindowX, IMPFriend
|
||||
{
|
||||
public Lobby lb;
|
||||
MainWindow mw;
|
||||
internal MainWindow mw;
|
||||
public Friend friend;
|
||||
public winMutiPlayer wmp;
|
||||
public GameCore Core { get; set; } = new GameCore();
|
||||
@ -62,7 +64,7 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//MGrid.Height = 500 * mw.Set.ZoomLevel;
|
||||
//MGrid.Height = 500 * mf.Set.ZoomLevel;
|
||||
MGrid.Width = 500 * mw.Set.ZoomLevel;
|
||||
double L = 0, T = 0;
|
||||
if (mw.Set.StartRecordLast)
|
||||
@ -188,9 +190,45 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
public Main Main { get; set; }
|
||||
|
||||
public ulong LobbyID => lb.Id;
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示吃东西动画
|
||||
/// </summary>
|
||||
bool showeatanm = true;
|
||||
/// <summary>
|
||||
/// 显示吃东西(夹层)动画
|
||||
/// </summary>
|
||||
/// <param name="graphName">夹层动画名</param>
|
||||
/// <param name="imageSource">被夹在中间的图片</param>
|
||||
public void DisplayFoodAnimation(string graphName, ImageSource imageSource)
|
||||
{
|
||||
if (showeatanm)
|
||||
{//显示动画
|
||||
showeatanm = false;
|
||||
Main.Display(graphName, imageSource, () =>
|
||||
{
|
||||
showeatanm = true;
|
||||
Main.DisplayToNomal();
|
||||
Main.EventTimer_Elapsed();
|
||||
});
|
||||
}
|
||||
}
|
||||
public ulong FriendID => friend.Id;
|
||||
|
||||
/// <summary>
|
||||
/// 喂食显示动画
|
||||
/// </summary>
|
||||
/// <param name="byname"></param>
|
||||
/// <param name="feed"></param>
|
||||
public void Feed(string byname, Feed feed)
|
||||
{
|
||||
DisplayFoodAnimation(feed.Item.GetGraph(), Dispatcher.Invoke(() => ImageSources.FindImage("food_" + (feed.Item.Image ?? feed.Item.Name), "food")));
|
||||
if (feed.EnableFunction)
|
||||
{
|
||||
mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price));
|
||||
mw.TakeItem(feed.Item);
|
||||
}
|
||||
else
|
||||
mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName));
|
||||
}
|
||||
/// <summary>
|
||||
/// 加载游戏
|
||||
/// </summary>
|
||||
@ -257,16 +295,22 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
|
||||
LoadingText.Content = "正在加载游戏\n该步骤可能会耗时比较长\n请耐心等待".Translate();
|
||||
|
||||
Foods.ForEach(item =>
|
||||
{
|
||||
item.ImageSource = ImageSources.FindImage("food_" + (item.Image ?? item.Name), "food");
|
||||
item.Star = mw.Set.BetterBuyData["star"].GetInfos().Contains(Name);
|
||||
});
|
||||
|
||||
Main.PlayVoiceVolume = mw.Set.VoiceVolume;
|
||||
|
||||
DisplayGrid.Child = Main;
|
||||
|
||||
//Main.SetMoveMode(mw.Set.AllowMove, mw.Set.SmartMove, mw.Set.SmartMoveInterval * 1000);
|
||||
//Main.SetMoveMode(mf.Set.AllowMove, mf.Set.SmartMove, mf.Set.SmartMoveInterval * 1000);
|
||||
//Main.SetLogicInterval(1500);
|
||||
if (mw.Set.MessageBarOutside)
|
||||
Main.MsgBar.SetPlaceOUT();
|
||||
|
||||
//Main.WorkCheck = mw.WorkCheck;
|
||||
//Main.WorkCheck = mf.WorkCheck;
|
||||
|
||||
//添加捏脸动画(若有)
|
||||
if (Core.Graph.GraphConfig.Data.ContainsLine("pinch"))
|
||||
@ -280,6 +324,27 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
LoadingText.Background = Function.ResourcesBrush(Function.BrushType.DARKPrimaryTransA);
|
||||
LoadingText.VerticalAlignment = VerticalAlignment.Top;
|
||||
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "吃饭".Translate(), () =>
|
||||
{
|
||||
new winMPBetterBuy(this).Show(Food.FoodType.Meal);
|
||||
});
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "喝水".Translate(), () =>
|
||||
{
|
||||
new winMPBetterBuy(this).Show(Food.FoodType.Drink);
|
||||
});
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "收藏".Translate(), () =>
|
||||
{
|
||||
new winMPBetterBuy(this).Show(Food.FoodType.Star);
|
||||
});
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "药品".Translate(), () =>
|
||||
{
|
||||
new winMPBetterBuy(this).Show(Food.FoodType.Drug);
|
||||
});
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "礼品".Translate(), () =>
|
||||
{
|
||||
new winMPBetterBuy(this).Show(Food.FoodType.Gift);
|
||||
});
|
||||
|
||||
Loaded = true;
|
||||
}));
|
||||
}
|
||||
|
318
VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml
Normal file
318
VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml
Normal file
@ -0,0 +1,318 @@
|
||||
<pu:WindowX x:Class="VPet_Simulator.Windows.winMPBetterBuy"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Topmost="True"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows"
|
||||
mc:Ignorable="d" Height="550" Width="800" FontSize="14" WindowStartupLocation="CenterScreen"
|
||||
Background="{DynamicResource PrimaryLighter}" pu:WindowXCaption.Height="45"
|
||||
pu:WindowXCaption.Background="{DynamicResource DARKPrimary}" pu:WindowXCaption.Foreground="#FFFFFF"
|
||||
pu:WindowXCaption.Buttons="Close" Icon="/Res/BetterBuy.png"
|
||||
pu:WindowXCaption.ShadowColor="{DynamicResource ShadowColor}" Closing="WindowX_Closing">
|
||||
<pu:WindowXCaption.CloseButtonStyle>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}">
|
||||
<Setter Property="Width" Value="28" />
|
||||
<Setter Property="Height" Value="28" />
|
||||
<Setter Property="Margin" Value="0,0,7,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="pu:ButtonHelper.CornerRadius" Value="14" />
|
||||
<Setter Property="pu:ButtonHelper.HoverBackground" Value="White" />
|
||||
<Setter Property="pu:ButtonHelper.ClickBackground" Value="{x:Null}" />
|
||||
<Setter Property="pu:ButtonHelper.HoverForeground" Value="{DynamicResource DARKPrimary}" />
|
||||
</Style>
|
||||
</pu:WindowXCaption.CloseButtonStyle>
|
||||
<pu:WindowXCaption.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="10,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image x:Name="ImageWHY" Width="28" Height="28" Source="/Res/BetterBuy.png"
|
||||
VerticalAlignment="Center" Margin="30,0,0,0" />
|
||||
<Button Style="{DynamicResource TextButtonStyle}" Foreground="{DynamicResource DARKPrimaryText}"
|
||||
VerticalAlignment="Center" FontSize="20" Click="BtnTitle_Click"
|
||||
pu:WindowX.IsDragMoveArea="False" Margin="10,0,0,0" Loaded="Button_Loaded" />
|
||||
<Grid Grid.Column="1" Margin="15,0,0,0" pu:WindowX.IsDragMoveArea="False" Width="200">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="TbTitleSearch" Grid.ColumnSpan="2" VerticalAlignment="Center" Padding="7,0"
|
||||
pu:TextBoxHelper.Watermark="{ll:Str 搜索商品}" FontSize="14" Background="#33FFFFFF"
|
||||
Height="30" BorderThickness="0" pu:TextBoxHelper.CornerRadius="5"
|
||||
Loaded="TbTitleSearch_Loaded" Foreground="{DynamicResource DARKPrimaryText}" />
|
||||
<Button Grid.Column="1" Margin="0,0,3,0" VerticalAlignment="Center" Height="28" Width="28"
|
||||
IsDefault="{Binding IsKeyboardFocusWithin, ElementName=TbTitleSearch}"
|
||||
BorderThickness="0" pu:ButtonHelper.CornerRadius="0,5,5,0" Background="Transparent"
|
||||
FontFamily="pack://application:,,,/Res/#remixicon" Content="" Padding="0"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" FontSize="16" Cursor="Hand"
|
||||
Click="BtnSearch_Click" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Viewbox HorizontalAlignment="Right" Margin="2">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock FontSize="16" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Center">
|
||||
<Run Text="{ll:Str 金钱}" />: $ <Run x:Name="rMoney" Loaded="rMoney_Loaded" Text="" />
|
||||
</TextBlock>
|
||||
<pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" FontSize="14" Height="20"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center" BoxHeight="14"
|
||||
ToggleSize="18" CheckedBackground="{DynamicResource Primary}"
|
||||
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent"
|
||||
ToggleShadowColor="{x:Null}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
|
||||
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False"
|
||||
BoxWidth="30" Loaded="Switch_Loaded" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</pu:WindowXCaption.HeaderTemplate>
|
||||
<Window.Resources>
|
||||
<local:BoolToIntConverter x:Key="BoolToIntConverter" />
|
||||
<local:DiscountPriceConverter x:Key="DiscountPriceConverter" />
|
||||
|
||||
<DataTemplate x:Key="CommodityDataTemplate">
|
||||
<Grid>
|
||||
<pu:CarouselPanel Grid.Column="1" Animation="Fade,Flow" AnimationDuration="0:0:0.3"
|
||||
CurrentIndex="{Binding IsChecked, Converter={StaticResource BoolToIntConverter}, ElementName=TbtnDetail}">
|
||||
<Border Background="{DynamicResource SecondaryTrans4}" CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Margin="25,0,0,0" Width="{Binding ActualHeight, ElementName=BdrImage}" />
|
||||
<TextBlock Grid.ColumnSpan="2" Margin="10,7,0,0" FontWeight="Bold"
|
||||
TextTrimming="CharacterEllipsis" FontSize="18" Text="{Binding TranslateName}" />
|
||||
<Grid Grid.Column="1" Margin="0,40,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock x:Name="TxtPrice" VerticalAlignment="Bottom"
|
||||
Text="{Binding Price, StringFormat='$ 0.0'}" FontWeight="Bold" FontSize="18"
|
||||
Foreground="{DynamicResource DARKPrimary}" />
|
||||
<!--<TextBlock x:Name="TxtDiscountPrice" Margin="5,0,0,0" FontWeight="Bold"
|
||||
FontSize="18" Foreground="{DynamicResource DARKPrimary}">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource DiscountPriceConverter}">
|
||||
<Binding Path="Price" />
|
||||
<Binding Path="Discount" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>-->
|
||||
</StackPanel>
|
||||
<!--<Border Grid.Row="3" Margin="0,5,0,0" HorizontalAlignment="Left"
|
||||
Background="{DynamicResource SecondaryTrans}" CornerRadius="2">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RepeatButton VerticalAlignment="Center" Content="-" Padding="0,0,0,5"
|
||||
Style="{DynamicResource IconInvertedForegroundRepeatButtonStyle}"
|
||||
Click="RbtnDecrease_Click" />
|
||||
<TextBox Grid.Column="1" Cursor="IBeam" Background="#CDFFFFFF"
|
||||
BorderThickness="0" HorizontalContentAlignment="Center"
|
||||
Text="{Binding Quantity}" MinWidth="30" />
|
||||
<RepeatButton Grid.Column="2" VerticalAlignment="Center" Content="+"
|
||||
Padding="0,0,0,5"
|
||||
Style="{DynamicResource IconInvertedForegroundRepeatButtonStyle}"
|
||||
Click="RbtnIncrease_Click" />
|
||||
</StackPanel>
|
||||
</Border>-->
|
||||
<Button Grid.Row="4" Margin="0,7,0,0" Padding="7,5" Cursor="Hand"
|
||||
HorizontalAlignment="Left" pu:ButtonHelper.Icon=""
|
||||
Style="{DynamicResource ThemedButtonStyle}" Content="{ll:Str 购买}"
|
||||
Click="BtnBuy_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Background="{DynamicResource DARKPrimary}" CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid Grid.Column="1" Margin="10,10,10,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="16"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" Text="{Binding TranslateName}" />
|
||||
<ScrollViewer Grid.Row="1" Grid.RowSpan="4" Margin="0,7,0,0"
|
||||
pu:ScrollBarHelper.ThumbBackground="#44FFFFFF"
|
||||
PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
|
||||
pu:ScrollBarHelper.HoverThumbBackground="#88FFFFFF">
|
||||
<StackPanel x:Name="StkContainer">
|
||||
<ItemsControl ItemsSource="{Binding DescriptionValues}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Width="{Binding ActualWidth, Converter={x:Static pu:Converters.DoubleDivideByConverter},ConverterParameter=2, ElementName=StkContainer}">
|
||||
<TextBlock Foreground="{DynamicResource DARKPrimaryText}"
|
||||
FontSize="12" Width="37" Padding="0"
|
||||
VerticalAlignment="Center" Text="{Binding Key}" />
|
||||
<TextBlock Text=":"
|
||||
Foreground="{DynamicResource DARKPrimaryText}"
|
||||
FontSize="12" />
|
||||
<TextBlock Foreground="{DynamicResource DARKPrimaryText}"
|
||||
FontSize="12" Padding="0" VerticalAlignment="Center"
|
||||
Text="{Binding Value}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock TextWrapping="Wrap" Background="Transparent" FontSize="12"
|
||||
Padding="0" Foreground="{DynamicResource DARKPrimaryText}"
|
||||
Text="{Binding Description}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</pu:CarouselPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border x:Name="BdrImage" Margin="10,35,0,10" CornerRadius="5"
|
||||
Visibility="{Binding IsChecked,Converter={x:Static pu:Converters.TrueToCollapseConverter}, ElementName=TbtnDetail}">
|
||||
<Image Source="{Binding ImageSource}" Stretch="UniformToFill" />
|
||||
</Border>
|
||||
<ToggleButton x:Name="TbtnStar" Grid.ColumnSpan="2" Margin="0,5,32,0" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22"
|
||||
Foreground="#FFB300" Background="Transparent" ToolTip="{ll:Str 收藏食物}"
|
||||
pu:ToggleButtonHelper.CornerRadius="5" pu:ToggleButtonHelper.CheckedContent=""
|
||||
pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
|
||||
Content="" IsChecked="{Binding Star}" />
|
||||
<ToggleButton x:Name="TbtnDetail" Grid.ColumnSpan="2" Margin="0,5,8,0" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" Background="Transparent"
|
||||
ToolTip="{ll:Str 物品详情}" pu:ToggleButtonHelper.CornerRadius="5"
|
||||
pu:ToggleButtonHelper.CheckedContent=""
|
||||
pu:ToggleButtonHelper.CheckedForeground="{DynamicResource DARKPrimaryText}"
|
||||
pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
|
||||
Content="" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!--<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Discount}" Value="100">
|
||||
<Setter TargetName="TxtPrice" Property="Foreground" Value="{DynamicResource DARKPrimary}" />
|
||||
<Setter TargetName="TxtPrice" Property="FontSize" Value="18" />
|
||||
<Setter TargetName="TxtPrice" Property="TextDecorations" Value="None" />
|
||||
-->
|
||||
<!--<Setter TargetName="TxtDiscountPrice" Property="Visibility" Value="Collapsed" />-->
|
||||
<!--
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>-->
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="{DynamicResource DARKPrimaryText}" />
|
||||
<Grid Margin="12, 10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{ll:Str 商品分类}" FontSize="18" Margin="5" Foreground="{DynamicResource DARKPrimary}" />
|
||||
<ListBox x:Name="LsbCategory" Grid.Row="1" Margin="-12,10,-12,0" Background="Transparent"
|
||||
BorderThickness="0" SelectedIndex="0" pu:ListBoxHelper.ItemsPadding="15,8"
|
||||
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
|
||||
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
||||
SelectionChanged="LsbSortRule_SelectionChanged">
|
||||
<ListBoxItem Content="{ll:Str 全部}" />
|
||||
<ListBoxItem Content="{ll:Str 收藏}" />
|
||||
<ListBoxItem Content="{ll:Str 正餐}" />
|
||||
<ListBoxItem Content="{ll:Str 零食}" />
|
||||
<ListBoxItem Content="{ll:Str 饮料}" />
|
||||
<ListBoxItem Content="{ll:Str 功能性}" />
|
||||
<ListBoxItem Content="{ll:Str 药品}" />
|
||||
<ListBoxItem Content="{ll:Str 礼品}" />
|
||||
</ListBox>
|
||||
<TextBlock Grid.Row="2" Text="{ll:Str 排序方式}" Margin="5" FontSize="18"
|
||||
Foreground="{DynamicResource DARKPrimary}" />
|
||||
<Border Grid.Row="3" Margin="0,10,0,0" MinHeight="100" CornerRadius="5">
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox x:Name="LsbSortRule" Background="Transparent" BorderThickness="0"
|
||||
pu:ListBoxHelper.ItemsPadding="10,5" pu:ListBoxHelper.ItemsCornerRadius="4"
|
||||
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
|
||||
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
||||
SelectedIndex="0" SelectionChanged="LsbSortRule_SelectionChanged">
|
||||
<ListBoxItem Content="{ll:Str 按名字}" />
|
||||
<ListBoxItem Content="{ll:Str 按价格}" />
|
||||
<ListBoxItem Content="{ll:Str 按饱腹度}" />
|
||||
<ListBoxItem Content="{ll:Str 按口渴度}" />
|
||||
<ListBoxItem Content="{ll:Str 按体力}" />
|
||||
<ListBoxItem Content="{ll:Str 按心情}" />
|
||||
<ListBoxItem Content="{ll:Str 按健康}" />
|
||||
<ListBoxItem Content="{ll:Str 按经验值}" />
|
||||
<ListBoxItem Content="{ll:Str 按好感度}" />
|
||||
</ListBox>
|
||||
<Rectangle Grid.Column="1" Margin="10,0,10,0" Width="1" Fill="{DynamicResource DARKPrimaryTrans4}" />
|
||||
<ListBox x:Name="LsbSortAsc" Grid.Column="2" Background="Transparent" BorderThickness="0"
|
||||
pu:ListBoxHelper.ItemsPadding="10,5" pu:ListBoxHelper.ItemsCornerRadius="4"
|
||||
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
|
||||
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
||||
SelectedIndex="0" SelectionChanged="LsbSortRule_SelectionChanged">
|
||||
<ListBoxItem Content="{ll:Str 升序}" />
|
||||
<ListBoxItem Content="{ll:Str 降序}" />
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Margin="10" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ItemsControl x:Name="IcCommodity" SizeChanged="AutoUniformGrid_SizeChanged">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<local:AutoUniformGrid VerticalAlignment="Top" ItemsMinWidth="250"
|
||||
Changed="AutoUniformGrid_Changed" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Height="140" Margin="0,0,10,10" Content="{Binding}"
|
||||
ContentTemplate="{StaticResource CommodityDataTemplate}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<pu:Pagination x:Name="pagination" Style="{DynamicResource StandardPaginationStyle}"
|
||||
CurrentPageChanged="pagination_CurrentPageChanged" />
|
||||
<StackPanel Grid.Column="1" Margin="5,0,0,0" Orientation="Horizontal">
|
||||
<TextBox x:Name="TbPage" MinWidth="50" Style="{DynamicResource StandardTextBoxStyle}"
|
||||
PreviewKeyDown="TbPage_PreviewKeyDown" />
|
||||
<TextBlock Margin="3,0,0,0" Text="页" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</pu:WindowX>
|
335
VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs
Normal file
335
VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs
Normal file
@ -0,0 +1,335 @@
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using Steamworks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using VPet_Simulator.Core;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
using static System.Windows.Forms.LinkLabel;
|
||||
using static VPet_Simulator.Core.GraphCore;
|
||||
using static VPet_Simulator.Core.GraphInfo;
|
||||
using static VPet_Simulator.Core.IGraph;
|
||||
using static VPet_Simulator.Windows.Interface.MPMessage;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// winMPBetterBuy.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class winMPBetterBuy : WindowX
|
||||
{
|
||||
private TextBox _searchTextBox;
|
||||
MPFriends mf;
|
||||
private bool AllowChange = false;
|
||||
private Switch _puswitch;
|
||||
private int _columns;
|
||||
private int _rows;
|
||||
|
||||
public winMPBetterBuy(MPFriends mf)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.mf = mf;
|
||||
Title = "给更好的{0}买".Translate(mf.friend.Name);
|
||||
LsbSortRule.SelectedIndex = mf.mw.Set["betterbuy"].GetInt("lastorder");
|
||||
LsbSortAsc.SelectedIndex = mf.mw.Set["betterbuy"].GetBool("lastasc") ? 0 : 1;
|
||||
AllowChange = true;
|
||||
}
|
||||
Run rMoney;
|
||||
public void Show(Food.FoodType type)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
if (_searchTextBox != null)
|
||||
_searchTextBox.Text = "";
|
||||
if (LsbCategory.SelectedIndex == (int)type)
|
||||
OrderItemSource(type, LsbSortRule.SelectedIndex, LsbSortAsc.SelectedIndex == 0);
|
||||
else
|
||||
LsbCategory.SelectedIndex = (int)type;
|
||||
if (rMoney != null)
|
||||
rMoney.Text = mf.Core.Save.Money.ToString("f2");
|
||||
|
||||
Show();
|
||||
}
|
||||
public void OrderItemSource(Food.FoodType type, int sortrule, bool sortasc, string searchtext = null)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<Food> foods;
|
||||
switch (type)
|
||||
{
|
||||
case Food.FoodType.Food:
|
||||
foods = mf.Foods;
|
||||
break;
|
||||
case Food.FoodType.Star:
|
||||
//List<Food> lf = new List<Food>();
|
||||
//foreach (var sub in mf.Set["betterbuy"].FindAll("star"))
|
||||
//{
|
||||
// var str = sub.Info;
|
||||
// var food = mf.Foods.FirstOrDefault(x => x.Name == str);
|
||||
// if (food != null)
|
||||
// lf.Add(food);
|
||||
//}
|
||||
//foods = lf;
|
||||
foods = mf.Foods.FindAll(x => x.Star);
|
||||
break;
|
||||
default:
|
||||
foods = mf.Foods.FindAll(x => x.Type == type);// || x.Type == Food.FoodType.Limit);
|
||||
break;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(searchtext))
|
||||
{
|
||||
foods = foods.FindAll(x => x.TranslateName.Contains(searchtext));
|
||||
}
|
||||
IOrderedEnumerable<Food> ordered;
|
||||
switch (sortrule)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.TranslateName);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.TranslateName);
|
||||
break;
|
||||
case 1:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Price);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Price);
|
||||
break;
|
||||
case 2:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.StrengthFood);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.StrengthFood);
|
||||
break;
|
||||
case 3:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.StrengthDrink);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.StrengthDrink);
|
||||
break;
|
||||
case 4:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Strength);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Strength);
|
||||
break;
|
||||
case 5:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Feeling);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Feeling);
|
||||
break;
|
||||
case 6:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Health);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Health);
|
||||
break;
|
||||
case 7:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Exp);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Exp);
|
||||
break;
|
||||
case 8:
|
||||
if (sortasc)
|
||||
ordered = foods.OrderBy(x => x.Likability);
|
||||
else
|
||||
ordered = foods.OrderByDescending(x => x.Likability);
|
||||
break;
|
||||
}
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//private void RbtnIncrease_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// var repeatButton = sender as RepeatButton;
|
||||
// var item = repeatButton.DataContext as BetterBuyItem;
|
||||
// item.Quantity = Math.Max(1, item.Quantity + 1);
|
||||
//}
|
||||
|
||||
//private void RbtnDecrease_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// var repeatButton = sender as RepeatButton;
|
||||
// var item = repeatButton.DataContext as BetterBuyItem;
|
||||
// item.Quantity = Math.Max(1, item.Quantity - 1);
|
||||
//}
|
||||
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
//var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
||||
//eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
//eventArg.Source = sender;
|
||||
//PageDetail.RaiseEvent(eventArg);
|
||||
}
|
||||
private void BtnBuy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var Button = sender as Button;
|
||||
var item = Button.DataContext as Food;
|
||||
//看是什么模式
|
||||
bool EnableFunction = mf.mw.Set.EnableFunction && mf.mw.HashCheck && !item.IsOverLoad()
|
||||
&& item.Price >= 1 && item.Price <= 1000 && item.Health >= 0 && item.Exp >= 0 &&
|
||||
item.Likability >= 0 && item.Price + 1000 < mf.mw.GameSavesData.GameSave.Money;
|
||||
//不吃负面/太贵/太便宜
|
||||
|
||||
if (EnableFunction)//扣钱
|
||||
mf.mw.GameSavesData.GameSave.Money -= item.Price;
|
||||
|
||||
mf.DisplayFoodAnimation(item.GetGraph(), item.ImageSource);
|
||||
|
||||
if (EnableFunction)
|
||||
mf.Main.LabelDisplayShow("{0}花费${3}\n给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName, item.Price));
|
||||
else
|
||||
mf.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName));
|
||||
|
||||
var msg = new MPMessage()
|
||||
{
|
||||
To = mf.friend.Id.Value,
|
||||
Type = (int)MPMessage.MSGType.Feed,
|
||||
};
|
||||
var feed = new Feed()
|
||||
{
|
||||
EnableFunction = EnableFunction,
|
||||
Item = item,
|
||||
};
|
||||
msg.SetContent(feed);
|
||||
mf.wmp.SendMessageALL(msg);
|
||||
|
||||
if (!_puswitch.IsChecked.Value)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
rMoney.Text = mf.mw.Core.Save.Money.ToString("f2");
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSearch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Search();
|
||||
}
|
||||
|
||||
private void BtnTitle_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_searchTextBox.Text = "";
|
||||
Search();
|
||||
}
|
||||
|
||||
private void Search()
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
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)
|
||||
{
|
||||
_searchTextBox = sender as TextBox;
|
||||
}
|
||||
|
||||
private void LsbSortRule_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
int order = LsbSortRule.SelectedIndex;
|
||||
bool asc = LsbSortAsc.SelectedIndex == 0;
|
||||
OrderItemSource((Food.FoodType)LsbCategory.SelectedIndex, order, asc, _searchTextBox?.Text);
|
||||
}
|
||||
|
||||
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Switch_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_puswitch = sender as Switch;
|
||||
_puswitch.IsChecked = mf.mw.Set["betterbuy"].GetBool("noautoclose");
|
||||
_puswitch.Click += Switch_Checked;
|
||||
}
|
||||
|
||||
private void Switch_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Search();
|
||||
TbPage.Text = e.NewValue.ToString();
|
||||
}
|
||||
|
||||
private void rMoney_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rMoney = sender as Run;
|
||||
rMoney.Text = mf.mw.Core.Save.Money.ToString("f2");
|
||||
}
|
||||
private void Button_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((Button)sender).Content = "给更好的{0}买".Translate(mf.friend.Name);
|
||||
}
|
||||
|
||||
private void TbPage_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter
|
||||
&& int.TryParse(TbPage.Text?.Trim(), out int page))
|
||||
{
|
||||
pagination.CurrentPage = Math.Max(0, Math.Min(pagination.MaxPage, page));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -317,11 +317,12 @@ public partial class winMutiPlayer : Window, IMPWindows
|
||||
To.DisplayMessage(MSG.GetContent<Chat>());
|
||||
break;
|
||||
case (int)MSGType.Interact:
|
||||
var byname = lb.Members.First(x => x.Id == From).Name;
|
||||
var interact = MSG.GetContent<Interact>();
|
||||
if (MSG.To == SteamClient.SteamId.Value)
|
||||
{
|
||||
var byname = lb.Members.First(x => x.Id == From).Name;
|
||||
bool isok = !IMPFriend.InConvenience(mw.Main);
|
||||
switch (MSG.GetContent<Interact>())
|
||||
switch (interact)
|
||||
{
|
||||
case Interact.TouchHead:
|
||||
mw.Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, mw.Core.Save.Name));
|
||||
@ -340,6 +341,39 @@ public partial class winMutiPlayer : Window, IMPWindows
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
To = MPFriends.Find(x => x.friend.Id == MSG.To);
|
||||
To.ActiveInteract(byname, interact);
|
||||
}
|
||||
break;
|
||||
case (int)MSGType.Feed:
|
||||
byname = lb.Members.First(x => x.Id == From).Name;
|
||||
var feed = MSG.GetContent<Feed>();
|
||||
if (MSG.To == SteamClient.SteamId.Value)
|
||||
{
|
||||
var item = feed.Item;
|
||||
feed.Item.ImageSource = Dispatcher.Invoke(() => mw.ImageSources.FindImage("food_" + (item.Image ?? item.Name), "food"));
|
||||
mw.DisplayFoodAnimation(feed.Item.GetGraph(), feed.Item.ImageSource);
|
||||
if (feed.EnableFunction)
|
||||
{
|
||||
mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price));
|
||||
//对于要修改数据的物品一定要再次检查,避免联机开挂毁存档
|
||||
if (item.Price >= 10 && item.Price <= 1000 && item.Health >= 0 && item.Exp >= 0 && item.Likability >= 0 && giveprice < 1000)
|
||||
{//单次联机收礼物上限1000
|
||||
giveprice += item.Price;
|
||||
mw.TakeItem(feed.Item);
|
||||
}
|
||||
}
|
||||
else
|
||||
mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName));
|
||||
}
|
||||
else
|
||||
{
|
||||
To = MPFriends.Find(x => x.friend.Id == MSG.To);
|
||||
To.Feed(byname, feed);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -352,7 +386,7 @@ public partial class winMutiPlayer : Window, IMPWindows
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private double giveprice = 0;
|
||||
public event Action<ulong, MPMessage> ReceivedMessage;
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
InitializeComponent();
|
||||
this.mw = mw;
|
||||
//set = mw.Set["pethelp"];
|
||||
//set = mf.Set["pethelp"];
|
||||
x = mw.Set.PetHelpLeft * mw.Width;
|
||||
y = mw.Set.PetHelpTop * mw.Width;
|
||||
Width = 50 * mw.Set.ZoomLevel;
|
||||
|
@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"VPet-Simulator.Windows": {
|
||||
"commandName": "Project",
|
||||
"nativeDebugging": true
|
||||
"nativeDebugging": false
|
||||
}
|
||||
}
|
||||
}
|
@ -107,10 +107,10 @@ namespace VPet_Simulator.Windows
|
||||
break;
|
||||
case Food.FoodType.Star:
|
||||
//List<Food> lf = new List<Food>();
|
||||
//foreach (var sub in mw.Set["betterbuy"].FindAll("star"))
|
||||
//foreach (var sub in mf.Set["betterbuy"].FindAll("star"))
|
||||
//{
|
||||
// var str = sub.Info;
|
||||
// var food = mw.Foods.FirstOrDefault(x => x.Name == str);
|
||||
// var food = mf.Foods.FirstOrDefault(x => x.Name == str);
|
||||
// if (food != null)
|
||||
// lf.Add(food);
|
||||
//}
|
||||
@ -216,7 +216,10 @@ namespace VPet_Simulator.Windows
|
||||
//eventArg.Source = sender;
|
||||
//PageDetail.RaiseEvent(eventArg);
|
||||
}
|
||||
bool showeatanm = true;
|
||||
/// <summary>
|
||||
/// 是否显示吃东西动画
|
||||
/// </summary>
|
||||
public bool showeatanm = true;
|
||||
|
||||
private void BtnBuy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@ -245,16 +248,9 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
mw.TakeItem(item);
|
||||
}
|
||||
if (showeatanm)
|
||||
{//显示动画
|
||||
showeatanm = false;
|
||||
mw.Main.Display(item.GetGraph(), item.ImageSource, () =>
|
||||
{
|
||||
showeatanm = true;
|
||||
mw.Main.DisplayToNomal();
|
||||
mw.Main.EventTimer_Elapsed();
|
||||
});
|
||||
}
|
||||
|
||||
mw.DisplayFoodAnimation(item.GetGraph(), item.ImageSource);
|
||||
|
||||
if (!_puswitch.IsChecked.Value)
|
||||
{
|
||||
TryClose();
|
||||
@ -306,7 +302,7 @@ namespace VPet_Simulator.Windows
|
||||
public void TryClose()
|
||||
{
|
||||
IcCommodity.ItemsSource = null;
|
||||
//mw.Topmost = mw.Set.TopMost;
|
||||
//mf.Topmost = mf.Set.TopMost;
|
||||
Hide();
|
||||
}
|
||||
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
@ -413,7 +409,7 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
private void TbPage_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.Key == Key.Enter
|
||||
if (e.Key == Key.Enter
|
||||
&& int.TryParse(TbPage.Text?.Trim(), out int page))
|
||||
{
|
||||
pagination.CurrentPage = Math.Max(0, Math.Min(pagination.MaxPage, page));
|
||||
|
@ -162,12 +162,12 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
private void Button_MoveToUp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//mw.Core.Graph.GraphConfig.Moves[8].Display(mw.Main);
|
||||
//mf.Core.Graph.GraphConfig.Moves[8].Display(mf.Main);
|
||||
}
|
||||
|
||||
private void Button_MoveToButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//mw.Core.Graph.GraphConfig.Moves[8].Display(mw.Main);
|
||||
//mf.Core.Graph.GraphConfig.Moves[8].Display(mf.Main);
|
||||
}
|
||||
|
||||
private void Button_MoveToRight_Click(object sender, RoutedEventArgs e)
|
||||
|
@ -213,7 +213,7 @@ namespace VPet_Simulator.Windows
|
||||
case "LB":
|
||||
RBCGPTUseLB.IsChecked = true;
|
||||
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
||||
//if (!mw.IsSteamUser)
|
||||
//if (!mf.IsSteamUser)
|
||||
// BtnCGPTReSet.IsEnabled = false;
|
||||
break;
|
||||
case "OFF":
|
||||
@ -950,7 +950,7 @@ namespace VPet_Simulator.Windows
|
||||
return;
|
||||
//else
|
||||
//{
|
||||
// mw.Set["SingleTips"][(gint)"open"] = 1;
|
||||
// mf.Set["SingleTips"][(gint)"open"] = 1;
|
||||
// MessageBoxX.Show("游戏开机启动的实现方式是创建快捷方式,不是注册表,更健康,所以游戏卸了也不知道\n如果游戏打不开,可以去这里手动删除游戏开机启动快捷方式:\n%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\".Translate()
|
||||
// , "关于卸载不掉的问题是因为开启了开机启动".Translate(), MessageBoxIcon.Info);
|
||||
//}
|
||||
@ -1079,7 +1079,7 @@ namespace VPet_Simulator.Windows
|
||||
switch (mw.Set["CGPT"][(gstr)"type"])
|
||||
{
|
||||
//case "API":
|
||||
// new winCGPTSetting(mw).ShowDialog();
|
||||
// new winCGPTSetting(mf).ShowDialog();
|
||||
// break;
|
||||
case "DIY":
|
||||
if (mw.TalkBoxCurr != null)
|
||||
@ -1090,13 +1090,13 @@ namespace VPet_Simulator.Windows
|
||||
case "LB":
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// if (((TalkBox)mw.TalkBox).ChatGPT_Reset())
|
||||
// if (((TalkBox)mf.TalkBox).ChatGPT_Reset())
|
||||
// {
|
||||
// ((TalkBox)mw.TalkBox).btn_startup.Visibility = Visibility.Visible;
|
||||
// ((TalkBox)mf.TalkBox).btn_startup.Visibility = Visibility.Visible;
|
||||
// MessageBoxX.Show("桌宠重置成功".Translate());
|
||||
// }
|
||||
//});
|
||||
//((TalkSelect)mw.TalkBox).RelsTime
|
||||
//((TalkSelect)mf.TalkBox).RelsTime
|
||||
break;
|
||||
case "OFF":
|
||||
default:
|
||||
@ -1118,7 +1118,7 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
//else if (RBCGPTUseAPI.IsChecked == true)
|
||||
//{
|
||||
// mw.Set["CGPT"][(gstr)"type"] = "API";
|
||||
// mf.Set["CGPT"][(gstr)"type"] = "API";
|
||||
//}
|
||||
else
|
||||
{
|
||||
@ -1131,10 +1131,10 @@ namespace VPet_Simulator.Windows
|
||||
//case "API":
|
||||
// BtnCGPTReSet.IsEnabled = true;
|
||||
// BtnCGPTReSet.Content = "打开 ChatGPT API 设置".Translate();
|
||||
// if (mw.TalkBox != null)
|
||||
// mw.Main.ToolBar.MainGrid.Children.Remove(mw.TalkBox);
|
||||
// mw.TalkBox = new TalkBoxAPI(mw);
|
||||
// mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
||||
// if (mf.TalkBox != null)
|
||||
// mf.Main.ToolBar.MainGrid.Children.Remove(mf.TalkBox);
|
||||
// mf.TalkBox = new TalkBoxAPI(mf);
|
||||
// mf.Main.ToolBar.MainGrid.Children.Add(mf.TalkBox);
|
||||
// break;
|
||||
case "DIY":
|
||||
BtnCGPTReSet.IsEnabled = true;
|
||||
|
Loading…
Reference in New Issue
Block a user