更新循环和显示逻辑&更新新动画

This commit is contained in:
ZouJin 2023-01-19 02:00:30 +08:00
parent 03b47558fa
commit 28f1831856
104 changed files with 158 additions and 164 deletions

View File

@ -57,7 +57,8 @@ namespace VPet_Simulator.Core
Core.TouchEvent.Add(new TouchArea(new Point(0, 0), new Size(500, 180), DisplayRaised, true));
var ig = Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode);
PetGrid.Child = ig.This;
ig.Run();
ig.Run(DisplayNomal);
EventTimer.Elapsed += EventTimer_Elapsed;
MoveTimer.Elapsed += MoveTimer_Elapsed;
@ -109,6 +110,7 @@ namespace VPet_Simulator.Core
{
MainGrid.MouseMove -= MainGrid_MouseMove;
rasetype = -1;
DisplayRaising();
}
}

View File

@ -19,7 +19,7 @@ namespace VPet_Simulator.Core
public void DisplayNomal()
{
IsNomal = true;
Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode));
Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode), DisplayNomal);
}
/// <summary>
/// 显示摸头情况
@ -74,7 +74,7 @@ namespace VPet_Simulator.Core
switch (rasetype++)
{
case -1:
DisplayFalled();
DisplayFalled_Left();
rasetype = -2;
return;
case 0:
@ -92,11 +92,20 @@ namespace VPet_Simulator.Core
}
}
/// <summary>
/// 显示掉到地上
/// 显示掉到地上 从左边
/// </summary>
public void DisplayFalled()
{//TODO:爬起
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_B_End, Core.Save.Mode), DisplayNomal);
public void DisplayFalled_Left()
{
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Left_B_End, Core.Save.Mode),
() => Display(Core.Graph.FindGraph(GraphCore.GraphType.Climb_Up_Left, Core.Save.Mode), DisplayNomal));
}
/// <summary>
/// 显示掉到地上 从左边
/// </summary>
public void DisplayFalled_Right()
{
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Right_B_End, Core.Save.Mode),
() => Display(Core.Graph.FindGraph(GraphCore.GraphType.Climb_Up_Right, Core.Save.Mode), DisplayNomal));
}
/// <summary>
/// 显示向左走 (有判断)
@ -532,11 +541,19 @@ namespace VPet_Simulator.Core
{
if (PetGrid.Child == graph.This)
{
Dispatcher.Invoke(() => {
PetGrid.Visibility = Visibility;
PetGrid2.Visibility = Visibility.Collapsed;
});
((IGraph)(PetGrid.Child)).Run(EndAction);
return;
}
else if (PetGrid2.Child == graph.This)
{
Dispatcher.Invoke(() => {
PetGrid2.Visibility = Visibility;
PetGrid.Visibility = Visibility.Collapsed;
});
((IGraph)(PetGrid2.Child)).Run(EndAction);
return;
}
@ -546,22 +563,30 @@ namespace VPet_Simulator.Core
if (petgridcrlf)
{
((IGraph)(PetGrid.Child)).Stop(true);
Dispatcher.Invoke(() => PetGrid2.Child = graph.This);
Task.Run(() =>
{
Thread.Sleep(25);
Dispatcher.Invoke(() => PetGrid.Child = null);
Dispatcher.Invoke(() => {
PetGrid2.Visibility = Visibility;
PetGrid.Visibility = Visibility.Collapsed;
PetGrid2.Child = graph.This;
});
//Task.Run(() =>
//{
// Thread.Sleep(25);
// Dispatcher.Invoke(() => PetGrid.Child = null);
//});
}
else
{
((IGraph)(PetGrid2.Child)).Stop(true);
Dispatcher.Invoke(() => PetGrid.Child = graph.This);
Task.Run(() =>
{
Thread.Sleep(25);
Dispatcher.Invoke(() => PetGrid2.Child = null);
Dispatcher.Invoke(() => {
PetGrid.Visibility = Visibility;
PetGrid2.Visibility = Visibility.Collapsed;
PetGrid.Child = graph.This;
});
//Task.Run(() =>
//{
// Thread.Sleep(25);
// Dispatcher.Invoke(() => PetGrid2.Child = null);
//});
}
petgridcrlf = !petgridcrlf;

View File

@ -33,7 +33,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
if (IsNomal)
switch (1)//Function.Rnd.Next(10))
switch (10)//Function.Rnd.Next(10))
{
case 0:
//随机向右

View File

@ -223,7 +223,7 @@ namespace VPet_Simulator.Core
private void MenuDIY_Click(object sender, RoutedEventArgs e)
{
m.Say("您好,我是玛哈萝, 让我来帮您熟悉并掌握使用vos系统,成为永世流传的虚拟主播.");
m.Say("您好,我是莉斯, 让我来帮您熟悉并掌握使用vos系统,成为永世流传的虚拟主播.");
}
}
}

View File

@ -34,6 +34,22 @@ namespace VPet_Simulator.Core
/// </summary>
Climb_Top_Left,
/// <summary>
/// 从下向右爬 (循环)
/// </summary>
Climb_Bottom_Right,
/// <summary>
/// 从下向左爬 (循环)
/// </summary>
Climb_Bottom_Left,
/// <summary>
/// 爬起向右
/// </summary>
Climb_Up_Right,
/// <summary>
/// 爬起向左
/// </summary>
Climb_Up_Left,
/// <summary>
/// 从右边爬 (循环)
/// </summary>
Climb_Right,
@ -78,13 +94,21 @@ namespace VPet_Simulator.Core
/// </summary>
Squat_C_End,
/// <summary>
/// 下落 (开始/循环)
/// 下落向左 (开始/循环)
/// </summary>
Fall_A_Loop,
Fall_Left_A_Loop,
/// <summary>
/// 下落 (结束)
/// 下落向左 (结束)
/// </summary>
Fall_B_End,
Fall_Left_B_End,
/// <summary>
/// 下落向右 (开始/循环)
/// </summary>
Fall_Right_A_Loop,
/// <summary>
/// 下落向右 (结束)
/// </summary>
Fall_Right_B_End,
/// <summary>
/// 走路向右 (开始)
/// </summary>
@ -110,36 +134,40 @@ namespace VPet_Simulator.Core
/// </summary>
Walk_Left_C_End,
}
/// <summary>
/// 动画类型默认设置 前文本|是否循环|是否常用
/// </summary>
public static readonly dynamic[][] GraphTypeValue = new dynamic[][]
{
new dynamic[]{ "raised_dynamic" ,false,true},
new dynamic[]{ "raised_static_a", false,true},
new dynamic[]{ "raised_static_b", false,true},
new dynamic[]{ "climb_top_right", false,false},
new dynamic[]{ "climb_top_left", false, false},
new dynamic[]{ "climb_right", false, false},
new dynamic[]{ "climb_left", false, false},
new dynamic[]{ "default", true,true},
new dynamic[]{ "touch_head_a", false,true},
new dynamic[]{ "touch_head_b", false,true},
new dynamic[]{ "touch_head_c", false,true},
new dynamic[]{ "crawl_right", false, true},
new dynamic[]{ "crawl_left", false, true},
new dynamic[]{ "squat_a", false,true},
new dynamic[]{ "squat_b", false, true},
new dynamic[]{ "squat_c", false,true},
new dynamic[]{ "fall_a", false, false},
new dynamic[]{ "fall_b", false,true},
new dynamic[]{ "walk_right_a", false,true},
new dynamic[]{ "walk_right_b", false, true},
new dynamic[]{ "walk_right_c", false,true},
new dynamic[]{ "walk_left_a", false,true},
new dynamic[]{ "walk_left_b", false, true},
new dynamic[]{ "walk_left_c", false,true},
};
///// <summary> loop 应该被取缔
///// 动画类型默认设置 前文本|是否循环|是否常用
///// </summary>
//public static readonly dynamic[][] GraphTypeValue = new dynamic[][]
//{
// new dynamic[]{ "raised_dynamic" ,false,true},
// new dynamic[]{ "raised_static_a", false,true},
// 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[]{ "climb_right", false, false},
// new dynamic[]{ "climb_left", false, false},
// new dynamic[]{ "default", true,true},
// new dynamic[]{ "touch_head_a", false,true},
// new dynamic[]{ "touch_head_b", false,true},
// new dynamic[]{ "touch_head_c", false,true},
// new dynamic[]{ "crawl_right", false, true},
// new dynamic[]{ "crawl_left", false, true},
// new dynamic[]{ "squat_a", false,true},
// new dynamic[]{ "squat_b", false, true},
// new dynamic[]{ "squat_c", false,true},
// new dynamic[]{ "fall_left_a", false, false},
// new dynamic[]{ "fall_left_b", false,true},
// new dynamic[]{ "fall_right_a", false, false},
// new dynamic[]{ "fall_right_b", false,true},
// new dynamic[]{ "walk_right_a", false,true},
// new dynamic[]{ "walk_right_b", false, true},
// new dynamic[]{ "walk_right_c", false,true},
// new dynamic[]{ "walk_left_a", false,true},
// new dynamic[]{ "walk_left_b", false, true},
// new dynamic[]{ "walk_left_c", false,true},
//};
/// <summary>
/// 图像字典
/// </summary>
@ -174,5 +202,23 @@ namespace VPet_Simulator.Core
}
return FindGraph(GraphType.Default, mode);
}
static string[] graphtypevalue = null;
public static string[] GraphTypeValue
{
get
{
if (graphtypevalue == null)
{
List<string> gtv = new List<string>();
foreach (string v in Enum.GetNames(typeof(GraphType)))
{
gtv.Add(v.Replace("_Start", "").Replace("_Loop", "").Replace("_End", "").ToLower());
}
graphtypevalue = gtv.ToArray();
}
return graphtypevalue;
}
}
}
}

