更新LinePutScript版本

This commit is contained in:
ZouJin 2023-05-10 09:16:58 +10:00
parent 2ee5eacc55
commit 15f51fc439
20 changed files with 71 additions and 60 deletions

View File

@ -62,7 +62,7 @@ namespace VPet_Simulator.Core
}
var ig = Core.Graph.FindGraph(GraphCore.GraphType.StartUP, core.Save.Mode);
//var ig2 = Core.Graph.FindGraph(GraphCore.GraphType.Default, core.Save.Mode);
//var ig2 = Core.Graph.FindGraph(GraphCore.GraphType.Default, core.GameSave.Mode);
PetGrid2.Visibility = Visibility.Collapsed;
ig.WaitForReadyRun(PetGrid, () =>

View File

@ -75,9 +75,9 @@ namespace VPet_Simulator.Core
{
Core.Save.Health -= Function.Rnd.Next(0, 1);
}
//if (Core.Save.Strength <= 40)
//if (Core.GameSave.Strength <= 40)
//{
// Core.Save.Health -= Function.Rnd.Next(0, 1);
// Core.GameSave.Health -= Function.Rnd.Next(0, 1);
//}
Core.Save.StrengthChangeFood(-1);
if (Core.Save.Feeling >= 75)
@ -109,8 +109,8 @@ namespace VPet_Simulator.Core
}
else
{
Core.Save.Mode = Save.ModeType.Happy;
//Core.Save.Mode = Save.ModeType.Ill;
Core.Save.Mode = GameSave.ModeType.Happy;
//Core.GameSave.Mode = GameSave.ModeType.Ill;
}
//UIHandle

View File

@ -53,7 +53,7 @@ namespace VPet_Simulator.Core
tMoney.Text = "$ " + m.Core.Save.Money.ToString("N2");
if (m.Core.Controller.EnableFunction)
{
till.Visibility = m.Core.Save.Mode == Save.ModeType.Ill ? Visibility.Visible : Visibility.Collapsed;
till.Visibility = m.Core.Save.Mode == GameSave.ModeType.Ill ? Visibility.Visible : Visibility.Collapsed;
tfun.Visibility = Visibility.Collapsed;
}
else

View File

