From d18d4a9dacd9557f2bc0b4cf141e99374406b4dc Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 30 五月 2025 11:39:49 +0800
Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建
---
Main/Core/GameEngine/Launch/AssetBundleInitTask.cs | 1
Main/System/Launch/LaunchBackGroundWin.cs | 63 ++++
Main/System/Login/ServerBehaviour.cs.meta | 5
Main/Login/ServerData.cs | 1
Main/System/AssetVersion/AssetVersionUtility.cs | 2
Main/System/Login/ServerBehaviourGroup.cs.meta | 5
Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs | 12
Main/System/Login/ServerBehaviour.cs | 108 +++++++
Main/System/Launch.meta | 8
Main/System/Login/ServerBehaviourGroup.cs | 38 ++
Main/System/Login/LoginWin.cs | 36 +-
Main/Utility/UIUtility.cs | 18
Main/System/Message/RichText.cs | 2
/dev/null | 87 -----
Main/UI/UIManager.cs | 11
Main/Component/UI/Common/SmoothMask.cs | 109 ++++--
Main/Utility/FieldPrint.cs | 2
Main/Login/ServerListCenter.cs | 8
Main/System/Launch/LaunchWin.cs | 292 +++++++++++++++++++
Main/System/Launch/LaunchBackGroundWin.cs.meta | 5
Main/Main.cs | 2
Main/Manager/ResManager.cs | 40 ++
Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs | 14
Main/System/Launch/LaunchWin.cs.meta | 5
24 files changed, 687 insertions(+), 187 deletions(-)
diff --git a/Main/Component/UI/Common/SmoothMask.cs b/Main/Component/UI/Common/SmoothMask.cs
index 14d04c5..592a7aa 100644
--- a/Main/Component/UI/Common/SmoothMask.cs
+++ b/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);
+ }
+ }
}
}
diff --git a/Main/Core/GameEngine/Launch/AssetBundleInitTask.cs b/Main/Core/GameEngine/Launch/AssetBundleInitTask.cs
index 3a3c9b8..e4efc44 100644
--- a/Main/Core/GameEngine/Launch/AssetBundleInitTask.cs
+++ b/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);
}
diff --git a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs b/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
index f409608..e905e4f 100644
--- a/Main/Core/GameEngine/Launch/BuiltInAssetCopyTask.cs
+++ b/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();
}
diff --git a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs b/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
index 0f71ccf..4a904d3 100644
--- a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
+++ b/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
diff --git a/Main/Login/ServerData.cs b/Main/Login/ServerData.cs
index be7773e..2bd42f6 100644
--- a/Main/Login/ServerData.cs
+++ b/Main/Login/ServerData.cs
@@ -34,7 +34,6 @@
_serverData = default(ServerData);
return false;
}
-
}
diff --git a/Main/Login/ServerListCenter.cs b/Main/Login/ServerListCenter.cs
index 72b5cd0..3a9759d 100644
--- a/Main/Login/ServerListCenter.cs
+++ b/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();
diff --git a/Main/Main.cs b/Main/Main.cs
index c83d14d..17951d3 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -20,8 +20,6 @@
{
Debug.Log("Main.Init() 琚皟鐢�");
- LaunchLoadingWin.Instance.CloseWindow();
-
SwitchToLoginScene();
}
diff --git a/Main/Manager/ResManager.cs b/Main/Manager/ResManager.cs
index 4fc65df..03e49f3 100644
--- a/Main/Manager/ResManager.cs
+++ b/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;
diff --git a/Main/System/AssetVersion/AssetVersionUtility.cs b/Main/System/AssetVersion/AssetVersionUtility.cs
index b460ea3..b67aa6c 100644
--- a/Main/System/AssetVersion/AssetVersionUtility.cs
+++ b/Main/System/AssetVersion/AssetVersionUtility.cs
@@ -72,7 +72,7 @@
{
if (task.IsDone)
{
- // TODO CYL
+ // TODO YYL
// PriorBundleConfig.Init(true);
GetAssetVersionFile();
}
diff --git a/Main/System/Launch.meta b/Main/System/Launch.meta
new file mode 100644
index 0000000..6fe820f
--- /dev/null
+++ b/Main/System/Launch.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ecc166dc7ffe889499ff7985afb2ec0b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Launch/LaunchBackGroundWin.cs b/Main/System/Launch/LaunchBackGroundWin.cs
new file mode 100644
index 0000000..5efcad7
--- /dev/null
+++ b/Main/System/Launch/LaunchBackGroundWin.cs
@@ -0,0 +1,63 @@
+锘縰sing 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;
+ }
+}
diff --git a/Main/System/Message/TextUnline.cs.meta b/Main/System/Launch/LaunchBackGroundWin.cs.meta
similarity index 68%
copy from Main/System/Message/TextUnline.cs.meta
copy to Main/System/Launch/LaunchBackGroundWin.cs.meta
index 245a752..ecde4e1 100644
--- a/Main/System/Message/TextUnline.cs.meta
+++ b/Main/System/Launch/LaunchBackGroundWin.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: 4f2256ca60f43dd46acb603765acad4d
-timeCreated: 1503129452
-licenseType: Free
+guid: 274065e6d2086ee4bbc02960291b9652
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Launch/LaunchWin.cs b/Main/System/Launch/LaunchWin.cs
new file mode 100644
index 0000000..ab70f09
--- /dev/null
+++ b/Main/System/Launch/LaunchWin.cs
@@ -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);
+ }
+ }
+ }
+
+ }
+
+
+
+
diff --git a/Main/System/Message/TextUnline.cs.meta b/Main/System/Launch/LaunchWin.cs.meta
similarity index 68%
rename from Main/System/Message/TextUnline.cs.meta
rename to Main/System/Launch/LaunchWin.cs.meta
index 245a752..9358400 100644
--- a/Main/System/Message/TextUnline.cs.meta
+++ b/Main/System/Launch/LaunchWin.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: 4f2256ca60f43dd46acb603765acad4d
-timeCreated: 1503129452
-licenseType: Free
+guid: 2a921f76dac28604584145426edd9a22
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index afabc1e..90c2d32 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/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:
diff --git a/Main/System/Login/ServerBehaviour.cs b/Main/System/Login/ServerBehaviour.cs
new file mode 100644
index 0000000..370e972
--- /dev/null
+++ b/Main/System/Login/ServerBehaviour.cs
@@ -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;
+ }
+ }
+
+ }
+
+ }
+
+
+
diff --git a/Main/System/Message/TextUnline.cs.meta b/Main/System/Login/ServerBehaviour.cs.meta
similarity index 68%
copy from Main/System/Message/TextUnline.cs.meta
copy to Main/System/Login/ServerBehaviour.cs.meta
index 245a752..0f9cced 100644
--- a/Main/System/Message/TextUnline.cs.meta
+++ b/Main/System/Login/ServerBehaviour.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: 4f2256ca60f43dd46acb603765acad4d
-timeCreated: 1503129452
-licenseType: Free
+guid: 807e2170cabc18d4a92bd106298b5ba8
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Login/ServerBehaviourGroup.cs b/Main/System/Login/ServerBehaviourGroup.cs
new file mode 100644
index 0000000..94c52c3
--- /dev/null
+++ b/Main/System/Login/ServerBehaviourGroup.cs
@@ -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);
+ }
+
+ }
+
+ }
+
+
diff --git a/Main/System/Message/TextUnline.cs.meta b/Main/System/Login/ServerBehaviourGroup.cs.meta
similarity index 68%
copy from Main/System/Message/TextUnline.cs.meta
copy to Main/System/Login/ServerBehaviourGroup.cs.meta
index 245a752..9994e81 100644
--- a/Main/System/Message/TextUnline.cs.meta
+++ b/Main/System/Login/ServerBehaviourGroup.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: 4f2256ca60f43dd46acb603765acad4d
-timeCreated: 1503129452
-licenseType: Free
+guid: cafbc0420a5673a46b94c5b4fab7d4a6
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Message/RichText.cs b/Main/System/Message/RichText.cs
index 6eed7b9..ef52da4 100644
--- a/Main/System/Message/RichText.cs
+++ b/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);
diff --git a/Main/System/Message/TextUnline.cs b/Main/System/Message/TextUnline.cs
deleted file mode 100644
index f1454e7..0000000
--- a/Main/System/Message/TextUnline.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-锘縰sing System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UI;
-public class TextUnline : MaskableGraphic {
-
- private RectTransform target;
-
- private bool isChanged = false;
-
- protected override void Awake()
- {
- if (transform.parent != null) {
- target = transform.parent as RectTransform;
- }
- }
-
- private List<UIVertex> vertlist = new List<UIVertex>();
-
- protected override void OnPopulateMesh(VertexHelper vh)
- {
- vh.Clear();
- DrawUnderline(vh);
- }
-
- private void DrawUnderline(VertexHelper vh)
- {
- if (vertlist.Count < 1) return;
-
- for (int i = 0; i < vertlist.Count; i++)
- {
- vh.AddVert(vertlist[i]);
- }
-
- for (int i = 0; i < vertlist.Count; i+=4)
- {
- vh.AddTriangle(i, i + 1, i + 2);
- vh.AddTriangle(i + 1, i + 3, i + 2);
- }
- }
-
- public void SetUIVertex(Vector3 start,Vector3 end,float delta, float height,Color color)
- {
- UIVertex[] verts = new UIVertex[4];
- Vector3 pos = Vector3.zero;
- pos.x = start.x;pos.y = start.y + delta;
- verts[0].position = pos;
- pos.x = end.x;
- verts[1].position = pos;
- pos.x = start.x;pos.y = pos.y + height;
- verts[2].position = pos;
- pos.x = end.x;
- verts[3].position = pos;
-
- for (int i = 0; i < 4; i++) {
- verts[i].color = color;
- verts[i].uv0 = Vector2.zero;
- vertlist.Add(verts[i]);
- }
- isChanged = true;
- }
-
- private void Update()
- {
- if (target != null) {
- rectTransform.sizeDelta = target.sizeDelta;
- rectTransform.localPosition = Vector3.zero;
- rectTransform.pivot = target.pivot;
- }
- else {
- if (transform.parent != null) {
- target = transform.parent as RectTransform;
- }
- }
-
- if (isChanged) {
- SetAllDirty();
- isChanged = false;
- }
- }
-
- public void ClearVert()
- {
- vertlist.Clear();
- isChanged = true;
- }
-}
diff --git a/Main/UI/UIManager.cs b/Main/UI/UIManager.cs
index 9504b1d..5abeecc 100644
--- a/Main/UI/UIManager.cs
+++ b/Main/UI/UIManager.cs
@@ -123,7 +123,7 @@
// 鍒濆鍖栧悇灞傜骇鐨凾ransform
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)
diff --git a/Main/Utility/FieldPrint.cs b/Main/Utility/FieldPrint.cs
index 1c7b1ee..039f211 100644
--- a/Main/Utility/FieldPrint.cs
+++ b/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];
diff --git a/Main/Utility/UIUtility.cs b/Main/Utility/UIUtility.cs
index 0d9577c..224e0d7 100644
--- a/Main/Utility/UIUtility.cs
+++ b/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)
--
Gitblit v1.8.0