Main/Component/UI/Decorate/Tweens/UIAlphaTween.cs
@@ -7,8 +7,6 @@ using UnityEngine.UI; using System; namespace vnxbqy.UI { [RequireComponent(typeof(CanvasGroup))] public class UIAlphaTween : MonoBehaviour @@ -226,8 +224,5 @@ } } } Main/Core/GameEngine/Launch/LaunchInHot.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic; using System.IO; public class LaunchInHot : MonoBehaviour public class LaunchInHot : SingletonMonobehaviour<LaunchInHot> { static int step = 0; public static LaunchStage m_CurrentStage = LaunchStage.None; @@ -17,6 +17,9 @@ bool launchComplete = false; float surplusProgress = 0f; float surplusTime = 0f; public Action OnApplicationOut = null; void Start() { @@ -190,6 +193,10 @@ } private void OnApplicationQuit() { OnApplicationOut?.Invoke(); } } Main/Core/NetworkPackage/DataToCtl/ConnectedState.cs
@@ -27,7 +27,7 @@ base.OnEnter(); m_NetWorkReachability = Application.internetReachability; // NetLinkWin.Hide(); NetLinkWin.Hide(); } protected override void Update() Main/Core/NetworkPackage/DataToCtl/DisconnectState.cs
@@ -9,7 +9,7 @@ { base.OnEnter(); // NetLinkWin.Hide(); NetLinkWin.Hide(); } protected override void Update() Main/Core/NetworkPackage/DataToCtl/NeverConnectState.cs
@@ -8,7 +8,7 @@ public override void OnEnter() { base.OnEnter(); // NetLinkWin.Hide(); NetLinkWin.Hide(); } protected override void Update() Main/Core/NetworkPackage/GameNetSystem.cs
@@ -342,6 +342,8 @@ finally { netState = NetState.NerverConnect; // TODO YYL // CrossServerLogin.Instance.busy = false; // //ArenaManager.isArenaClient = false; // var loginModel = ModelCenter.Instance.GetModel<LoginModel>(); @@ -366,7 +368,7 @@ // // GameObject.Destroy(obj.transform.GetChild(i).gameObject); // //} // //SceneManager.LoadScene("Empty"); // NetLinkWin.Hide(); NetLinkWin.Hide(); // DTC0403_tagPlayerLoginLoadOK.neverLoginOk = true; } } Main/Login/ServerListCenter.cs
@@ -220,18 +220,13 @@ if (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest) { var localSaveAccountName = LocalSave.GetString(LoginManager.Instance.USER_ACCOUNT); var localSaveAccountName = LocalSave.GetString(LoginManager.USER_ACCOUNT); RequestServerListPlayer(localSaveAccountName); } } public void RequestServerCommonList() { if (VersionUtility.Instance.InIosAuditTime()) { return; } HttpRequest.Instance.RequestHttpGet(SERVERLIST_URL_COMMON, HttpRequest.defaultHttpContentType, 1, OnGetServerList); } @@ -240,7 +235,7 @@ if (_ok) { ServerListParser.Instance.PushCommonServerListRawData(_result); // NetLinkWin.Hide(); NetLinkWin.Hide(); } else { @@ -458,7 +453,7 @@ //这边请求用的是旧账号,sdk登录成功会用新账号请求一次,内网登录需要手动点击一次服务器列表刷新 public void RequestPlayerServerList() { if (LoginManager.Instance.IsLogined) if (LoginManager.Instance.isLogined) { var account = LoginManager.Instance.localSaveAccountName; if (string.IsNullOrEmpty(account)) @@ -477,7 +472,7 @@ //2.服务器列表界面刷新逻辑没做好,serverGroupSelectEvent的调用直接决定了界面显示 public void FiltrateDefaultServerAndServerGroup() { if (LoginManager.Instance.IsLogined) if (LoginManager.Instance.isLogined) { return; } Main/Main.cs
@@ -39,6 +39,8 @@ // 初始化游戏场景 Debug.Log("初始化游戏场景"); ReleaseMgrs(); // 初始化游戏系统 managers.Add(BattleManager.Instance); @@ -56,6 +58,11 @@ public static void OnSwitchToLoginScene() { ReleaseMgrs(); } private static void ReleaseMgrs() { foreach (var manager in managers) { manager.Release(); Main/Manager/LoginManager.cs
@@ -1,26 +1,14 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class LoginManager : ManagerBase<LoginManager> { public string USER_ACCOUNT; public string localSaveAccountName { get { return PlayerPrefs.GetString("localSaveAccountName", ""); } } public bool IsLogined { get { return false; } } public const uint DwVersionNo = 153518004; public readonly static string USER_ACCOUNT = Application.dataPath + "UserAccount"; public readonly static string USER_PASSWORD = Application.dataPath + "UserPassword"; public bool sdkLogined { @@ -28,18 +16,287 @@ set; } = false; public bool reconnectBackGround { get; set; } = false; public bool onCreateRole { get; set; } = false; public bool busy { get; set; } = false; int ServerListLoop = 200; //秒:在登录界面请求服务器列表的间隔 long LastLoopSecond = 0; //上一次的请求时间 100纳秒单位 public SDKUtils.FP_LoginOk sdkLoginResult; public SDKUtils.FP_CheckIDAuthentication sdkIDCheckIDAuthentication; public string localSaveAccountName { get { return LocalSave.GetString(USER_ACCOUNT); } set { LocalSave.SetString(USER_ACCOUNT, value); } } public event Action<bool> registerResultEvent; public event Action accountBindOkEvent; public event Action loginErrorEvent; //游戏启动后表格加载 模块加载失败的提示 public string loginErrorInfo; public string ipBuf { get; private set; } public int portBuf { get; private set; } public int gamePortBuf { get; private set; } public string accountBuf { get; private set; } public string passwordBuf { get; private set; } public bool isLogined { get; set; } public override void Init() { SDKUtils.Instance.onFreePlatformLoginOk += OnSDKAccountLoginOk; SDKUtils.Instance.onFreePlatformLogoutOk += OnSDKAccountLoginOutOk; SDKUtils.Instance.onFreePlatformBindOk += OnSDKAccountBindOk; LaunchInHot.Instance.OnApplicationOut += OnApplicationOut; } public override void Release() { SDKUtils.Instance.onFreePlatformLoginOk -= OnSDKAccountLoginOk; SDKUtils.Instance.onFreePlatformLogoutOk -= OnSDKAccountLoginOutOk; SDKUtils.Instance.onFreePlatformBindOk -= OnSDKAccountBindOk; LaunchInHot.Instance.OnApplicationOut -= OnApplicationOut; } private void OnSDKAccountLoginOk(SDKUtils.FP_LoginOk _result) { sdkLogined = true; sdkLoginResult = _result; if (!DebugUtility.Instance.isWhiteListAccount) { DebugUtility.Instance.RequestWhiteListAuthority(sdkLoginResult.account); } ServerListCenter.Instance.RequestServerListPlayer(sdkLoginResult.account); SDKUtils.Instance.MakeKeyAndVisible(); // TODO YYL // OperationLogCollect.Instance.RecordLauchEvent(5); // GameNotice.OpenGameNotice(); } private void OnSDKAccountLoginOutOk() { sdkLogined = false; sdkLoginResult = default(SDKUtils.FP_LoginOk); GameNetSystem.Instance.LoginOut(); } private void OnSDKAccountBindOk() { sdkLoginResult.phone = 1; if (accountBindOkEvent != null) { accountBindOkEvent(); } } private void OnGetIDAuthenticationInfo(SDKUtils.FP_CheckIDAuthentication _info) { sdkIDCheckIDAuthentication = _info; } public void AccountLogin(string _account, string _ip, int _port, int _gamePort) { Debug.LogFormat("账号登录, account:{0} ; ip:{1} ; port:{2} ; gamePort:{3}", _account, _ip, _port, _gamePort); isLogined = true; if (Application.internetReachability == NetworkReachability.NotReachable) { // TODO YYL // ConfirmCancel.ShowPopConfirm( // Language.Get("Mail101"), // Language.Get("L1116"), // () => { } // ); return; } if (busy) { return; } busy = true; try { reconnectBackGround = false; accountBuf = _account; localSaveAccountName = accountBuf; ipBuf = _ip; portBuf = _port; gamePortBuf = _gamePort; ConnectGameServer(ipBuf, gamePortBuf); GameNetSystem.Instance.OnAccountLogin(); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } public void AccountLogin(string ip, int port, int gamePort) public void AccountLogin(string _ip, int _port, int _gamePort) { if (sdkLogined) { AccountLogin(sdkLoginResult.account, _ip, _port, _gamePort); } else { SDKUtils.Instance.FreePlatformLogin(); } } public void ReAccountLogin() { if (busy) { return; } busy = true; reconnectBackGround = true; try { ConnectGameServer(ipBuf, gamePortBuf); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } private void OnAccountLogin(bool _ok, string _result) { if (!_ok) { busy = false; Debug.LogError(_result); NetLinkWin.Hide(); return; } if (string.IsNullOrEmpty(_result)) { busy = false; // TODO YYL // ServerTipDetails.DisplayNormalTip(Language.Get("L1117")); NetLinkWin.Hide(); return; } var stringSet = _result.Split('|'); if (stringSet[0] != "OK") { if (stringSet.Length > 1) { // TODO YYL // ServerTipDetails.DisplayNormalTip(stringSet[1]); } busy = false; NetLinkWin.Hide(); return; } localSaveAccountName = accountBuf; try { ConnectGameServer(ipBuf, gamePortBuf); } catch (Exception ex) { busy = false; Debug.Log(ex); } } void ConnectGameServer(string _ip, int _port) { GameNetSystem.Instance.BeginConnectGameServer(_ip, _port, OnGameServerConnected); } private void OnGameServerConnected(bool ok) { // TODO YYL // if (ok) // { // var sendInfo = new C0123_tagCClientPackVersion(); // sendInfo.Version = DwVersionNo; // GameNetSystem.Instance.SendInfo(sendInfo); // } // else // { // busy = false; // } } // TODO YYL public void AccessLogin(/*H0101_tagServerPrepared _serverInfo*/) { // GameNetSystem.Instance.SendInfo(Get0101SendPackage(_serverInfo)); // 登录 } public void CheckClientVersion() { // TODO YYL // var sendInfo = new C010D_tagCClientVersion(); // sendInfo.Version = "10.1000.1"; // GameNetSystem.Instance.SendInfo(sendInfo); } private void OnApplicationOut() { // TODO YYL // var sendInfo = new C0103_tagCPlayerLogOut(); // sendInfo.Type = 1; // GameNetSystem.Instance.SendInfo(sendInfo); } public void RequestServerListLoop() { long nowTick = DateTime.Now.Ticks; if (LastLoopSecond == 0) { LastLoopSecond = nowTick; return; } if ((nowTick - LastLoopSecond) / 10000000 > ServerListLoop) { Debug.Log("定时请求服务器列表"); ServerListCenter.Instance.RequestServerCommonList(); LastLoopSecond = nowTick; } } } Main/System/ClientVersion/RequestSecretWin.cs
Main/System/ClientVersion/RequestSecretWin.cs.meta
Main/System/ClientVersion/VersionUpdateWin.cs
New file @@ -0,0 +1,59 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using DG.Tweening; using Cysharp.Threading.Tasks; public class VersionUpdateWin : UIBase { // 组件引用 [SerializeField] Button m_Confirm; [SerializeField] RichText m_Info; // 生命周期 protected override void Awake() { base.Awake(); // 初始化组件引用 } protected override void Start() { base.Start(); // 初始化数据 } protected override void InitComponent() { base.InitComponent(); m_Confirm.AddListener(Confirm); } // UI事件 protected override void OnOpen() { base.OnOpen(); // 窗口打开时的逻辑 // TODO YYL m_Info.text = string.Empty;//Language.GetFromLocal(9); } protected override void OnClose() { base.OnClose(); // 窗口关闭时的逻辑 } public override void Refresh() { base.Refresh(); // 刷新UI显示 } private void Confirm() { SDKUtils.Instance.GoToAppStore(VersionUtility.Instance.versionInfo.downUrl, "com.android.vending"); } } Main/System/ClientVersion/VersionUpdateWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: d284e5da25bb42a48bb3e4dcabe6b8e9 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Login.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: ae60482d361940746b454d97ea61be29 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/System/Login/GameAgeWarnWin.cs
New file @@ -0,0 +1,61 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using DG.Tweening; using Cysharp.Threading.Tasks; public class GameAgeWarnWin : UIBase { // 组件引用 [SerializeField] Transform m_Title1; //协议 [SerializeField] Transform m_Info1; [SerializeField] Transform m_Title2; //隐私 [SerializeField] Transform m_Info2; [SerializeField] Transform m_Title3; //年龄 [SerializeField] Transform m_Info3; [SerializeField] Button m_Close; // 生命周期 protected override void Awake() { base.Awake(); // 初始化组件引用 } protected override void Start() { base.Start(); // 初始化数据 } // UI事件 protected override void OnOpen() { base.OnOpen(); // 窗口打开时的逻辑 // m_Title1.SetActive(functionOrder == 1); // m_Info1.SetActive(functionOrder == 1); // m_Title2.SetActive(functionOrder == 2); // m_Info2.SetActive(functionOrder == 2); // m_Title3.SetActive(functionOrder == 3); // m_Info3.SetActive(functionOrder == 3); } protected override void OnClose() { base.OnClose(); // 窗口关闭时的逻辑 } public override void Refresh() { base.Refresh(); // 刷新UI显示 } public void SetFunctionOrder(int _functionOrder) { } } Main/System/Login/GameAgeWarnWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b2799fc2b27083f4e95c535c8c1627d5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Login/GameNotice.cs
New file @@ -0,0 +1,62 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameNotice { static bool noticeShowed = false; public static void OpenGameNotice() { try { if (VersionUtility.Instance.versionInfo == null || noticeShowed) return; var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch); if (!string.IsNullOrEmpty(url)) { SDKUtils.Instance.OpenUrl(url); noticeShowed = true; } } catch (System.Exception ex) { noticeShowed = true; } } public static bool HasNotice() { try { if (VersionUtility.Instance.versionInfo == null) return false; var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch); Debug.LogFormat("公告地址:{0}", url); return !string.IsNullOrEmpty(url); } catch (System.Exception ex) { return false; } } public static void OpenGameNoticeForce() { try { if (VersionUtility.Instance.versionInfo == null) return; var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.Get().branch); if (!string.IsNullOrEmpty(url)) { SDKUtils.Instance.OpenUrl(url); } } catch (System.Exception ex) { Debug.Log(ex); } } } Main/System/Login/GameNotice.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 6d2ea198f3b719542a730e8728d3f137 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Login/LoginWin.cs
New file @@ -0,0 +1,351 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.Tracing; using UnityEngine; using UnityEngine.UI; public class LoginWin : UIBase, ICanvasRaycastFilter { public static bool firstOpenEnd { get; private set; } private string m_ServerIP = "mobile.173on.com"; private int m_Port = 9090; private int m_GamePort = 19006; [SerializeField] Image m_Logo; [SerializeField] UIAlphaTween m_AlphaTween; [SerializeField] RectTransform m_WaitServerList; [SerializeField] RectTransform m_ContainerEnterGame; [SerializeField] RectTransform m_ContainerAccount; [SerializeField] Image m_ServerState; [SerializeField] Text m_ServerStateDescription; [SerializeField] Text m_ServerName; [SerializeField] protected InputField m_Account; [SerializeField] Button m_EnterGame; [SerializeField] Button m_QQLogin; [SerializeField] Button m_WXLogin; [SerializeField] Button m_ServerSelect; [SerializeField] Button m_SwitchAccount; [SerializeField] Button m_Notice; [SerializeField] Button m_UserHelp; [SerializeField] Button m_CleanCache; [SerializeField] Toggle checkRead; [SerializeField] Button serverRead; [SerializeField] Button hideRead; [SerializeField] Button ageWarn; [SerializeField] Text verInfo; protected override void InitComponent() { base.InitComponent(); Debug.Log("初始化登录窗口"); #if UNITY_EDITOR m_Account.onEndEdit.AddListener(x => { EnterGame(); }); #endif m_EnterGame.SetListener(EnterGame); m_QQLogin.SetListener(QQLogin); m_WXLogin.SetListener(WXLogin); m_ServerSelect.SetListener(OpenServerListWin); m_SwitchAccount.SetListener(SwitchAccount); m_Notice.SetListener(VeiwNotice); if (m_UserHelp) { m_UserHelp.SetListener(OpenUserHelp); } m_CleanCache.SetListener(ResourcesPath.Instance.CleanCache); serverRead.SetListener(() => { GameAgeWarnWin win = UIManager.Instance.OpenWindow<GameAgeWarnWin>(); win.SetFunctionOrder(1); // WindowCenter.Instance.OpenFromLocal<GameAgeWarnWin>(1); }); hideRead.SetListener(() => { GameAgeWarnWin win = UIManager.Instance.OpenWindow<GameAgeWarnWin>(); win.SetFunctionOrder(2); }); ageWarn.SetListener(() => { GameAgeWarnWin win = UIManager.Instance.OpenWindow<GameAgeWarnWin>(); win.SetFunctionOrder(3); }); } public override void HandleOpen() { base.HandleOpen(); Debug.Log("打开登录窗口"); ServerListCenter.Instance.serverSelectEvent += OnServerChange; ServerListCenter.Instance.onServerListRefreshEvent += OnServerListRefresh; ServerListCenter.Instance.RequestPlayerServerList(); LoginManager.Instance.isLogined = false; ServerListCenter.Instance.FiltrateDefaultServerAndServerGroup(); m_AlphaTween.SetStartState(); Refresh(); m_AlphaTween.Play(() => { firstOpenEnd = true; InGameDownLoad.Instance.downLoadGo = false; DownloadMgr.MaxDownLoadTask = InGameDownLoad.Instance.GetMaxTask(); }); } public override void HandleClose() { base.HandleClose(); Debug.Log("关闭登录窗口"); ServerListCenter.Instance.serverSelectEvent -= OnServerChange; ServerListCenter.Instance.onServerListRefreshEvent -= OnServerListRefresh; SDKUtils.Instance.onFreePlatformLoginOk -= OnLoginOk; SDKUtils.Instance.SendShowFloatWin(); } public override void Refresh() { base.Refresh(); Debug.Log("刷新登录窗口"); // 版本信息 string strVersion = StringUtility.Contact("ver ", InitialFunctionConfig.Get("version").Numerical1); verInfo.text = strVersion; // var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo"); // m_Logo.overrideSprite = sprite; // m_Logo.SetNativeSize(); m_Logo.rectTransform.anchoredPosition = VersionConfig.Get().logoPosition; m_Notice.SetActive(GameNotice.HasNotice()); // var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo"); // TODO YYL // bool hasNotice = GameNotice.HasNotice(); // 账号切换 m_SwitchAccount.SetActive(false); // 用户帮助 // TODO YYL // var appId = VersionConfig.Get().appId; // var branch = VersionConfig.Get().branch; // m_UserHelp.SetActive(ContactConfig.GetConfig(appId, branch) != null); // 是否已经获取到服务器列表 bool isGetServerList = ServerListCenter.Instance.serverListGot; m_WaitServerList.SetActive(!isGetServerList); m_ContainerEnterGame.SetActive(isGetServerList); m_ContainerAccount.SetActive(isGetServerList && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu)); // loginBtn.SetActive(isGetServerList); if (isGetServerList) { ChangeServerInfo(ServerListCenter.Instance.currentServer); } ChangeUserInfo(LoginManager.Instance.localSaveAccountName); m_EnterGame.SetActive(true); m_QQLogin.SetActive(false); m_WXLogin.SetActive(false); // 用户协议 todo checkRead.isOn = LocalSave.GetBool("tqsecretToggle"); } private void OnLoginOk(SDKUtils.FP_LoginOk arg0) { } private void OnServerChange() { ChangeServerInfo(ServerListCenter.Instance.currentServer); } // private void OnLoginBtnClick() // { // // TODO 登录 // Debug.Log("登录" + username.text + " / " + password.text); // CloseWindow(); // StageManager.Instance.ToGameScene(); // } private void ChangeServerInfo(ServerData _serverData) { // m_ServerName.text = _serverData.name.Replace("@gm", ""); m_ServerIP = _serverData.region_domain; m_Port = _serverData.login_port; m_GamePort = _serverData.game_port; switch ((ServerState)_serverData.running_status) { case ServerState.Maintain: case ServerState.Predicted: // m_ServerState.SetSprite("XT_FWQ_TB4"); // m_ServerStateDescription.text = Language.GetFromLocal(29); break; case ServerState.Normal: // m_ServerState.SetSprite("XT_FWQ_TB2"); // m_ServerStateDescription.text = Language.GetFromLocal(28); break; case ServerState.Busy: // m_ServerState.SetSprite("XT_FWQ_TB3"); // m_ServerStateDescription.text = Language.GetFromLocal(27); break; case ServerState.Hot: // m_ServerState.SetSprite("XT_FWQ_TB1"); // m_ServerStateDescription.text = Language.GetFromLocal(26); break; } } private void ChangeUserInfo(string user) { // m_Account.text = user; } private void OnServerListRefresh() { // m_WaitServerList.SetActive(!ServerListCenter.Instance.serverListGot); // m_ContainerEnterGame.SetActive(ServerListCenter.Instance.serverListGot); // m_ContainerAccount.SetActive(ServerListCenter.Instance.serverListGot // && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu)); } protected virtual void EnterGame() { if (!checkRead.isOn) { // TODO YYL // ConfirmCancel.ShowPopConfirm(Language.Get("agreementTitle"), Language.Get("agreementInfo")); LocalSave.SetBool("tqsecretToggle", false); //方便测试 return; } LocalSave.SetBool("tqsecretToggle", true); SDKUtils.Instance.SendHideFloatWin(); Login(); //到这里一定是下载表结束 InGameDownLoad.Instance.SetDownloadMark(); } protected void LateUpdate() { raycastTarget = true; LoginManager.Instance.RequestServerListLoop(); } protected void QQLogin() { SDKUtils.Instance.TencentLogin("Login"); } protected void WXLogin() { SDKUtils.Instance.TencentLogin("Loginwx"); } private void OpenServerListWin() { // TODO YYL UIManager.Instance.OpenWindow<ServerListWin>(); } private void SwitchAccount() { SDKUtils.Instance.FreePlatformLoginout(); LoginManager.Instance.sdkLogined = true; } private void VeiwNotice() { GameNotice.OpenGameNoticeForce(); } private void OpenUserHelp() { // TODO YYL // UIManager.Instance.OpenWindow<UserHelpWin>(); } protected void Login() { var allow = false; if (DebugUtility.Instance.isWhiteListAccount) { allow = true; } else { if (ServerListCenter.Instance.currentServer.running_status == (int)ServerState.Maintain || ServerListCenter.Instance.currentServer.running_status == (int)ServerState.Predicted) { allow = false; } else { allow = true; } } if (!allow) { switch ((ServerState)ServerListCenter.Instance.currentServer.running_status) { // TODO YYL case ServerState.Maintain: // SysNotifyMgr.Instance.ShowTip("ServerDown"); break; case ServerState.Predicted: // SysNotifyMgr.Instance.ShowTip("ServerOpen", ServerListCenter.Instance.currentServer.start_date.ToString("yyyy-MM-dd HH:mm")); break; } return; } if (GameNetSystem.Instance.netState == GameNetSystem.NetState.NerverConnect) { switch (VersionConfig.Get().versionAuthority) { case VersionAuthority.InterTest: if (string.IsNullOrEmpty(m_Account.text)) { // TODO YYL // ServerTipDetails.DisplayNormalTip(Language.Get("L1095")); return; } LoginManager.Instance.AccountLogin(m_Account.text, m_ServerIP, m_Port, m_GamePort); break; case VersionAuthority.Release: LoginManager.Instance.AccountLogin(m_ServerIP, m_Port, m_GamePort); break; } // TODO YYL // OperationLogCollect.Instance.RecordLauchEvent(6); // OperationLogCollect.Instance.RecordEvent(7); } } } Main/System/Login/LoginWin.cs.meta
Main/System/Login/ServerGroupToggle.cs
New file @@ -0,0 +1,49 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, January 10, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; public class ServerGroupToggle : ScrollItem { [SerializeField] Toggle m_Toggle; public Toggle toggle { get { return m_Toggle; } } [SerializeField] Text m_Title; [SerializeField] FontColorSizeConfig m_FontColor; int startIndex = 0; int count = 0; string groupName; public override void Display(object _data) { base.Display(_data); groupName = (string)_data; m_Title.text = groupName; m_Toggle.isOn = groupName == ServerListCenter.Instance.currentServerGroup; m_Title.color = m_FontColor.GetColorSize(m_Toggle.isOn ? "Selected" : "Normal").color; m_Toggle.RemoveAllListeners(); m_Toggle.AddListener(OnSelected); } public override void Dispose() { base.Dispose(); } private void OnSelected(bool _value) { m_Title.color = m_FontColor.GetColorSize(_value ? "Selected" : "Normal").color; if (_value) { ServerListCenter.Instance.currentServerGroup = groupName; } } } Main/System/Login/ServerGroupToggle.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 192bb0e4edd5b9146a748091369c503f MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Login/ServerListWin.cs
New file @@ -0,0 +1,109 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using DG.Tweening; using Cysharp.Threading.Tasks; public class ServerListWin : UIBase { // 组件引用 [SerializeField] CyclicScroll m_ServerGroupScroll; [SerializeField] CyclicScroll m_ServerScroll; [SerializeField] Button m_Close; // 生命周期 protected override void Awake() { base.Awake(); // 初始化组件引用 } protected override void Start() { base.Start(); // 初始化数据 } protected override void InitComponent() { base.InitComponent(); m_Close.AddListener(CloseWindow); } // UI事件 protected override void OnOpen() { base.OnOpen(); // 窗口打开时的逻辑 ServerListCenter.Instance.serverGroupSelectEvent += RefreshServerList; m_ServerGroupScroll.Init(ServerListCenter.Instance.GetAllServerGroup()); RefreshServerList(); } protected override void OnClose() { base.OnClose(); // 窗口关闭时的逻辑 ServerListCenter.Instance.serverGroupSelectEvent -= RefreshServerList; } public override void Refresh() { base.Refresh(); // 刷新UI显示 } private void RefreshServerList() { ServerGroup serverGroup = null; if (ServerListCenter.Instance.TryGetServerGroup(ServerListCenter.Instance.currentServerGroup, out serverGroup)) { if (serverGroup.group_list != null) { var groupDatas = new List<ServerDataCouple>(); var serverDataList = new List<ServerData>(serverGroup.group_list); for (int i = serverDataList.Count - 1; i >= 0; i--) { if (VersionConfig.Get().isBanShu) { if (serverDataList[i].region_flag != 8000) { serverDataList.RemoveAt(i); } } else { if (serverDataList[i].region_flag == 8000) { serverDataList.RemoveAt(i); } } } serverDataList.Sort(ServerData.Compare); var max = serverDataList.Count; for (int i = 0; i < max; i++, i++) { if (i + 1 < max) { groupDatas.Add(new ServerDataCouple(serverDataList[i], serverDataList[i + 1])); } else { groupDatas.Add(new ServerDataCouple(serverDataList[i])); } } m_ServerScroll.Init(groupDatas); } else { m_ServerScroll.Init<ServerDataCouple>(null); } } } } Main/System/Login/ServerListWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: c6340fed6a9d02445b05bc07bc6644aa MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/NetLink.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: 96479f08f2fa4f640bb411315f5ce16b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/System/NetLink/NetLinkWin.cs
New file @@ -0,0 +1,90 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using DG.Tweening; using Cysharp.Threading.Tasks; public class NetLinkWin : UIBase { // 组件引用 [SerializeField] Transform backGround; [SerializeField] Transform circle; static float linkOverTime = 0f; float timer = 0f; bool actived = false; // 生命周期 protected override void Awake() { base.Awake(); // 初始化组件引用 } protected override void Start() { base.Start(); // 初始化数据 } protected override void InitComponent() { base.InitComponent(); } // UI事件 protected override void OnOpen() { base.OnOpen(); // 窗口打开时的逻辑 timer = 0f; if (linkOverTime > 0.001f) { actived = false; backGround.SetActive(false); circle.SetActive(false); } else { actived = true; backGround.SetActive(true); circle.SetActive(true); } } protected override void OnClose() { base.OnClose(); // 窗口关闭时的逻辑 } public override void Refresh() { base.Refresh(); // 刷新UI显示 } protected void LateUpdate() { timer += Time.deltaTime; if (!actived && timer > linkOverTime) { backGround.SetActive(true); circle.SetActive(true); } } public static void Show(float _delay = 0f) { linkOverTime = _delay; UIManager.Instance.OpenWindow<NetLinkWin>(); } public static void Hide() { UIManager.Instance.CloseWindow<NetLinkWin>(); } } Main/System/NetLink/NetLinkWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: dd817f590609dcd458019e2ef2d4f992 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/UI/Login/LoginWin.cs
File was deleted Main/UI/UIBase.cs
@@ -391,6 +391,17 @@ } #endregion public bool raycastTarget { get; set; } = true; public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) { return raycastTarget; } #region 动画方法 // 停止当前正在播放的动画