2023-06-03 21:51:58 +00:00
|
|
|
|
using LinePutScript.Converter;
|
2023-06-08 08:46:53 +00:00
|
|
|
|
using Panuon.WPF;
|
2023-06-03 21:51:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-06-08 08:46:53 +00:00
|
|
|
|
using System.Windows.Media;
|
2023-06-03 21:51:58 +00:00
|
|
|
|
using VPet_Simulator.Core;
|
2023-06-08 08:46:53 +00:00
|
|
|
|
using static LinePutScript.Converter.LPSConvert;
|
2023-06-03 21:51:58 +00:00
|
|
|
|
|
|
|
|
|
namespace VPet_Simulator.Windows.Interface
|
|
|
|
|
{
|
2023-06-08 08:46:53 +00:00
|
|
|
|
public class Food : NotifyPropertyChangedBase, IFood
|
2023-06-03 21:51:58 +00:00
|
|
|
|
{
|
2023-06-08 08:46:53 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 食物类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public enum FoodType
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 食物 (默认)
|
|
|
|
|
/// </summary>
|
|
|
|
|
Food,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 收藏 (自定义)
|
|
|
|
|
/// </summary>
|
|
|
|
|
Star,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 正餐
|
|
|
|
|
/// </summary>
|
|
|
|
|
Meal,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 零食
|
|
|
|
|
/// </summary>
|
|
|
|
|
Snack,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 饮料
|
|
|
|
|
/// </summary>
|
|
|
|
|
Drink,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 功能性
|
|
|
|
|
/// </summary>
|
|
|
|
|
Functional,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 药品
|
|
|
|
|
/// </summary>
|
|
|
|
|
Drug,
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 食物类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Line(type: ConvertType.ToEnum, ignoreCase: true)]
|
|
|
|
|
public FoodType Type { get; set; } = FoodType.Food;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 食物名字
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Line(name: "name")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public int Exp { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double Strength { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double StrengthFood { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double StrengthDrink { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double Feeling { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double Health { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double Likability { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 食物价格
|
|
|
|
|
/// </summary>
|
2023-06-08 08:46:53 +00:00
|
|
|
|
[Line(ignoreCase: true)]
|
2023-06-03 21:51:58 +00:00
|
|
|
|
public double Price { get; set; }
|
2023-06-08 08:46:53 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 描述
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Line(ignoreCase: true)]
|
|
|
|
|
public string Desc { get; set; }
|
2023-06-08 21:06:46 +00:00
|
|
|
|
private string desc = null;
|
2023-06-08 08:46:53 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 描述(ToBetterBuy)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Description
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2023-06-08 21:06:46 +00:00
|
|
|
|
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;
|
2023-06-08 08:46:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示的图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ImageSource ImageSource { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否已收藏
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Star { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物品图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Line(ignoreCase: true)]
|
|
|
|
|
public string Image;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载物品图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void LoadImageSource(IMainWindow imw)
|
|
|
|
|
{
|
|
|
|
|
ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food");
|
|
|
|
|
Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name);
|
|
|
|
|
}
|
2023-06-03 21:51:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|