mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
独立语音控件
This commit is contained in:
parent
5f9bf91b98
commit
72d73cff0f
@ -1,6 +1,5 @@
|
||||
<pu:ContentControlX x:Class="VPet_Simulator.Core.Main" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VPet_Simulator.Core"
|
||||
mc:Ignorable="d" d:DesignHeight="250" d:DesignWidth="250">
|
||||
@ -8,6 +7,7 @@
|
||||
<Grid x:Name="MainGrid" Width="500" Height="500" MouseLeftButtonDown="MainGrid_MouseLeftButtonDown"
|
||||
x:FieldModifier="public" MouseLeftButtonUp="MainGrid_MouseLeftButtonUp"
|
||||
MouseRightButtonDown="MainGrid_MouseRightButtonDown" MouseMove="MainGrid_MouseWave">
|
||||
<MediaElement x:Name="VoicePlayer" LoadedBehavior="Play" UnloadedBehavior="Stop" />
|
||||
<Grid x:Name="UIGrid_Back" x:FieldModifier="public" />
|
||||
<Border x:Name="PetGrid" VerticalAlignment="Bottom" />
|
||||
<Border x:Name="PetGrid2" VerticalAlignment="Bottom" />
|
||||
|
@ -106,6 +106,14 @@ namespace VPet_Simulator.Core
|
||||
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));
|
||||
}
|
||||
/// <summary>
|
||||
/// 播放语音
|
||||
/// </summary>
|
||||
/// <param name="VoicePath">语音位置</param>
|
||||
public void PlayVoice(Uri VoicePath)
|
||||
{
|
||||
VoicePlayer.Source = VoicePath;
|
||||
}
|
||||
|
||||
private void SmartMoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
|
@ -38,17 +38,20 @@ namespace VPet_Simulator.Core
|
||||
/// <param name="text">说话内容</param>
|
||||
public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining)
|
||||
{
|
||||
OnSay?.Invoke(text);
|
||||
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
|
||||
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
OnSay?.Invoke(text);
|
||||
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
|
||||
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
|
||||
{
|
||||
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
|
||||
Saying(type);
|
||||
});
|
||||
else
|
||||
{
|
||||
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
|
||||
Saying(type);
|
||||
});
|
||||
else
|
||||
{
|
||||
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Saying(GraphCore.Helper.SayType type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user