View File

@ -61,7 +61,7 @@ namespace VPet_Simulator.Core
/// <param name="path">文件夹位置</param>
/// <param name="isLoop">是否循环</param>
/// <param name="storemem">是否储存到内存以支持快速显示</param>
public PNGAnimation(string path, Save.ModeType modetype, GraphCore.GraphType graphtype, bool isLoop = true, bool storemem = false)
public PNGAnimation(string path, Save.ModeType modetype, GraphCore.GraphType graphtype, bool storemem = false, bool isLoop = false)
{
InitializeComponent();
Animations = new List<Animation>();
@ -171,7 +171,7 @@ namespace VPet_Simulator.Core
//先显示该图层
parent.Dispatcher.Invoke(Visible);
//然后等待帧时间毫秒
Thread.Sleep(Time);
Thread.Sleep(Time);
//判断是否要下一步
if (parent.PlayState)
{
@ -185,14 +185,15 @@ namespace VPet_Simulator.Core
}
else
{
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);
//});
return;
}
//要下一步,现在就隐藏图层
@ -230,6 +231,6 @@ namespace VPet_Simulator.Core
DoEndAction = !StopEndAction;
PlayState = false;
}
}
}

View File

@ -19,15 +19,12 @@ namespace VPet_Simulator.Windows
/// <summary>
/// 宠物图像
/// </summary>
public GraphCore Graph
public GraphCore Graph(bool storemem)
{
get
{
var g = new GraphCore();
foreach (var p in path)
LoadGraph(g, new DirectoryInfo(p), "");
return g;
}
var g = new GraphCore();
foreach (var p in path)
LoadGraph(g, new DirectoryInfo(p), "", storemem);
return g;
}
/// <summary>
/// 图像位置
@ -50,7 +47,7 @@ namespace VPet_Simulator.Windows
GraphSetting = lps["graph"];
}
public static void LoadGraph(GraphCore graph, DirectoryInfo di, string path_name)
public static void LoadGraph(GraphCore graph, DirectoryInfo di, string path_name,bool storemem)
{
var list = di.EnumerateDirectories();
if (list.Count() == 0)
@ -64,24 +61,24 @@ namespace VPet_Simulator.Windows
path_name = path_name.Trim('_').ToLower();
for (int i = 0; i < GraphTypeValue.Length; i++)
{
if (path_name.StartsWith(GraphTypeValue[i][0]))
if (path_name.StartsWith(GraphTypeValue[i]))
{
if (path_name.Contains("happy"))
{
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Happy, (GraphType)i, GraphTypeValue[i][1], GraphTypeValue[i][2]), (GraphType)i);
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Happy, (GraphType)i, storemem), (GraphType)i);
}
if (path_name.Contains("nomal"))
{
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Nomal, (GraphType)i, GraphTypeValue[i][1], GraphTypeValue[i][2]), (GraphType)i);
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Nomal, (GraphType)i, storemem), (GraphType)i);
}
if (path_name.Contains("poorcondition"))
{
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.PoorCondition, (GraphType)i, GraphTypeValue[i][1], GraphTypeValue[i][2]), (GraphType)i);
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.PoorCondition, (GraphType)i, storemem), (GraphType)i);
}
if (path_name.Contains("ill"))
{
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Ill, (GraphType)i, GraphTypeValue[i][1], GraphTypeValue[i][2]), (GraphType)i);
graph.AddGraph(new PNGAnimation(di.FullName, Save.ModeType.Ill, (GraphType)i, storemem), (GraphType)i);
}
return;
}
@ -94,7 +91,7 @@ namespace VPet_Simulator.Windows
else
foreach (var p in list)
{
LoadGraph(graph, p, path_name + "_" + p.Name);
LoadGraph(graph, p, path_name + "_" + p.Name,storemem);
}
}
}

