mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
联机支持关闭互动功能
This commit is contained in:
parent
7087b64c56
commit
35a51b050c
@ -147,7 +147,7 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// 获取或设置消息框是否外置
|
||||
/// </summary>
|
||||
bool MessageBarOutside { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前是否记录游戏退出位置
|
||||
/// </summary>
|
||||
@ -201,6 +201,10 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// 游戏数据
|
||||
/// </summary>
|
||||
ILine GameData { get; }
|
||||
/// <summary>
|
||||
/// 联机允许交互
|
||||
/// </summary>
|
||||
bool MPNOTouch { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,4 +79,8 @@ public interface IMPFriend
|
||||
/// <param name="graphName">夹层动画名</param>
|
||||
/// <param name="imageSource">被夹在中间的图片</param>
|
||||
void DisplayFoodAnimation(string graphName, ImageSource imageSource);
|
||||
/// <summary>
|
||||
/// 是否不允许交互
|
||||
/// </summary>
|
||||
bool NOTouch { get; }
|
||||
}
|
||||
|
@ -492,7 +492,14 @@ namespace VPet_Simulator.Windows
|
||||
line.SetInt("h", value.Height);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息框外置
|
||||
/// </summary>
|
||||
public bool MPNOTouch
|
||||
{
|
||||
get => this["mutiplay"].GetBool("notouch");
|
||||
set => this["mutiplay"].SetBool("notouch", value);
|
||||
}
|
||||
public ILine BetterBuyData => FindorAddLine("betterbuy");
|
||||
|
||||
public ILine GameData => FindorAddLine("gamedata");
|
||||
|
@ -28,6 +28,7 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using ToolBar = VPet_Simulator.Core.ToolBar;
|
||||
using Microsoft.VisualBasic.Logging;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace VPet_Simulator.Windows;
|
||||
/// <summary>
|
||||
@ -52,6 +53,8 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
return true;
|
||||
return OnMod.Find(ModName.ToLower()) != null;
|
||||
}
|
||||
public bool NOTouch { get; set; } = false;
|
||||
|
||||
|
||||
public MPFriends(winMutiPlayer wmp, MainWindow mw, Lobby lb, Friend friend)
|
||||
{
|
||||
@ -178,14 +181,31 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
if (lobby.Id == lb.Id && friend.Id == this.friend.Id)
|
||||
{
|
||||
string tmp = lb.GetMemberData(friend, "save");
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Core.Save = GameSave_VPet.Load(new Line(tmp));
|
||||
Main.ToolBar.M_TimeUIHandle(Main);
|
||||
Main.ToolBar.tfun.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tmp))
|
||||
{
|
||||
Core.Save = GameSave_VPet.Load(new Line(tmp));
|
||||
Main.ToolBar.M_TimeUIHandle(Main);
|
||||
Main.ToolBar.tfun.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
if (lb.GetMemberData(friend, "onmod") == "true")
|
||||
{
|
||||
NoTouchTrue();
|
||||
}
|
||||
else
|
||||
{
|
||||
NOTouch = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void NoTouchTrue()
|
||||
{
|
||||
NOTouch = true;
|
||||
Main.ToolBar.MenuInteract.IsEnabled = false;
|
||||
|
||||
}
|
||||
|
||||
private void Main_Event_TouchHead()
|
||||
{
|
||||
@ -294,12 +314,29 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
Main.ToolBar = new Core.ToolBar(Main);
|
||||
Main.ToolBar.Visibility = Visibility.Collapsed;
|
||||
Main.UIGrid.Children.Add(Main.ToolBar);
|
||||
Main.Load_2_TouchEvent();
|
||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchHeadLocate, Core.Graph.GraphConfig.TouchHeadSize, () => { DisplayTouchHead(); return true; }));
|
||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchBodyLocate, Core.Graph.GraphConfig.TouchBodySize, () => { DisplayTouchBody(); return true; }));
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
IGameSave.ModeType m = (IGameSave.ModeType)i;
|
||||
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate[i], Core.Graph.GraphConfig.TouchRaisedSize[i],
|
||||
() =>
|
||||
{
|
||||
if (Core.Save.Mode == m)
|
||||
{
|
||||
Main.DisplayRaised();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}, true));
|
||||
}
|
||||
Task.Run(Main.Load_24_WaitAndStart);
|
||||
|
||||
Main.ToolBar.MenuInteract.Items.Clear();
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Interact, "摸头".Translate(), Main.DisplayTouchHead);
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Interact, "摸身体".Translate(), Main.DisplayTouchBody);
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Interact, "摸头".Translate(), DisplayTouchHead);
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Interact, "摸身体".Translate(), DisplayTouchBody);
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Interact, "捏脸".Translate(), () => DisplayPinch());
|
||||
|
||||
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Setting, "退出访客表".Translate(), wmp.Close);
|
||||
@ -391,11 +428,23 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
|
||||
public new bool Loaded = false;
|
||||
|
||||
public void DisplayTouchHead()
|
||||
{
|
||||
if (NOTouch) return;
|
||||
Main.DisplayTouchHead();
|
||||
}
|
||||
public void DisplayTouchBody()
|
||||
{
|
||||
if (NOTouch) return;
|
||||
Main.DisplayTouchBody();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示捏脸情况
|
||||
/// </summary>
|
||||
public bool DisplayPinch()
|
||||
{
|
||||
if (NOTouch) return false;
|
||||
if (Core.Graph.FindGraphs("pinch", AnimatType.A_Start, Core.Save.Mode) == null)
|
||||
{
|
||||
return false;
|
||||
@ -520,7 +569,7 @@ public partial class MPFriends : WindowX, IMPFriend
|
||||
/// </summary>
|
||||
public void ActiveInteract(string byname, Interact interact)
|
||||
{
|
||||
if (!Loaded)
|
||||
if (!Loaded || NOTouch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VPet_Simulator.Windows"
|
||||
mc:Ignorable="d" Margin="5" Width="340" Height="80" Background="{DynamicResource SecondaryLight}"
|
||||
mc:Ignorable="d" Margin="5" Width="338" Height="80" Background="{DynamicResource SecondaryLight}"
|
||||
BorderBrush="{DynamicResource Secondary}">
|
||||
<Grid>
|
||||
<pu:ContentControlX HorizontalAlignment="Left" Margin="10" CornerRadius="27">
|
||||
@ -12,15 +12,15 @@
|
||||
</pu:ContentControlX>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="70,0,0,0"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" FontSize="16">
|
||||
<Run Text="{ll:Str 访客}" />: <Run x:Name="rPetName" Text="{ll:Str 萝莉斯}" FontSize="20" FontWeight="Bold" />
|
||||
<Run Text="{ll:Str 访客}" />: <Run x:Name="rPetName" Text="萝莉斯" FontSize="20" FontWeight="Bold" />
|
||||
<LineBreak />
|
||||
<Run Text="{ll:Str 来自}" />: <Run x:Name="hostName" Text="XXX" FontWeight="Bold" /><LineBreak />
|
||||
<Run x:Name="info" Text="Lv ??" />
|
||||
</TextBlock>
|
||||
<Button Style="{DynamicResource ThemedButtonStyle}" HorizontalAlignment="Right" Content="{ll:Str 重置位置}"
|
||||
VerticalAlignment="Top" Margin="10" Click="btn_ReSetLocal" />
|
||||
VerticalAlignment="Top" Margin="8" Click="btn_ReSetLocal" />
|
||||
<Button x:Name="Kick" Style="{DynamicResource ThemedButtonStyle}" HorizontalAlignment="Right"
|
||||
Content="{ll:Str 送客}" VerticalAlignment="Bottom" Margin="10" Click="Kick_Click" Visibility="Collapsed"
|
||||
Content="{ll:Str 送客}" VerticalAlignment="Bottom" Margin="8" Click="Kick_Click" Visibility="Collapsed"
|
||||
d:Visibility="Visible" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
@ -8,7 +8,8 @@
|
||||
Title="{ll:Str 访客表}" MinHeight="400" Width="400" Closed="Window_Closed" FontSize="16" SizeToContent="Height"
|
||||
MaxHeight="800" ResizeMode="CanMinimize" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<pu:ContentControlX Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top" CornerRadius="40">
|
||||
<pu:ContentControlX Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
CornerRadius="20">
|
||||
<Image x:Name="HostHead" Source="/Res/TopLogo2019.PNG" />
|
||||
</pu:ContentControlX>
|
||||
|
||||
@ -19,16 +20,16 @@
|
||||
<Run Text="{ll:Str 主持人}" />: <Run x:Name="hostName" Text="XXX" /><LineBreak />
|
||||
<Run Text="{ll:Str 访客表ID}" />:
|
||||
</TextBlock>
|
||||
<TextBox x:Name="lbLid" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="200,70,0,0"
|
||||
<TextBox x:Name="lbLid" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="210,70,0,0"
|
||||
BorderThickness="0" IsReadOnly="True" Text="1145141919" Background="{DynamicResource DARKPrimaryTrans4}"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" Padding="0" />
|
||||
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Margin="15,115,15,15">
|
||||
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Margin="15,135,15,15">
|
||||
<TabItem Header="{ll:Str 访客列表}">
|
||||
<StackPanel x:Name="MUUCList" Background="{DynamicResource SecondaryLighter}" />
|
||||
</TabItem>
|
||||
<TabItem Header="{ll:Str 消息日志}">
|
||||
<TextBox x:Name="tbLog" Margin="0" BorderThickness="0" Background="{DynamicResource DARKPrimaryTrans4}"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" IsReadOnly="True"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" IsReadOnly="True" TextWrapping="WrapWithOverflow"
|
||||
VerticalScrollBarVisibility="Visible" />
|
||||
</TabItem>
|
||||
|
||||
@ -38,7 +39,13 @@
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" CheckedBackground="{DynamicResource Primary}"
|
||||
CheckedBorderBrush="{DynamicResource Primary}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
|
||||
Content="{ll:Str 允许好友加入}" ToggleBrush="{DynamicResource PrimaryDark}" ToggleShadowColor="{x:Null}"
|
||||
ToggleSize="14" IsChecked="True" Checked="swAllowJoin_Checked"
|
||||
Unchecked="swAllowJoin_Unchecked" IsEnabled="False"/>
|
||||
ToggleSize="14" IsChecked="True" Checked="swAllowJoin_Checked" Unchecked="swAllowJoin_Unchecked"
|
||||
IsEnabled="False" />
|
||||
<pu:Switch x:Name="swAllowTouch" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,110,20,0"
|
||||
Background="Transparent" BorderBrush="{DynamicResource PrimaryDark}" BoxHeight="16" BoxWidth="35"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" CheckedBackground="{DynamicResource Primary}"
|
||||
CheckedBorderBrush="{DynamicResource Primary}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
|
||||
Content="{ll:Str 允许好友交互}" ToggleBrush="{DynamicResource PrimaryDark}" ToggleShadowColor="{x:Null}"
|
||||
ToggleSize="14" IsChecked="True" Checked="swAllowTouch_Checked" Unchecked="swAllowTouch_Unchecked" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -133,6 +133,7 @@ public partial class winMutiPlayer : Window, IMPWindows
|
||||
lb.SetMemberData("save", mw.GameSavesData.GameSave.ToLine().ToString());
|
||||
lb.SetMemberData("onmod", mw.Set.FindLine("onmod")?.ToString() ?? "onmod");
|
||||
lb.SetMemberData("petgraph", mw.Set.PetGraph);
|
||||
lb.SetMemberData("notouch", mw.Set.MPNOTouch.ToString());
|
||||
|
||||
SteamMatchmaking.OnLobbyMemberJoined += SteamMatchmaking_OnLobbyMemberJoined;
|
||||
SteamMatchmaking.OnLobbyMemberLeave += SteamMatchmaking_OnLobbyMemberLeave;
|
||||
@ -543,4 +544,16 @@ public partial class winMutiPlayer : Window, IMPWindows
|
||||
mw.Main.Display(graphname, AnimatType.B_Loop, (graphname) =>
|
||||
mw.Main.DisplayCEndtoNomal(graphname))));
|
||||
}
|
||||
|
||||
private void swAllowTouch_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
lb.SetMemberData("notouch", "true");
|
||||
mw.Set.MPNOTouch = false;
|
||||
}
|
||||
|
||||
private void swAllowTouch_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
lb.SetMemberData("notouch", "false");
|
||||
mw.Set.MPNOTouch = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user