diff --git a/VPet-Simulator.Core/Display/Main.xaml.cs b/VPet-Simulator.Core/Display/Main.xaml.cs
index b56b1ae..49274f4 100644
--- a/VPet-Simulator.Core/Display/Main.xaml.cs
+++ b/VPet-Simulator.Core/Display/Main.xaml.cs
@@ -49,7 +49,7 @@ namespace VPet_Simulator.Core
ToolBar = new ToolBar(this);
ToolBar.Visibility = Visibility.Collapsed;
UIGrid.Children.Add(ToolBar);
- MsgBar = new MessageBar();
+ MsgBar = new MessageBar(this);
MsgBar.Visibility = Visibility.Collapsed;
UIGrid.Children.Add(MsgBar);
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchHeadLocate, Core.Graph.GraphConfig.TouchHeadSize, DisplayTouchHead));
@@ -71,10 +71,6 @@ namespace VPet_Simulator.Core
MoveTimer.AutoReset = false;
}
- public void Say(string text)
- {
- MsgBar.Show(Core.Save.Name, text);
- }
private void MoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
string str = DisplayType.ToString();
@@ -131,11 +127,18 @@ namespace VPet_Simulator.Core
rasetype = -1;
DisplayRaising();
}
- else if (SmartMove)
+ else
{
- MoveTimer.AutoReset = true;
- SmartMoveTimer.Stop();
- SmartMoveTimer.Start();
+ //if (MsgBar.Visibility == Visibility.Visible)
+ //{
+ // MsgBar.ForceClose();
+ //}
+ if (SmartMove)
+ {
+ MoveTimer.AutoReset = true;
+ SmartMoveTimer.Stop();
+ SmartMoveTimer.Start();
+ }
}
}
diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs
index f8f51c9..b80836b 100644
--- a/VPet-Simulator.Core/Display/MainDisplay.cs
+++ b/VPet-Simulator.Core/Display/MainDisplay.cs
@@ -53,10 +53,12 @@ namespace VPet_Simulator.Core
Display(GraphCore.GraphType.Crawl_Right_C_End, EndAction);
return true;
case GraphType.Fall_Left_B_Loop:
- Display(GraphCore.GraphType.Fall_Left_C_End, EndAction);
+ Display(GraphCore.GraphType.Fall_Left_C_End,
+ () => Display(GraphCore.GraphType.Climb_Up_Left, EndAction));
return true;
case GraphType.Fall_Right_B_Loop:
- Display(GraphCore.GraphType.Fall_Right_C_End, EndAction);
+ Display(GraphCore.GraphType.Fall_Right_C_End,
+ () => Display(GraphCore.GraphType.Climb_Up_Right, EndAction));
return true;
case GraphType.Walk_Left_B_Loop:
Display(GraphCore.GraphType.Walk_Left_C_End, EndAction);
@@ -97,7 +99,6 @@ namespace VPet_Simulator.Core
ig2.IsContinue = true;
return;
}
- Core.Graph.RndGraph.Clear();
Display(GraphCore.GraphType.Touch_Head_A_Start, () =>
Display(GraphCore.GraphType.Touch_Head_B_Loop, () =>
Display(GraphCore.GraphType.Touch_Head_C_End, DisplayNomal
@@ -111,7 +112,6 @@ namespace VPet_Simulator.Core
{
looptimes = 0;
CountNomal = 0;
- Core.Graph.RndGraph.Clear();
Display(GraphCore.GraphType.Boring_A_Start, DisplayBoringing);
}
///
@@ -132,7 +132,6 @@ namespace VPet_Simulator.Core
{
looptimes = 0;
CountNomal = 0;
- Core.Graph.RndGraph.Clear();
Display(GraphCore.GraphType.Squat_A_Start, DisplaySquating);
}
///
@@ -152,7 +151,6 @@ namespace VPet_Simulator.Core
{
looptimes = 0;
CountNomal = 0;
- Core.Graph.RndGraph.Clear();
if (force)
Display(GraphCore.GraphType.Sleep_A_Start, DisplaySleepingForce);
else
@@ -969,9 +967,10 @@ namespace VPet_Simulator.Core
///
/// 动画类型
/// 动画结束后操作
- public void Display(GraphType Type, Action EndAction = null)//, bool StoreRnd = false)
+ /// 是否储存随机数字典
+ public void Display(GraphType Type, Action EndAction = null, bool storernd = false)
{
- Display(Core.Graph.FindGraph(Type, Core.Save.Mode), EndAction);
+ Display(Core.Graph.FindGraph(Type, Core.Save.Mode, storernd), EndAction);
}
bool petgridcrlf = true;
///
diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs
index 685f7bd..b094ca5 100644
--- a/VPet-Simulator.Core/Display/MainLogic.cs
+++ b/VPet-Simulator.Core/Display/MainLogic.cs
@@ -17,13 +17,25 @@ namespace VPet_Simulator.Core
public const int LoopMax = 10;
public const int LoopMid = 7;
public const int LoopMin = 5;
- public const int TreeRND = 4;
+ public const int TreeRND = 5;
public Timer EventTimer = new Timer(15000)
{
AutoReset = true,
Enabled = true
};
+ public void Say(string text)
+ {
+ Display(GraphCore.GraphType.Say_A_Start, () =>
+ {
+ Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
+ Saying();
+ });
+ }
+ public void Saying()
+ {
+ Display(GraphCore.GraphType.Say_B_Loop, Saying);
+ }
private void EventTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
diff --git a/VPet-Simulator.Core/Display/MessageBar.xaml.cs b/VPet-Simulator.Core/Display/MessageBar.xaml.cs
index c0be33a..77c9a95 100644
--- a/VPet-Simulator.Core/Display/MessageBar.xaml.cs
+++ b/VPet-Simulator.Core/Display/MessageBar.xaml.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
@@ -13,6 +14,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Timer = System.Timers.Timer;
namespace VPet_Simulator.Core
{
@@ -21,12 +23,14 @@ namespace VPet_Simulator.Core
///
public partial class MessageBar : UserControl, IDisposable
{
- public MessageBar()
+ Main m;
+ public MessageBar(Main m)
{
InitializeComponent();
EndTimer.Elapsed += EndTimer_Elapsed;
ShowTimer.Elapsed += ShowTimer_Elapsed;
CloseTimer.Elapsed += CloseTimer_Elapsed;
+ this.m = m;
}
private void CloseTimer_Elapsed(object sender, ElapsedEventArgs e)
@@ -35,7 +39,8 @@ namespace VPet_Simulator.Core
{
Dispatcher.Invoke(() => this.Visibility = Visibility.Collapsed);
EndAction?.Invoke();
- }else
+ }
+ else
{
Dispatcher.Invoke(() => Opacity -= 0.02);
}
@@ -50,6 +55,11 @@ namespace VPet_Simulator.Core
}
else
{
+ Task.Run(() =>
+ {
+ Thread.Sleep(timeleft * 50);
+ m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal);
+ });
ShowTimer.Stop();
EndTimer.Start();
}
@@ -65,9 +75,14 @@ namespace VPet_Simulator.Core
}
public Timer EndTimer = new Timer() { Interval = 100 };
- public Timer ShowTimer = new Timer() { Interval = 20 };
+ public Timer ShowTimer = new Timer() { Interval = 40 };
public Timer CloseTimer = new Timer() { Interval = 10 };
int timeleft;
+ ///
+ /// 显示消息
+ ///
+ /// 名字
+ /// 内容
public void Show(string name, string text)
{
TText.Text = "";
@@ -94,11 +109,17 @@ namespace VPet_Simulator.Core
private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
- EndTimer.Stop(); ShowTimer.Stop();CloseTimer.Close();
+ ForceClose();
+ }
+ ///
+ /// 强制关闭
+ ///
+ public void ForceClose()
+ {
+ EndTimer.Stop(); ShowTimer.Stop(); CloseTimer.Close();
this.Visibility = Visibility.Collapsed;
EndAction?.Invoke();
}
-
public void Dispose()
{
EndTimer.Dispose();
diff --git a/VPet-Simulator.Core/Graph/GraphCore.cs b/VPet-Simulator.Core/Graph/GraphCore.cs
index 22d3517..305dad4 100644
--- a/VPet-Simulator.Core/Graph/GraphCore.cs
+++ b/VPet-Simulator.Core/Graph/GraphCore.cs
@@ -177,6 +177,30 @@ namespace VPet_Simulator.Core
/// 睡觉 (结束)
///
Sleep_C_End,
+ ///
+ /// 说话 (开始)
+ ///
+ Say_A_Start,
+ ///
+ /// 说话 (循环)
+ ///
+ Say_B_Loop,
+ ///
+ /// 说话 (结束)
+ ///
+ Say_C_End,
+ ///
+ /// 待机 (开始) (自动保持一致性)
+ ///
+ Idel_A_Start,
+ ///
+ /// 待机 (循环) (自动保持一致性)
+ ///
+ Idel_B_Loop,
+ ///
+ /// 待机 (结束) (自动保持一致性)
+ ///
+ Idel_C_End,
}
///// loop 应该被取缔
///// 动画类型默认设置 前文本|是否循环|是否常用
@@ -265,9 +289,9 @@ namespace VPet_Simulator.Core
///
/// 动画类型
/// 状态类型,找不到就找相同动画类型
- ///// 是否储存随机数字典
+ /// 是否储存随机数字典
///
- public IGraph FindGraph(GraphType type, Save.ModeType mode)//
+ public IGraph FindGraph(GraphType type, Save.ModeType mode, bool storernd = false)
{
if (Graphs.ContainsKey(type))
{
@@ -276,18 +300,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
@@ -382,7 +406,7 @@ namespace VPet_Simulator.Core
///
public double LocateClimbTop;
-
+
///
/// 初始化设置
///
diff --git a/VPet-Simulator.Core/Graph/PNGAnimation.xaml.cs b/VPet-Simulator.Core/Graph/PNGAnimation.xaml.cs
index 3f2e951..55bb98f 100644
--- a/VPet-Simulator.Core/Graph/PNGAnimation.xaml.cs
+++ b/VPet-Simulator.Core/Graph/PNGAnimation.xaml.cs
@@ -170,7 +170,7 @@ namespace VPet_Simulator.Core
public void Run(Action EndAction = null)
{
//先显示该图层
- parent.Dispatcher.Invoke(Visible);
+ parent.Dispatcher.BeginInvoke(Visible);
//然后等待帧时间毫秒
Thread.Sleep(Time);
//判断是否要下一步
@@ -186,8 +186,8 @@ namespace VPet_Simulator.Core
}
else
{
- //parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden);
- //parent.Dispatcher.Invoke(Hidden);
+ //parent.endwilldo = () => parent.Dispatcher.BeginInvoke(Hidden);
+ //parent.Dispatcher.BeginInvoke(Hidden);
parent.PlayState = false;
if (parent.DoEndAction)
EndAction?.Invoke();//运行结束动画时事件
@@ -197,20 +197,20 @@ namespace VPet_Simulator.Core
Task.Run(() =>
{
Thread.Sleep(25);
- parent.Dispatcher.Invoke(Hidden);
+ parent.Dispatcher.BeginInvoke(Hidden);
});
return;
}
//要下一步,现在就隐藏图层
//隐藏该图层
- parent.Dispatcher.Invoke(Hidden);
+ parent.Dispatcher.BeginInvoke(Hidden);
parent.Animations[parent.nowid].Run(EndAction);
return;
}
else
{
parent.IsContinue = false;
- //parent.Dispatcher.Invoke(Hidden);
+ //parent.Dispatcher.BeginInvoke(Hidden);
if (parent.DoEndAction)
EndAction?.Invoke();//运行结束动画时事件
parent.StopAction?.Invoke();
@@ -218,7 +218,7 @@ namespace VPet_Simulator.Core
Task.Run(() =>
{
Thread.Sleep(25);
- parent.Dispatcher.Invoke(Hidden);
+ parent.Dispatcher.BeginInvoke(Hidden);
});
}
}
diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml b/VPet-Simulator.Windows/WinDesign/winConsole.xaml
index 248fbc4..6c885f1 100644
--- a/VPet-Simulator.Windows/WinDesign/winConsole.xaml
+++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml
@@ -11,5 +11,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs
index 02d256c..9e4af2f 100644
--- a/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs
@@ -29,7 +29,7 @@ namespace VPet_Simulator.Windows
{
GraphListBox.Items.Add(v);
}
-
+
}
public void DisplayLoop(GraphType graphType)
{
@@ -42,5 +42,89 @@ namespace VPet_Simulator.Windows
LabelNowPlay.Content = $"当前正在播放: {GraphListBox.SelectedItem}";
DisplayLoop((GraphType)Enum.Parse(typeof(GraphType), (string)GraphListBox.SelectedItem));
}
+
+ private void DisplayListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (DisplayListBox.SelectedItem == null)
+ return;
+ LabelSuccess.Content = $"当前正在运行: {(string)((ListBoxItem)DisplayListBox.SelectedItem).Content}";
+ switch ((string)((ListBoxItem)DisplayListBox.SelectedItem).Content)
+ {
+ case "DisplayNomal":
+ mw.Main.DisplayNomal();
+ break;
+ case "DisplayTouchHead":
+ mw.Main.DisplayTouchHead();
+ break;
+ case "DisplayBoring":
+ mw.Main.DisplayBoring();
+ break;
+ case "DisplaySquat":
+ mw.Main.DisplaySquat();
+ break;
+ case "DisplaySquating":
+ mw.Main.DisplaySquating();
+ break;
+ case "DisplaySleep":
+ mw.Main.DisplaySleep();
+ break;
+ case "DisplaySleeping":
+ mw.Main.DisplaySleeping();
+ break;
+ case "DisplaySleepingForce":
+ mw.Main.DisplaySleepingForce();
+ break;
+ case "DisplayRaised":
+ mw.Main.DisplayRaised();
+ break;
+ case "DisplayFalled_Left":
+ mw.Main.DisplayFalled_Left();
+ break;
+ case "DisplayFalled_Right":
+ mw.Main.DisplayFalled_Right();
+ break;
+ case "DisplayWalk_Left":
+ mw.Main.DisplayWalk_Left();
+ break;
+ case "DisplayWalk_Right":
+ mw.Main.DisplayWalk_Right();
+ break;
+ case "DisplayCrawl_Left":
+ mw.Main.DisplayCrawl_Left();
+ break;
+ case "DisplayCrawl_Right":
+ mw.Main.DisplayCrawl_Right();
+ break;
+ case "DisplayClimb_Left_UP":
+ mw.Main.DisplayClimb_Left_UP();
+ break;
+ case "DisplayClimb_Left_DOWN":
+ mw.Main.DisplayClimb_Left_DOWN();
+ break;
+ case "DisplayClimb_Right_UP":
+ mw.Main.DisplayClimb_Right_UP();
+ break;
+ case "DisplayClimb_Right_DOWN":
+ mw.Main.DisplayClimb_Right_DOWN();
+ break;
+ case "DisplayClimb_Top_Right":
+ mw.Main.DisplayClimb_Top_Right();
+ break;
+ case "DisplayClimb_Top_Left":
+ mw.Main.DisplayClimb_Top_Left();
+ break;
+ case "DisplayFall_Left":
+ mw.Main.DisplayFall_Left();
+ break;
+ case "DisplayFall_Right":
+ mw.Main.DisplayFall_Right();
+ break;
+ }
+ }
+
+ private void Say_Click(object sender, RoutedEventArgs e)
+ {
+ mw.Main.Say(SayTextBox.Text);
+ }
}
}
diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
index 50b4dad..0360e66 100644
--- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
@@ -42,8 +42,8 @@ namespace VPet_Simulator.Windows
ZoomSlider.Maximum = 3;
}
ZoomSlider.Value = mw.Set.ZoomLevel * 2;
- this.Width = 400 * ZoomSlider.Value;
- this.Height = 450 * ZoomSlider.Value;
+ this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
+ this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
sDesktopAlignment.IsChecked = mw.Set.EnableFunction;
CalSlider.Value = mw.Set.LogicInterval;
@@ -440,8 +440,8 @@ namespace VPet_Simulator.Windows
private void ZoomSlider_MouseUp(object sender, MouseButtonEventArgs e)
{
mw.SetZoomLevel(ZoomSlider.Value / 2);
- this.Width = 400 * ZoomSlider.Value;
- this.Height = 450 * ZoomSlider.Value;
+ this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
+ this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
}
private void PressLengthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
@@ -535,6 +535,6 @@ namespace VPet_Simulator.Windows
mw.Main.SetMoveMode(mw.Set.AllowMove, mw.Set.SmartMove, mw.Set.SmartMoveInterval * 1000);
}
-
+
}
}
diff --git a/VPet-Simulator.Windows/WinDesign/winReport.xaml b/VPet-Simulator.Windows/WinDesign/winReport.xaml
index bdb005a..c93ec64 100644
--- a/VPet-Simulator.Windows/WinDesign/winReport.xaml
+++ b/VPet-Simulator.Windows/WinDesign/winReport.xaml
@@ -12,11 +12,12 @@
Margin="10,0,0,0" />
-
+
游戏内报错
逻辑计算错误
数值设计不合理
玩法与功能建议
+ 游玩心得分享
-