更新爬行动画&删除内存优化

This commit is contained in:
ZouJin 2023-01-23 01:33:13 +08:00
parent 20d420be52
commit 598b83c2ec
51 changed files with 282 additions and 170 deletions

View File

@ -46,6 +46,30 @@ namespace VPet_Simulator.Core
case GraphCore.GraphType.Squat_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Crawl_Left_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Crawl_Left_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Crawl_Right_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Crawl_Right_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Fall_Left_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Left_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Fall_Right_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Right_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Walk_Left_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode, true), EndAction);
return true;
case GraphType.Walk_Right_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode, true), EndAction);
return true;
//case GraphType.Climb_Left:
//case GraphType.Climb_Right:
//case GraphType.Climb_Top_Left:
//case GraphType.Climb_Top_Right:
// DisplayFalled_Left();
// return true;
}
return false;
}
@ -193,7 +217,7 @@ namespace VPet_Simulator.Core
CountNomal = 0;
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk, 0);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk * Core.Controller.ZoomRatio, 0);
MoveTimer.Start();
DisplayWalk_Lefting();
});
@ -273,7 +297,7 @@ namespace VPet_Simulator.Core
CountNomal = 0;
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk, 0);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk * Core.Controller.ZoomRatio, 0);
MoveTimer.Start();
DisplayWalk_Righting();
});
@ -341,64 +365,122 @@ namespace VPet_Simulator.Core
}
}
}
///// <summary>
///// 显示向左爬 (有判断)
///// </summary>
//public void DisplayClimb_Bottom_Left()
//{
// //看看距离是否满足调节
// if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
// {
// walklength = 0;
// Display(GraphCore.GraphType.Climb_Bottom_Left, () =>
// {
// MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
// MoveTimer.Start();
// DisplayWalk_Lefting();
// });
// }
//}
///// <summary>
///// 显示向左爬
///// </summary>
//private void DisplayClimb_Bottom_Lefting()
//{
// //看看距离是不是不足
// if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio)
// {//是,停下恢复默认 or/爬墙
// switch (Function.Rnd.Next(3))
// {
// case 0:
// DisplayClimb_Left_UP(() =>
// {
// MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal);
// });
// return;
// case 1:
// DisplayClimb_Left_DOWN(() =>
// {
// MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal);
// });
// return;
// default:
// MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal);
// return;
// }
// }
// //不是:继续右边走or停下
// if (Function.Rnd.Next(walklength++) < 5)
// {
// Display(GraphCore.GraphType.Walk_Left_B_Loop, DisplayWalk_Lefting);
// }
// else
// {//停下来
// MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal);
// }
//}
/// <summary>
/// 显示向左爬 (有判断)
/// </summary>
public void DisplayCrawl_Left()
{
//看看距离是否满足调节
if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
{
walklength = 0;
Display(GraphCore.GraphType.Crawl_Left_A_Start, () =>
{
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedCrawl * Core.Controller.ZoomRatio, 0);//TODO:锚定设置
MoveTimer.Start();
DisplayCrawl_Lefting();
});
}
}
/// <summary>
/// 显示向左爬
/// </summary>
private void DisplayCrawl_Lefting()
{
//看看距离是不是不足
if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio)
{//是,停下恢复默认 or/爬墙
switch (Function.Rnd.Next(3))
{
case 0:
DisplayClimb_Left_UP(() =>
{
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
});
return;
case 1:
DisplayClimb_Left_DOWN(() =>
{
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
});
return;
default:
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
return;
}
}
//不是:继续右边走or停下
if (Function.Rnd.Next(walklength++) < 5)
{
Display(GraphCore.GraphType.Crawl_Left_B_Loop, DisplayCrawl_Lefting);
}
else
{//停下来
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
}
}
/// <summary>
/// 显示向右爬 (有判断)
/// </summary>
public void DisplayCrawl_Right()
{
//看看距离是否满足调节
if (Core.Controller.GetWindowsDistanceRight() > 400 * Core.Controller.ZoomRatio)
{
walklength = 0;
Display(GraphCore.GraphType.Crawl_Right_A_Start, () =>
{
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedCrawl * Core.Controller.ZoomRatio, 0);//TODO:锚定设置
MoveTimer.Start();
DisplayCrawl_Righting();
});
}
}
/// <summary>
/// 显示向右爬
/// </summary>
private void DisplayCrawl_Righting()
{
//看看距离是不是不足
if (Core.Controller.GetWindowsDistanceRight() < 50 * Core.Controller.ZoomRatio)
{//是,停下恢复默认 or/爬墙
switch (Function.Rnd.Next(3))
{
case 0:
DisplayClimb_Right_UP(() =>
{
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Right_C_End, DisplayNomal);
});
return;
case 1:
DisplayClimb_Right_DOWN(() =>
{
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Right_C_End, DisplayNomal);
});
return;
default:
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Right_C_End, DisplayNomal);
return;
}
}
//不是:继续右边走or停下
if (Function.Rnd.Next(walklength++) < 5)
{
Display(GraphCore.GraphType.Crawl_Right_B_Loop, DisplayCrawl_Righting);
}
else
{//停下来
MoveTimer.Stop();
Display(GraphCore.GraphType.Crawl_Right_C_End, DisplayNomal);
}
}
/// <summary>
/// 显示左墙壁爬行 上
/// </summary>
@ -409,10 +491,10 @@ namespace VPet_Simulator.Core
{
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
Core.Controller.MoveWindows(-(Core.Controller.GetWindowsDistanceLeft() + Core.Graph.GraphConfig.LocateClimbLeft) / Core.Controller.ZoomRatio, 0);
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimer.Start();
DisplayClimb_Lefting_UP();
});
@ -472,10 +554,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
Core.Controller.MoveWindows(-(Core.Controller.GetWindowsDistanceLeft() + Core.Graph.GraphConfig.LocateClimbLeft) / Core.Controller.ZoomRatio, 0);
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimer.Start();
DisplayClimb_Lefting_DOWN();
});
@ -516,10 +598,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
Core.Controller.MoveWindows((Core.Controller.GetWindowsDistanceRight()+ Core.Graph.GraphConfig.LocateClimbRight) / Core.Controller.ZoomRatio, 0);
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimer.Start();
DisplayClimb_Righting_UP();
});
@ -579,10 +661,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
Core.Controller.MoveWindows((Core.Controller.GetWindowsDistanceRight() + Core.Graph.GraphConfig.LocateClimbRight) / Core.Controller.ZoomRatio, 0);
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimer.Start();
DisplayClimb_Righting_DOWN();
});
@ -623,8 +705,8 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop, 0);
Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp()+ Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
MoveTimer.Start();
DisplayClimb_Top_Righting();
}
@ -675,8 +757,8 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop, 0);
Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp() + Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
MoveTimer.Start();
DisplayClimb_Top_Lefting();
}
@ -727,7 +809,7 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedFallX * Core.Controller.ZoomRatio, Core.Graph.GraphConfig.SpeedFallY * Core.Controller.ZoomRatio);
MoveTimer.Start();
Display(GraphType.Fall_Left_A_Start, DisplayFall_Lefting);
}
@ -790,7 +872,7 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedFallX * Core.Controller.ZoomRatio, Core.Graph.GraphConfig.SpeedFallY * Core.Controller.ZoomRatio);
MoveTimer.Start();
Display(GraphType.Fall_Right_A_Start, DisplayFall_Righting);
}

