diff --git a/VPet-Simulator.Windows.Interface/MutiPlayer/IMPWindows.cs b/VPet-Simulator.Windows.Interface/MutiPlayer/IMPWindows.cs index fa5e338..ce14a7b 100644 --- a/VPet-Simulator.Windows.Interface/MutiPlayer/IMPWindows.cs +++ b/VPet-Simulator.Windows.Interface/MutiPlayer/IMPWindows.cs @@ -44,7 +44,7 @@ public interface IMPWindows /// /// 好友id /// 消息内容(数据包) - void SendMessage(ulong friendid, MPMessage msg); + bool SendMessage(ulong friendid, MPMessage msg); /// /// 给所有人发送消息 diff --git a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs index c68903b..d2011c6 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs @@ -190,7 +190,7 @@ public partial class MPFriends : WindowX, IMPFriend Main.ToolBar.M_TimeUIHandle(Main); Main.ToolBar.tfun.Visibility = Visibility.Collapsed; } - if (lb.GetMemberData(friend, "onmod") == "true") + if (lb.GetMemberData(friend, "notouch") == "true") { NoTouchTrue(); } @@ -214,14 +214,14 @@ public partial class MPFriends : WindowX, IMPFriend private void Main_Event_TouchHead() { - Main.LabelDisplayShow("{0}在摸{1}的头".Translate(SteamClient.Name, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在摸{1}的头".Translate(SteamClient.Name, Core.Save.Name), 3000); var msg = new MPMessage() { Type = (int)MSGType.Interact, To = friend.Id }; msg.SetContent(Interact.TouchHead); wmp.SendMessageALL(msg); } private void Main_Event_TouchBody() { - Main.LabelDisplayShow("{0}在摸{1}的头".Translate(SteamClient.Name, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在摸{1}的头".Translate(SteamClient.Name, Core.Save.Name), 3000); var msg = new MPMessage() { Type = (int)MSGType.Interact, To = friend.Id }; msg.SetContent(Interact.TouchBody); wmp.SendMessageALL(msg); @@ -371,7 +371,7 @@ public partial class MPFriends : WindowX, IMPFriend HideForDesign.Children.Remove(MPTalkBox); Main.ToolBar.MainGrid.Children.Add(MPTalkBox); - if (lb.GetMemberData(friend, "onmod") == "true") + if (lb.GetMemberData(friend, "notouch") == "true") { NoTouchTrue(); } @@ -441,6 +441,8 @@ public partial class MPFriends : WindowX, IMPFriend Loaded = true; })); } + + public winMPBetterBuy winMPBetterBuy; public void ShowBetterBuy(Food.FoodType foodType) @@ -478,7 +480,7 @@ public partial class MPFriends : WindowX, IMPFriend return false; } Main.CountNomal = 0; - Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(SteamClient.Name, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(SteamClient.Name, Core.Save.Name), 3000); if (Main.DisplayType.Name == "pinch") { if (Main.DisplayType.Animat == AnimatType.A_Start) @@ -501,7 +503,7 @@ public partial class MPFriends : WindowX, IMPFriend } private void DisplayPinch_loop() { - Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(SteamClient.Name, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(SteamClient.Name, Core.Save.Name), 3000); var msg = new MPMessage() { Type = (int)MSGType.Interact, To = friend.Id }; msg.SetContent(Interact.TouchPinch); wmp.SendMessageALL(msg); @@ -607,7 +609,7 @@ public partial class MPFriends : WindowX, IMPFriend { case Interact.TouchHead: case Interact.TouchBody: - Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 3000); break; case Interact.TouchPinch: Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(byname, Core.Save.Name)); @@ -619,15 +621,15 @@ public partial class MPFriends : WindowX, IMPFriend { case Interact.TouchHead: DisplayNOCALTouchHead(); - Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 3000); break; case Interact.TouchBody: DisplayNOCALTouchBody(); - Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, Core.Save.Name), 3000); break; case Interact.TouchPinch: DisplayNOCALTouchPinch(); - Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(byname, Core.Save.Name), 5000); + Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(byname, Core.Save.Name), 3000); break; } } @@ -643,7 +645,7 @@ public partial class MPFriends : WindowX, IMPFriend Main.Display(GraphType.Shutdown, AnimatType.Single, () => Dispatcher.Invoke(Close)); Task.Run(() => { - Thread.Sleep(5000); + Thread.Sleep(3000); if (Loaded) Dispatcher.Invoke(Close); }); @@ -811,8 +813,8 @@ public partial class MPFriends : WindowX, IMPFriend public void ReSetLocal() { - Main.CleanState(); - Main.DisplayToNomal(); + Main?.CleanState(); + Main?.DisplayToNomal(); Left = (SystemParameters.PrimaryScreenWidth - Width) / 2; Top = (SystemParameters.PrimaryScreenHeight - Height) / 2; } diff --git a/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs index 037ebff..b2094ce 100644 --- a/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs @@ -202,9 +202,9 @@ namespace VPet_Simulator.Windows mf.DisplayFoodAnimation(item.GetGraph(), item.ImageSource); if (EnableFunction) - mf.Main.LabelDisplayShow("{0}花费${3}\n给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName, item.Price), 10000); + mf.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName, item.Price), 6000); else - mf.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName), 10000); + mf.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(SteamClient.Name, mf.Core.Save.Name, item.TranslateName), 6000); var msg = new MPMessage() { diff --git a/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs index e020e10..bf4a2c4 100644 --- a/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs @@ -43,6 +43,7 @@ public partial class winMutiPlayer : Window, IMPWindows public winMutiPlayer(MainWindow mw, ulong? lobbyid = null) { InitializeComponent(); + swAllowTouch.IsChecked = !mw.Set.MPNOTouch; this.mw = mw; if (lobbyid == null) CreateLobby(); @@ -276,10 +277,10 @@ public partial class winMutiPlayer : Window, IMPWindows /// /// 给指定好友发送消息 /// - public void SendMessage(ulong friendid, MPMessage msg) + public bool SendMessage(ulong friendid, MPMessage msg) { byte[] data = ConverTo(msg); - SteamNetworking.SendP2PPacket(friendid, data); + return SteamNetworking.SendP2PPacket(friendid, data); } /// /// 给所有人发送消息 @@ -309,8 +310,8 @@ public partial class winMutiPlayer : Window, IMPWindows public event Action OnMemberJoined; private void SteamMatchmaking_OnLobbyMemberJoined(Lobby lobby, Friend friend) { - if (lobby.Id == lb.Id) - { + if (lobby.Id == lb.Id && MPFriends.Find(x => x.friend.Id == friend.Id) == null) + { //如果有未处理的退出,不管 Log("好友{0}已加入访客表".Translate(friend.Name)); var mpf = new MPFriends(this, mw, lb, friend); MPFriends.Add(mpf); @@ -349,21 +350,22 @@ public partial class winMutiPlayer : Window, IMPWindows var interact = MSG.GetContent(); if (MSG.To == SteamClient.SteamId.Value) { + if (mw.Set.MPNOTouch) return; bool isok = !IMPFriend.InConvenience(mw.Main); switch (interact) { case Interact.TouchHead: - mw.Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, mw.Core.Save.Name), 5000); + mw.Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, mw.Core.Save.Name), 3000); if (isok) DisplayNOCALTouchHead(); break; case Interact.TouchBody: - mw.Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, mw.Core.Save.Name), 5000); + mw.Main.LabelDisplayShow("{0}在摸{1}的头".Translate(byname, mw.Core.Save.Name), 3000); if (isok) DisplayNOCALTouchBody(); break; case Interact.TouchPinch: - mw.Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(byname, mw.Core.Save.Name), 5000); + mw.Main.LabelDisplayShow("{0}在捏{1}的脸".Translate(byname, mw.Core.Save.Name), 3000); if (isok) DisplayNOCALTouchPinch(); break; @@ -385,7 +387,7 @@ public partial class winMutiPlayer : Window, IMPWindows mw.DisplayFoodAnimation(feed.Item.GetGraph(), feed.Item.ImageSource); if (feed.EnableFunction) { - mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price), 10000); + mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price), 6000); Log("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price)); //对于要修改数据的物品一定要再次检查,避免联机开挂毁存档 if (item.Price >= 10 && item.Price <= 1000 && item.Health >= 0 && item.Exp >= 0 && item.Likability >= 0 && giveprice < 1000 @@ -397,7 +399,7 @@ public partial class winMutiPlayer : Window, IMPWindows } else { - mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName), 10000); + mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName), 6000); Log("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName)); } } @@ -545,13 +547,14 @@ public partial class winMutiPlayer : Window, IMPWindows private void swAllowTouch_Checked(object sender, RoutedEventArgs e) { if (mw == null) return; - lb.SetMemberData("notouch", "true"); + lb.SetMemberData("notouch", "false"); mw.Set.MPNOTouch = false; } private void swAllowTouch_Unchecked(object sender, RoutedEventArgs e) { - lb.SetMemberData("notouch", "false"); - mw.Set.MPNOTouch = false; + if (mw == null) return; + lb.SetMemberData("notouch", "true"); + mw.Set.MPNOTouch = true; } } diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index 7650e61..6b7af30 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -63,9 +63,13 @@ + + + + diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps index 411e894..7c4c8a1 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps @@ -24,7 +24,6 @@ 和{0}悄悄说#Whisper to {0}:| 和{0}说#Say it with {0}:| 给更好的{0}买#Buy for Better {0}:| -{0}花费${3}\n给{1}买了{2}#{0} spends ${3}\n to buy {1} for {2}:| 加入/创建访客表失败,请检查网络连接或重启游戏#Failed to join/create Guest List, please check your internet connection or restart the game!:| {0}的访客表#The Guest List for {0}:| 访客表已被房主{0}关闭#Guest List has been closed by Host {0}:| diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps index c0a25fb..674ac4e 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps @@ -24,7 +24,6 @@ 和{0}悄悄说#和{0}悄悄说:| 和{0}说#和{0}说:| 给更好的{0}买#给更好的{0}买:| -{0}花费${3}\n给{1}买了{2}#{0}花费${3}\n给{1}买了{2}:| 加入/创建访客表失败,请检查网络连接或重启游戏#加入/创建访客表失败,请检查网络连接或重启游戏:| {0}的访客表#{0}的访客表:| 访客表已被房主{0}关闭#访客表已被房主{0}关闭:| diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps index d5880d7..b963190 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps @@ -24,7 +24,6 @@ 和{0}悄悄说#和{0}悄悄說:| 和{0}说#和{0}說:| 给更好的{0}买#給更好的{0}買:| -{0}花费${3}\n给{1}买了{2}#{0}花費${3}\n給{1}買了{2}:| 加入/创建访客表失败,请检查网络连接或重启游戏#加入/建立訪客表失敗,請檢查網路連線或重新啟動遊戲:| {0}的访客表#{0}的訪客表:| 访客表已被房主{0}关闭#訪客表已被屋主{0}關閉:|