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

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: case GraphCore.GraphType.Squat_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode, true), EndAction); Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode, true), EndAction);
return true; 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; return false;
} }
@ -193,7 +217,7 @@ namespace VPet_Simulator.Core
CountNomal = 0; CountNomal = 0;
Display(GraphCore.GraphType.Walk_Left_A_Start, () => 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(); MoveTimer.Start();
DisplayWalk_Lefting(); DisplayWalk_Lefting();
}); });
@ -273,7 +297,7 @@ namespace VPet_Simulator.Core
CountNomal = 0; CountNomal = 0;
Display(GraphCore.GraphType.Walk_Right_A_Start, () => 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(); MoveTimer.Start();
DisplayWalk_Righting(); DisplayWalk_Righting();
}); });
@ -341,64 +365,122 @@ namespace VPet_Simulator.Core
} }
} }
} }
///// <summary> /// <summary>
///// 显示向左爬 (有判断) /// 显示向左爬 (有判断)
///// </summary> /// </summary>
//public void DisplayClimb_Bottom_Left() public void DisplayCrawl_Left()
//{ {
// //看看距离是否满足调节 //看看距离是否满足调节
// if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio) if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
// { {
// walklength = 0; walklength = 0;
// Display(GraphCore.GraphType.Climb_Bottom_Left, () => Display(GraphCore.GraphType.Crawl_Left_A_Start, () =>
// { {
// MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置 MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedCrawl * Core.Controller.ZoomRatio, 0);//TODO:锚定设置
// MoveTimer.Start(); MoveTimer.Start();
// DisplayWalk_Lefting(); DisplayCrawl_Lefting();
// }); });
// } }
//} }
///// <summary> /// <summary>
///// 显示向左爬 /// 显示向左爬
///// </summary> /// </summary>
//private void DisplayClimb_Bottom_Lefting() private void DisplayCrawl_Lefting()
//{ {
// //看看距离是不是不足 //看看距离是不是不足
// if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio) if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio)
// {//是,停下恢复默认 or/爬墙 {//是,停下恢复默认 or/爬墙
// switch (Function.Rnd.Next(3)) switch (Function.Rnd.Next(3))
// { {
// case 0: case 0:
// DisplayClimb_Left_UP(() => DisplayClimb_Left_UP(() =>
// { {
// MoveTimer.Stop(); MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal); Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
// }); });
// return; return;
// case 1: case 1:
// DisplayClimb_Left_DOWN(() => DisplayClimb_Left_DOWN(() =>
// { {
// MoveTimer.Stop(); MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal); Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
// }); });
// return; return;
// default: default:
// MoveTimer.Stop(); MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal); Display(GraphCore.GraphType.Crawl_Left_C_End, DisplayNomal);
// return; return;
// } }
// } }
// //不是:继续右边走or停下 //不是:继续右边走or停下
// if (Function.Rnd.Next(walklength++) < 5) if (Function.Rnd.Next(walklength++) < 5)
// { {
// Display(GraphCore.GraphType.Walk_Left_B_Loop, DisplayWalk_Lefting); Display(GraphCore.GraphType.Crawl_Left_B_Loop, DisplayCrawl_Lefting);
// } }
// else else
// {//停下来 {//停下来
// MoveTimer.Stop(); MoveTimer.Stop();
// Display(GraphCore.GraphType.Walk_Left_C_End, DisplayNomal); 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>
/// 显示左墙壁爬行 上 /// 显示左墙壁爬行 上
/// </summary> /// </summary>
@ -409,10 +491,10 @@ namespace VPet_Simulator.Core
{ {
walklength = 0; walklength = 0;
CountNomal = 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, () => 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(); MoveTimer.Start();
DisplayClimb_Lefting_UP(); DisplayClimb_Lefting_UP();
}); });
@ -472,10 +554,10 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 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, () => 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(); MoveTimer.Start();
DisplayClimb_Lefting_DOWN(); DisplayClimb_Lefting_DOWN();
}); });
@ -516,10 +598,10 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 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, () => 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(); MoveTimer.Start();
DisplayClimb_Righting_UP(); DisplayClimb_Righting_UP();
}); });
@ -579,10 +661,10 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 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, () => 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(); MoveTimer.Start();
DisplayClimb_Righting_DOWN(); DisplayClimb_Righting_DOWN();
}); });
@ -623,8 +705,8 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 0; CountNomal = 0;
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置 Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp()+ Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop, 0); MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
MoveTimer.Start(); MoveTimer.Start();
DisplayClimb_Top_Righting(); DisplayClimb_Top_Righting();
} }
@ -675,8 +757,8 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 0; CountNomal = 0;
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置 Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp() + Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop, 0); MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
MoveTimer.Start(); MoveTimer.Start();
DisplayClimb_Top_Lefting(); DisplayClimb_Top_Lefting();
} }
@ -727,7 +809,7 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 0; CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150); //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(); MoveTimer.Start();
Display(GraphType.Fall_Left_A_Start, DisplayFall_Lefting); Display(GraphType.Fall_Left_A_Start, DisplayFall_Lefting);
} }
@ -790,7 +872,7 @@ namespace VPet_Simulator.Core
walklength = 0; walklength = 0;
CountNomal = 0; CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150); //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(); MoveTimer.Start();
Display(GraphType.Fall_Right_A_Start, DisplayFall_Righting); 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) private void EventTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
Core.Save.CleanChange();
//所有Handle //所有Handle
TimeHandle?.Invoke(this); TimeHandle?.Invoke(this);
@ -28,15 +29,17 @@ namespace VPet_Simulator.Core
if (Core.Save.StrengthFood >= 50) if (Core.Save.StrengthFood >= 50)
{ {
Core.Save.StrengthChange(1); Core.Save.StrengthChange(1);
if (Core.Save.StrengthFood >= 75)
Core.Save.Health += Function.Rnd.Next(0, 1);
} }
else if (Core.Save.StrengthFood <= 25) else if (Core.Save.StrengthFood <= 25)
{ {
Core.Save.Health -= Function.Rnd.Next(0, 1); Core.Save.Health -= Function.Rnd.Next(0, 1);
} }
if (Core.Save.Strength <= 40) //if (Core.Save.Strength <= 40)
{ //{
Core.Save.Health -= Function.Rnd.Next(0, 1); // Core.Save.Health -= Function.Rnd.Next(0, 1);
} //}
Core.Save.StrengthChangeFood(-1); Core.Save.StrengthChangeFood(-1);
if (Core.Save.Feeling >= 75) if (Core.Save.Feeling >= 75)
{ {
@ -55,10 +58,13 @@ namespace VPet_Simulator.Core
{ {
Core.Save.Health -= Function.Rnd.Next(0, 1); 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(); var newmod = Core.Save.CalMode();
if (Core.Save.Mode != newmod) if (Core.Save.Mode != newmod)
{ {
//TODO:切换逻辑 //TODO:切换逻辑
Core.Save.Mode = newmod; Core.Save.Mode = newmod;
} }
} }
@ -71,7 +77,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this)); Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
if (DisplayType == GraphCore.GraphType.Default && !isPress) 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 0:
case 7: case 7:
@ -114,6 +120,14 @@ namespace VPet_Simulator.Core
case 17: case 17:
DisplaySquat(); DisplaySquat();
break; break;
case 19:
case 20:
DisplayCrawl_Left();
break;
case 21:
case 22:
DisplayCrawl_Right();
break;
default: default:
break; break;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -18,11 +18,11 @@ namespace VPet_Simulator.Core
/// <summary> /// <summary>
/// 宠物图像 /// 宠物图像
/// </summary> /// </summary>
public GraphCore Graph(bool storemem) public GraphCore Graph()
{ {
var g = new GraphCore(); var g = new GraphCore();
foreach (var p in path) foreach (var p in path)
LoadGraph(g, new DirectoryInfo(p), "", storemem); LoadGraph(g, new DirectoryInfo(p), "");
g.GraphConfig = Config; g.GraphConfig = Config;
return g; return g;
} }
@ -47,7 +47,7 @@ namespace VPet_Simulator.Core
Config = new Config(lps); 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(); var list = di.EnumerateDirectories();
if (list.Count() == 0) if (list.Count() == 0)
@ -66,19 +66,19 @@ namespace VPet_Simulator.Core
if (path_name.Contains("happy")) 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")) 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")) 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")) 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; return;
} }
@ -91,7 +91,7 @@ namespace VPet_Simulator.Core
else else
foreach (var p in list) 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"); get => !this["diagnosis"].GetBool("disable");
set => this["diagnosis"].SetBool("disable", !value); set => this["diagnosis"].SetBool("disable", !value);
} }
/// <summary> ///// <summary> //经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
/// 是将图片储存到内存 ///// 是将图片储存到内存
/// </summary> ///// </summary>
public bool StoreInMemory //public bool StoreInMemory
{ //{
get => this["set"].GetBool("storemem"); // get => !this["set"].GetBool("storemem");
set => this["set"].SetBool("storemem", value); // set => this["set"].SetBool("storemem", value);
} //}
/// <summary> /// <summary>
/// 数据收集频率 /// 数据收集频率
/// </summary> /// </summary>

View File

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

View File

@ -2,5 +2,5 @@ pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:
touchhead:|px#159:|py#16:|sw#189:|sh#178:| touchhead:|px#159:|py#16:|sw#189:|sh#178:|
touchraised:|px#0:|py#50:|sw#500:|sh#200:| touchraised:|px#0:|py#50:|sw#500:|sh#200:|
raisepoint:|x#290:|y#128:| 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:| 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