2023-10-25 15:57:18 +00:00
|
|
|
|
using LinePutScript.Localization.WPF;
|
|
|
|
|
using Panuon.WPF.UI;
|
|
|
|
|
using System.Collections.Generic;
|
2023-01-08 02:59:54 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
namespace VPet_Simulator.Windows
|
2023-01-08 02:59:54 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// winCharacterPanel.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class winCharacterPanel : WindowX
|
|
|
|
|
{
|
2023-10-25 15:57:18 +00:00
|
|
|
|
MainWindow mw;
|
|
|
|
|
public winCharacterPanel(MainWindow mw)
|
2023-01-08 02:59:54 +00:00
|
|
|
|
{
|
2023-10-25 15:57:18 +00:00
|
|
|
|
this.mw = mw;
|
2023-01-08 02:59:54 +00:00
|
|
|
|
InitializeComponent();
|
2023-10-25 15:57:18 +00:00
|
|
|
|
|
|
|
|
|
foreach (var v in mw.GameSavesData.Statistics.Data)
|
|
|
|
|
{
|
|
|
|
|
Statlists.Add(new Statlist(v.Key, v.Value));
|
|
|
|
|
}
|
|
|
|
|
DataGridStatic.DataContext = Statlists;
|
|
|
|
|
}
|
|
|
|
|
private List<Statlist> Statlists { get; set; } = new List<Statlist>();
|
|
|
|
|
private class Statlist
|
|
|
|
|
{
|
|
|
|
|
public Statlist(string statid, string statcount)
|
|
|
|
|
{
|
|
|
|
|
this.statid = statid;
|
|
|
|
|
this.statcount = statcount;
|
|
|
|
|
if (statid.StartsWith("buy_"))
|
|
|
|
|
{
|
|
|
|
|
statname = "购买次数".Translate() + statid.Substring(3);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
statname = statid.Translate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string statid { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计显示名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string statname { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计内容
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string statcount { get; set; }
|
2023-01-08 02:59:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbExperience_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Text = $"{e.Value * 10} / {100 * 10}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbStrength_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Text = $"{e.Value} / 100";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbSpirit_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var progressBar = (ProgressBar)sender;
|
|
|
|
|
progressBar.Foreground = GetForeground(e.Value);
|
|
|
|
|
progressBar.BorderBrush = GetForeground(e.Value);
|
|
|
|
|
e.Text = $"{e.Value} / 100";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbHunger_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var progressBar = (ProgressBar)sender;
|
|
|
|
|
progressBar.Foreground = GetForeground(e.Value);
|
|
|
|
|
progressBar.BorderBrush = GetForeground(e.Value);
|
|
|
|
|
e.Text = $"{e.Value} / 100";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbThirsty_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var progressBar = (ProgressBar)sender;
|
|
|
|
|
progressBar.Foreground = GetForeground(e.Value);
|
|
|
|
|
progressBar.BorderBrush = GetForeground(e.Value);
|
|
|
|
|
e.Text = $"{e.Value} / 100";
|
2023-10-25 15:57:18 +00:00
|
|
|
|
if (e.Value <= 20)
|
2023-01-08 02:59:54 +00:00
|
|
|
|
{
|
|
|
|
|
txtHearth.Visibility = Visibility.Visible;
|
|
|
|
|
stkHearth.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PgbHearth_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Text = $"{e.Value} / 100";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Brush GetForeground(double value)
|
|
|
|
|
{
|
2023-10-25 15:57:18 +00:00
|
|
|
|
if (value >= 80)
|
2023-01-08 02:59:54 +00:00
|
|
|
|
{
|
|
|
|
|
return FindResource("SuccessProgressBarForeground") as Brush;
|
|
|
|
|
}
|
2023-10-25 15:57:18 +00:00
|
|
|
|
else if (value >= 50)
|
2023-01-08 02:59:54 +00:00
|
|
|
|
{
|
|
|
|
|
return FindResource("WarningProgressBarForeground") as Brush;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return FindResource("DangerProgressBarForeground") as Brush;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|