优化补充

This commit is contained in:
sin365 2023-12-15 13:34:08 +08:00
parent 4f9cb4d22d
commit 15cfb0af8c
3 changed files with 8 additions and 13 deletions

View File

@ -26,7 +26,7 @@ namespace ClientCore.Manager
if (msg.Status == LoginResultStatus.Ok)
{
App.log.Debug("登录成功");
App.user.InitMainUserData(msg);
App.user.InitMainUserData(App.user.userdata.Account);
}
else
{

View File

@ -20,14 +20,13 @@ namespace ClientCore.Manager
//注册重连成功事件,以便后续自动登录
App.networkHelper.OnReConnected += OnReConnected;
}
MainUserDataBase user = new MainUserDataBase();
public bool IsLoggedIn => user.IsLoggedIn;
public MainUserDataBase userdata { get;private set; } = new MainUserDataBase();
public bool IsLoggedIn => userdata.IsLoggedIn;
public void InitMainUserData(string UName)
{
user.Account = UName;
user.IsLoggedIn = true;
userdata.Account = UName;
userdata.IsLoggedIn = true;
//以及其他数据初始化
//...
}
@ -37,7 +36,7 @@ namespace ClientCore.Manager
/// </summary>
public void LoginOutData()
{
user.IsLoggedIn = false;
userdata.IsLoggedIn = false;
//以及其他数据清理
//...
}
@ -48,9 +47,9 @@ namespace ClientCore.Manager
public void OnReConnected()
{
//如果之前已登录,则重新登录
if (user.IsLoggedIn)
if (userdata.IsLoggedIn)
{
App.login.Login(user.Account);
App.login.Login(userdata.Account);
}
}
}

View File

@ -13,10 +13,6 @@ namespace ClientCore.Network
/// </summary>
public class NetworkHelper : NetworkHelperCore
{
/// <summary>
/// 网络库调试日志输出
/// </summary>
public event OnLogOutHandler OnLogOut;
public NetworkHelper()
{
//指定接收服务器数据事件