Skip to content

Commit

Permalink
修复bug&更好买描述
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisYounger committed Jun 8, 2023
1 parent c451f83 commit 18d837b
Show file tree
Hide file tree
Showing 66 changed files with 133 additions and 90 deletions.
4 changes: 2 additions & 2 deletions VPet-Simulator.Core/Display/MainLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public void SayRnd(string text)
/// 说话
/// </summary>
/// <param name="text">说话内容</param>
public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining)
public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining, bool force = false)
{
Task.Run(() =>
{
OnSay?.Invoke(text);
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
if (force || type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
{
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
Expand Down
30 changes: 21 additions & 9 deletions VPet-Simulator.Core/Display/ToolBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,22 @@ private void M_TimeUIHandle(Main m)
pFeeling.Value = m.Core.Save.Feeling;
pStrengthFood.Value = m.Core.Save.StrengthFood;
pStrengthDrink.Value = m.Core.Save.StrengthDrink;
tStrength.Text = $"{m.Core.Save.ChangeStrength:f1}/t";
tFeeling.Text = $"{m.Core.Save.ChangeFeeling:f1}/t";
tStrengthDrink.Text = $"{m.Core.Save.ChangeStrengthDrink:f1}/t";
tStrengthFood.Text = $"{m.Core.Save.ChangeStrengthFood:f1}/t";
if (m.Core.Save.ChangeStrength < 1)
tStrength.Text = $"{m.Core.Save.ChangeStrength:f1}/t";
else
tStrength.Text = $"{m.Core.Save.ChangeStrength:f2}/t";
if (m.Core.Save.ChangeFeeling < 1)
tFeeling.Text = $"{m.Core.Save.ChangeFeeling:f1}/t";
else
tFeeling.Text = $"{m.Core.Save.ChangeFeeling:f2}/t";
if (m.Core.Save.ChangeStrengthDrink < 1)
tStrengthDrink.Text = $"{m.Core.Save.ChangeStrengthDrink:f1}/t";
else
tStrengthDrink.Text = $"{m.Core.Save.ChangeStrengthDrink:f2}/t";
if (m.Core.Save.ChangeStrengthFood < 1)
tStrengthFood.Text = $"{m.Core.Save.ChangeStrengthFood:f1}/t";
else
tStrengthFood.Text = $"{m.Core.Save.ChangeStrengthFood:f2}/t";
}
}

Expand Down Expand Up @@ -178,33 +190,33 @@ public void AddMenuButton(MenuType parentMenu,

private void PgbExperience_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value} / {pExp.Maximum}";
e.Text = $"{e.Value:f2} / {pExp.Maximum:f0}";
}

private void PgbStrength_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value} / 100";
e.Text = $"{e.Value:f2} / 100";
}

private void PgbSpirit_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
e.Text = $"{e.Value:f2} / 100";
}

private void PgbHunger_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
e.Text = $"{e.Value:f2} / 100";
}

private void PgbThirsty_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
e.Text = $"{e.Value:f2} / 100";
//if (e.Value <= 20)
//{
// tHearth.Visibility = Visibility.Visible;
Expand Down
14 changes: 10 additions & 4 deletions VPet-Simulator.Core/Display/WorkTimer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ private void M_TimeUIHandle(Main m)
{
case Main.WorkingState.Study:
m.Core.Save.Money += GetCount * 0.2;
Stop(() => m.Say($"学习完成啦, 累计学会了 {(GetCount * 1.2):f2} EXP\n共计花费了{MaxTime}分钟"));
Stop(() => m.Say($"学习完成啦, 累计学会了 {(GetCount * 1.2):f2} 经验值\n共计花费了{MaxTime}分钟"
, GraphCore.Helper.SayType.Shining, true));
break;
case Main.WorkingState.WorkONE:
m.Core.Save.Money += GetCount * 0.15;
Stop(() => m.Say($"{m.Core.Graph.GraphConfig.Str[(gstr)"work1"]}完成啦, 累计赚了 {GetCount * 1.15:f2} 金钱\n共计花费了{MaxTime}分钟"));
Stop(() => m.Say($"{m.Core.Graph.GraphConfig.Str[(gstr)"work1"]}完成啦, 累计赚了 {GetCount * 1.15:f2} 金钱\n共计花费了{MaxTime}分钟"
, GraphCore.Helper.SayType.Shining, true));
break;
case Main.WorkingState.WorkTWO:
m.Core.Save.Money += GetCount * 0.25;
Stop(() => m.Say($"{m.Core.Graph.GraphConfig.Str[(gstr)"work2"]}完成啦, 累计赚了 {GetCount * 1.25:f2} 金钱\n共计花费了{MaxTime}分钟"));
Stop(() => m.Say($"{m.Core.Graph.GraphConfig.Str[(gstr)"work2"]}完成啦, 累计赚了 {GetCount * 1.25:f2} 金钱\n共计花费了{MaxTime}分钟"
, GraphCore.Helper.SayType.Shining, true));
break;
}

