优化补充

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) if (msg.Status == LoginResultStatus.Ok)
{ {
App.log.Debug("登录成功"); App.log.Debug("登录成功");
App.user.InitMainUserData(msg); App.user.InitMainUserData(App.user.userdata.Account);
} }
else else
{ {

View File

@ -20,14 +20,13 @@ namespace ClientCore.Manager
//注册重连成功事件,以便后续自动登录 //注册重连成功事件,以便后续自动登录
App.networkHelper.OnReConnected += OnReConnected; App.networkHelper.OnReConnected += OnReConnected;
} }
public MainUserDataBase userdata { get;private set; } = new MainUserDataBase();
MainUserDataBase user = new MainUserDataBase(); public bool IsLoggedIn => userdata.IsLoggedIn;
public bool IsLoggedIn => user.IsLoggedIn;
public void InitMainUserData(string UName) public void InitMainUserData(string UName)
{ {
user.Account = UName; userdata.Account = UName;
user.IsLoggedIn = true; userdata.IsLoggedIn = true;
//以及其他数据初始化 //以及其他数据初始化
//... //...
} }
@ -37,7 +36,7 @@ namespace ClientCore.Manager
/// </summary> /// </summary>
public void LoginOutData() public void LoginOutData()
{ {
user.IsLoggedIn = false; userdata.IsLoggedIn = false;
//以及其他数据清理 //以及其他数据清理
//... //...
} }
@ -48,9 +47,9 @@ namespace ClientCore.Manager
public void OnReConnected() 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> /// </summary>
public class NetworkHelper : NetworkHelperCore public class NetworkHelper : NetworkHelperCore
{ {
/// <summary>
/// 网络库调试日志输出
/// </summary>
public event OnLogOutHandler OnLogOut;
public NetworkHelper() public NetworkHelper()
{ {
//指定接收服务器数据事件 //指定接收服务器数据事件