优化说话&修复bug

This commit is contained in:
ZouJin 2023-01-28 01:44:57 +08:00
parent 02009313ab
commit 81debbaf67
4 changed files with 33 additions and 9 deletions

View File

@ -41,7 +41,7 @@ namespace VPet_Simulator.Core
/// 刷新时间时会调用该方法,在所有任务处理完之后
/// </summary>
public event Action<Main> TimeUIHandle;
public Main(GameCore core)
public Main(GameCore core,bool loadtouchevent = true)
{
InitializeComponent();
Core = core;
@ -52,8 +52,12 @@ namespace VPet_Simulator.Core
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));
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true));
if (loadtouchevent)
{
LoadTouchEvent();
}
var ig = Core.Graph.FindGraph(GraphCore.GraphType.Default, core.Save.Mode);
PetGrid.Child = ig.This;
var ig2 = Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, core.Save.Mode);
@ -65,6 +69,14 @@ namespace VPet_Simulator.Core
MoveTimer.Elapsed += MoveTimer_Elapsed;
SmartMoveTimer.Elapsed += SmartMoveTimer_Elapsed;
}
/// <summary>
/// 自动加载触摸事件
/// </summary>
public void LoadTouchEvent()
{
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));
}
private void SmartMoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{

View File

@ -24,13 +24,22 @@ namespace VPet_Simulator.Core
AutoReset = true,
Enabled = true
};
/// <summary>
/// 说话
/// </summary>
/// <param name="text">说话内容</param>
public void Say(string text)
{
Display(GraphCore.GraphType.Say_A_Start, () =>
if (DisplayType == GraphCore.GraphType.Default)
Display(GraphCore.GraphType.Say_A_Start, () =>
{
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
Saying();
});
else
{
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
Saying();
});
}
}
public void Saying()
{

View File

@ -58,7 +58,8 @@ namespace VPet_Simulator.Core
Task.Run(() =>
{
Thread.Sleep(timeleft * 50);
m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal);
if (m.DisplayType == GraphCore.GraphType.Default || m.DisplayType.ToString().Contains("Say"))
m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal);
});
ShowTimer.Stop();
EndTimer.Start();

View File

@ -65,10 +65,12 @@ namespace VPet_Simulator.Windows
Set = new Setting("Setting#VPET:|\n");
//this.Width = 400 * ZoomSlider.Value;
//this.Height = 450 * ZoomSlider.Value;
this.Height = 500 * Set.ZoomLevel;
this.Width = 500 * Set.ZoomLevel;
InitializeComponent();
this.Height = 1000 * Set.ZoomLevel;
this.Width = 1000 * Set.ZoomLevel;
//不存在就关掉
var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup");
if (!modpath.Exists)