更新下蹲和睡觉动画
@ -75,7 +75,12 @@ namespace VPet_Simulator.Core
|
||||
}
|
||||
private void MoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
string str = DisplayType.ToString();
|
||||
Core.Controller.MoveWindows(MoveTimerPoint.X, MoveTimerPoint.Y);
|
||||
if (!str.Contains("Left") && !str.Contains("Right"))
|
||||
{
|
||||
MoveTimer.Stop();
|
||||
}
|
||||
}
|
||||
public Action DefaultClickAction;
|
||||
bool isPress = false;
|
||||
|
@ -41,28 +41,31 @@ namespace VPet_Simulator.Core
|
||||
switch (DisplayType)
|
||||
{
|
||||
case GraphCore.GraphType.Boring_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Boring_C_End, EndAction);
|
||||
return true;
|
||||
case GraphCore.GraphType.Squat_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Squat_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Crawl_Left_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Crawl_Left_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Crawl_Left_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Crawl_Right_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Crawl_Right_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Crawl_Right_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Fall_Left_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Left_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Fall_Left_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Fall_Right_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_Right_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Fall_Right_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Walk_Left_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Left_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Walk_Left_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Walk_Right_B_Loop:
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode, true), EndAction);
|
||||
Display(GraphCore.GraphType.Walk_Right_C_End, EndAction);
|
||||
return true;
|
||||
case GraphType.Sleep_B_Loop:
|
||||
Display(GraphCore.GraphType.Sleep_C_End, EndAction);
|
||||
return true;
|
||||
//case GraphType.Climb_Left:
|
||||
//case GraphType.Climb_Right:
|
||||
@ -95,9 +98,9 @@ namespace VPet_Simulator.Core
|
||||
return;
|
||||
}
|
||||
Core.Graph.RndGraph.Clear();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, Core.Save.Mode, true), () =>
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_B_Loop, Core.Save.Mode, true), () =>
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_C_End, Core.Save.Mode, true), DisplayNomal
|
||||
Display(GraphCore.GraphType.Touch_Head_A_Start, () =>
|
||||
Display(GraphCore.GraphType.Touch_Head_B_Loop, () =>
|
||||
Display(GraphCore.GraphType.Touch_Head_C_End, DisplayNomal
|
||||
)));
|
||||
}
|
||||
|
||||
@ -109,17 +112,17 @@ namespace VPet_Simulator.Core
|
||||
looptimes = 0;
|
||||
CountNomal = 0;
|
||||
Core.Graph.RndGraph.Clear();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_A_Start, Core.Save.Mode, true), DisplayBoringing);
|
||||
Display(GraphCore.GraphType.Boring_A_Start, DisplayBoringing);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示无聊情况
|
||||
/// </summary>
|
||||
private void DisplayBoringing()
|
||||
{
|
||||
if (Function.Rnd.Next(++looptimes) > 10)
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_C_End, Core.Save.Mode, true), DisplayNomal);
|
||||
if (Function.Rnd.Next(++looptimes) > LoopProMax)
|
||||
Display(GraphCore.GraphType.Boring_C_End, DisplayNomal);
|
||||
else
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Boring_B_Loop, Core.Save.Mode, true), DisplayBoringing);
|
||||
Display(GraphCore.GraphType.Boring_B_Loop, DisplayBoringing);
|
||||
}
|
||||
int looptimes;
|
||||
/// <summary>
|
||||
@ -130,18 +133,49 @@ namespace VPet_Simulator.Core
|
||||
looptimes = 0;
|
||||
CountNomal = 0;
|
||||
Core.Graph.RndGraph.Clear();
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_A_Start, Core.Save.Mode, true), DisplaySquating);
|
||||
Display(GraphCore.GraphType.Squat_A_Start, DisplaySquating);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示蹲下情况
|
||||
/// </summary>
|
||||
public void DisplaySquating()
|
||||
{
|
||||
if (Function.Rnd.Next(++looptimes) > 10)
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_C_End, Core.Save.Mode, true), DisplayNomal);
|
||||
if (Function.Rnd.Next(++looptimes) > LoopProMax)
|
||||
Display(GraphCore.GraphType.Squat_C_End, DisplayNomal);
|
||||
else
|
||||
Display(Core.Graph.FindGraph(GraphCore.GraphType.Squat_B_Loop, Core.Save.Mode, true), DisplaySquating);
|
||||
Display(GraphCore.GraphType.Squat_B_Loop, DisplaySquating);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示睡觉情况
|
||||
/// </summary>
|
||||
public void DisplaySleep(bool force = false)
|
||||
{
|
||||
looptimes = 0;
|
||||
CountNomal = 0;
|
||||
Core.Graph.RndGraph.Clear();
|
||||
if (force)
|
||||
Display(GraphCore.GraphType.Sleep_A_Start, DisplaySleepingForce);
|
||||
else
|
||||
Display(GraphCore.GraphType.Sleep_A_Start, DisplaySleeping);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示睡觉情况 (正常)
|
||||
/// </summary>
|
||||
public void DisplaySleeping()
|
||||
{
|
||||
if (Function.Rnd.Next(++looptimes) > LoopProMax)
|
||||
Display(GraphCore.GraphType.Sleep_C_End, DisplayNomal);
|
||||
else
|
||||
Display(GraphCore.GraphType.Sleep_B_Loop, DisplaySleeping);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示睡觉情况 (强制)
|
||||
/// </summary>
|
||||
public void DisplaySleepingForce()
|
||||
{//TODO:如果开启了Function,强制睡觉为永久,否则睡到自然醒+LoopMax
|
||||
Display(GraphCore.GraphType.Sleep_B_Loop, DisplaySleepingForce);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示拖拽情况
|
||||
/// </summary>
|
||||
@ -930,10 +964,14 @@ namespace VPet_Simulator.Core
|
||||
|
||||
|
||||
|
||||
|
||||
public void Display(GraphType Type, Action EndAction = null, bool StoreRnd = false)
|
||||
/// <summary>
|
||||
/// 显示动画
|
||||
/// </summary>
|
||||
/// <param name="Type">动画类型</param>
|
||||
/// <param name="EndAction">动画结束后操作</param>
|
||||
public void Display(GraphType Type, Action EndAction = null)//, bool StoreRnd = false)
|
||||
{
|
||||
Display(Core.Graph.FindGraph(Type, Core.Save.Mode, StoreRnd), EndAction);
|
||||
Display(Core.Graph.FindGraph(Type, Core.Save.Mode), EndAction);
|
||||
}
|
||||
bool petgridcrlf = true;
|
||||
/// <summary>
|
||||
|
@ -13,6 +13,7 @@ namespace VPet_Simulator.Core
|
||||
public const int DistanceMax = 100;
|
||||
public const int DistanceMid = 100;
|
||||
public const int DistanceMin = 50;
|
||||
public const int LoopProMax = 20;
|
||||
public const int LoopMax = 10;
|
||||
public const int LoopMid = 7;
|
||||
public const int LoopMin = 5;
|
||||
@ -84,7 +85,7 @@ namespace VPet_Simulator.Core
|
||||
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
|
||||
|
||||
if (DisplayType == GraphCore.GraphType.Default && !isPress)
|
||||
switch (Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal)))
|
||||
switch (17)//Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal)))
|
||||
{
|
||||
case 0:
|
||||
//随机向右
|
||||
@ -123,6 +124,10 @@ namespace VPet_Simulator.Core
|
||||
case 11:
|
||||
DisplayCrawl_Right();
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
DisplaySleep();
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
DisplayBoring();
|
||||
@ -130,7 +135,7 @@ namespace VPet_Simulator.Core
|
||||
case 18:
|
||||
case 17:
|
||||
DisplaySquat();
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@
|
||||
<MenuItem x:Name="MenuPanel" Header="面板" MouseEnter="MenuPanel_MouseEnter" MouseLeave="MenuPanel_MouseLeave"
|
||||
HorizontalContentAlignment="Center" />
|
||||
<MenuItem x:Name="MenuInteract" Header="互动" HorizontalContentAlignment="Center">
|
||||
<MenuItem Header="睡觉" HorizontalContentAlignment="Center" />
|
||||
<MenuItem Header="睡觉" HorizontalContentAlignment="Center" Click="Sleep_Click" />
|
||||
<MenuItem Header="玩耍" HorizontalContentAlignment="Center" />
|
||||
<MenuItem Header="说话" HorizontalContentAlignment="Center" />
|
||||
<MenuItem Header="学习" HorizontalContentAlignment="Center" />
|
||||
|
@ -247,5 +247,10 @@ namespace VPet_Simulator.Core
|
||||
closetimer.Dispose();
|
||||
closePanelTimer.Dispose();
|
||||
}
|
||||
|
||||
private void Sleep_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
m.DisplaySleep(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,9 +265,9 @@ namespace VPet_Simulator.Core
|
||||
/// </summary>
|
||||
/// <param name="type">动画类型</param>
|
||||
/// <param name="mode">状态类型,找不到就找相同动画类型</param>
|
||||
/// <param name="storernd">是否储存随机数字典</param>
|
||||
///// <param name="storernd">是否储存随机数字典</param>
|
||||
/// <returns></returns>
|
||||
public IGraph FindGraph(GraphType type, Save.ModeType mode, bool storernd = false)
|
||||
public IGraph FindGraph(GraphType type, Save.ModeType mode)//
|
||||
{
|
||||
if (Graphs.ContainsKey(type))
|
||||
{
|
||||
@ -276,18 +276,18 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
if (list.Count == 1)
|
||||
return list[0];
|
||||
if (storernd)
|
||||
if (RndGraph.TryGetValue(list.Count, out int index))
|
||||
{
|
||||
return list[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
index = Function.Rnd.Next(list.Count);
|
||||
RndGraph.Add(list.Count, index);
|
||||
return list[index];
|
||||
}
|
||||
else
|
||||
//if (storernd)
|
||||
// if (RndGraph.TryGetValue(list.Count, out int index))
|
||||
// {
|
||||
// return list[index];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// index = Function.Rnd.Next(list.Count);
|
||||
// RndGraph.Add(list.Count, index);
|
||||
// return list[index];
|
||||
// }
|
||||
//else
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
else
|
||||
|
@ -85,10 +85,7 @@ namespace VPet_Simulator.Core
|
||||
Visibility = Visibility.Hidden
|
||||
};
|
||||
MainGrid.Children.Add(img);
|
||||
Animations.Add(new Animation(this, time, () =>
|
||||
{
|
||||
img.Visibility = Visibility.Visible;
|
||||
}, () => img.Visibility = Visibility.Hidden));
|
||||
Animations.Add(new Animation(this, time, () => img.Visibility = Visibility.Visible, () => img.Visibility = Visibility.Hidden));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
@ -196,7 +193,7 @@ namespace VPet_Simulator.Core
|
||||
EndAction?.Invoke();//运行结束动画时事件
|
||||
parent.StopAction?.Invoke();
|
||||
parent.StopAction = null;
|
||||
//重新加载第一帧
|
||||
//延时隐藏
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(25);
|
||||
@ -213,16 +210,16 @@ namespace VPet_Simulator.Core
|
||||
else
|
||||
{
|
||||
parent.IsContinue = false;
|
||||
parent.Dispatcher.Invoke(Hidden);
|
||||
//parent.Dispatcher.Invoke(Hidden);
|
||||
if (parent.DoEndAction)
|
||||
EndAction?.Invoke();//运行结束动画时事件
|
||||
parent.StopAction?.Invoke();
|
||||
parent.StopAction = null;
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// Thread.Sleep(25);
|
||||
// parent.Dispatcher.Invoke(Hidden);
|
||||
//});
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(25);
|
||||
parent.Dispatcher.Invoke(Hidden);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 191 KiB |
After Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 134 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 189 KiB |
Before Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 170 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 163 KiB |
After Width: | Height: | Size: 163 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 157 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 157 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 157 KiB |
After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 161 KiB |