长按捏脸功能

This commit is contained in:
ZouJin 2023-11-20 23:44:24 +08:00
parent c4e2b2b168
commit 504f597792
4 changed files with 64 additions and 3 deletions

View File

@ -9,8 +9,8 @@
MouseMove="MainGrid_MouseWave">
<MediaElement x:Name="VoicePlayer" LoadedBehavior="Manual" UnloadedBehavior="Stop" x:FieldModifier="public" />
<Grid x:Name="UIGrid_Back" x:FieldModifier="public" VerticalAlignment="Top" Width="500" />
<Border x:Name="PetGrid" Height="500" VerticalAlignment="Top" Width="500" />
<Border x:Name="PetGrid2" Height="500" VerticalAlignment="Top" Width="500" />
<Border x:Name="PetGrid" Height="500" VerticalAlignment="Top" Width="500" x:FieldModifier="public"/>
<Border x:Name="PetGrid2" Height="500" VerticalAlignment="Top" Width="500" x:FieldModifier="public"/>
<Grid x:Name="UIGrid" x:FieldModifier="public" VerticalAlignment="Top" Width="500" />
<Label x:Name="LabelDisplay" HorizontalAlignment="Center" VerticalAlignment="Center" Content="内容显示如下"
FontSize="30" Background="{DynamicResource DARKPrimaryTransA}"

View File

@ -255,7 +255,7 @@ namespace VPet_Simulator.Core
/// 默认长按事件
/// </summary>
public Action DefaultPressAction;
bool isPress = false;
public bool isPress = false;
long presstime;
private void MainGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{

View File

@ -243,6 +243,10 @@ namespace VPet_Simulator.Core
/// <returns>储存的文本 (已翻译)</returns>
public string StrGetString(string name) => LocalizeCore.Translate(Str.GetString(name));
/// <summary>
/// 剩余设置数据
/// </summary>
public LPS_D Data;
/// <summary>
/// 初始化设置
/// </summary>
/// <param name="lps"></param>
@ -281,6 +285,7 @@ namespace VPet_Simulator.Core
}
Str = new Line_D(lps["str"]);
Duration = new Line_D(lps["duration"]);
Data = new LPS_D(lps);
}
/// <summary>
/// 加载更多设置,新的替换后来的,允许空内容
@ -334,6 +339,7 @@ namespace VPet_Simulator.Core
{
Moves.Add(LPSConvert.DeserializeObject<Move>(line));
}
Data.AddRange(lps);
}
}

View File

@ -1656,6 +1656,16 @@ namespace VPet_Simulator.Windows
HashCheck = HashCheck;
//添加捏脸动画(若有)
if (Core.Graph.GraphConfig.Data.ContainsLine("pinch"))
{
var pin = Core.Graph.GraphConfig.Data["pinch"];
Main.Core.TouchEvent.Insert(0, new TouchArea(
new Point(pin[(gdbe)"px"], pin[(gdbe)"py"]), new Size(pin[(gdbe)"sw"], pin[(gdbe)"sh"])
, () => { DisplayPinch(); return true; }, true));
}
if (Set.HitThrough)
{
if (!Set["v"][(gbol)"HitThrough"])
@ -1733,5 +1743,50 @@ namespace VPet_Simulator.Windows
//}
}
/// <summary>
/// 显示捏脸情况
/// </summary>
public void DisplayPinch()
{
Main.CountNomal = 0;
if (Core.Controller.EnableFunction && Core.Save.Strength >= 10 && Core.Save.Feeling < 100)
{
Core.Save.StrengthChange(-2);
Core.Save.FeelingChange(1);
Core.Save.Mode = Core.Save.CalMode();
Main.LabelDisplayShowChangeNumber(LocalizeCore.Translate("体力-{0:f0} 心情+{1:f0}"), 2, 1);
}
if (Main.DisplayType.Name == "pinch")
{
if (Main.DisplayType.Animat == AnimatType.A_Start)
return;
else if (Main.DisplayType.Animat == AnimatType.B_Loop)
if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Name == "pinch" && ig.GraphInfo.Animat == AnimatType.B_Loop)
{
ig.IsContinue = true;
return;
}
else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Name == "pinch" && ig2.GraphInfo.Animat == AnimatType.B_Loop)
{
ig2.IsContinue = true;
return;
}
}
Main_Event_TouchHead();
Main_Event_TouchBody();
Main.Display("pinch", AnimatType.A_Start, () =>
Main.Display("pinch", AnimatType.B_Loop, DisplayPinch_loop));
}
private void DisplayPinch_loop()
{
if (Main.isPress && Main.DisplayType.Name == "pinch" && Main.DisplayType.Animat == AnimatType.B_Loop)
{
Main.Display("pinch", AnimatType.B_Loop, DisplayPinch_loop);
}
else
{
Main.DisplayCEndtoNomal("pinch");
}
}
}
}