using System; using System.Net; using CSNetwork; using CSNetwork.GPDataType; using BrewMonster.Common; using UnityEngine; // Account login info struct public struct AccountLoginInfo { public uint login_time; public uint login_ip; public uint current_ip; public void Reset() { login_time = 0; login_ip = 0; current_ip = 0; } } // Game runtime partial class partial class CECGameRun { public AccountLoginInfo m_AccountLoginInfo = new AccountLoginInfo(); public bool m_bAccountLoginInfoShown = false; public byte m_accountInfoFlag = 0; public bool m_bAccountInfoShown = false; public void ResetAccountLoginInfo() { m_AccountLoginInfo.Reset(); m_bAccountLoginInfoShown = true; } public void ShowAccountLoginInfo() { Debug.Log("[Cuong] ShowAccountLoginInfo"); if (!m_bAccountLoginInfoShown) { m_bAccountLoginInfoShown = true; // Assuming CECUIConfig::Instance().GetGameUI().bEnableShowIP translates to true for now bool bEnableShowIP = true; if (bEnableShowIP) { // Last login time DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime t = Epoch.AddSeconds(m_AccountLoginInfo.login_time).ToLocalTime(); string timeStr = string.Format("({0}-{1:00}-{2:00} {3:00}:{4:00})", t.Year, t.Month, t.Day, t.Hour, t.Minute); string textTime = string.Format("Lần đăng nhập trước: {0}", timeStr); // 9343 EventBus.Publish(new GameSession.ChatMessageEvent { context = textTime, channel = (byte)ChatChannel.GP_CHAT_SYSTEM }); Debug.Log($"[Cuong] ShowAccountLoginInfo {textTime}"); // Last login IP string ipStr = new IPAddress((long)m_AccountLoginInfo.login_ip).ToString(); string textIp = string.Format("IP đăng nhập trước: {0}", ipStr); // 9344 EventBus.Publish(new GameSession.ChatMessageEvent { context = textIp, channel = (byte)ChatChannel.GP_CHAT_SYSTEM }); Debug.Log($"[Cuong] ShowAccountLoginInfo {textIp}"); // Current login IP string curIpStr = new IPAddress((long)m_AccountLoginInfo.current_ip).ToString(); string textCurIp = string.Format("IP đăng nhập hiện tại: {0}", curIpStr); // 9345 EventBus.Publish(new GameSession.ChatMessageEvent { context = textCurIp, channel = (byte)ChatChannel.GP_CHAT_SYSTEM }); Debug.Log($"[Cuong] ShowAccountLoginInfo {textCurIp}"); } } } public void SetAccountInfoFlag(byte accountinfo_flag) { m_accountInfoFlag = accountinfo_flag; m_bAccountInfoShown = false; } public void ShowAccountInfo() { if (!m_bAccountInfoShown) { m_bAccountInfoShown = true; bool bEnableCompleteAccount = true; if (bEnableCompleteAccount && ((m_accountInfoFlag & 0x03) != 0)) { string text = "Hoàn tất thông tin tài khoản..."; // 9347 EventBus.Publish(new GameSession.ChatMessageEvent { context = text, channel = (byte)ChatChannel.GP_CHAT_SYSTEM }); Debug.Log($"[Cuong] ShowAccountInfo {text}"); } } } }