Expand Down Expand Up @@ -222,7 +225,10 @@ public void Stop(Action @then = null)
m.Display(GraphCore.GraphType.WorkTWO_C_End, then ?? m.DisplayNomal);
break;
default:
then?.Invoke();
if (then == null)
m.DisplayNomal();
else
then();
return;
}
}
Expand Down
21 changes: 19 additions & 2 deletions VPet-Simulator.Windows.Interface/Food.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,32 @@ public enum FoodType
/// </summary>
[Line(ignoreCase: true)]
public string Desc { get; set; }
private string desc = null;
/// <summary>
/// 描述(ToBetterBuy)
/// </summary>
public string Description
{
get
{
StringBuilder sb = new StringBuilder(Desc);
return sb.ToString();
if(desc == null)
{
StringBuilder sb = new StringBuilder();
if (Exp != 0)
sb.Append("经验值:\t").Append(Exp > 0 ? "+" : "").Append(Exp.ToString("f2")).AppendLine();
if (StrengthFood != 0) sb.Append("饱腹度:\t").Append(StrengthFood > 0 ? "+" : "").Append(StrengthFood.ToString("f2")).Append("\t\t");
if (StrengthDrink != 0) sb.Append("口渴度:\t").Append(StrengthDrink > 0 ? "+" : "").Append(StrengthDrink.ToString("f2")).AppendLine();
if (Strength != 0) sb.Append("体力:\t").Append(Strength > 0 ? "+" : "").Append(Strength.ToString("f2")).Append("\t\t");
if (Feeling != 0)
sb.Append("心情:\t").Append(Feeling > 0 ? "+" : "").Append(Feeling.ToString("f2")).AppendLine();
if (Health != 0)
sb.Append("健康:\t").Append(Health > 0 ? "+" : "").Append(Health.ToString("f2")).Append("\t\t");
if (Likability != 0)
sb.Append("好感度:\t").Append(Likability > 0 ? "+" : "").Append(Likability.ToString("f2"));
sb.AppendLine().Append(Desc);
desc = sb.ToString();
}
return desc;
}
}
/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</StackPanel>
</Border>-->
<Button Grid.Row="4" Margin="0,7,0,0" Padding="7,5" Cursor="Hand"
HorizontalAlignment="Left" pu:ButtonHelper.Icon="&#xEF61;"
HorizontalAlignment="Left" pu:ButtonHelper.Icon="&#xF11A;"
Style="{DynamicResource ThemedButtonStyle}" Content="购买" Click="BtnBuy_Click" />
</Grid>
</Grid>
Expand All @@ -123,6 +123,7 @@
Foreground="{DynamicResource DARKPrimaryText}" Text="{Binding Name}" />
<ScrollViewer Grid.Row="1" Grid.RowSpan="4" Margin="0,7,0,0"
pu:ScrollBarHelper.ThumbBackground="#44FFFFFF"
PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
pu:ScrollBarHelper.HoverThumbBackground="#88FFFFFF">
<TextBlock TextWrapping="Wrap" Background="Transparent" FontSize="12" Padding="0"
Foreground="{DynamicResource DARKPrimaryText}" Text="{Binding Description}" />
Expand Down Expand Up @@ -228,7 +229,7 @@
</Border>
</Grid>
<Grid Margin="10" Grid.Column="1">
<ScrollViewer>
<ScrollViewer x:Name="PageDetail">
<ItemsControl x:Name="IcCommodity" VerticalAlignment="Top">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
Expand Down
8 changes: 7 additions & 1 deletion VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ public void OrderItemSource(Food.FoodType type, int sortrule, bool sortasc, stri
// 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)
{

Expand Down
15 changes: 8 additions & 7 deletions VPet-Simulator.Windows/WinDesign/winGameSetting.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent" BoxWidth="35"
BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
ToggleBrush="{DynamicResource PrimaryDark}" Content="退出位置"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" ToolTip="该游戏随着开机启动该程序"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" ToolTip="游戏退出位置为下次桌宠启动出现的位置"
Unchecked="StartPlace_Checked" VerticalAlignment="Center" Checked="StartPlace_Checked" />
<TextBox x:Name="TextBoxStartUpX" Grid.Column="1" Style="{DynamicResource StandardTextBoxStyle}"
ToolTip="X轴" pu:TextBoxHelper.Icon="X" FontSize="16" Margin="0,0,5,0"
Expand Down Expand Up @@ -573,10 +573,10 @@
<TabItem Header="关于" BorderBrush="{DynamicResource PrimaryDarker}"
Foreground="{DynamicResource PrimaryText}">
<Grid>
<Image x:Name="ImageWHY" Width="64" HorizontalAlignment="Right" VerticalAlignment="Center"
Height="64" Source="/Res/TopLogo2019.PNG" Margin="0,210,55,0" />
<TextBlock Margin="0,0,0,0" Text="虚拟主播模拟器 规格" FontSize="20" FontWeight="Bold" />
<TextBlock Margin="0,130,0,0" FontWeight="Bold">
<Image x:Name="ImageWHY" Width="64" HorizontalAlignment="Right" VerticalAlignment="Top" Height="64" Source="/Res/TopLogo2019.PNG" Margin="0,325,55,0" />
<TextBlock Margin="0,0,0,0" Text="虚拟主播模拟器 规格" FontSize="20" FontWeight="Bold"
VerticalAlignment="Top" />
<TextBlock Margin="0,130,0,0" FontWeight="Bold" VerticalAlignment="Top">
<Run>游戏策划</Run><LineBreak />
<Run>UI&amp;程序</Run><LineBreak />
<Run>动画绘制</Run><LineBreak />
Expand All @@ -595,7 +595,7 @@
Click="Group_Click" FontWeight="Normal">相关群</Hyperlink>

</TextBlock>
<TextBlock Margin="0,30,0,0" FontWeight="Bold">
<TextBlock Margin="0,30,0,0" FontWeight="Bold" VerticalAlignment="Top">
<Run>用户名</Run><LineBreak />
<Run>版本</Run><LineBreak />
<Run>激活</Run><LineBreak />
Expand All @@ -605,7 +605,8 @@
<Run x:Name="runabVer">v1.0 (100)</Run><LineBreak />
<Run x:Name="runActivate">已通过Steam[uid]激活服务注册</Run><LineBreak />
</TextBlock>
<TextBlock Margin="0,100,0,0" Text="制作组名单" FontSize="20" FontWeight="Bold" />
<TextBlock Margin="0,100,0,0" Text="制作组名单" FontSize="20" FontWeight="Bold"
HorizontalAlignment="Left" VerticalAlignment="Top" />
<TextBlock Margin="100,130,0,0" VerticalAlignment="Top" TextWrapping="WrapWithOverflow">
<Run>杨远洛里斯, 广大MOD作者</Run><LineBreak />
<Run>洛里斯杨远, トニーちゃん</Run> <Hyperlink Click="Git_Click">Git贡献名单</Hyperlink><LineBreak />
Expand Down
Loading

0 comments on commit 18d837b

Please sign in to comment.