mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修复动画显示相关bug
This commit is contained in:
parent
76461367b2
commit
82781cde1c
@ -206,7 +206,7 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
else if (Core.Save.StrengthFood <= 25)
|
||||
{
|
||||
Core.Save.Health -= Function.Rnd.Next() * TimePass;
|
||||
Core.Save.Health -= Function.Rnd.NextDouble() * TimePass;
|
||||
addhealth -= 2;
|
||||
}
|
||||
if (Core.Save.StrengthDrink >= 50)
|
||||
@ -218,7 +218,7 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
else if (Core.Save.StrengthDrink <= 25)
|
||||
{
|
||||
Core.Save.Health -= Function.Rnd.Next() * TimePass;
|
||||
Core.Save.Health -= Function.Rnd.NextDouble() * TimePass;
|
||||
addhealth -= 2;
|
||||
}
|
||||
if (addhealth > 0)
|
||||
@ -285,7 +285,6 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
//所有Handle
|
||||
TimeHandle?.Invoke(this);
|
||||
|
||||
if (Core.Controller.EnableFunction)
|
||||
{
|
||||
FunctionSpend(0.05);
|
||||
|
@ -50,7 +50,7 @@ namespace VPet_Simulator.Core
|
||||
public static void LoadGraph(GraphCore graph, FileSystemInfo path, ILine info)
|
||||
{
|
||||
bool isLoop = info[(gbol)"loop"];
|
||||
FoodAnimation pa = new FoodAnimation(graph, GraphHelper.GetGraphInfo(path, info), info[(gstr)"front_lay"], info[(gstr)"back_lay"], info, isLoop);
|
||||
FoodAnimation pa = new FoodAnimation(graph, new GraphInfo(path, info), info[(gstr)"front_lay"], info[(gstr)"back_lay"], info, isLoop);
|
||||
graph.AddGraph(pa);
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -106,6 +106,10 @@ namespace VPet_Simulator.Core
|
||||
return list[0];
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
if (mode == GameSave.ModeType.Ill)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int i = (int)mode + 1;
|
||||
if (i < 3)
|
||||
{
|
||||
@ -115,20 +119,17 @@ namespace VPet_Simulator.Core
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
i = (int)mode - 1;
|
||||
if (i >= 0)
|
||||
if (i >= 1)
|
||||
{
|
||||
//向上兼容的动画
|
||||
list = gl.FindAll(x => x.GraphInfo.ModeType == (GameSave.ModeType)i);
|
||||
if (list.Count > 0)
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
//如果实在找不到,就走随机数
|
||||
//if (mode != GameSave.ModeType.Ill)
|
||||
//{
|
||||
list = gl;
|
||||
//如果实在找不到,就走随机数(无生病)
|
||||
list = gl.FindAll(x => x.GraphInfo.ModeType != GameSave.ModeType.Ill);
|
||||
if (list.Count > 0)
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
//}
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
return null;// FindGraph(GraphType.Default, mode);
|
||||
}
|
||||
@ -305,7 +306,7 @@ namespace VPet_Simulator.Core
|
||||
|
||||
Str.AddRange(lps["str"]);
|
||||
Duration.AddRange(lps["duration"]);
|
||||
|
||||
|
||||
foreach (var line in lps.FindAllLine("work"))
|
||||
{
|
||||
Works.Add(LPSConvert.DeserializeObject<Work>(line));
|
||||
|
@ -20,7 +20,7 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
public static class GraphHelper
|
||||
{
|
||||
static string[][] graphtypevalue = null;
|
||||
internal static string[][] graphtypevalue = null;
|
||||
/// <summary>
|
||||
/// 动画类型默认前文本
|
||||
/// </summary>
|
||||
@ -76,103 +76,7 @@ namespace VPet_Simulator.Core
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过文件位置和信息获取动画信息
|
||||
/// </summary>
|
||||
/// <param name="path">文件夹位置</param>
|
||||
/// <param name="info">信息</param>
|
||||
/// <returns>动画信息</returns>
|
||||
public static GraphInfo GetGraphInfo(FileSystemInfo path, ILine info)
|
||||
{
|
||||
var pn = Sub.Split(path.FullName.Substring(0, path.FullName.Length - path.Extension.Length).ToLower(), info[(gstr)"startuppath"].ToLower()).Last();
|
||||
var path_name = pn.Replace('\\', '_').Split('_').ToList();
|
||||
path_name.RemoveAll(string.IsNullOrWhiteSpace);
|
||||
if (!Enum.TryParse(info[(gstr)"mode"], true, out GameSave.ModeType modetype))
|
||||
{
|
||||
if (path_name.Remove("happy"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Happy;
|
||||
}
|
||||
else if (path_name.Remove("nomal"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Nomal;
|
||||
}
|
||||
else if (path_name.Remove("poorcondition"))
|
||||
{
|
||||
modetype = GameSave.ModeType.PoorCondition;
|
||||
}
|
||||
else if (path_name.Remove("ill"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Ill;
|
||||
}
|
||||
else
|
||||
{
|
||||
modetype = GameSave.ModeType.Nomal;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(info[(gstr)"graph"], true, out GraphType graphtype))
|
||||
{
|
||||
graphtype = GraphInfo.GraphType.Common;
|
||||
for (int i = 0; i < GraphTypeValue.Length; i++)
|
||||
{//挨个找第一个匹配的
|
||||
if (path_name.Contains(GraphTypeValue[i][0]))
|
||||
{
|
||||
int index = path_name.IndexOf(GraphTypeValue[i][0]);
|
||||
bool ismatch = true;
|
||||
for (int b = 1; b < GraphTypeValue[i].Length && b + index < path_name.Count; b++)
|
||||
{
|
||||
if (path_name[index + b] != GraphTypeValue[i][b])
|
||||
{
|
||||
ismatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ismatch)
|
||||
{
|
||||
graphtype = (GraphType)i;
|
||||
path_name.RemoveRange(index, GraphTypeValue[i].Length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(info[(gstr)"animat"], true, out AnimatType animatType))
|
||||
{
|
||||
if (path_name.Remove("a") || path_name.Remove("start"))
|
||||
{
|
||||
animatType = AnimatType.A_Start;
|
||||
}
|
||||
else if (path_name.Remove("b") || path_name.Remove("loop"))
|
||||
{
|
||||
animatType = AnimatType.B_Loop;
|
||||
}
|
||||
else if (path_name.Remove("c") || path_name.Remove("end"))
|
||||
{
|
||||
animatType = AnimatType.C_End;
|
||||
}
|
||||
else
|
||||
{
|
||||
animatType = AnimatType.Single;
|
||||
}
|
||||
}
|
||||
string name = info.Info;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
while (path_name.Count > 0 && (double.TryParse(path_name.Last(), out _) || path_name.Last().StartsWith("~")))
|
||||
{
|
||||
path_name.RemoveAt(path_name.Count - 1);
|
||||
}
|
||||
if (path_name.Count > 0)
|
||||
name = path_name.Last();
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
name = graphtype.ToString().ToLower();
|
||||
}
|
||||
return new GraphInfo(name, graphtype, animatType, modetype);// { Info = info };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作/学习
|
||||
|
@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static VPet_Simulator.Core.GraphHelper;
|
||||
|
||||
namespace VPet_Simulator.Core
|
||||
{
|
||||
@ -32,7 +35,104 @@ namespace VPet_Simulator.Core
|
||||
Type = type;
|
||||
ModeType = modeType;
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过文件位置和信息获取动画信息
|
||||
/// </summary>
|
||||
/// <param name="path">文件夹位置</param>
|
||||
/// <param name="info">信息</param>
|
||||
public GraphInfo(FileSystemInfo path, ILine info)
|
||||
{
|
||||
var pn = Sub.Split(path.FullName.Substring(0, path.FullName.Length - path.Extension.Length).ToLower(), info[(gstr)"startuppath"].ToLower()).Last();
|
||||
var path_name = pn.Replace('\\', '_').Split('_').ToList();
|
||||
path_name.RemoveAll(string.IsNullOrWhiteSpace);
|
||||
if (!Enum.TryParse(info[(gstr)"mode"], true, out GameSave.ModeType modetype))
|
||||
{
|
||||
if (path_name.Remove("happy"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Happy;
|
||||
}
|
||||
else if (path_name.Remove("nomal"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Nomal;
|
||||
}
|
||||
else if (path_name.Remove("poorcondition"))
|
||||
{
|
||||
modetype = GameSave.ModeType.PoorCondition;
|
||||
}
|
||||
else if (path_name.Remove("ill"))
|
||||
{
|
||||
modetype = GameSave.ModeType.Ill;
|
||||
}
|
||||
else
|
||||
{
|
||||
modetype = GameSave.ModeType.Nomal;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(info[(gstr)"graph"], true, out GraphType graphtype))
|
||||
{
|
||||
graphtype = GraphInfo.GraphType.Common;
|
||||
for (int i = 0; i < GraphTypeValue.Length; i++)
|
||||
{//挨个找第一个匹配的
|
||||
if (path_name.Contains(GraphTypeValue[i][0]))
|
||||
{
|
||||
int index = path_name.IndexOf(GraphTypeValue[i][0]);
|
||||
bool ismatch = true;
|
||||
for (int b = 1; b < GraphTypeValue[i].Length && b + index < path_name.Count; b++)
|
||||
{
|
||||
if (path_name[index + b] != GraphTypeValue[i][b])
|
||||
{
|
||||
ismatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ismatch)
|
||||
{
|
||||
graphtype = (GraphType)i;
|
||||
path_name.RemoveRange(index, GraphTypeValue[i].Length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(info[(gstr)"animat"], true, out AnimatType animatType))
|
||||
{
|
||||
if (path_name.Remove("a") || path_name.Remove("start"))
|
||||
{
|
||||
animatType = AnimatType.A_Start;
|
||||
}
|
||||
else if (path_name.Remove("b") || path_name.Remove("loop"))
|
||||
{
|
||||
animatType = AnimatType.B_Loop;
|
||||
}
|
||||
else if (path_name.Remove("c") || path_name.Remove("end"))
|
||||
{
|
||||
animatType = AnimatType.C_End;
|
||||
}
|
||||
else
|
||||
{
|
||||
animatType = AnimatType.Single;
|
||||
}
|
||||
}
|
||||
Name = info.Info;
|
||||
if (string.IsNullOrWhiteSpace(Name))
|
||||
{
|
||||
while (path_name.Count > 0 && (double.TryParse(path_name.Last(), out _) || path_name.Last().StartsWith("~")))
|
||||
{
|
||||
path_name.RemoveAt(path_name.Count - 1);
|
||||
}
|
||||
if (path_name.Count > 0)
|
||||
Name = path_name.Last();
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Name))
|
||||
{
|
||||
Name = graphtype.ToString().ToLower();
|
||||
}
|
||||
Type = graphtype;
|
||||
Animat = animatType;
|
||||
ModeType = modetype;
|
||||
}
|
||||
/// <summary>
|
||||
/// 类型: 主要动作分类
|
||||
/// </summary>
|
||||
|
@ -155,7 +155,7 @@ namespace VPet_Simulator.Core
|
||||
var paths = p.GetFiles();
|
||||
|
||||
bool isLoop = info[(gbol)"loop"];
|
||||
PNGAnimation pa = new PNGAnimation(graph, path.FullName, paths, GraphHelper.GetGraphInfo(path, info), isLoop);
|
||||
PNGAnimation pa = new PNGAnimation(graph, path.FullName, paths, new GraphInfo(path, info), isLoop);
|
||||
graph.AddGraph(pa);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace VPet_Simulator.Core
|
||||
length = 1000;
|
||||
}
|
||||
bool isLoop = info[(gbol)"loop"];
|
||||
Picture pa = new Picture(graph, path.FullName, GraphHelper.GetGraphInfo(path, info), length, isLoop);
|
||||
Picture pa = new Picture(graph, path.FullName, new GraphInfo(path, info), length, isLoop);
|
||||
graph.AddGraph(pa);
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1,9 +1,9 @@
|
||||
PNGAnimation#drink_back_lay:|path#Happy\back_lay:|mode#Happy:|graph#Not_Able:|
|
||||
///PNGAnimation#drink_front_lay:|path#Happy\front_lay:|mode#Happy:|graph#Not_Able:|
|
||||
PNGAnimation#drink_back_lay:|path#Nomal\back_lay:|mode#Nomal:|graph#Not_Able:|
|
||||
PNGAnimation#drink_front_lay:|path#front_lay:|mode#Nomal:|graph#Not_Able:|
|
||||
PNGAnimation#drink_back_lay:|path#PoorCondition\back_lay:|mode#PoorCondition:|graph#Not_Able:|
|
||||
///PNGAnimation#drink_front_lay:|path#PoorCondition\front_lay:|mode#PoorCondition:|graph#Not_Able:|
|
||||
PNGAnimation#drink_back_lay:|path#Happy\back_lay:|mode#Happy:|graph#Common:|
|
||||
///PNGAnimation#drink_front_lay:|path#Happy\front_lay:|mode#Happy:|graph#Common:|
|
||||
PNGAnimation#drink_back_lay:|path#Nomal\back_lay:|mode#Nomal:|graph#Common:|
|
||||
PNGAnimation#drink_front_lay:|path#front_lay:|mode#Nomal:|graph#Common:|
|
||||
PNGAnimation#drink_back_lay:|path#PoorCondition\back_lay:|mode#PoorCondition:|graph#Common:|
|
||||
///PNGAnimation#drink_front_lay:|path#PoorCondition\front_lay:|mode#PoorCondition:|graph#Common:|
|
||||
FoodAnimation#drink:|mode#Happy:|graph#drink:|a0#1000:|a1#125,268,286,77,60:|a2#125,167,164,78:|a3#125,198,160,78:|a4#125,199,163,78:|a5#125,199,160,78:|a6#125,199,163,78:|a7#125,199,160,78:|a8#125,169,164,78:|a9#125,268,286,77,60:|a10#625:|front_lay#drink_front_lay:|back_lay#drink_back_lay:|
|
||||
FoodAnimation#drink:|mode#nomal:|graph#drink:|a0#1000:|a1#125,268,286,77,60:|a2#125,167,164,78:|a3#125,198,160,78:|a4#125,199,163,78:|a5#125,199,160,78:|a6#125,199,163,78:|a7#125,199,160,78:|a8#125,169,164,78:|a9#125,268,286,77,60:|a10#625:|front_lay#drink_front_lay:|back_lay#drink_back_lay:|
|
||||
FoodAnimation#drink:|mode#PoorCondition:|graph#drink:|a0#1000:|a1#125,268,286,77,60:|a2#125,167,164,78:|a3#125,198,160,78:|a4#125,199,163,78:|a5#125,199,160,78:|a6#125,199,163,78:|a7#125,199,160,78:|a8#125,169,164,78:|a9#125,268,286,77,60:|a10#625:|front_lay#drink_front_lay:|back_lay#drink_back_lay:|
|
||||
|
@ -1,3 +1,3 @@
|
||||
PNGAnimation#eat_back_lay:|path#back_lay:|mode#ill:|graph#Not_Able:|
|
||||
PNGAnimation#eat_front_lay:|path#front_lay:|mode#ill:|graph#Not_Able:|
|
||||
PNGAnimation#eat_back_lay:|path#back_lay:|mode#ill:|graph#Common:|
|
||||
PNGAnimation#eat_front_lay:|path#front_lay:|mode#ill:|graph#Common:|
|
||||
FoodAnimation#eat:|mode#ill:|graph#Eat:|a0#500:|a1#125,60,125,59:|a2#125,120,175,59:|a3#125,170,250,59:|a4#250,165,232,64:|a5#250,170,265,65:|a6#250,170,270,65:|a7#250,180,270,64:|a8#2000:|front_lay#eat_front_lay:|back_lay#eat_back_lay:|///Time,MarginX,Y,Width,Rotate,Opacity
|
@ -1,3 +1,3 @@
|
||||
PNGAnimation#eat_back_lay:|path#back_lay:|mode#nomal:|graph#Not_Able:|
|
||||
PNGAnimation#eat_front_lay:|path#front_lay:|mode#nomal:|graph#Not_Able:|
|
||||
PNGAnimation#eat_back_lay:|path#back_lay:|mode#nomal:|graph#Common:|
|
||||
PNGAnimation#eat_front_lay:|path#front_lay:|mode#nomal:|graph#Common:|
|
||||
FoodAnimation#eat:|mode#nomal:|graph#Eat:|a0#175,215,23,60,0,0.375:|a1#125,247,88,60,25,0.4375:|a2#125,233,83,60,-20:|a3#125,228,178,57,-5.5:|a4#750,224,196,65:|a5#125,222,163,65:|a6#375,224,194,65:|a7#125,222,158,65:|a8#750:|front_lay#eat_front_lay:|back_lay#eat_back_lay:|
|
@ -1,3 +1,3 @@
|
||||
PNGAnimation#eat_back_lay_2:|path#back_lay:|mode#nomal:|graph#Not_Able:|
|
||||
PNGAnimation#eat_front_lay_2:|path#front_lay:|mode#nomal:|graph#Not_Able:|
|
||||
PNGAnimation#eat_back_lay_2:|path#back_lay:|mode#nomal:|graph#Common:|
|
||||
PNGAnimation#eat_front_lay_2:|path#front_lay:|mode#nomal:|graph#Common:|
|
||||
FoodAnimation#eat:|mode#nomal:|graph#Eat:|a0#175,205,23,60,0,0.375:|a1#125,220,88,60,25,0.4375:|a2#125,222,83,60,-20:|a3#125,216,178,57,-5.5:|a4#750,212,196,65:|a5#125,210,163,65:|a6#375,212,194,65:|a7#125,210,158,65:|a8#750:|front_lay#eat_front_lay_2:|back_lay#eat_back_lay_2:|
|
Loading…
Reference in New Issue
Block a user