Skip to content

Commit

Permalink
优化说话&修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisYounger committed Jan 27, 2023
1 parent 0200931 commit 81debba
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
18 changes: 15 additions & 3 deletions VPet-Simulator.Core/Display/Main.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public partial class Main : UserControl, IDisposable
/// 刷新时间时会调用该方法,在所有任务处理完之后
/// </summary>
public event Action<Main> TimeUIHandle;
public Main(GameCore core)
public Main(GameCore core,bool loadtouchevent = true)
{
InitializeComponent();
Core = core;
Expand All @@ -52,8 +52,12 @@ public Main(GameCore 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);
Expand All @@ -65,6 +69,14 @@ public Main(GameCore 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)
{
Expand Down
15 changes: 12 additions & 3 deletions VPet-Simulator.Core/Display/MainLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ public partial class Main
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()
{
Expand Down
3 changes: 2 additions & 1 deletion VPet-Simulator.Core/Display/MessageBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ private void ShowTimer_Elapsed(object sender, ElapsedEventArgs e)
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();
Expand Down
6 changes: 4 additions & 2 deletions VPet-Simulator.Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public MainWindow()
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)
Expand Down

0 comments on commit 81debba

Please sign in to comment.