mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
支持动画参数
This commit is contained in:
parent
17c96bcded
commit
3210cc7c2b
Binary file not shown.
Before Width: | Height: | Size: 5.5 MiB After Width: | Height: | Size: 4.3 MiB |
BIN
README.assets/ss8.gif
Normal file
BIN
README.assets/ss8.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 810 KiB |
BIN
README.assets/主图.png
Normal file
BIN
README.assets/主图.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 MiB |
@ -2,7 +2,7 @@
|
||||
|
||||
虚拟桌宠模拟器 一个开源的桌宠软件, 可以内置到任何WPF应用程序
|
||||
|
||||
![ss4](README.assets/ss4.gif)
|
||||
![主图](README.assets/%E4%B8%BB%E5%9B%BE.png)
|
||||
|
||||
获取虚拟桌宠模拟器 [OnSteam(免费)](https://store.steampowered.com/app/1920960/VPet) 或 通过[Nuget]()内置到你的WPF应用程序
|
||||
|
||||
@ -26,7 +26,9 @@
|
||||
|
||||
##### 提起
|
||||
|
||||
![ss4](README.assets/ss4.gif)
|
||||
![ss4](README.assets/ss4.gif)![ss4](README.assets/ss8.gif)
|
||||
|
||||
|
||||
|
||||
##### 爬墙
|
||||
|
||||
|
@ -52,9 +52,8 @@ namespace VPet_Simulator.Core
|
||||
MsgBar = new MessageBar();
|
||||
MsgBar.Visibility = Visibility.Collapsed;
|
||||
UIGrid.Children.Add(MsgBar);
|
||||
//TODO:锚定设置
|
||||
Core.TouchEvent.Add(new TouchArea(new Point(138, 12), new Size(224, 176), DisplayTouchHead));
|
||||
Core.TouchEvent.Add(new TouchArea(new Point(0, 0), new Size(500, 180), DisplayRaised, true));
|
||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchHeadLocate, Core.Graph.GraphConfig.TouchHeadSize, DisplayTouchHead));
|
||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true));
|
||||
var ig = Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode);
|
||||
PetGrid.Child = ig.This;
|
||||
ig.Run(DisplayNomal);
|
||||
@ -108,7 +107,7 @@ namespace VPet_Simulator.Core
|
||||
private void MainGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
isPress = false;
|
||||
if (rasetype != -1)
|
||||
if (rasetype != int.MinValue)
|
||||
{
|
||||
MainGrid.MouseMove -= MainGrid_MouseMove;
|
||||
rasetype = -1;
|
||||
@ -119,8 +118,8 @@ namespace VPet_Simulator.Core
|
||||
private void MainGrid_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var mp = e.GetPosition(MainGrid);
|
||||
var x = mp.X - 290;//TODO:锚定设置
|
||||
var y = mp.Y - 128;
|
||||
var x = mp.X - Core.Graph.GraphConfig.RaisePoint.X;
|
||||
var y = mp.Y - Core.Graph.GraphConfig.RaisePoint.Y;
|
||||
Core.Controller.MoveWindows(x, y);
|
||||
if (Math.Abs(x) + Math.Abs(y) > 10)
|
||||
rasetype = 0;
|
||||
|
@ -9,17 +9,26 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using static VPet_Simulator.Core.GraphCore;
|
||||
|
||||
namespace VPet_Simulator.Core
|
||||
{
|
||||
public partial class Main
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前动画类型
|
||||
/// </summary>
|
||||
public GraphCore.GraphType DisplayType = GraphCore.GraphType.Default;
|
||||
/// <summary>
|
||||
/// 默认循环次数
|
||||
/// </summary>
|
||||
public int CountNomal = 0;
|
||||
/// <summary>
|
||||
/// 显示默认情况
|
||||
/// </summary>
|
||||
public void DisplayNomal()
|
||||
{
|
||||
CountNomal++;
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode), DisplayNomal);
|
||||
}
|
||||
/// <summary>
|
||||
@ -46,15 +55,15 @@ namespace VPet_Simulator.Core
|
||||
/// </summary>
|
||||
public void DisplayTouchHead()
|
||||
{
|
||||
if (petgridcrlf)
|
||||
if (DisplayType == GraphCore.GraphType.Touch_Head_B_Loop)
|
||||
if (PetGrid.Child is IGraph ig && ig.GraphType == GraphCore.GraphType.Touch_Head_B_Loop)
|
||||
{
|
||||
((IGraph)PetGrid.Child).IsContinue = true;
|
||||
ig.IsContinue = true;
|
||||
return;
|
||||
}
|
||||
else if (PetGrid2.Child is IGraph ig2 && ig2.GraphType == GraphCore.GraphType.Touch_Head_B_Loop)
|
||||
{
|
||||
((IGraph)PetGrid.Child).IsContinue = true;
|
||||
ig2.IsContinue = true;
|
||||
return;
|
||||
}
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, Core.Save.Mode), () =>
|
||||
@ -120,7 +129,7 @@ namespace VPet_Simulator.Core
|
||||
// Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode)
|
||||
//))));
|
||||
}
|
||||
int rasetype = -1;
|
||||
int rasetype = int.MinValue;
|
||||
int walklength = 0;
|
||||
/// <summary>
|
||||
/// 显示拖拽中
|
||||
@ -131,7 +140,7 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
case -1:
|
||||
DisplayFalled_Left();
|
||||
rasetype = -2;
|
||||
rasetype = int.MinValue;
|
||||
return;
|
||||
case 0:
|
||||
case 1:
|
||||
@ -174,7 +183,7 @@ namespace VPet_Simulator.Core
|
||||
walklength = 0;
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_A_Start, Core.Save.Mode), () =>
|
||||
{
|
||||
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk, 0);
|
||||
MoveTimer.Start();
|
||||
DisplayWalk_Lefting();
|
||||
});
|
||||
@ -233,12 +242,53 @@ namespace VPet_Simulator.Core
|
||||
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_A_Start, Core.Save.Mode), () =>
|
||||
{
|
||||
MoveTimerPoint = new Point(-20, 0);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk, 0);
|
||||
MoveTimer.Start();
|
||||
DisplayWalk_Righting();
|
||||
});
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示向右走
|
||||
/// </summary>
|
||||
private void DisplayWalk_Righting()
|
||||
{
|
||||
//看看距离是不是不足
|
||||
if (Core.Controller.GetWindowsDistanceRight() < 50 * Core.Controller.ZoomRatio)
|
||||
{//是,停下恢复默认 or/爬墙
|
||||
switch (Function.Rnd.Next(3))
|
||||
{
|
||||
case 0:
|
||||
DisplayClimb_Right_UP(() =>
|
||||
{
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
});
|
||||
return;
|
||||
case 1:
|
||||
DisplayClimb_Right_DOWN(() =>
|
||||
{
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
});
|
||||
return;
|
||||
default:
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//不是:继续右边走or停下
|
||||
if (Function.Rnd.Next(walklength++) < 5)
|
||||
{
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_B_Loop, Core.Save.Mode), DisplayWalk_Righting);
|
||||
}
|
||||
else
|
||||
{//停下来
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// 显示向左爬 (有判断)
|
||||
///// </summary>
|
||||
@ -298,47 +348,6 @@ namespace VPet_Simulator.Core
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 显示向右走
|
||||
/// </summary>
|
||||
private void DisplayWalk_Righting()
|
||||
{
|
||||
//看看距离是不是不足
|
||||
if (Core.Controller.GetWindowsDistanceRight() < 50 * Core.Controller.ZoomRatio)
|
||||
{//是,停下恢复默认 or/爬墙
|
||||
switch (Function.Rnd.Next(3))
|
||||
{
|
||||
case 0:
|
||||
DisplayClimb_Right_UP(() =>
|
||||
{
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
});
|
||||
return;
|
||||
case 1:
|
||||
DisplayClimb_Right_DOWN(() =>
|
||||
{
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
});
|
||||
return;
|
||||
default:
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//不是:继续右边走or停下
|
||||
if (Function.Rnd.Next(walklength++) < 5)
|
||||
{
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_B_Loop, Core.Save.Mode), DisplayWalk_Righting);
|
||||
}
|
||||
else
|
||||
{//停下来
|
||||
MoveTimer.Stop();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode), DisplayNomal);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示左墙壁爬行 上
|
||||
/// </summary>
|
||||
public void DisplayClimb_Left_UP(Action ifNot = null)
|
||||
@ -350,7 +359,7 @@ namespace VPet_Simulator.Core
|
||||
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), () =>
|
||||
{
|
||||
MoveTimerPoint = new Point(0, -10);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Lefting_UP();
|
||||
});
|
||||
@ -404,7 +413,7 @@ namespace VPet_Simulator.Core
|
||||
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), () =>
|
||||
{
|
||||
MoveTimerPoint = new System.Windows.Point(0, 10);//TODO:锚定设置
|
||||
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Lefting_DOWN();
|
||||
});
|
||||
@ -448,7 +457,7 @@ namespace VPet_Simulator.Core
|
||||
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), () =>
|
||||
{
|
||||
MoveTimerPoint = new Point(0, -10);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Righting_UP();
|
||||
});
|
||||
@ -502,7 +511,7 @@ namespace VPet_Simulator.Core
|
||||
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), () =>
|
||||
{
|
||||
MoveTimerPoint = new Point(0, 10);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Righting_DOWN();
|
||||
});
|
||||
@ -543,7 +552,7 @@ namespace VPet_Simulator.Core
|
||||
walklength = 0;
|
||||
|
||||
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop, 0);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Top_Righting();
|
||||
}
|
||||
@ -594,7 +603,7 @@ namespace VPet_Simulator.Core
|
||||
|
||||
|
||||
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(8, 0);//TODO:锚定设置
|
||||
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop, 0);
|
||||
MoveTimer.Start();
|
||||
DisplayClimb_Top_Lefting();
|
||||
}
|
||||
@ -648,13 +657,17 @@ namespace VPet_Simulator.Core
|
||||
/// <param name="graph">动画</param>
|
||||
/// <param name="EndAction">结束操作</param>
|
||||
public void Display(IGraph graph, Action EndAction = null)
|
||||
{
|
||||
{
|
||||
//if(graph.GraphType == GraphType.Climb_Up_Left)
|
||||
//{
|
||||
// Dispatcher.Invoke(() => Say(graph.GraphType.ToString()));
|
||||
//}
|
||||
DisplayType = graph.GraphType;
|
||||
if (PetGrid.Child == graph.This)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
PetGrid.Visibility = Visibility;
|
||||
PetGrid.Visibility = Visibility.Visible;
|
||||
PetGrid2.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
((IGraph)(PetGrid.Child)).Run(EndAction);
|
||||
@ -664,7 +677,7 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
PetGrid2.Visibility = Visibility;
|
||||
PetGrid2.Visibility = Visibility.Visible;
|
||||
PetGrid.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
((IGraph)(PetGrid2.Child)).Run(EndAction);
|
||||
@ -678,9 +691,9 @@ namespace VPet_Simulator.Core
|
||||
((IGraph)(PetGrid.Child)).Stop(true);
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
PetGrid2.Visibility = Visibility;
|
||||
PetGrid.Visibility = Visibility.Collapsed;
|
||||
PetGrid2.Child = graph.This;
|
||||
PetGrid.Visibility = Visibility.Collapsed;
|
||||
PetGrid2.Visibility = Visibility.Visible;
|
||||
});
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
@ -693,9 +706,9 @@ namespace VPet_Simulator.Core
|
||||
((IGraph)(PetGrid2.Child)).Stop(true);
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
PetGrid.Visibility = Visibility;
|
||||
PetGrid2.Visibility = Visibility.Collapsed;
|
||||
PetGrid.Child = graph.This;
|
||||
PetGrid2.Visibility = Visibility.Collapsed;
|
||||
PetGrid.Visibility = Visibility.Visible;
|
||||
});
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
|
@ -28,8 +28,8 @@ namespace VPet_Simulator.Core
|
||||
//UIHandle
|
||||
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
|
||||
|
||||
if (DisplayType == GraphCore.GraphType.Default)
|
||||
switch (20)//Function.Rnd.Next(10))
|
||||
if (DisplayType == GraphCore.GraphType.Default)
|
||||
switch (-1)//Function.Rnd.Next(10))
|
||||
{
|
||||
case 0:
|
||||
//随机向右
|
||||
@ -56,10 +56,10 @@ namespace VPet_Simulator.Core
|
||||
case 11:
|
||||
DisplayClimb_Top_Left();
|
||||
break;
|
||||
case 20:
|
||||
case 15:
|
||||
DisplayBoring();
|
||||
break;
|
||||
case 21:
|
||||
case 16:
|
||||
DisplaySquat();
|
||||
break;
|
||||
default:
|
||||
|
@ -1,14 +1,17 @@
|
||||
using System;
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace VPet_Simulator.Core
|
||||
{
|
||||
public class GraphCore
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 动画类型
|
||||
/// </summary>
|
||||
@ -199,6 +202,13 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
Graphs[type].Add(graph);
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加动画 自动创建
|
||||
/// </summary>
|
||||
/// <param name="path">位置</param>
|
||||
/// <param name="modetype">状态类型</param>
|
||||
/// <param name="graphtype">动画类型</param>
|
||||
/// <param name="storemem">是否储存到内存以节约加载</param>
|
||||
public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype, bool storemem = false)
|
||||
{
|
||||
var paths = new DirectoryInfo(path).GetFiles();
|
||||
@ -210,6 +220,12 @@ namespace VPet_Simulator.Core
|
||||
else
|
||||
AddGraph(new PNGAnimation(paths, modetype, graphtype, storemem), graphtype);
|
||||
}
|
||||
/// <summary>
|
||||
/// 查找动画
|
||||
/// </summary>
|
||||
/// <param name="type">动画类型</param>
|
||||
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
||||
/// <returns></returns>
|
||||
public IGraph FindGraph(GraphType type, Save.ModeType mode)
|
||||
{
|
||||
if (Graphs.ContainsKey(type))
|
||||
@ -227,6 +243,9 @@ namespace VPet_Simulator.Core
|
||||
return FindGraph(GraphType.Default, mode);
|
||||
}
|
||||
static string[] graphtypevalue = null;
|
||||
/// <summary>
|
||||
/// 动画类型默认前文本
|
||||
/// </summary>
|
||||
public static string[] GraphTypeValue
|
||||
{
|
||||
get
|
||||
@ -244,5 +263,115 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
}
|
||||
|
||||
public Config GraphConfig;
|
||||
/// <summary>
|
||||
/// 动画设置
|
||||
/// </summary>
|
||||
public class Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 摸头触发位置
|
||||
/// </summary>
|
||||
public Point TouchHeadLocate;
|
||||
/// <summary>
|
||||
/// 提起触发位置
|
||||
/// </summary>
|
||||
public Point TouchRaisedLocate;
|
||||
/// <summary>
|
||||
/// 摸头触发大小
|
||||
/// </summary>
|
||||
public Size TouchHeadSize;
|
||||
/// <summary>
|
||||
/// 提起触发大小
|
||||
/// </summary>
|
||||
public Size TouchRaisedSize;
|
||||
|
||||
/// <summary>
|
||||
/// 提起定位点
|
||||
/// </summary>
|
||||
public Point RaisePoint;
|
||||
/// <summary>
|
||||
/// 行走速度
|
||||
/// </summary>
|
||||
public double SpeedWalk;
|
||||
/// <summary>
|
||||
/// 侧边爬行速度
|
||||
/// </summary>
|
||||
public double SpeedClimb;
|
||||
/// <summary>
|
||||
/// 顶部爬行速度
|
||||
/// </summary>
|
||||
public double SpeedClimbTop;
|
||||
/// <summary>
|
||||
/// 爬行速度
|
||||
/// </summary>
|
||||
public double SpeedCrawl;
|
||||
/// <summary>
|
||||
/// 定位爬行左边距离
|
||||
/// </summary>
|
||||
public double LocateClimbLeft;
|
||||
/// <summary>
|
||||
/// 定位爬行右边距离
|
||||
/// </summary>
|
||||
public double LocateClimbRight;
|
||||
/// <summary>
|
||||
/// 定位爬行上边距离
|
||||
/// </summary>
|
||||
public double LocateClimbTop;
|
||||
/// <summary>
|
||||
/// 初始化设置
|
||||
/// </summary>
|
||||
/// <param name="lps"></param>
|
||||
public Config(LpsDocument lps)
|
||||
{
|
||||
TouchHeadLocate = new Point(lps["touchhead"][(gdbe)"px"], lps["touchhead"][(gdbe)"py"]);
|
||||
TouchHeadSize = new Size(lps["touchhead"][(gdbe)"sw"], lps["touchhead"][(gdbe)"sh"]);
|
||||
TouchRaisedLocate = new Point(lps["touchraised"][(gdbe)"px"], lps["touchraised"][(gdbe)"py"]);
|
||||
TouchRaisedSize = new Size(lps["touchraised"][(gdbe)"sw"], lps["touchraised"][(gdbe)"sh"]);
|
||||
RaisePoint = new Point(lps["raisepoint"][(gdbe)"x"], lps["raisepoint"][(gdbe)"y"]);
|
||||
var s = lps["speed"];
|
||||
SpeedWalk = s[(gdbe)"walk"];
|
||||
SpeedClimb = s[(gdbe)"climb"];
|
||||
SpeedClimbTop = s[(gdbe)"climbtop"];
|
||||
SpeedCrawl = s[(gdbe)"crawl"];
|
||||
s = lps["locate"];
|
||||
LocateClimbLeft = s[(gdbe)"climbleft"];
|
||||
LocateClimbRight = s[(gdbe)"climbright"];
|
||||
LocateClimbTop = s[(gdbe)"climbtop"];
|
||||
}
|
||||
/// <summary>
|
||||
/// 加载更多设置,新的替换后来的,允许空内容
|
||||
/// </summary>
|
||||
public void Set(LpsDocument lps)
|
||||
{
|
||||
if (lps.HaveLine("touchhead"))
|
||||
{
|
||||
TouchHeadLocate = new Point(lps["touchhead"][(gdbe)"px"], lps["touchhead"][(gdbe)"py"]);
|
||||
TouchHeadSize = new Size(lps["touchhead"][(gdbe)"sw"], lps["touchhead"][(gdbe)"wh"]);
|
||||
}
|
||||
if (lps.HaveLine("touchraised"))
|
||||
{
|
||||
TouchRaisedLocate = new Point(lps["touchraised"][(gdbe)"px"], lps["touchraised"][(gdbe)"py"]);
|
||||
TouchRaisedSize = new Size(lps["touchraised"][(gdbe)"sw"], lps["touchraised"][(gdbe)"wh"]);
|
||||
}
|
||||
if (lps.HaveLine("raisepoint"))
|
||||
RaisePoint = new Point(lps["raisepoint"][(gdbe)"x"], lps["raisepoint"][(gdbe)"y"]);
|
||||
var s = lps.FindLine("speed");
|
||||
if (s != null)
|
||||
{
|
||||
SpeedWalk = s.GetDouble("walk", SpeedWalk);
|
||||
SpeedClimb = s.GetDouble("climb", SpeedWalk);
|
||||
SpeedClimbTop = s.GetDouble("climbtop", SpeedWalk);
|
||||
SpeedCrawl = s.GetDouble("crawl", SpeedWalk);
|
||||
}
|
||||
s = lps.FindLine("locate");
|
||||
if (s != null)
|
||||
{
|
||||
LocateClimbLeft = s.GetDouble("climbleft", LocateClimbLeft);
|
||||
LocateClimbRight = s.GetDouble("climbright", LocateClimbRight);
|
||||
LocateClimbTop = s.GetDouble("climbtop", LocateClimbTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ namespace VPet_Simulator.Core
|
||||
|
||||
public GraphCore.GraphType GraphType { get; private set; }
|
||||
|
||||
private Action endwilldo;
|
||||
int nowid;
|
||||
/// <summary>
|
||||
/// 新建 PNG 动画
|
||||
@ -183,10 +184,11 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.Dispatcher.Invoke(Hidden);
|
||||
parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden);
|
||||
if (parent.DoEndAction)
|
||||
EndAction?.Invoke();//运行结束动画时事件
|
||||
//重新加载第一帧
|
||||
|
||||
//重新加载第一帧
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// Thread.Sleep(25);
|
||||
@ -203,13 +205,14 @@ namespace VPet_Simulator.Core
|
||||
else
|
||||
{
|
||||
parent.IsContinue = false;
|
||||
parent.Dispatcher.Invoke(Hidden);
|
||||
if (parent.DoEndAction)
|
||||
EndAction?.Invoke();//运行结束动画时事件
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(25);
|
||||
parent.Dispatcher.Invoke(Hidden);
|
||||
});
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// Thread.Sleep(25);
|
||||
// parent.Dispatcher.Invoke(Hidden);
|
||||
//});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,6 +221,11 @@ namespace VPet_Simulator.Core
|
||||
/// </summary>
|
||||
public void Run(Action EndAction = null)
|
||||
{
|
||||
if(endwilldo != null && nowid != Animations.Count)
|
||||
{
|
||||
endwilldo.Invoke();
|
||||
endwilldo = null;
|
||||
}
|
||||
nowid = 0;
|
||||
PlayState = true;
|
||||
DoEndAction = true;
|
||||
|
@ -6,15 +6,14 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
using VPet_Simulator.Core;
|
||||
using static VPet_Simulator.Core.GraphCore;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
namespace VPet_Simulator.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 宠物
|
||||
/// 宠物加载器
|
||||
/// </summary>
|
||||
public class CorePet
|
||||
public class PetLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// 宠物图像
|
||||
@ -24,6 +23,7 @@ namespace VPet_Simulator.Windows
|
||||
var g = new GraphCore();
|
||||
foreach (var p in path)
|
||||
LoadGraph(g, new DirectoryInfo(p), "", storemem);
|
||||
g.GraphConfig = Config;
|
||||
return g;
|
||||
}
|
||||
/// <summary>
|
||||
@ -38,13 +38,13 @@ namespace VPet_Simulator.Windows
|
||||
/// 宠物介绍
|
||||
/// </summary>
|
||||
public string Intor;
|
||||
public Line GraphSetting;
|
||||
public CorePet(LpsDocument lps, DirectoryInfo directory)
|
||||
public GraphCore.Config Config;
|
||||
public PetLoader(LpsDocument lps, DirectoryInfo directory)
|
||||
{
|
||||
Name = lps.First().Info;
|
||||
Intor = lps.First()["intor"].Info;
|
||||
path.Add(directory.FullName + "\\" + lps.First()["path"].Info);
|
||||
GraphSetting = lps["graph"];
|
||||
Config = new Config(lps);
|
||||
}
|
||||
|
||||
public static void LoadGraph(GraphCore graph, DirectoryInfo di, string path_name,bool storemem)
|
@ -157,6 +157,7 @@
|
||||
<Compile Include="Handle\Function.cs" />
|
||||
<Compile Include="Handle\GameCore.cs" />
|
||||
<Compile Include="Handle\IController.cs" />
|
||||
<Compile Include="Handle\PetLoader.cs" />
|
||||
<Compile Include="Handle\Save.cs" />
|
||||
<Compile Include="Item\Drink.cs" />
|
||||
<Compile Include="Item\Food.cs" />
|
||||
|
@ -73,12 +73,11 @@ namespace VPet_Simulator.Windows
|
||||
var name = lps.First().Info;
|
||||
var p = mw.Pets.FirstOrDefault(x => x.Name == name);
|
||||
if (p == null)
|
||||
mw.Pets.Add(new CorePet(lps, di));
|
||||
mw.Pets.Add(new PetLoader(lps, di));
|
||||
else
|
||||
{
|
||||
p.path.Add(di.FullName + "\\" + lps.First()["path"].Info);
|
||||
foreach (var sub in lps["graph"])
|
||||
p.GraphSetting.AddorReplaceSub(sub);
|
||||
p.Config.Set(lps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace VPet_Simulator.Windows
|
||||
public readonly string ModPath = Environment.CurrentDirectory + @"\mod";
|
||||
public readonly bool IsSteamUser;
|
||||
public Setting Set;
|
||||
public List<CorePet> Pets = new List<CorePet>();
|
||||
public List<PetLoader> Pets = new List<PetLoader>();
|
||||
public List<CoreMOD> CoreMODs = new List<CoreMOD>();
|
||||
public GameCore Core = new GameCore();
|
||||
public winGameSetting winSetting;
|
||||
|
@ -110,7 +110,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Function\CoreMOD.cs" />
|
||||
<Compile Include="Function\CorePet.cs" />
|
||||
<Compile Include="Function\Setting.cs" />
|
||||
<Compile Include="MainWindow.cs" />
|
||||
<Compile Include="WinDesign\winCharacterPanel.xaml.cs">
|
||||
|
@ -1 +1,6 @@
|
||||
pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:|
|
||||
pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:|
|
||||
touchhead:|px#138:|py#12:|sw#224:|sh#176:|
|
||||
touchraised:|px#0:|py#0:|sw#500:|sh#180:|
|
||||
raisepoint:|x#290:|y#128:|
|
||||
speed:|walk#20:|climb#10:|climbtop#8:|crawl#8:|
|
||||
locate:|climbleft#145:|climbright#185:|climbtop#150:|
|
Loading…
Reference in New Issue
Block a user