View File

@ -19,6 +19,7 @@ namespace VPet_Simulator.Core
private void EventTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
Core.Save.CleanChange();
//所有Handle
TimeHandle?.Invoke(this);
@ -28,15 +29,17 @@ namespace VPet_Simulator.Core
if (Core.Save.StrengthFood >= 50)
{
Core.Save.StrengthChange(1);
if (Core.Save.StrengthFood >= 75)
Core.Save.Health += Function.Rnd.Next(0, 1);
}
else if (Core.Save.StrengthFood <= 25)
{
Core.Save.Health -= Function.Rnd.Next(0, 1);
}
if (Core.Save.Strength <= 40)
{
Core.Save.Health -= Function.Rnd.Next(0, 1);
}
//if (Core.Save.Strength <= 40)
//{
// Core.Save.Health -= Function.Rnd.Next(0, 1);
//}
Core.Save.StrengthChangeFood(-1);
if (Core.Save.Feeling >= 75)
{
@ -55,11 +58,14 @@ namespace VPet_Simulator.Core
{
Core.Save.Health -= Function.Rnd.Next(0, 1);
}
else if(Core.Save.StrengthDrink >= 75)
Core.Save.Health += Function.Rnd.Next(0, 1);
var newmod = Core.Save.CalMode();
if(Core.Save.Mode != newmod)
if (Core.Save.Mode != newmod)
{
//TODO:切换逻辑
Core.Save.Mode = newmod;
Core.Save.Mode = newmod;
}
}
else
@ -71,7 +77,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
if (DisplayType == GraphCore.GraphType.Default && !isPress)
switch (9)//Function.Rnd.Next(Math.Max(20, 200 - CountNomal)))
switch (22)//Function.Rnd.Next(Math.Max(23, 200 - CountNomal)))
{
case 0:
case 7:
@ -114,6 +120,14 @@ namespace VPet_Simulator.Core
case 17:
DisplaySquat();
break;
case 19:
case 20:
DisplayCrawl_Left();
break;
case 21:
case 22:
DisplayCrawl_Right();
break;
default:
break;
}