@ -316,7 +316,7 @@ namespace VPet_Simulator.Core
/// <param name="modetype">状态类型</param>
/// <param name="graphtype">动画类型</param>
///// <param name="storemem">是否储存到内存以节约加载</param>
public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype)//, bool storemem = false)
public void AddGraph(string path, GameSave.ModeType modetype, GraphType graphtype)//, bool storemem = false)
{
var paths = new DirectoryInfo(path).GetFiles();
if (paths.Length == 0)
@ -338,7 +338,7 @@ namespace VPet_Simulator.Core
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
/// <param name="storernd">是否储存随机数字典</param>
/// <returns></returns>
public IGraph FindGraph(GraphType type, Save.ModeType mode, bool storernd = false)
public IGraph FindGraph(GraphType type, GameSave.ModeType mode, bool storernd = false)
{
if (Graphs.ContainsKey(type))
{
@ -359,9 +359,9 @@ namespace VPet_Simulator.Core
return list[index];
}
}
if (mode != Save.ModeType.Ill)
if (mode != GameSave.ModeType.Ill)
{
list = Graphs[type].FindAll(x => x.ModeType != Save.ModeType.Ill);
list = Graphs[type].FindAll(x => x.ModeType != GameSave.ModeType.Ill);
if (list.Count > 0)
return list[Function.Rnd.Next(list.Count)];
}

View File

@ -41,7 +41,7 @@ namespace VPet_Simulator.Core
/// <summary>
/// 该动画模式
/// </summary>
Save.ModeType ModeType { get; }
GameSave.ModeType ModeType { get; }
/// <summary>
/// 该动画类型
/// </summary>

View File

@ -51,7 +51,7 @@ namespace VPet_Simulator.Core
/// </summary>
public bool IsContinue { get; set; } = false;
public Save.ModeType ModeType { get; private set; }
public GameSave.ModeType ModeType { get; private set; }
public GraphCore.GraphType GraphType { get; private set; }
/// <summary>
@ -74,7 +74,7 @@ namespace VPet_Simulator.Core
/// <param name="path">文件夹位置</param>
/// <param name="paths">文件内容列表</param>
/// <param name="isLoop">是否循环</param>
public PNGAnimation(GraphCore graphCore, string path, FileInfo[] paths, Save.ModeType modetype, GraphCore.GraphType graphtype, bool isLoop = false)
public PNGAnimation(GraphCore graphCore, string path, FileInfo[] paths, GameSave.ModeType modetype, GraphCore.GraphType graphtype, bool isLoop = false)
{
Animations = new List<Animation>();
IsLoop = isLoop;

View File

@ -21,7 +21,7 @@ namespace VPet_Simulator.Core
/// 新建新静态图像
/// </summary>
/// <param name="path">图片路径</param>
public Picture(GraphCore graphCore, string path, Save.ModeType modetype, GraphCore.GraphType graphType, int length = 1000, bool isloop = false)
public Picture(GraphCore graphCore, string path, GameSave.ModeType modetype, GraphCore.GraphType graphType, int length = 1000, bool isloop = false)
{
ModeType = modetype;
IsLoop = isloop;
@ -41,7 +41,7 @@ namespace VPet_Simulator.Core
/// 图片资源
/// </summary>
public string Path;
public Save.ModeType ModeType { get; private set; }
public GameSave.ModeType ModeType { get; private set; }
private GraphCore GraphCore;
public bool PlayState { get; set; }
public bool IsLoop { get; set; }

View File

@ -27,7 +27,7 @@ namespace VPet_Simulator.Core
/// <summary>
/// 游戏数据
/// </summary>
public Save Save;
public GameSave Save;
}
/// <summary>
/// 触摸范围事件

View File

@ -1,4 +1,5 @@
using LinePutScript;
using LinePutScript.Converter;
using System;
using System.Collections.Generic;
using System.Linq;
@ -11,21 +12,22 @@ namespace VPet_Simulator.Core
/// <summary>
/// 游戏存档
/// </summary>
public class Save
public class GameSave
{
/// <summary>
/// 宠物名字
/// </summary>
[Line(name:"name")]
public string Name;
/// <summary>
/// 金钱
/// </summary>
public double Money;
[Line(Type = LPSConvert.ConvertType.ToFloat, Name ="money")] public double Money;
/// <summary>
/// 经验值
/// </summary>
public int Exp;
[Line(name:"exp")] public int Exp;
/// <summary>
/// 等级
/// </summary>
@ -41,7 +43,7 @@ namespace VPet_Simulator.Core
/// 体力 0-100
/// </summary>
public double Strength { get => strength; set => strength = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strength;
/// <summary>
/// 变化 体力
@ -56,7 +58,7 @@ namespace VPet_Simulator.Core
/// 饱腹度
/// </summary>
public double StrengthFood { get => strengthFood; set => strengthFood = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strengthFood;
public void StrengthChangeFood(double value)
{
@ -72,6 +74,7 @@ namespace VPet_Simulator.Core
/// </summary>
public double StrengthDrink { get => strengthDrink; set => strengthDrink = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strengthDrink;
/// <summary>
/// 变化 口渴度
@ -87,6 +90,7 @@ namespace VPet_Simulator.Core
/// </summary>
public double Feeling { get => feeling; set => feeling = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double feeling;
/// <summary>
/// 变化 心情
@ -102,12 +106,14 @@ namespace VPet_Simulator.Core
/// </summary>
public double Health { get => health; set => health = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double health;
/// <summary>
/// 好感度(隐藏)(累加值)
/// </summary>
public double Likability { get => likability; set => likability = Math.Min(90 + Level * 10, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double likability;
/// <summary>
@ -144,6 +150,7 @@ namespace VPet_Simulator.Core
/// </summary>
Ill
}
[Line(name:"mode")]
public ModeType Mode = ModeType.Nomal;
/// <summary>
/// 计算宠物当前状态
@ -177,7 +184,7 @@ namespace VPet_Simulator.Core
/// <summary>
/// 新游戏
/// </summary>
public Save(string name)
public GameSave(string name)
{
Name = name;
Money = 100;
@ -193,35 +200,39 @@ namespace VPet_Simulator.Core
/// <summary>
/// 读档
/// </summary>
public Save(Line line)
public GameSave()
{
Money = line.GetFloat("money");
Name = line.Info;
Exp = line.GetInt("exp");
Strength = line.GetFloat("strength");
StrengthDrink = line.GetFloat("strengthdrink");
StrengthFood = line.GetFloat("strengthfood");
Feeling = line.GetFloat("feeling");
Health = line.GetFloat("health");
Likability = line.GetFloat("likability");
Mode = CalMode();
//Money = line.GetFloat("money");
//Name = line.Info;
//Exp = line.GetInt("exp");
//Strength = line.GetFloat("strength");
//StrengthDrink = line.GetFloat("strengthdrink");
//StrengthFood = line.GetFloat("strengthfood");
//Feeling = line.GetFloat("feeling");
//Health = line.GetFloat("health");
//Likability = line.GetFloat("likability");
//Mode = CalMode();
}
/// <summary>
/// 读档
/// </summary>
public static GameSave Load(ILine data) => LPSConvert.DeserializeObject<GameSave>(data);
/// <summary>
/// 存档
/// </summary>
/// <returns>存档行</returns>
public Line ToLine()
{
Line save = new Line("vpet", Name);
save.SetFloat("money", Money);
save.SetInt("exp", Exp);
save.SetFloat("strength", Strength);
save.SetFloat("strengthdrink", StrengthDrink);
save.SetFloat("strengthfood", StrengthFood);
save.SetFloat("feeling", Feeling);
save.SetFloat("health", Health);
save.SetFloat("Likability", Likability);
return save;
//Line save = new Line("vpet", Name);
//save.SetFloat("money", Money);
//save.SetInt("exp", Exp);
//save.SetFloat("strength", Strength);
//save.SetFloat("strengthdrink", StrengthDrink);
//save.SetFloat("strengthfood", StrengthFood);
//save.SetFloat("feeling", Feeling);
//save.SetFloat("health", Health);
//save.SetFloat("Likability", Likability);
return LPSConvert.SerializeObject(this,"vpet");
}
/// <summary>
/// 当前正在的状态

View File

@ -60,23 +60,23 @@ namespace VPet_Simulator.Core
{
if (path_name.Contains("happy"))
{
graph.AddGraph(di.FullName, Save.ModeType.Happy, (GraphType)i);
graph.AddGraph(di.FullName, GameSave.ModeType.Happy, (GraphType)i);
}
if (path_name.Contains("nomal"))
{
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i);
graph.AddGraph(di.FullName, GameSave.ModeType.Nomal, (GraphType)i);
}
if (path_name.Contains("poorcondition"))
{
graph.AddGraph(di.FullName, Save.ModeType.PoorCondition, (GraphType)i);
graph.AddGraph(di.FullName, GameSave.ModeType.PoorCondition, (GraphType)i);
}
if (path_name.Contains("ill"))
{
graph.AddGraph(di.FullName, Save.ModeType.Ill, (GraphType)i);
graph.AddGraph(di.FullName, GameSave.ModeType.Ill, (GraphType)i);
}
else
{
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i);
graph.AddGraph(di.FullName, GameSave.ModeType.Nomal, (GraphType)i);
}
return;
}

View File

@ -74,7 +74,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\VUPSimulator\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\VUPSimulator\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
@ -156,7 +156,7 @@
<Compile Include="Handle\GameCore.cs" />
<Compile Include="Handle\IController.cs" />
<Compile Include="Handle\PetLoader.cs" />
<Compile Include="Handle\Save.cs" />
<Compile Include="Handle\GameSave.cs" />
<Compile Include="Item\Drink.cs" />
<Compile Include="Item\Food.cs" />
<Compile Include="Item\Item.cs" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.6.1" targetFramework="net462" />
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.9.4" targetFramework="net462" />
</packages>

View File

@ -48,7 +48,7 @@ namespace VPet_Simulator.Windows.Interface
public virtual void EndGame() { }
/// <summary>
/// 储存游戏 (可以写 Save.Other 储存设置和数据等)
/// 储存游戏 (可以写 GameSave.Other 储存设置和数据等)
/// </summary>
public virtual void Save() { }

View File

@ -89,7 +89,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.6.1" targetFramework="net462" />
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.9.4" targetFramework="net462" />
</packages>

View File

@ -194,9 +194,9 @@ namespace VPet_Simulator.Windows
//加载游戏内容
Core.Controller = new MWController(this);
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
Core.Save = new Save(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First());
Core.Save = GameSave.Load(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First());
else
Core.Save = new Save("萝莉斯");
Core.Save = new GameSave("萝莉斯");
AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed;

View File

@ -82,7 +82,7 @@
<HintPath>..\packages\ChatGPT.API.Framework.1.0.3\lib\net462\ChatGPT.API.Framework.dll</HintPath>
</Reference>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.6.1\lib\net48\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.0\lib\net48\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>

View File

@ -218,7 +218,7 @@ namespace VPet_Simulator.Windows
btn_startup.Content = "初始化桌宠聊天程序中...";
var sid = Steamworks.SteamClient.SteamId.Value;
var cont = $"请使用口语化的、可爱的、女性化的、调皮的语言风格和我交流\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>";
//太长了记不住+太贵var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题请直接给出回答不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
//太长了记不住+太贵var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.GameSave.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题请直接给出回答不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
Task.Run(() =>
{
if (OPENAI(sid, cont))

View File

@ -58,7 +58,7 @@ namespace VPet_Simulator.Windows
if (GraphListBox.SelectedItem == null)
return;
var graph = mw.Main.Core.Graph.FindGraph((GraphType)Enum.Parse(typeof(GraphType), (string)GraphListBox.SelectedItem),
(Save.ModeType)Enum.Parse(typeof(Save.ModeType), (string)(((ComboBoxItem)ComboxMode.SelectedItem).Content)));
(GameSave.ModeType)Enum.Parse(typeof(GameSave.ModeType), (string)(((ComboBoxItem)ComboxMode.SelectedItem).Content)));
if (graph == null)
{
LabelNowPlay.Content = "未找到对应类型图像资源";

View File

@ -3,7 +3,7 @@
<package id="ChatGPT.API.Framework" version="1.0.3" targetFramework="net48" />
<package id="Facepunch.Steamworks" version="2.3.3" targetFramework="net48" />
<package id="Facepunch.Steamworks.win32" version="2.3.3" targetFramework="net48" />
<package id="LinePutScript" version="1.6.1" targetFramework="net48" />
<package id="LinePutScript" version="1.8.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net48" />
<package id="Panuon.WPF.UI" version="1.1.9.4" targetFramework="net48" />