更新显示逻辑&新动画添加
@ -76,10 +76,12 @@ namespace VPet_Simulator.Core
|
|||||||
private void MainGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void MainGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
isPress = true;
|
isPress = true;
|
||||||
if (!IsNomal)
|
if (DisplayType != GraphCore.GraphType.Default)
|
||||||
{//不是nomal! 可能会卡timer,所有全部timer清空下
|
{//不是nomal! 可能会卡timer,所有全部timer清空下
|
||||||
MoveTimer.Stop();
|
MoveTimer.Stop();
|
||||||
MainGrid.MouseMove -= MainGrid_MouseMove;
|
MainGrid.MouseMove -= MainGrid_MouseMove;
|
||||||
|
if (DisplayStopMove(DisplayNomal))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
@ -13,20 +14,38 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
public partial class Main
|
public partial class Main
|
||||||
{
|
{
|
||||||
|
public GraphCore.GraphType DisplayType = GraphCore.GraphType.Default;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示默认情况
|
/// 显示默认情况
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisplayNomal()
|
public void DisplayNomal()
|
||||||
{
|
{
|
||||||
IsNomal = true;
|
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode), DisplayNomal);
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode), DisplayNomal);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 显示结束动画
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="EndAction">结束后接下来</param>
|
||||||
|
/// <returns>是否成功结束</returns>
|
||||||
|
public bool DisplayStopMove(Action EndAction)
|
||||||
|
{
|
||||||
|
switch (DisplayType)
|
||||||
|
{
|
||||||
|
case GraphCore.GraphType.Boring_B_Loop:
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_C_End, Core.Save.Mode), EndAction);
|
||||||
|
return true;
|
||||||
|
case GraphCore.GraphType.Squat_B_Loop:
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode), EndAction);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示摸头情况
|
/// 显示摸头情况
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisplayTouchHead()
|
public void DisplayTouchHead()
|
||||||
{
|
{
|
||||||
IsNomal = false;
|
|
||||||
if (petgridcrlf)
|
if (petgridcrlf)
|
||||||
if (PetGrid.Child is IGraph ig && ig.GraphType == GraphCore.GraphType.Touch_Head_B_Loop)
|
if (PetGrid.Child is IGraph ig && ig.GraphType == GraphCore.GraphType.Touch_Head_B_Loop)
|
||||||
{
|
{
|
||||||
@ -43,12 +62,49 @@ namespace VPet_Simulator.Core
|
|||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_C_End, Core.Save.Mode), DisplayNomal
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_C_End, Core.Save.Mode), DisplayNomal
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示无聊情况
|
||||||
|
/// </summary>
|
||||||
|
public void DisplayBoring()
|
||||||
|
{
|
||||||
|
looptimes = 0;
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_A_Start, Core.Save.Mode), DisplayBoringing);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 显示无聊情况
|
||||||
|
/// </summary>
|
||||||
|
private void DisplayBoringing()
|
||||||
|
{
|
||||||
|
if (Function.Rnd.Next(++looptimes) > 10)
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
else
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_B_Loop, Core.Save.Mode), DisplayBoringing);
|
||||||
|
}
|
||||||
|
int looptimes;
|
||||||
|
/// <summary>
|
||||||
|
/// 显示蹲下情况
|
||||||
|
/// </summary>
|
||||||
|
public void DisplaySquat()
|
||||||
|
{
|
||||||
|
looptimes = 0;
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_A_Start, Core.Save.Mode), DisplaySquating);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 显示蹲下情况
|
||||||
|
/// </summary>
|
||||||
|
public void DisplaySquating()
|
||||||
|
{
|
||||||
|
if (Function.Rnd.Next(++looptimes) > 10)
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
else
|
||||||
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_B_Loop, Core.Save.Mode), DisplaySquating);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示拖拽情况
|
/// 显示拖拽情况
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisplayRaised()
|
public void DisplayRaised()
|
||||||
{
|
{
|
||||||
IsNomal = false;
|
|
||||||
//位置迁移: 254-128
|
//位置迁移: 254-128
|
||||||
MainGrid.MouseMove += MainGrid_MouseMove;
|
MainGrid.MouseMove += MainGrid_MouseMove;
|
||||||
rasetype = 0;
|
rasetype = 0;
|
||||||
@ -116,7 +172,6 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
||||||
{
|
{
|
||||||
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
||||||
@ -175,7 +230,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceRight() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceRight() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
||||||
{
|
{
|
||||||
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
||||||
@ -184,6 +239,64 @@ namespace VPet_Simulator.Core
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
///// <summary>
|
||||||
|
///// 显示向左爬 (有判断)
|
||||||
|
///// </summary>
|
||||||
|
//public void DisplayClimb_Bottom_Left()
|
||||||
|
//{
|
||||||
|
// //看看距离是否满足调节
|
||||||
|
// if (Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
|
||||||
|
// {
|
||||||
|
// walklength = 0;
|
||||||
|
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Climb_Bottom_Left, Core.Save.Mode), () =>
|
||||||
|
// {
|
||||||
|
// 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(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
// });
|
||||||
|
// return;
|
||||||
|
// case 1:
|
||||||
|
// DisplayClimb_Left_DOWN(() =>
|
||||||
|
// {
|
||||||
|
// MoveTimer.Stop();
|
||||||
|
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
// });
|
||||||
|
// return;
|
||||||
|
// default:
|
||||||
|
// MoveTimer.Stop();
|
||||||
|
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //不是:继续右边走or停下
|
||||||
|
// if (Function.Rnd.Next(walklength++) < 5)
|
||||||
|
// {
|
||||||
|
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_B_Loop, Core.Save.Mode), DisplayWalk_Lefting);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {//停下来
|
||||||
|
// MoveTimer.Stop();
|
||||||
|
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode), DisplayNomal);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示向右走
|
/// 显示向右走
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -231,11 +344,9 @@ namespace VPet_Simulator.Core
|
|||||||
public void DisplayClimb_Left_UP(Action ifNot = null)
|
public void DisplayClimb_Left_UP(Action ifNot = null)
|
||||||
{
|
{
|
||||||
//看看距离是否满足调节
|
//看看距离是否满足调节
|
||||||
if (Core.Controller.GetWindowsDistanceLeft() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceLeft() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > 300 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
|
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
||||||
{
|
{
|
||||||
@ -269,7 +380,7 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//不是:继续or停下
|
//不是:继续or停下
|
||||||
if (Function.Rnd.Next(walklength++) < 5)
|
if (Function.Rnd.Next(walklength++) < 8)
|
||||||
{
|
{
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Climb_Left, Core.Save.Mode), DisplayClimb_Lefting_UP);
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Climb_Left, Core.Save.Mode), DisplayClimb_Lefting_UP);
|
||||||
}
|
}
|
||||||
@ -288,7 +399,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceLeft() < 50 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
|
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - 145, 0);//TODO:锚定设置
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
||||||
@ -332,7 +443,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceRight() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceRight() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
|
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
||||||
@ -386,7 +497,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceRight() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceRight() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
|
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 185, 0);//TODO:锚定设置
|
||||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
||||||
@ -427,10 +538,9 @@ namespace VPet_Simulator.Core
|
|||||||
public void DisplayClimb_Top_Right()
|
public void DisplayClimb_Top_Right()
|
||||||
{
|
{
|
||||||
//看看距离是否满足调节
|
//看看距离是否满足调节
|
||||||
if (Core.Controller.GetWindowsDistanceUp() < 50 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceRight() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceUp() < 100 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceRight() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
||||||
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
||||||
@ -481,7 +591,7 @@ namespace VPet_Simulator.Core
|
|||||||
if (Core.Controller.GetWindowsDistanceUp() < 50 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
|
if (Core.Controller.GetWindowsDistanceUp() < 50 * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceLeft() > 400 * Core.Controller.ZoomRatio)
|
||||||
{
|
{
|
||||||
walklength = 0;
|
walklength = 0;
|
||||||
IsNomal = false;
|
|
||||||
|
|
||||||
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
||||||
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
||||||
@ -539,9 +649,11 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="EndAction">结束操作</param>
|
/// <param name="EndAction">结束操作</param>
|
||||||
public void Display(IGraph graph, Action EndAction = null)
|
public void Display(IGraph graph, Action EndAction = null)
|
||||||
{
|
{
|
||||||
|
DisplayType = graph.GraphType;
|
||||||
if (PetGrid.Child == graph.This)
|
if (PetGrid.Child == graph.This)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
PetGrid.Visibility = Visibility;
|
PetGrid.Visibility = Visibility;
|
||||||
PetGrid2.Visibility = Visibility.Collapsed;
|
PetGrid2.Visibility = Visibility.Collapsed;
|
||||||
});
|
});
|
||||||
@ -550,7 +662,8 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
else if (PetGrid2.Child == graph.This)
|
else if (PetGrid2.Child == graph.This)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
PetGrid2.Visibility = Visibility;
|
PetGrid2.Visibility = Visibility;
|
||||||
PetGrid.Visibility = Visibility.Collapsed;
|
PetGrid.Visibility = Visibility.Collapsed;
|
||||||
});
|
});
|
||||||
@ -563,7 +676,8 @@ namespace VPet_Simulator.Core
|
|||||||
if (petgridcrlf)
|
if (petgridcrlf)
|
||||||
{
|
{
|
||||||
((IGraph)(PetGrid.Child)).Stop(true);
|
((IGraph)(PetGrid.Child)).Stop(true);
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
PetGrid2.Visibility = Visibility;
|
PetGrid2.Visibility = Visibility;
|
||||||
PetGrid.Visibility = Visibility.Collapsed;
|
PetGrid.Visibility = Visibility.Collapsed;
|
||||||
PetGrid2.Child = graph.This;
|
PetGrid2.Child = graph.This;
|
||||||
@ -577,7 +691,8 @@ namespace VPet_Simulator.Core
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
((IGraph)(PetGrid2.Child)).Stop(true);
|
((IGraph)(PetGrid2.Child)).Stop(true);
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
PetGrid.Visibility = Visibility;
|
PetGrid.Visibility = Visibility;
|
||||||
PetGrid2.Visibility = Visibility.Collapsed;
|
PetGrid2.Visibility = Visibility.Collapsed;
|
||||||
PetGrid.Child = graph.This;
|
PetGrid.Child = graph.This;
|
||||||
|
@ -10,10 +10,6 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
public partial class Main
|
public partial class Main
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 是否在默认情况(playnoaml)
|
|
||||||
/// </summary>
|
|
||||||
public bool IsNomal = true;
|
|
||||||
|
|
||||||
public Timer EventTimer = new Timer(15000)
|
public Timer EventTimer = new Timer(15000)
|
||||||
{
|
{
|
||||||
@ -32,8 +28,8 @@ namespace VPet_Simulator.Core
|
|||||||
//UIHandle
|
//UIHandle
|
||||||
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
|
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
|
||||||
|
|
||||||
if (IsNomal)
|
if (DisplayType == GraphCore.GraphType.Default)
|
||||||
switch (10)//Function.Rnd.Next(10))
|
switch (20)//Function.Rnd.Next(10))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
//随机向右
|
//随机向右
|
||||||
@ -51,12 +47,25 @@ namespace VPet_Simulator.Core
|
|||||||
case 4:
|
case 4:
|
||||||
DisplayClimb_Right_DOWN();
|
DisplayClimb_Right_DOWN();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
DisplayWalk_Right();
|
||||||
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
DisplayClimb_Top_Right();
|
DisplayClimb_Top_Right();
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
DisplayClimb_Top_Left();
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
DisplayBoring();
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
DisplaySquat();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 定点移动位置向量
|
/// 定点移动位置向量
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -34,14 +35,6 @@ namespace VPet_Simulator.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Climb_Top_Left,
|
Climb_Top_Left,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从下向右爬 (循环)
|
|
||||||
/// </summary>
|
|
||||||
Climb_Bottom_Right,
|
|
||||||
/// <summary>
|
|
||||||
/// 从下向左爬 (循环)
|
|
||||||
/// </summary>
|
|
||||||
Climb_Bottom_Left,
|
|
||||||
/// <summary>
|
|
||||||
/// 爬起向右
|
/// 爬起向右
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Climb_Up_Right,
|
Climb_Up_Right,
|
||||||
@ -133,6 +126,18 @@ namespace VPet_Simulator.Core
|
|||||||
/// 走路向左 (结束)
|
/// 走路向左 (结束)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Walk_Left_C_End,
|
Walk_Left_C_End,
|
||||||
|
/// <summary>
|
||||||
|
/// 无聊 (开始)
|
||||||
|
/// </summary>
|
||||||
|
Boring_A_Start,
|
||||||
|
/// <summary>
|
||||||
|
/// 无聊 (循环)
|
||||||
|
/// </summary>
|
||||||
|
Boring_B_Loop,
|
||||||
|
/// <summary>
|
||||||
|
/// 无聊 (结束)
|
||||||
|
/// </summary>
|
||||||
|
Boring_C_End,
|
||||||
}
|
}
|
||||||
///// <summary> loop 应该被取缔
|
///// <summary> loop 应该被取缔
|
||||||
///// 动画类型默认设置 前文本|是否循环|是否常用
|
///// 动画类型默认设置 前文本|是否循环|是否常用
|
||||||
@ -180,12 +185,31 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="type">类型</param>
|
/// <param name="type">类型</param>
|
||||||
public void AddGraph(IGraph graph, GraphType type)
|
public void AddGraph(IGraph graph, GraphType type)
|
||||||
{
|
{
|
||||||
|
//switch (graph.GraphType)
|
||||||
|
//{
|
||||||
|
// case GraphType.Default:
|
||||||
|
// case GraphType.Boring_B_Loop:
|
||||||
|
// case GraphType.Squat_B_Loop:
|
||||||
|
// graph.IsLoop = true;
|
||||||
|
// break;
|
||||||
|
//}//循环真要不得,要做随机循环
|
||||||
if (!Graphs.ContainsKey(type))
|
if (!Graphs.ContainsKey(type))
|
||||||
{
|
{
|
||||||
Graphs.Add(type, new List<IGraph>());
|
Graphs.Add(type, new List<IGraph>());
|
||||||
}
|
}
|
||||||
Graphs[type].Add(graph);
|
Graphs[type].Add(graph);
|
||||||
}
|
}
|
||||||
|
public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype, bool storemem = false)
|
||||||
|
{
|
||||||
|
var paths = new DirectoryInfo(path).GetFiles();
|
||||||
|
if (paths.Length == 0)
|
||||||
|
return;
|
||||||
|
if (paths.Length == 1)
|
||||||
|
AddGraph(new Picture(paths[0].FullName, modetype, graphtype,
|
||||||
|
int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last())), graphtype);
|
||||||
|
else
|
||||||
|
AddGraph(new PNGAnimation(paths, modetype, graphtype, storemem), graphtype);
|
||||||
|
}
|
||||||
public IGraph FindGraph(GraphType type, Save.ModeType mode)
|
public IGraph FindGraph(GraphType type, Save.ModeType mode)
|
||||||
{
|
{
|
||||||
if (Graphs.ContainsKey(type))
|
if (Graphs.ContainsKey(type))
|
||||||
|
@ -58,10 +58,10 @@ namespace VPet_Simulator.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新建 PNG 动画
|
/// 新建 PNG 动画
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">文件夹位置</param>
|
/// <param name="paths">文件夹位置</param>
|
||||||
/// <param name="isLoop">是否循环</param>
|
/// <param name="isLoop">是否循环</param>
|
||||||
/// <param name="storemem">是否储存到内存以支持快速显示</param>
|
/// <param name="storemem">是否储存到内存以支持快速显示</param>
|
||||||
public PNGAnimation(string path, Save.ModeType modetype, GraphCore.GraphType graphtype, bool storemem = false, 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>();
|
||||||
@ -70,7 +70,7 @@ namespace VPet_Simulator.Core
|
|||||||
GraphType = graphtype;
|
GraphType = graphtype;
|
||||||
ModeType = modetype;
|
ModeType = modetype;
|
||||||
if (storemem)
|
if (storemem)
|
||||||
foreach (var file in new DirectoryInfo(path).GetFiles())
|
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());
|
||||||
var img = new Image()
|
var img = new Image()
|
||||||
@ -99,13 +99,11 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Visibility = Visibility.Hidden
|
Visibility = Visibility.Hidden
|
||||||
};
|
};
|
||||||
var fs = new DirectoryInfo(path).GetFiles();
|
int time = int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
|
||||||
|
|
||||||
int time = int.Parse(fs[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last());
|
|
||||||
//第一张图:有专门自己的图层
|
//第一张图:有专门自己的图层
|
||||||
var img = new Image()
|
var img = new Image()
|
||||||
{
|
{
|
||||||
Source = new BitmapImage(new Uri(fs[0].FullName)),
|
Source = new BitmapImage(new Uri(paths[0].FullName)),
|
||||||
Visibility = Visibility.Hidden
|
Visibility = Visibility.Hidden
|
||||||
};
|
};
|
||||||
MainGrid.Children.Add(img);
|
MainGrid.Children.Add(img);
|
||||||
@ -115,16 +113,16 @@ namespace VPet_Simulator.Core
|
|||||||
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(fs[1].FullName));
|
imgs[1].Source = new BitmapImage(new Uri(paths[1].FullName));
|
||||||
}, () => img.Visibility = Visibility.Hidden));
|
}, () => img.Visibility = Visibility.Hidden));
|
||||||
|
|
||||||
int last = fs.Count() - 1;
|
int last = paths.Count() - 1;
|
||||||
for (int i = 1; i < last; i++)
|
for (int i = 1; i < last; i++)
|
||||||
{
|
{
|
||||||
time = int.Parse(fs[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 = fs[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;
|
||||||
@ -133,7 +131,7 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
//最后一张图: 不处理下一张图的imgsSources
|
//最后一张图: 不处理下一张图的imgsSources
|
||||||
|
|
||||||
time = int.Parse(fs[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));
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,14 @@ namespace VPet_Simulator.Core
|
|||||||
/// 新建新静态图像
|
/// 新建新静态图像
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">图片路径</param>
|
/// <param name="path">图片路径</param>
|
||||||
public Picture(string path, Save.ModeType modetype, int length = 1000, bool isloop = false)
|
public Picture(string path, Save.ModeType modetype, GraphCore.GraphType graphType, int length = 1000, bool isloop = false)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ModeType = modetype;
|
ModeType = modetype;
|
||||||
IsLoop = isloop;
|
IsLoop = isloop;
|
||||||
Length = length;
|
Length = length;
|
||||||
Source = new BitmapImage(new Uri(path));
|
Source = new BitmapImage(new Uri(path));
|
||||||
|
GraphType = graphType;
|
||||||
}
|
}
|
||||||
public Save.ModeType ModeType { get; private set; }
|
public Save.ModeType ModeType { get; private set; }
|
||||||
|
|
||||||
@ -42,9 +43,9 @@ namespace VPet_Simulator.Core
|
|||||||
|
|
||||||
public UIElement This => this;
|
public UIElement This => this;
|
||||||
|
|
||||||
public bool IsContinue { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public bool IsContinue { get; set; }
|
||||||
|
|
||||||
public GraphCore.GraphType GraphType => throw new NotImplementedException();
|
public GraphCore.GraphType GraphType { get; set; }
|
||||||
|
|
||||||
public void Run(Action EndAction = null)
|
public void Run(Action EndAction = null)
|
||||||
{
|
{
|
||||||
|
@ -66,19 +66,19 @@ namespace VPet_Simulator.Windows
|
|||||||
|
|
||||||
if (path_name.Contains("happy"))
|
if (path_name.Contains("happy"))
|
||||||
{
|
{
|
||||||
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Happy, (GraphType)i, storemem), (GraphType)i);
|
graph.AddGraph(di.FullName, Save.ModeType.Happy, (GraphType)i, storemem);
|
||||||
}
|
}
|
||||||
if (path_name.Contains("nomal"))
|
if (path_name.Contains("nomal"))
|
||||||
{
|
{
|
||||||
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Nomal, (GraphType)i, storemem), (GraphType)i);
|
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i, storemem);
|
||||||
}
|
}
|
||||||
if (path_name.Contains("poorcondition"))
|
if (path_name.Contains("poorcondition"))
|
||||||
{
|
{
|
||||||
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.PoorCondition, (GraphType)i, storemem), (GraphType)i);
|
graph.AddGraph(di.FullName, Save.ModeType.PoorCondition, (GraphType)i, storemem);
|
||||||
}
|
}
|
||||||
if (path_name.Contains("ill"))
|
if (path_name.Contains("ill"))
|
||||||
{
|
{
|
||||||
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Ill, (GraphType)i, storemem), (GraphType)i);
|
graph.AddGraph(di.FullName, Save.ModeType.Ill, (GraphType)i, storemem);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 184 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 193 KiB |
Before Width: | Height: | Size: 167 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 167 KiB |
Before Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 153 KiB |
Before Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 139 KiB |
Before Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 139 KiB |
Before Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 153 KiB |
Before Width: | Height: | Size: 161 KiB |