View File

@ -70,13 +70,29 @@ namespace VPet_Simulator.Core
/// </summary>
Touch_Head_C_End,
/// <summary>
/// 爬行向右 (开始)
/// </summary>
Crawl_Right_A_Start,
/// <summary>
/// 爬行向右 (循环)
/// </summary>
Crawl_Right,
Crawl_Right_B_Loop,
/// <summary>
/// 爬行向右 (结束)
/// </summary>
Crawl_Right_C_End,
/// <summary>
/// 爬行向左 (开始)
/// </summary>
Crawl_Left_A_Start,
/// <summary>
/// 爬行向左 (循环)
/// </summary>
Crawl_Left,
Crawl_Left_B_Loop,
/// <summary>
/// 爬行向左 (结束)
/// </summary>
Crawl_Left_C_End,
/// <summary>
/// 下蹲 (开始)
/// </summary>
@ -160,8 +176,8 @@ namespace VPet_Simulator.Core
// new dynamic[]{ "raised_static_b", false,true},
// new dynamic[]{ "climb_top_right", false,false},
// new dynamic[]{ "climb_top_left", false, false},
// new dynamic[]{ "climb_bottom_right", false,false},
// new dynamic[]{ "climb_bottom_left", false, false},
// new dynamic[]{ "Crawl_right", false,false},
// new dynamic[]{ "Crawl_left", false, false},
// new dynamic[]{ "climb_right", false, false},
// new dynamic[]{ "climb_left", false, false},
// new dynamic[]{ "default", true,true},

View File

@ -29,10 +29,10 @@ namespace VPet_Simulator.Core
/// 是否继续播放
/// </summary>
bool IsContinue { get; set; }
/// <summary>
/// 是否储存到内存以支持快速显示
/// </summary>
bool StoreMemory { get; }
///// <summary>//经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
///// 是否储存到内存以支持快速显示
///// </summary>
//bool StoreMemory { get; }
/// <summary>
/// 该动画UI状态
/// </summary>

View File

