日志功能实装

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.Input;
using System.Windows.Media; using System.Windows.Media;
using ToolBar = VPet_Simulator.Core.ToolBar; using ToolBar = VPet_Simulator.Core.ToolBar;
using Microsoft.VisualBasic.Logging;
namespace VPet_Simulator.Windows; namespace VPet_Simulator.Windows;
/// <summary> /// <summary>
@ -239,10 +240,14 @@ public partial class MPFriends : WindowX, IMPFriend
if (feed.EnableFunction) if (feed.EnableFunction)
{ {
mw.Main.LabelDisplayShow("{0}花费${3}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName, feed.Item.Price)); 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); mw.TakeItem(feed.Item);
} }
else else
{
mw.Main.LabelDisplayShow("{0}给{1}买了{2}".Translate(byname, mw.GameSavesData.GameSave.Name, feed.Item.TranslateName)); 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> /// <summary>
/// 加载游戏 /// 加载游戏
@ -623,12 +628,15 @@ public partial class MPFriends : WindowX, IMPFriend
{ {
case Chat.Type.Private: case Chat.Type.Private:
Main.Say("{0} 悄悄地对你说: {1}".Translate(msg.SendName, msg.Content)); Main.Say("{0} 悄悄地对你说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 悄悄地对你说: {1}".Translate(msg.SendName, msg.Content));
break; break;
case Chat.Type.Internal: case Chat.Type.Internal:
Main.Say("{0} 对你说: {1}".Translate(msg.SendName, msg.Content)); Main.Say("{0} 对你说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 对你说: {1}".Translate(msg.SendName, msg.Content));
break; break;
case Chat.Type.Public: case Chat.Type.Public:
Main.Say("{0} 对大家说: {1}".Translate(msg.SendName, msg.Content)); Main.Say("{0} 对大家说: {1}".Translate(msg.SendName, msg.Content));
wmp.Log("{0} 对大家说: {1}".Translate(msg.SendName, msg.Content));
break; break;
} }
} }

View File

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

View File

@ -50,3 +50,6 @@ theme#Theme:|
来自#From:| 来自#From:|
重置位置#Reset Location:| 重置位置#Reset Location:|
送客#Sending Guests:| 送客#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}已加入訪客表:|