日志功能实装

This commit is contained in:
ZouJin 2024-03-22 17:28:37 +08:00
parent 473a943a93
commit 4ad458c15e
5 changed files with 27 additions and 3 deletions

View File

@ -27,6 +27,7 @@ using static VPet_Simulator.Windows.Interface.MPMessage;
using System.Windows.Input;
using System.Windows.Media;
using ToolBar = VPet_Simulator.Core.ToolBar;
using Microsoft.VisualBasic.Logging;
namespace VPet_Simulator.Windows;
/// <summary>
@ -239,10 +240,14 @@ public partial class MPFriends : WindowX, IMPFriend
if (feed.EnableFunction)
{
mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price));
wmp.Log("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price));
mw.TakeItem(feed.Item);
}
else
{
mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName));
wmp.Log("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName));
}
}
/// <summary>
/// 加载游戏
@ -424,7 +429,7 @@ public partial class MPFriends : WindowX, IMPFriend
msg.SetContent(Interact.TouchPinch);
wmp.SendMessageALL(msg);
if (Main.isPress && Main.DisplayType.Name == "pinch" && Main.DisplayType.Animat == AnimatType.B_Loop)
{
{
Main.Display("pinch", AnimatType.B_Loop, DisplayPinch_loop);
}
else
@ -623,12 +628,15 @@ public partial class MPFriends : WindowX, IMPFriend
{
case Chat.Type.Private:
Main.Say("{0} 悄悄地对你说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 悄悄地对你说: {1}".Translate(msg.SendName, msg.Content));
break;
case Chat.Type.Internal:
Main.Say("{0} 对你说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 对你说: {1}".Translate(msg.SendName, msg.Content));
break;
case Chat.Type.Public:
Main.Say("{0} 对大家说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 对大家说: {1}".Translate(msg.SendName, msg.Content));
break;
}
}

View File

@ -1,6 +1,7 @@
using LinePutScript;
using LinePutScript.Converter;
using LinePutScript.Localization.WPF;
using Microsoft.VisualBasic.Logging;
using Panuon.WPF.UI;
using Steamworks;
using Steamworks.Data;
@ -136,7 +137,7 @@ public partial class winMutiPlayer : Window, IMPWindows
SteamMatchmaking.OnLobbyMemberJoined += SteamMatchmaking_OnLobbyMemberJoined;
SteamMatchmaking.OnLobbyMemberLeave += SteamMatchmaking_OnLobbyMemberLeave;
SteamMatchmaking.OnLobbyDataChanged += SteamMatchmaking_OnLobbyDataChanged;
Steamworks.Data.Image? img = await lb.Owner.GetMediumAvatarAsync();
Dispatcher.Invoke(() =>
@ -194,6 +195,7 @@ public partial class winMutiPlayer : Window, IMPWindows
});
}
mw.MutiPlayerStart(this);
Log("已成功连接到访客表".Translate());
LoopP2PPacket();
});
}
@ -249,6 +251,7 @@ public partial class winMutiPlayer : Window, IMPWindows
MPFriends.Remove(mpuc.mpf);
mpuc.mpf.Quit();
}
Log("好友{0}已退出访客表".Translate(friend.Name));
}
}
GraphInfo lastgraph = new GraphInfo() { Type = GraphType.Common };
@ -307,6 +310,7 @@ public partial class winMutiPlayer : Window, IMPWindows
{
if (lobby.Id == lb.Id)
{
Log("好友{0}已加入访客表".Translate(friend.Name));
var mpf = new MPFriends(this, mw, lb, friend);
MPFriends.Add(mpf);
mpf.Show();
@ -381,6 +385,7 @@ public partial class winMutiPlayer : Window, IMPWindows
if (feed.EnableFunction)
{
mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price), 10000);
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)
{//单次联机收礼物上限1000
@ -389,14 +394,16 @@ public partial class winMutiPlayer : Window, IMPWindows
}
}
else
{
mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName), 10000);
Log("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName));
}
}
else
{
To = MPFriends.Find(x => x.friend.Id == MSG.To);
To.Feed(byname, feed);
}
break;
}
}

View File

@ -50,3 +50,6 @@ theme#Theme:|
来自#From:|
重置位置#Reset Location:|
送客#Sending Guests:|
已成功连接到访客表#Successfully connected to the Guest List:|
好友{0}已退出访客表#Friend {0} has exited the Guest List:|
好友{0}已加入访客表#Friend {0} has joined the Guest List:|

View File

@ -50,3 +50,6 @@ theme#主题:|
来自#来自:|
重置位置#重置位置:|
送客#送客:|
已成功连接到访客表#已成功连接到访客表:|
好友{0}已退出访客表#好友{0}已退出访客表:|
好友{0}已加入访客表#好友{0}已加入访客表:|

View File

@ -50,3 +50,6 @@ theme#主題:|
来自#來自:|
重置位置#重置位置:|
送客#送客:|
已成功连接到访客表#已成功連接到訪客表:|
好友{0}已退出访客表#好友{0}已退出訪客表:|
好友{0}已加入访客表#好友{0}已加入訪客表:|