Main/Component/UI/Common/SmoothMask.cs
@@ -56,54 +56,42 @@ } private void SetChildrenImageMaterial(Transform _transform) { Image image; Transform transform; for(int i = 0;i < _transform.childCount;i++) { transform = _transform.GetChild(i); image = transform.GetComponent<Image>(); if(image != null) { image.material = imageMaterials.Length > 0 ? imageMaterials[0] : null; } else { var imageex = transform.GetComponent<ImageEx>(); if (imageex != null) { imageex.material = imageMaterials.Length > 0 ? imageMaterials[0] : null; } } Image[] images = _transform.GetComponentsInChildren<Image>(true); ImageEx[] imageexs = _transform.GetComponentsInChildren<ImageEx>(true); if(transform.childCount > 0) { SetChildrenImageMaterial(transform); if (null != images) { for(int i = 0;i < images.Length;i++) { images[i].material = imageMaterials.Length > 0? imageMaterials[0] : null; } } if (null!= imageexs) { for(int i = 0;i < imageexs.Length;i++) { imageexs[i].material = imageMaterials.Length > 0? imageMaterials[0] : null; } } } private void SetChildrenTextMaterial(Transform _parent) { Text text; Transform transform; for(int i = 0;i < _parent.childCount;i++) { transform = _parent.GetChild(i); text = transform.GetComponent<Text>(); if(text != null) { text.material = textMaterials.Length > 0 ? textMaterials[0] : null; } if(transform.childCount > 0) { SetChildrenTextMaterial(transform); Text[] texts = _parent.GetComponentsInChildren<Text>(true); if(texts!= null) { for(int i = 0;i < texts.Length;i++) { texts[i].material = textMaterials.Length > 0? textMaterials[0] : null; } } } private void UpdateChildMaterialSmoothMask() { if (null == canvasScaler) return; var scaleX = canvasScaler.transform.localScale.x; var scaleY = canvasScaler.transform.localScale.y; leftBottom = scaleX == 0f ? Vector2.zero : rectTransform.GetMinWorldPosition() / scaleX; rightTop = scaleY == 0f ? Vector2.zero : rectTransform.GetMaxWorldPosition() / scaleY; Vector3[] corners = new Vector3[4]; rectTransform.GetWorldCorners(corners); leftBottom = new Vector2(corners[0].x, corners[0].y); rightTop = new Vector2(corners[2].x, corners[2].y); if(imageMaterials != null) { for(int i = 0;i < imageMaterials.Length;i++) { @@ -118,10 +106,55 @@ } } static void SetSmoothMask(Material material,Vector2 leftBottom,Vector2 rightTop,Vector2 smoothRect) { material.SetVector("_LeftBottom",leftBottom); material.SetVector("_RightTop",rightTop); material.SetVector("_SmoothRect",smoothRect); #if UNITY_EDITOR void OnDrawGizmos() { Vector3[] corners = new Vector3[4]; rectTransform.GetWorldCorners(corners); Gizmos.color = Color.red; // 设置线框颜色 // 绘制矩形边界 Gizmos.DrawLine(corners[0], corners[1]); // 左下→左上 Gizmos.DrawLine(corners[1], corners[2]); // 左上→右上 Gizmos.DrawLine(corners[2], corners[3]); // 右上→右下 Gizmos.DrawLine(corners[3], corners[0]); // 右下→左下 } #endif void SetSmoothMask(Material material,Vector2 leftBottom,Vector2 rightTop,Vector2 smoothRect) { Image[] images = GetComponentsInChildren<Image>(true); ImageEx[] imageexs = GetComponentsInChildren<ImageEx>(true); Text[] texts = GetComponentsInChildren<Text>(true); if (null != images) { foreach (var graphic in images) { graphic.material.SetVector("_LeftBottom",leftBottom); graphic.material.SetVector("_RightTop",rightTop); graphic.material.SetVector("_SmoothRect",smoothRect); } } if (null != imageexs) { foreach (var graphic in imageexs) { graphic.material.SetVector("_LeftBottom",leftBottom); graphic.material.SetVector("_RightTop",rightTop); graphic.material.SetVector("_SmoothRect",smoothRect); } } if (null != texts) { foreach (var graphic in texts) { graphic.material.SetVector("_LeftBottom",leftBottom); graphic.material.SetVector("_RightTop",rightTop); graphic.material.SetVector("_SmoothRect",smoothRect); } } } } Main/Core/GameEngine/Launch/AssetBundleInitTask.cs
@@ -30,7 +30,6 @@ public override void End() { expectTime = timer; // TODO YYL // UILoader.LoadWindowAsync("LaunchBackGroundWin", null); Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer); } Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
@@ -54,10 +54,16 @@ { AssetBundleUtility.Instance.InitBuiltInAsset(); } // TODO YYL // ConfigInitiator.SyncInit(); // WindowCenter.Instance.DestoryWinsByStage(WindowCenter.WindowStage.Launch); // WindowCenter.Instance.OpenFromLocal<LaunchWin>(); UIManager.Instance.CloseWindow<DownLoadWin>(); UIManager.Instance.CloseWindow<VersionUpdateWin>(); UIManager.Instance.CloseWindow<LaunchWin>(); if (!AssetSource.uiFromEditor) { AssetBundleUtility.Instance.UnloadAssetBundle("builtin/prefabs", true, false); } UIManager.Instance.OpenWindow<LaunchWin>(); Language.InitDefaultLanguage(); } Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
@@ -17,14 +17,14 @@ ShaderUtility.WarmUpAll(); //SpeechTranslate.Instance.RequestGetToken(); // TODO CYL // WindowCenter.Instance.Open<LaunchBackGroundWin>(true); UIManager.Instance.OpenWindow<LaunchBackGroundWin>(); // var launchWin = WindowCenter.Instance.Get<LaunchWin>(); // if (launchWin != null) // { // launchWin.FadeOut(); // } var launchWin = UIManager.Instance.GetUI<LaunchWin>(); if (launchWin != null) { launchWin.FadeOut(); } // try Main/Login/ServerData.cs
@@ -34,7 +34,6 @@ _serverData = default(ServerData); return false; } } Main/Login/ServerListCenter.cs
@@ -234,6 +234,7 @@ { if (_ok) { Debug.LogError(" OnGetServerList " + _result); ServerListParser.Instance.PushCommonServerListRawData(_result); NetLinkWin.Hide(); } @@ -262,6 +263,13 @@ } } List<string> prints = FieldPrint.PrintFieldsExpand(serverInfoCommon.common[0], true); for (int i = 0; i < prints.Count; i++) { Debug.LogError($"index : {i} " + prints[i]); } serverInfoCommon.recommend.group_list = recommendServers.ToArray(); FiltrateDefaultServerAndServerGroup(); Main/Main.cs
@@ -20,8 +20,6 @@ { Debug.Log("Main.Init() 被调用"); LaunchLoadingWin.Instance.CloseWindow(); SwitchToLoginScene(); } Main/Manager/ResManager.cs
@@ -98,13 +98,51 @@ } } #if UNITY_EDITOR public string GetFullDirectory(string directory) { string fullDirectory = Path.Combine(ResourcesOutPath, directory); return fullDirectory; } public string FindFilePath(string directory, string fileName) { string[] files = Directory.GetFiles(GetFullDirectory(directory), fileName, SearchOption.AllDirectories); if (files.Length > 0) { return files[0]; } return string.Empty; } public string GetRelativePath(string absolutePath) { string relativePath = absolutePath.Replace(ResourcesOutPath, "Assets/ResourcesOut/"); return relativePath; } #endif public T LoadAsset<T> (string directory, string name) where T : UnityEngine.Object { T asset = null; #if UNITY_EDITOR var path = string.Concat($"Assets/ResourcesOut/{directory}/{name}", GetExtension(typeof(T))); // 找不到文件时,尝试在内部继续找 if (!File.Exists(path)) { path = GetRelativePath(FindFilePath(directory, name + GetExtension(typeof(T)))); if (string.IsNullOrEmpty(path)) { Debug.LogErrorFormat("LoadAsset() => 加载不到资源: {1} {0}." + path, name, directory); return asset; } } asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path); #else //TODO YYL ASSET BUNDLE部分要重写处理一下 if (prefabBundle == null) { // string _path = GetAssetFilePath("builtin/prefabs"); @@ -115,7 +153,7 @@ #endif if (asset == null) { Debug.LogErrorFormat("LoadBuiltInPrefab() => 加载不到资源: {0}.", name); Debug.LogErrorFormat("LoadAsset() => 加载不到资源: {0}.", name); } return asset; Main/System/AssetVersion/AssetVersionUtility.cs
@@ -72,7 +72,7 @@ { if (task.IsDone) { // TODO CYL // TODO YYL // PriorBundleConfig.Init(true); GetAssetVersionFile(); } Main/System/Launch.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: ecc166dc7ffe889499ff7985afb2ec0b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/System/Launch/LaunchBackGroundWin.cs
New file @@ -0,0 +1,63 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using DG.Tweening; using Cysharp.Threading.Tasks; public class LaunchBackGroundWin : UIBase { // 组件引用 [SerializeField] RectTransform m_StaticBackGround; [SerializeField] Image m_BackGroundImage; [SerializeField] TextEx info; // 生命周期 protected override void Awake() { base.Awake(); // 初始化组件引用 } protected override void Start() { base.Start(); // 初始化数据 } // UI事件 protected override void OnOpen() { base.OnOpen(); // 窗口打开时的逻辑 LoginManager.Instance.loginErrorEvent += OnLoginError; var sprite = BuiltInLoader.LoadSprite("LoginBackGround"); m_BackGroundImage.overrideSprite = sprite; m_BackGroundImage.preserveAspect = true; m_StaticBackGround.SetActive(true); this.transform.SetAsFirstSibling(); info.text = LoginManager.Instance.loginErrorInfo; } protected override void OnClose() { base.OnClose(); // 窗口关闭时的逻辑 LoginManager.Instance.loginErrorEvent -= OnLoginError; } public override void Refresh() { base.Refresh(); // 刷新UI显示 } void OnLoginError() { info.text = LoginManager.Instance.loginErrorInfo; } } Main/System/Launch/LaunchBackGroundWin.cs.metacopy from Main/System/Message/TextUnline.cs.meta copy to Main/System/Launch/LaunchBackGroundWin.cs.meta
File was copied from Main/System/Message/TextUnline.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 4f2256ca60f43dd46acb603765acad4d timeCreated: 1503129452 licenseType: Free guid: 274065e6d2086ee4bbc02960291b9652 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/Launch/LaunchWin.cs
New file @@ -0,0 +1,292 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, September 05, 2017 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LaunchWin : UIBase { [SerializeField] UIAlphaTween m_AlphaTween; [SerializeField] Image m_BackGround; [SerializeField] RectTransform m_AndroidProgressContainer; [SerializeField] RectTransform m_NetworkContainer; [SerializeField] SmoothSlider m_PartProgressSlider; [SerializeField] SmoothSlider m_TotalProgressSlider; [SerializeField] Text m_StageDescription; [SerializeField] RectTransform m_IosProgressContainer; [SerializeField] Text m_IosProgressTip; [SerializeField] Text m_BuildTime; [SerializeField] Text m_Version; [SerializeField] Button m_UserHelp; bool assetBuildTimeShowed = false; LaunchStage showStage = LaunchStage.None; int showStep = 0; string stepDescription = string.Empty; float backGroundTimer = 0f; int backGroundIndex = 0; List<Sprite> backGrounds = new List<Sprite>(); int AllTimes = 0; int WaitSeconds = 0; bool ShowCircleView = false; float TempCheck = 0; protected override void InitComponent() { m_BackGround.preserveAspect = true; if (Application.isEditor) { var sprite = BuiltInLoader.LoadSprite("Launch_1"); m_BackGround.overrideSprite = sprite; } else { for (var i = 0; i < 3; i++) { var sprite = BuiltInLoader.LoadSprite(StringUtility.Contact("Launch_", i + 1)); if (sprite != null) { backGrounds.Add(sprite); } } m_BackGround.overrideSprite = backGrounds[0]; } // AddListener if (m_UserHelp) { m_UserHelp.SetListener(OpenUserHelp); } } protected override void OnPreOpen() { backGroundTimer = 0f; backGroundIndex = 0; if (m_TotalProgressSlider != null) { m_TotalProgressSlider.ResetValue(0f); } m_AlphaTween.SetStartState(); m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : ""; if (m_UserHelp) { var appId = VersionConfig.Get().appId; var branch = VersionConfig.Get().branch; //m_UserHelp.SetActive(ContactConfig.GetConfig(appId, branch) != null); m_UserHelp.SetActive(false); } if (m_NetworkContainer != null) { m_NetworkContainer.SetActive(false); } var AppleCheck = InitialFunctionConfig.Get("CheckTime").Numerical1; var AndroidCheck = InitialFunctionConfig.Get("CheckTime").Numerical2; var CheckAll = InitialFunctionConfig.Get("NetworkCheck").Numerical1; AllTimes = int.Parse(CheckAll); var CheckTime = InitialFunctionConfig.Get("NetworkCheck").Numerical2; WaitSeconds = int.Parse(CheckTime); ShowCircleView = false; if (Application.platform == RuntimePlatform.IPhonePlayer && AppleCheck == "1") ShowCircleView = true; if (Application.platform == RuntimePlatform.Android && AndroidCheck == "1") ShowCircleView = true; if (ShowCircleView) { m_AndroidProgressContainer.SetActive(false); m_IosProgressContainer.SetActive(true); m_Version.text = string.Empty; } else { m_AndroidProgressContainer.SetActive(true); m_IosProgressContainer.SetActive(false); m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, Language.Id); } if (m_StageDescription != null) { m_StageDescription.text = GetLaunchStageDescription(showStage, showStep); } UpdateProgress(); if (m_TotalProgressSlider == null) { m_TotalProgressSlider = this.GetComponentInChildren<SmoothSlider>(true); } } protected override void OnOpen() { } protected override void OnPreClose() { } protected override void OnClose() { } public void FadeOut() { m_AlphaTween.Play(); } string GetLaunchStageDescription(LaunchStage _stage, int step) { switch (_stage) { case LaunchStage.SDKInit: return Language.GetFromLocal(36); case LaunchStage.AssetCopy: return StringUtility.Contact(Language.GetFromLocal(37), "(", step, ")"); case LaunchStage.AssetDecompress: return StringUtility.Contact(Language.GetFromLocal(38), "(", step, ")"); case LaunchStage.ClientVersion: return Language.GetFromLocal(39); case LaunchStage.CheckAsset: return Language.GetFromLocal(40); case LaunchStage.DownLoad: return Language.GetFromLocal(41); case LaunchStage.AssetBundleInit: return Language.GetFromLocal(42); case LaunchStage.ConfigInit: return StringUtility.Contact(Language.GetFromLocal(43), "(", step, ")"); case LaunchStage.Complete: return Language.GetFromLocal(44); default: return ""; } } protected void LateUpdate() { UpdateProgress(); backGroundTimer += Time.deltaTime; if (backGroundTimer >= 3f) { backGroundTimer = 0f; if (backGrounds.Count > 1) { m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count]; } } if (HttpBehaviour.ConnectAllTimes >= AllTimes && m_NetworkContainer != null) { TempCheck += Time.deltaTime; m_NetworkContainer.SetActive(true); if (TempCheck >= WaitSeconds) { TempCheck = 0; m_NetworkContainer.SetActive(false); HttpBehaviour.ConnectAllTimes = 0; } } } private void OpenUserHelp() { // TODO YYL // UIManager.Instance.OpenWindow<UserHelpWin>(); } private void UpdateProgress() { //if (Application.platform == RuntimePlatform.IPhonePlayer) if(ShowCircleView) { m_IosProgressContainer.SetActive(LaunchInHot.progressInfo.stage != LaunchStage.DownLoad); var remainder = ((int)Time.time) % 3; var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "..."; m_IosProgressTip.text = StringUtility.Contact(Language.GetFromLocal(30), dot); } else { var progressInfo = LaunchInHot.progressInfo; if (progressInfo.stage == LaunchStage.DownLoad) { if (m_PartProgressSlider != null && m_PartProgressSlider.gameObject.activeInHierarchy) { m_PartProgressSlider.SetActive(false); } if (m_TotalProgressSlider != null && m_TotalProgressSlider.gameObject.activeInHierarchy) { m_TotalProgressSlider.SetActive(false); } } else { if (m_PartProgressSlider != null && !m_PartProgressSlider.gameObject.activeInHierarchy) { m_PartProgressSlider.SetActive(true); } if (m_TotalProgressSlider != null && !m_TotalProgressSlider.gameObject.activeInHierarchy) { m_TotalProgressSlider.SetActive(true); } if (m_TotalProgressSlider != null) { m_TotalProgressSlider.value = progressInfo.totalProgress; } if (m_PartProgressSlider != null) { m_PartProgressSlider.value = progressInfo.partProgress; } } DisplayStageDescription(progressInfo.stage, progressInfo.step); //if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue) //{ // assetBuildTimeShowed = true; // var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes; // m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString()); //} } } private void DisplayStageDescription(LaunchStage stage, int step) { if (showStage != stage || showStep != step) { showStage = stage; showStep = step; if (m_StageDescription != null) { m_StageDescription.text = GetLaunchStageDescription(stage, step); } } } } Main/System/Launch/LaunchWin.cs.meta
File was renamed from Main/System/Message/TextUnline.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 4f2256ca60f43dd46acb603765acad4d timeCreated: 1503129452 licenseType: Free guid: 2a921f76dac28604584145426edd9a22 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/Login/LoginWin.cs
@@ -123,13 +123,12 @@ 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(); 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"); bool hasNotice = GameNotice.HasNotice(); @@ -186,7 +185,7 @@ private void ChangeServerInfo(ServerData _serverData) { // m_ServerName.text = _serverData.name.Replace("@gm", ""); m_ServerName.text = _serverData.name.Replace("@gm", ""); m_ServerIP = _serverData.region_domain; m_Port = _serverData.login_port; m_GamePort = _serverData.game_port; @@ -195,35 +194,35 @@ { case ServerState.Maintain: case ServerState.Predicted: // m_ServerState.SetSprite("XT_FWQ_TB4"); // m_ServerStateDescription.text = Language.GetFromLocal(29); 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); 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); 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); m_ServerState.SetSprite("XT_FWQ_TB1"); m_ServerStateDescription.text = Language.GetFromLocal(26); break; } } private void ChangeUserInfo(string user) { // m_Account.text = 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)); 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() @@ -321,6 +320,7 @@ if (GameNetSystem.Instance.netState == GameNetSystem.NetState.NerverConnect) { Debug.LogError("AccountLogin -----------"); switch (VersionConfig.Get().versionAuthority) { case VersionAuthority.InterTest: Main/System/Login/ServerBehaviour.cs
New file @@ -0,0 +1,108 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, January 10, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System; public class ServerBehaviour : MonoBehaviour { // [SerializeField] AvatarCell avatarCell; [SerializeField] Image m_ServerState; [SerializeField] Text m_ServerName; [SerializeField] Text m_OpenTime; [SerializeField] Button m_Select; [SerializeField] Text m_RoleName; [SerializeField] Text m_RoleLevel; ServerData m_ServerData; public void Display(ServerData _serverData) { m_ServerData = _serverData; switch ((ServerState)_serverData.running_status) { case ServerState.Maintain: case ServerState.Predicted: m_ServerState.SetSprite("XT_FWQ_TB4"); break; case ServerState.Normal: m_ServerState.SetSprite("XT_FWQ_TB2"); break; case ServerState.Busy: m_ServerState.SetSprite("XT_FWQ_TB3"); break; case ServerState.Hot: m_ServerState.SetSprite("XT_FWQ_TB1"); break; } m_ServerName.text = _serverData.name.Replace("@gm", ""); var job = _serverData.job; if (job != 0) { // avatarCell.bgImage.SetActive(true); // avatarCell.avatarImage.SetActive(true); // avatarCell.avatarFrameImage.SetActive(false); m_RoleName.SetActive(true); m_RoleLevel.SetActive(true); m_OpenTime.SetActive(false); // avatarCell.InitUI(AvatarHelper.GetDefaultAvatarModel(job)); m_RoleName.text = _serverData.roleid; m_RoleLevel.text = Language.Get("Z1024", _serverData.level); } else { m_OpenTime.SetActive(m_ServerData.start_date > DateTime.Now); if (m_ServerData.start_date > DateTime.Now) { m_OpenTime.text = Language.Get("ServerOnTime", m_ServerData.start_date.ToString("yyyy-MM-dd HH:mm")); } // avatarCell.bgImage.SetActive(false); // avatarCell.avatarImage.SetActive(false); // avatarCell.avatarFrameImage.SetActive(false); m_RoleName.SetActive(false); m_RoleLevel.SetActive(false); } m_Select.RemoveAllListeners(); m_Select.AddListener(SelectServer); var gmImage = this.FindComponent("Image", "gm"); gmImage.SetActive(_serverData.name.Contains("@gm")); } private void SelectServer() { if (DebugUtility.Instance.isWhiteListAccount) { ServerListCenter.Instance.currentServer = m_ServerData; UIManager.Instance.CloseWindow<ServerListWin>(); } else { switch ((ServerState)m_ServerData.running_status) { case ServerState.Maintain: SysNotifyMgr.Instance.ShowTip("ServerDown"); break; case ServerState.Predicted: SysNotifyMgr.Instance.ShowTip("ServerOpen", m_ServerData.start_date.ToString("yyyy-MM-dd HH:mm")); break; default: ServerListCenter.Instance.currentServer = m_ServerData; UIManager.Instance.CloseWindow<ServerListWin>(); break; } } } } Main/System/Login/ServerBehaviour.cs.metacopy from Main/System/Message/TextUnline.cs.meta copy to Main/System/Login/ServerBehaviour.cs.meta
File was copied from Main/System/Message/TextUnline.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 4f2256ca60f43dd46acb603765acad4d timeCreated: 1503129452 licenseType: Free guid: 807e2170cabc18d4a92bd106298b5ba8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/Login/ServerBehaviourGroup.cs
New file @@ -0,0 +1,38 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, January 10, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; public class ServerBehaviourGroup : ScrollItem { [SerializeField] ServerBehaviour m_ServerBehaviour_1; [SerializeField] ServerBehaviour m_ServerBehaviour_2; public override void Display(object _data) { base.Display(_data); var serverDataGroup = (ServerDataCouple)_data; m_ServerBehaviour_1.SetActive(serverDataGroup.serverData1.region_flag > 0); m_ServerBehaviour_2.SetActive(serverDataGroup.serverData2.region_flag > 0); if (serverDataGroup.serverData1.region_flag > 0) { m_ServerBehaviour_1.Display(serverDataGroup.serverData1); } if (serverDataGroup.serverData2.region_flag > 0) { m_ServerBehaviour_2.Display(serverDataGroup.serverData2); } } } Main/System/Login/ServerBehaviourGroup.cs.metacopy from Main/System/Message/TextUnline.cs.meta copy to Main/System/Login/ServerBehaviourGroup.cs.meta
File was copied from Main/System/Message/TextUnline.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 4f2256ca60f43dd46acb603765acad4d timeCreated: 1503129452 licenseType: Free guid: cafbc0420a5673a46b94c5b4fab7d4a6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 Main/System/Message/RichText.cs
@@ -181,7 +181,7 @@ unline = transform.GetComponentInChildren<TextUnline>(); if (unline == null) { GameObject obj = Resources.Load("UIComp/TextUnline") as GameObject; GameObject obj = BuiltInLoader.LoadPrefab("TextUnline"); // GameObject obj = UILoader.LoadPrefab("TextUnline") as GameObject; obj = Instantiate(obj); obj.transform.SetParent(transform); Main/System/Message/TextUnline.cs
File was deleted Main/UI/UIManager.cs
@@ -123,7 +123,7 @@ // 初始化各层级的Transform staticTrans = uiRoot.Find("Static"); bottomTrans = uiRoot.Find("Bottom"); midTrans = uiRoot.Find("Mid"); midTrans = uiRoot.Find("Middle"); topTrans = uiRoot.Find("Top"); systemTrans = uiRoot.Find("System"); @@ -465,6 +465,8 @@ uiObject.transform.SetParent(parentTrans, false); // Debug.LogError("加载UI资源-SetParent " + uiName + " transName is " + parentTrans.gameObject.name); // 设置排序顺序 int baseSortingOrder = GetBaseSortingOrderForLayer(uiBase.uiLayer); uiBase.SetSortingOrder(baseSortingOrder); @@ -522,7 +524,10 @@ { // 获取UI类型名称 string uiName = typeof(T).Name; // Debug.LogError("打开ui " + uiName); // 加载UI资源 T ui = LoadUIResource<T>(uiName); if (ui == null) @@ -531,6 +536,8 @@ Debug.LogError($"打开UI失败: {uiName}"); return null; } // Debug.LogError("加载UI资源 " + uiName); // 自动设置父级UI(如果未指定且支持父子关系) if (parentUI == null && ui.supportParentChildRelation && uiStack.Count > 0) Main/Utility/FieldPrint.cs
@@ -51,7 +51,7 @@ return contents; } private static string[] PrintArray(string _name, object _object) public static string[] PrintArray(string _name, object _object) { var objects = _object as Array; var contents = new string[objects.Length]; Main/Utility/UIUtility.cs
@@ -78,22 +78,16 @@ public static Vector2 GetMaxWorldPosition(this RectTransform _rectTransform) { Vector2 max; var offsetY = (1 - _rectTransform.pivot.y) * _rectTransform.rect.height; var offsetX = (1 - _rectTransform.pivot.x) * _rectTransform.rect.width; max = _rectTransform.TransformPoint(offsetX, offsetY, 0); return max; Vector3[] cornors = new Vector3[4]; _rectTransform.GetWorldCorners(cornors); return cornors[2]; } public static Vector2 GetMinWorldPosition(this RectTransform _rectTransform) { Vector2 min; var offsetY = -_rectTransform.pivot.y * _rectTransform.rect.height; var offsetX = -_rectTransform.pivot.x * _rectTransform.rect.width; min = _rectTransform.TransformPoint(offsetX, offsetY, 0); return min; Vector3[] cornors = new Vector3[4]; _rectTransform.GetWorldCorners(cornors); return cornors[0]; } public static Vector2 GetMaxReferencePosition(this RectTransform _rectTransform, Transform _reference)