View File

@ -66,92 +66,7 @@ namespace VPet_Simulator.Windows
zoomlevel = value;
}
}
/// <summary>
/// 分辨率类型,仅支持以下分辨率 q:1.77 l:1.6 s:1.33
/// </summary>
public enum ResolutionType
{
q1280x720,// = 128000720,
l1280x800,// = 128000800,
s1280x960,// = 128000960,
q1440x810,// = 144000810,
l1440x900,// = 144000900,
s1440x1080,// = 144001080,
q1600x900,// = 160000900,
l1600x1000,// = 160001000,
s1600x1200,// = 160001200,
q1680x945,// = 160000945,
l1680x1050,// = 160001050,
s1680x1260,// = 160001260,
q1920x1080,// = 192001080,
l1920x1200,// = 192001200,
s1920x1440,// = 192001440,
q2048x1152,// = 204801152,
l2048x1260,// = 204801260,
s2048x1536,// = 204801536,
q2560x1440,// = 256001440,
l2560x1600,// = 256001600,
s2560x1920,// = 256001920,
q3840x2160,// = 384002160,
l3840x2400,// = 384002400,
s3840x2880,// = 384002880,
}
/// <summary>
/// 分辨率表,快速查询分辨率
/// </summary>
public static readonly int[] ResolutionList = {
128000720,
128000800,
128000960,
144000810,
144000900,
144001080,
160000900,
160001000,
160001200,
160000945,
160001050,
160001260,
192001080,
192001200,
192001440,
204801152,
204801260,
204801536,
256001440,
256001600,
256001920,
384002160,
384002400,
384002880
};
//public static readonly Dictionary<int, int> ResolutionList = new Dictionary<int, int>()
//{
// {1, 128000720 },
// 128000800,
// 128000960,
// 144000810,
// 144000900,
// 144001080,
// 160000900,
// 160001000,
// 160001200,
// 160000945,
// 160001050,
// 160001260,
// 192001080,
// 192001200,
// 192001440,
// 204801152,
// 204801260,
// 204801536,
// 256001440,
// 256001600,
// 256001920,
// 384002160,
// 384002400,
// 384002880,
//};
public bool IsFullScreen
{
get => FindLine("fullscreen") != null;
@ -172,6 +87,14 @@ namespace VPet_Simulator.Windows
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 int DiagnosisInterval

View File

@ -101,9 +101,9 @@ namespace VPet_Simulator.Windows
Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载游戏内容"));
//加载游戏内容
Core.Controller = new MWController(this);
Core.Save = new Save("玛哈萝");
Core.Save = new Save("莉斯");
Dispatcher.Invoke(new Action(() => {
Core.Graph = Pets[0].Graph;
Core.Graph = Pets[0].Graph(Set.StoreInMemory);
LoadingText.Visibility = Visibility.Collapsed;
winSetting = new winGameSetting(this);
var main = new Main(Core) { };

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 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: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Some files were not shown because too many files have changed in this diff Show More