@ -48,10 +48,10 @@ namespace VPet_Simulator.Core
///// 是否重置状态从0开始播放
///// </summary>
//public bool IsResetPlay { get; set; } = false;
/// <summary>
/// 是否储存到内存以支持快速显示
/// </summary>
public bool StoreMemory { get; private set; }
///// <summary>//经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
///// 是否储存到内存以支持快速显示
///// </summary>
//public bool StoreMemory { get; private set; }
public UIElement This => this;
public Save.ModeType ModeType { get; private set; }
@ -67,81 +67,80 @@ namespace VPet_Simulator.Core
/// </summary>
/// <param name="paths">文件夹位置</param>
/// <param name="isLoop">是否循环</param>
/// <param name="storemem">是否储存到内存以支持快速显示</param>
public PNGAnimation(FileInfo[] paths, Save.ModeType modetype, GraphCore.GraphType graphtype, bool storemem = false, bool isLoop = false)
public PNGAnimation(FileInfo[] paths, Save.ModeType modetype, GraphCore.GraphType graphtype, bool isLoop = false)
{
InitializeComponent();
Animations = new List<Animation>();
IsLoop = isLoop;
StoreMemory = storemem;
//StoreMemory = storemem;
GraphType = graphtype;
ModeType = modetype;
if (storemem)
foreach (var file in paths)
{
int time = int.Parse(file.Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
var img = new Image()
{
Source = new BitmapImage(new Uri(file.FullName)),
Visibility = Visibility.Hidden
};
MainGrid.Children.Add(img);
Animations.Add(new Animation(this, time, () =>
{
img.Visibility = Visibility.Visible;
}, () => img.Visibility = Visibility.Hidden));
}
else
//if (storemem)
foreach (var file in paths)
{
Image[] imgs = new Image[3];
imgs[0] = new Image()
{
Visibility = Visibility.Hidden
};
imgs[1] = new Image()
{
Visibility = Visibility.Hidden
};
imgs[2] = new Image()
{
Visibility = Visibility.Hidden
};
int time = int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
//第一张图:有专门自己的图层
int time = int.Parse(file.Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
var img = new Image()
{
Source = new BitmapImage(new Uri(paths[0].FullName)),
Source = new BitmapImage(new Uri(file.FullName)),
Visibility = Visibility.Hidden
};
MainGrid.Children.Add(img);
MainGrid.Children.Add(imgs[0]);
MainGrid.Children.Add(imgs[1]);
MainGrid.Children.Add(imgs[2]);
Animations.Add(new Animation(this, time, () =>
{
img.Visibility = Visibility.Visible;
imgs[1].Source = new BitmapImage(new Uri(paths[1].FullName));
}, () => img.Visibility = Visibility.Hidden));
int last = paths.Count() - 1;
for (int i = 1; i < last; i++)
{
time = int.Parse(paths[i].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
var im1 = imgs[i % 3];
var im2 = imgs[(i + 1) % 3];
var st3 = paths[i + 1].FullName;
Animations.Add(new Animation(this, time, () =>
{
im1.Visibility = Visibility.Visible;
im2.Source = new BitmapImage(new Uri(st3));
}, () => im1.Visibility = Visibility.Hidden));
}
//最后一张图: 不处理下一张图的imgsSources
time = int.Parse(paths[last].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
Animations.Add(new Animation(this, time, () => imgs[last % 3].Visibility = Visibility.Visible
, () => imgs[last % 3].Visibility = Visibility.Hidden));
}
//else
//{
// Image[] imgs = new Image[3];
// imgs[0] = new Image()
// {
// Visibility = Visibility.Hidden
// };
// imgs[1] = new Image()
// {
// Visibility = Visibility.Hidden
// };
// imgs[2] = new Image()
// {
// Visibility = Visibility.Hidden
// };
// int time = int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
// //第一张图:有专门自己的图层
// var img = new Image()
// {
// Source = new BitmapImage(new Uri(paths[0].FullName)),
// Visibility = Visibility.Hidden
// };
// MainGrid.Children.Add(img);
// MainGrid.Children.Add(imgs[0]);
// MainGrid.Children.Add(imgs[1]);
// MainGrid.Children.Add(imgs[2]);
// Animations.Add(new Animation(this, time, () =>
// {
// img.Visibility = Visibility.Visible;
// imgs[1].Source = new BitmapImage(new Uri(paths[1].FullName));
// }, () => img.Visibility = Visibility.Hidden));
// int last = paths.Count() - 1;
// for (int i = 1; i < last; i++)
// {
// time = int.Parse(paths[i].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
// var im1 = imgs[i % 3];
// var im2 = imgs[(i + 1) % 3];
// var st3 = paths[i + 1].FullName;
// Animations.Add(new Animation(this, time, () =>
// {
// im1.Visibility = Visibility.Visible;
// im2.Source = new BitmapImage(new Uri(st3));
// }, () => im1.Visibility = Visibility.Hidden));
// }
// //最后一张图: 不处理下一张图的imgsSources
// time = int.Parse(paths[last].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
// Animations.Add(new Animation(this, time, () => imgs[last % 3].Visibility = Visibility.Visible
// , () => imgs[last % 3].Visibility = Visibility.Hidden));
//}
}
/// <summary>
/// 单帧动画
@ -192,6 +191,7 @@ namespace VPet_Simulator.Core
{
//parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden);
//parent.Dispatcher.Invoke(Hidden);
parent.PlayState = false;
if (parent.DoEndAction)
EndAction?.Invoke();//运行结束动画时事件
parent.StopAction?.Invoke();

View File

@ -39,7 +39,7 @@ namespace VPet_Simulator.Core
public bool PlayState { get; set; }
public bool IsLoop { get; set; }
public int Length { get; set; }
public bool StoreMemory => true;
//public bool StoreMemory => true;//经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
public UIElement This => this;

View File

@ -18,11 +18,11 @@ namespace VPet_Simulator.Core
/// <summary>
/// 宠物图像
/// </summary>
public GraphCore Graph(bool storemem)
public GraphCore Graph()
{
var g = new GraphCore();
foreach (var p in path)
LoadGraph(g, new DirectoryInfo(p), "", storemem);
LoadGraph(g, new DirectoryInfo(p), "");
g.GraphConfig = Config;
return g;
}
@ -47,7 +47,7 @@ namespace VPet_Simulator.Core
Config = new Config(lps);
}
public static void LoadGraph(GraphCore graph, DirectoryInfo di, string path_name,bool storemem)
public static void LoadGraph(GraphCore graph, DirectoryInfo di, string path_name)
{
var list = di.EnumerateDirectories();
if (list.Count() == 0)
@ -66,19 +66,19 @@ namespace VPet_Simulator.Core
if (path_name.Contains("happy"))
{
graph.AddGraph(di.FullName, Save.ModeType.Happy, (GraphType)i, storemem);
graph.AddGraph(di.FullName, Save.ModeType.Happy, (GraphType)i);
}
if (path_name.Contains("nomal"))
{
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i, storemem);
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i);
}
if (path_name.Contains("poorcondition"))
{
graph.AddGraph(di.FullName, Save.ModeType.PoorCondition, (GraphType)i, storemem);
graph.AddGraph(di.FullName, Save.ModeType.PoorCondition, (GraphType)i);
}
if (path_name.Contains("ill"))
{
graph.AddGraph(di.FullName, Save.ModeType.Ill, (GraphType)i, storemem);
graph.AddGraph(di.FullName, Save.ModeType.Ill, (GraphType)i);
}
return;
}
@ -91,7 +91,7 @@ namespace VPet_Simulator.Core
else
foreach (var p in list)
{
LoadGraph(graph, p, path_name + "_" + p.Name,storemem);
LoadGraph(graph, p, path_name + "_" + p.Name);
}
}
}

View File

@ -86,14 +86,14 @@ namespace VPet_Simulator.Windows
get => !this["diagnosis"].GetBool("disable");
set => this["diagnosis"].SetBool("disable", !value);
}
/// <summary>
/// 是将图片储存到内存
/// </summary>
public bool StoreInMemory
{
get => this["set"].GetBool("storemem");
set => this["set"].SetBool("storemem", value);
}
///// <summary> //经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
///// 是将图片储存到内存
///// </summary>
//public bool StoreInMemory
//{
// get => !this["set"].GetBool("storemem");
// set => this["set"].SetBool("storemem", value);
//}
/// <summary>
/// 数据收集频率
/// </summary>

View File

@ -110,7 +110,7 @@ namespace VPet_Simulator.Windows
Core.Save = new Save("萝莉斯");
Dispatcher.Invoke(new Action(() =>
{
Core.Graph = Pets[0].Graph(Set.StoreInMemory);
Core.Graph = Pets[0].Graph();
LoadingText.Visibility = Visibility.Collapsed;
winSetting = new winGameSetting(this);
var main = new Main(Core) { };

View File

@ -2,5 +2,5 @@ pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:
touchhead:|px#159:|py#16:|sw#189:|sh#178:|
touchraised:|px#0:|py#50:|sw#500:|sh#200:|
raisepoint:|x#290:|y#128:|
speed:|walk#20:|climb#10:|climbtop#8:|crawl#8:|fallx#14:|fally#10:|
speed:|walk#40:|climb#20:|climbtop#16:|crawl#16:|fallx#28:|fally#20:|crawl#20:|
locate:|climbleft#145:|climbright#185:|climbtop#150:|

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB