| | |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using UnityEngine.EventSystems; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class AutoSelectCyclicScroll : CyclicScroll |
| | |
| | | } |
| | | |
| | | [ContextMenu("Arrange")] |
| | | public override void ReArrange() |
| | | public override async UniTask ReArrange() |
| | | { |
| | | base.ReArrange(); |
| | | await base.ReArrange(); |
| | | |
| | | foreach (var item in infiniteItems) |
| | | { |
| | |
| | | |
| | | public void LuaInit(int[] indexs, bool stepByStep) |
| | | { |
| | | Init(new List<int>(indexs), stepByStep); |
| | | Init(new List<int>(indexs), stepByStep).Forget(); |
| | | } |
| | | |
| | | public virtual void Init<T>(List<T> _datas, bool _stepByStep = false) |
| | | public virtual async UniTaskVoid Init<T>(List<T> _datas, bool _stepByStep = false) |
| | | { |
| | | if (_datas == null || _datas.Count == 0) |
| | | { |
| | |
| | | |
| | | datas = _datas; |
| | | |
| | | ReArrange(); |
| | | await ReArrange(); |
| | | FillBatchData(0); |
| | | |
| | | if (_stepByStep) |
| | |
| | | |
| | | if (_stepByStep) |
| | | { |
| | | Co_StepByStepAppear(); |
| | | Co_StepByStepAppear().Forget(); |
| | | // StartCoroutine("Co_StepByStepAppear"); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | [ContextMenu("Arrange")] |
| | | public virtual void ReArrange() |
| | | public virtual async UniTask ReArrange() |
| | | { |
| | | velocity = 0f; |
| | | autoLerp = false; |
| | | CreateElements(); |
| | | await CreateElements(); |
| | | ElementsMatch(); |
| | | Arrange(align); |
| | | } |
| | | |
| | | private void CreateElements() |
| | | private async UniTask CreateElements() |
| | | { |
| | | var items = this.content.GetComponentsInChildren<ScrollItem>(true); |
| | | if (items.Length < m_ChildCount) |
| | |
| | | var dif = m_ChildCount - items.Length; |
| | | if (!string.IsNullOrEmpty(m_ChildPrefabName) && !string.IsNullOrEmpty(m_ChildDisplayName)) |
| | | { |
| | | var tasks = new List<UniTask>(dif); |
| | | for (var i = 0; i < dif; i++) |
| | | { |
| | | UIUtility.CreateWidget(m_ChildPrefabName, m_ChildDisplayName).ContinueWith(instance => |
| | | tasks.Add(UIUtility.CreateWidget(m_ChildPrefabName, m_ChildDisplayName).ContinueWith(instance => |
| | | { |
| | | if (this == null) |
| | | { |
| | |
| | | return; |
| | | } |
| | | instance.transform.SetParentEx(this.m_Content, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | }).Forget(); |
| | | |
| | | instance.SetActive(false); |
| | | })); |
| | | } |
| | | await UniTask.WhenAll(tasks); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class DynamicCyclicScroll : CyclicScroll |
| | | { |
| | | [SerializeField] int m_MaxDynamicElements; |
| | | |
| | | public override void Init<T>(List<T> _datas, bool _stepByStep = false) |
| | | public override async UniTaskVoid Init<T>(List<T> _datas, bool _stepByStep = false) |
| | | { |
| | | var maxCount = Mathf.Min(m_MaxDynamicElements, _datas.Count); |
| | | var beyond = _datas.Count > m_MaxDynamicElements; |
| | |
| | | } |
| | | |
| | | this.enabled = beyond; |
| | | base.Init(_datas, _stepByStep); |
| | | base.Init(_datas, _stepByStep).Forget(); |
| | | } |
| | | |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | /// <summary> |
| | | /// 椭圆形遮罩组件 |
| | | /// 基于模板测试实现椭圆形遮罩效果 |
| | | /// 妞渾褰㈤伄缃╃粍浠? |
| | | /// 鍩轰簬妯℃澘娴嬭瘯瀹炵幇妞渾褰㈤伄缃╂晥鏋? |
| | | /// </summary> |
| | | [RequireComponent(typeof(RectTransform))] |
| | | [AddComponentMenu("UI/Effects/Ellipse Mask")] |
| | | [ExecuteInEditMode] |
| | | public class EllipseMask : MonoBehaviour |
| | | { |
| | | [Header("椭圆参数")] |
| | | |
| | | |
| | | [Header("妞渾鍙傛暟")] |
| | | [SerializeField] private Vector2 m_EllipseCenter = new Vector2(0.5f, 0.5f); |
| | | [SerializeField] private Vector2 m_EllipseRadius = new Vector2(0.5f, 0.5f); |
| | | [SerializeField] [Range(0, 0.5f)] private float m_Softness = 0f; //暂无效果 |
| | | [SerializeField] private int m_StencilID = 1; //多个遮罩时 |
| | | [SerializeField] [Range(0, 0.5f)] private float m_Softness = 0f; //鏆傛棤鏁堟灉 |
| | | [SerializeField] private int m_StencilID = 1; //澶氫釜閬僵鏃? |
| | | [SerializeField] private bool m_ShowMaskGraphic = false; |
| | | |
| | | private Material m_MaskMaterial; |
| | | private Image m_MaskImage; |
| | | private RectTransform m_RectTransform; |
| | | private List<Graphic> m_MaskedChildren = new List<Graphic>(); |
| | | // 缓存GetComponentsInChildren结果,避免每次OnEnable分配数组 |
| | | // 缂撳瓨GetComponentsInChildren缁撴灉锛岄伩鍏嶆瘡娆nEnable鍒嗛厤鏁扮粍 |
| | | private static List<Graphic> _graphicCacheList = new List<Graphic>(); |
| | | private bool m_MaskShaderLoading = false; |
| | | |
| | | public Vector2 EllipseCenter |
| | | { |
| | |
| | | StencilID = order; |
| | | m_RectTransform = GetComponent<RectTransform>(); |
| | | |
| | | // 创建遮罩图像 |
| | | // 鍒涘缓閬僵鍥惧儚 |
| | | CreateMaskImage(); |
| | | |
| | | // 创建遮罩材质 |
| | | // 鍒涘缓閬僵鏉愯川 |
| | | CreateMaskMaterial(); |
| | | |
| | | UpdateMask(); |
| | |
| | | CreateMaskMaterial(); |
| | | UpdateMask(); |
| | | |
| | | // 为所有子对象添加模板测试 |
| | | // 涓烘墍鏈夊瓙瀵硅薄娣诲姞妯℃澘娴嬭瘯 |
| | | UpdateChildrenStencil(); |
| | | } |
| | | |
| | |
| | | DestroyImmediate(m_MaskMaterial); |
| | | m_MaskMaterial = null; |
| | | } |
| | | m_MaskShaderLoading = false; |
| | | |
| | | // 移除子对象的模板测试 |
| | | // 绉婚櫎瀛愬璞$殑妯℃澘娴嬭瘯 |
| | | RemoveChildrenStencil(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建遮罩图像 |
| | | /// 鍒涘缓閬僵鍥惧儚 |
| | | /// </summary> |
| | | private void CreateMaskImage() |
| | | { |
| | |
| | | m_MaskImage.color = Color.white; |
| | | } |
| | | } |
| | | #if !UNITY_EDITOR |
| | | // 鍦╯hader寮傛鍔犺浇瀹屾垚鍓嶈涓哄叏閫忔槑锛岄槻姝㈤粯璁hader娓叉煋鍑虹櫧鑹茬煩褰? |
| | | if (m_MaskMaterial == null) |
| | | { |
| | | m_MaskImage.color = Color.clear; |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建遮罩材质 |
| | | /// 鍒涘缓閬僵鏉愯川 |
| | | /// </summary> |
| | | private void CreateMaskMaterial() |
| | | { |
| | | #if !UNITY_EDITOR |
| | | if (m_MaskMaterial == null) |
| | | if (m_MaskMaterial == null && !m_MaskShaderLoading) |
| | | { |
| | | m_MaskShaderLoading = true; |
| | | ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMask").ContinueWith(ellipseShader => |
| | | { |
| | | m_MaskShaderLoading = false; |
| | | if (this == null) { return; } |
| | | if (ellipseShader != null) |
| | | { |
| | | m_MaskMaterial = new Material(ellipseShader); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("EllipseMask shader not found!"); |
| | | // shader使用ColorMask 0,恢复color不会显示颜色,但保证Canvas提交DrawCall写入stencil |
| | | if (m_MaskImage != null) |
| | | m_MaskImage.color = Color.white; |
| | | UpdateMask(); |
| | | UpdateChildrenStencil(); |
| | | } |
| | | }).Forget(); |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新遮罩 |
| | | /// 鏇存柊閬僵 |
| | | /// </summary> |
| | | private void UpdateMask() |
| | | { |
| | |
| | | { |
| | | UpdateMaterialProperties(); |
| | | |
| | | // 设置材质到Image |
| | | // 璁剧疆鏉愯川鍒癐mage |
| | | m_MaskImage.material = m_MaskMaterial; |
| | | |
| | | // 强制重绘 |
| | | // 寮哄埗閲嶇粯 |
| | | m_MaskImage.SetMaterialDirty(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新材质属性 |
| | | /// 鏇存柊鏉愯川灞炴€? |
| | | /// </summary> |
| | | private void UpdateMaterialProperties() |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新遮罩可见性 |
| | | /// 鏇存柊閬僵鍙鎬? |
| | | /// </summary> |
| | | private void UpdateMaskVisibility() |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 为子对象添加模板测试 |
| | | /// 涓哄瓙瀵硅薄娣诲姞妯℃澘娴嬭瘯 |
| | | /// </summary> |
| | | public void UpdateChildrenStencil() |
| | | { |
| | | // 清除之前的列表 |
| | | // 娓呴櫎涔嬪墠鐨勫垪琛? |
| | | m_MaskedChildren.Clear(); |
| | | |
| | | // 使用静态缓存列表避免每次分配数组 |
| | | // 浣跨敤闈欐€佺紦瀛樺垪琛ㄩ伩鍏嶆瘡娆″垎閰嶆暟缁? |
| | | _graphicCacheList.Clear(); |
| | | GetComponentsInChildren(false, _graphicCacheList); |
| | | for (int i = 0; i < _graphicCacheList.Count; i++) |
| | | { |
| | | var graphic = _graphicCacheList[i]; |
| | | // 跳过遮罩本身 |
| | | // 璺宠繃閬僵鏈韩 |
| | | if (graphic.gameObject == this.gameObject) |
| | | continue; |
| | | |
| | | // 为子对象创建遮罩材质 |
| | | |
| | | // 涓哄瓙瀵硅薄鍒涘缓閬僵鏉愯川 |
| | | CreateChildMaskMaterial(graphic); |
| | | m_MaskedChildren.Add(graphic); |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 为子对象创建遮罩材质 |
| | | /// 涓哄瓙瀵硅薄鍒涘缓閬僵鏉愯川 |
| | | /// </summary> |
| | | private void CreateChildMaskMaterial(Graphic graphic) |
| | | { |
| | |
| | | { |
| | | |
| | | #if !UNITY_EDITOR |
| | | // Shader maskedShader = Shader.Find("GUI/EllipseMaskedContent"); |
| | | ResManager.Instance.LoadAssetAsync<Shader>("Shader", "GUI_EllipseMaskedContent").ContinueWith(maskedShader => |
| | | { |
| | | if (this == null || graphic == null) { return; } |
| | | if (maskedShader != null) |
| | | { |
| | | Material maskedMaterial = new Material(maskedShader); |
| | | maskedMaterial.SetInt("_Stencil", m_StencilID); |
| | | maskedMaterial.SetInt("_StencilComp", 3); // Equal |
| | | graphic.material = maskedMaterial; |
| | | graphic.SetMaterialDirty(); |
| | | } |
| | | }).Forget(); |
| | | #else |
| | |
| | | } |
| | | else |
| | | { |
| | | // 更新现有材质的模板ID |
| | | // 鏇存柊鐜版湁鏉愯川鐨勬ā鏉縄D |
| | | graphic.material.SetInt("_Stencil", m_StencilID); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除子对象的模板测试 |
| | | /// 绉婚櫎瀛愬璞$殑妯℃澘娴嬭瘯 |
| | | /// </summary> |
| | | private void RemoveChildrenStencil() |
| | | { |
| | |
| | | { |
| | | if (graphic != null && graphic.material != null) |
| | | { |
| | | // 重置材质 |
| | | // 閲嶇疆鏉愯川 |
| | | graphic.material = null; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置椭圆参数 |
| | | /// 璁剧疆妞渾鍙傛暟 |
| | | /// </summary> |
| | | /// <param name="center">椭圆中心(归一化坐标)</param> |
| | | /// <param name="radius">椭圆半径(归一化坐标)</param> |
| | | /// <param name="softness">边缘柔化程度</param> |
| | | /// <param name="center">妞渾涓績锛堝綊涓€鍖栧潗鏍囷級</param> |
| | | /// <param name="radius">妞渾鍗婂緞锛堝綊涓€鍖栧潗鏍囷級</param> |
| | | /// <param name="softness">杈圭紭鏌斿寲绋嬪害</param> |
| | | public void SetEllipseParameters(Vector2 center, Vector2 radius, float softness = 0.1f) |
| | | { |
| | | m_EllipseCenter = center; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置圆形参数(特殊情况的椭圆) |
| | | /// 璁剧疆鍦嗗舰鍙傛暟锛堢壒娈婃儏鍐电殑妞渾锛? |
| | | /// </summary> |
| | | /// <param name="center">圆心(归一化坐标)</param> |
| | | /// <param name="radius">半径(归一化坐标)</param> |
| | | /// <param name="softness">边缘柔化程度</param> |
| | | /// <param name="center">鍦嗗績锛堝綊涓€鍖栧潗鏍囷級</param> |
| | | /// <param name="radius">鍗婂緞锛堝綊涓€鍖栧潗鏍囷級</param> |
| | | /// <param name="softness">杈圭紭鏌斿寲绋嬪害</param> |
| | | public void SetCircleParameters(Vector2 center, float radius, float softness = 0.1f) |
| | | { |
| | | SetEllipseParameters(center, new Vector2(radius, radius), softness); |
| | |
| | | } |
| | | } |
| | | #endif |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | /// <summary> |
| | |
| | | duration = Mathf.Max(0.5f, expectTime); |
| | | if (AssetSource.isUseAssetBundle) |
| | | { |
| | | AssetBundleUtility.Instance.Initialize(); |
| | | AssetBundleUtility.Instance.Initialize().Forget(); |
| | | done = false; |
| | | progress = 0f; |
| | | } |
| | |
| | | { |
| | | if (VersionUtility.Instance.NeedDownAsset()) |
| | | { |
| | | var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, "/config/PriorBundle.txt"); |
| | | var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/PriorBundle.txt"); |
| | | var downloadTask = new DownloadHotTask(remoteURL, localURL); |
| | | downloadTask.BeginDownload(AssetVersionUtility.OnDownLoadPriorBundle); |
| | | |
| | | |
| | | remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, $"/config/{config.appId}OPConfig.txt"); |
| | | localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, "config/OPConfig.txt"); |
| | | var downloadTask2 = new DownloadHotTask(remoteURL, localURL); |
| | | downloadTask2.BeginDownload(AssetVersionUtility.OnDownLoadOPConfig); |
| | | //AssetVersionUtility.GetAssetVersionFile(); |
| | | done = false; |
| | | progress = 0f; |
| | | // 通过 YooAsset(ConfigManager)加载配置,不再走旧的 HTTP 下载 |
| | | LoadConfigsViaYooAsset().Forget(); |
| | | } |
| | | else |
| | | { |
| | | //if (Application.isEditor) |
| | | // PatchLoader.InitLocalPatchAsset(); |
| | | done = true; |
| | | } |
| | | |
| | | |
| | | }).Forget(); |
| | | } |
| | | |
| | | private async UniTaskVoid LoadConfigsViaYooAsset() |
| | | { |
| | | try |
| | | { |
| | | // 并行加载 PriorBundle 和 OPConfig(通过 YooAsset / ConfigManager) |
| | | var t1 = PriorBundleConfig.LazyInitAsync(); |
| | | var t2 = OPConfigConfig.LazyInitAsync(); |
| | | await UniTask.WhenAll(t1, t2); |
| | | Debug.Log("[CheckAssetValidTask] PriorBundle 和 OPConfig 通过 YooAsset 加载完成"); |
| | | |
| | | // YooAsset 已在 Launch 阶段完成资源版本检查和下载 |
| | | // 不再需要旧的 AssetsVersion.txt 下载 + 文件校验流程 |
| | | AssetVersionUtility.ForceCompleteCheck(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError($"[CheckAssetValidTask] YooAsset 加载配置失败: {ex}"); |
| | | AssetVersionUtility.ForceCompleteCheck(); |
| | | } |
| | | } |
| | | |
| | | public override void End() |
| | |
| | | public static LaunchStage m_CurrentStage = LaunchStage.None; |
| | | public static LaunchProgressInfo progressInfo { get; private set; } |
| | | |
| | | /// <summary> |
| | | /// 外部设置进度信息(用于 Launch 流水线结束后继续显示 config 加载进度) |
| | | /// </summary> |
| | | public static void SetProgressInfo(LaunchProgressInfo info) |
| | | { |
| | | progressInfo = info; |
| | | } |
| | | |
| | | float timer = 0f; |
| | | Queue<LaunchTask> tasks = new Queue<LaunchTask>(); |
| | | LaunchTask currentTask = null; |
| | |
| | | // Editor 非 WebGL target + AB 模式:从本地 StreamingAssets 加载已构建的 AB |
| | | playMode = EPlayMode.OfflinePlayMode; |
| | | #else |
| | | // 其他平台 AB 模式 |
| | | playMode = EPlayMode.OfflinePlayMode; |
| | | // 非 WebGL 正式包:与 Launch 阶段保持一致 |
| | | // 有 cdnUrl → HostPlayMode(随包 + 远程下载),无 → OfflinePlayMode |
| | | string cdnUrl = VersionConfigEx.config?.cdnUrl; |
| | | if (!string.IsNullOrEmpty(cdnUrl)) |
| | | { |
| | | playMode = EPlayMode.HostPlayMode; |
| | | remoteServices = new UrlRemoteServices(cdnUrl); |
| | | } |
| | | else |
| | | { |
| | | playMode = EPlayMode.OfflinePlayMode; |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | if (!isAfterPlayerDataInitialize)
|
| | | {
|
| | | //只有回登录界面后的断线重连 和初次登录才加载游戏场景
|
| | | StageManager.Instance.ToGameScene();
|
| | | StageManager.Instance.ToGameScene().Forget();
|
| | | DayRemind.Instance.SetDayRemind(DayRemind.DJQTip, false);
|
| | | }
|
| | | isAfterPlayerDataInitialize = true;
|
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class GameNetSystem : Singleton<GameNetSystem> |
| | |
| | | |
| | | LoginManager.Instance.busy = false; |
| | | |
| | | StageManager.Instance.ReturnToLoginScene(); |
| | | StageManager.Instance.ReturnToLoginScene().Forget(); |
| | | NetLinkWin.Hide(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // 启动定期检查池的协程 |
| | | CheckPoolUsage(); |
| | | CheckPoolUsage().Forget(); |
| | | } |
| | | |
| | | private async UniTask CheckPoolUsage() |
| | |
| | | public static void Init()
|
| | | {
|
| | | Debug.Log("Main.Init() 被调用");
|
| | | var launchWin = UIManager.Instance.GetUI<LaunchWin>();
|
| | | if (launchWin != null)
|
| | | {
|
| | | launchWin.FadeOut();
|
| | | }
|
| | | // 不关闭 LaunchWin,保留到 config 加载完成后再关闭
|
| | | SwitchToLoginScene().Forget();
|
| | | }
|
| | |
|
| | | private static async UniTask SwitchToLoginScene()
|
| | | {
|
| | | // Debug.Log("打开登录界面");
|
| | | // UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
|
| | | Debug.Log("切换到登录场景");
|
| | | await ConfigManager.Instance.Init();
|
| | | Debug.Log("切换到登录场景 - 开始加载全量配置");
|
| | |
|
| | | // 在 LaunchWin 上显示 config 加载进度
|
| | | LaunchInHot.m_CurrentStage = LaunchStage.ConfigInit;
|
| | | LaunchInHot.SetProgressInfo(new LaunchProgressInfo(LaunchStage.ConfigInit, 1, 0f, 0f));
|
| | |
|
| | | // 启动全量配置加载
|
| | | var configInitTask = ConfigManager.Instance.Init();
|
| | |
|
| | | // 持续更新进度,直到加载完成
|
| | | while (!ConfigManager.Instance.isLoadFinished)
|
| | | {
|
| | | float p = ConfigManager.Instance.GetLoadingProgress();
|
| | | LaunchInHot.SetProgressInfo(new LaunchProgressInfo(LaunchStage.ConfigInit, 1, p, p));
|
| | | await UniTask.Yield();
|
| | | }
|
| | | await configInitTask;
|
| | |
|
| | | // 配置加载完成,关闭 LaunchWin
|
| | | var launchWin = UIManager.Instance.GetUI<LaunchWin>();
|
| | | if (launchWin != null)
|
| | | {
|
| | | launchWin.FadeOut();
|
| | | }
|
| | |
|
| | | GeneralDefine.Init();
|
| | | #if UNITY_EDITOR
|
| | | SysNotifyMgr.Instance.BeforePlayerDataInitializeEvent();
|
| | | #endif
|
| | | StageManager.Instance.ToLoginScene().Forget();
|
| | |
|
| | | }
|
| | |
|
| | | public static async UniTask InitManagers()
|
| | |
| | |
|
| | | public class ManagerBase<T> : Singleton<T>, IManager where T : ManagerBase<T>, new()
|
| | | {
|
| | | public virtual async UniTask Init()
|
| | | public virtual UniTask Init()
|
| | | {
|
| | |
|
| | | return UniTask.CompletedTask;
|
| | | }
|
| | |
|
| | | public virtual void Release()
|
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.SceneManagement;
|
| | | using ProjSG.Resource;
|
| | | using YooAsset;
|
| | |
|
| | | public enum StageName
|
| | | {
|
| | |
| | | // public Action OnSwitchAccount;
|
| | | private LaunchWinData launchWinData = null;
|
| | |
|
| | | public async UniTask Init()
|
| | | public UniTask Init()
|
| | | {
|
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow;
|
| | | return UniTask.CompletedTask;
|
| | | }
|
| | |
|
| | | public void Release()
|
| | |
| | | LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
|
| | | InitLoadingWinData(loadingWin);
|
| | |
|
| | | // Phase 1 (0% ~ 60%): Scene loading
|
| | | AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Login");
|
| | | asyncOperation.allowSceneActivation = false;
|
| | |
|
| | | while (!asyncOperation.isDone)
|
| | | // Phase 1 (0% ~ 50%): Scene loading
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | if (asyncOperation.progress >= 0.9f)
|
| | | var handle = YooAssetService.Instance.BeginLoadScene("Assets/ResourcesOut/Scenes/Login.unity", LoadSceneMode.Single, LocalPhysicsMode.None, true);
|
| | | while (!handle.IsDone)
|
| | | {
|
| | | asyncOperation.allowSceneActivation = true;
|
| | | if (handle.Progress >= 0.9f)
|
| | | handle.UnSuspend();
|
| | | loadingWin.SetProgress(handle.Progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | loadingWin.SetProgress(asyncOperation.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | else
|
| | | {
|
| | | var asyncOp = SceneManager.LoadSceneAsync("Login");
|
| | | asyncOp.allowSceneActivation = false;
|
| | | while (!asyncOp.isDone)
|
| | | {
|
| | | if (asyncOp.progress >= 0.9f)
|
| | | asyncOp.allowSceneActivation = true;
|
| | | loadingWin.SetProgress(asyncOp.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | }
|
| | |
|
| | | // Phase 2 (50% ~ 100%): Manager initialization
|
| | |
| | | {
|
| | | UIManager.Instance.DestroyAllUI();
|
| | |
|
| | | await SceneManager.LoadSceneAsync("Login");
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | await YooAssetService.Instance.LoadSceneAsync("Assets/ResourcesOut/Scenes/Login.unity");
|
| | | else
|
| | | await SceneManager.LoadSceneAsync("Login");
|
| | |
|
| | | Main.OnSwitchToLoginScene();
|
| | | currentStage = StageName.Login;
|
| | |
| | |
|
| | | SoundPlayer.Instance.StopBackGroundMusic();
|
| | |
|
| | | // Phase 1 (0% ~ 60%): Scene loading
|
| | | AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Game");
|
| | | asyncOperation.allowSceneActivation = false;
|
| | |
|
| | | while (!asyncOperation.isDone)
|
| | | // Phase 1 (0% ~ 50%): Scene loading
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | if (asyncOperation.progress >= 0.9f)
|
| | | var handle = YooAssetService.Instance.BeginLoadScene("Assets/ResourcesOut/Scenes/Game.unity", LoadSceneMode.Single, LocalPhysicsMode.None, true);
|
| | | while (!handle.IsDone)
|
| | | {
|
| | | asyncOperation.allowSceneActivation = true;
|
| | | if (handle.Progress >= 0.9f)
|
| | | handle.UnSuspend();
|
| | | loadingWin.SetProgress(handle.Progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | loadingWin.SetProgress(asyncOperation.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | else
|
| | | {
|
| | | var asyncOp = SceneManager.LoadSceneAsync("Game");
|
| | | asyncOp.allowSceneActivation = false;
|
| | | while (!asyncOp.isDone)
|
| | | {
|
| | | if (asyncOp.progress >= 0.9f)
|
| | | asyncOp.allowSceneActivation = true;
|
| | | loadingWin.SetProgress(asyncOp.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | | }
|
| | |
|
| | | // Phase 2 (50% ~ 100%): Manager data ready
|
| | |
| | | initialized = true; |
| | | } |
| | | |
| | | private async UniTask Co_LoadMainfestFile(string _category) |
| | | private UniTask Co_LoadMainfestFile(string _category) |
| | | { |
| | | var path = AssetVersionUtility.GetAssetFilePath(StringUtility.Concat(AssetVersionUtility.EncodeFileName(_category), "_assetbundle"), false); |
| | | var _assetBundle = AssetBundle.LoadFromFile(path); |
| | |
| | | if (_assetBundle == null) |
| | | { |
| | | Debug.LogErrorFormat("AssetBundleManifest的包文件为空或者加载出错. Path:{0}", path); |
| | | return; |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | AssetBundleManifest _assetBundleManifest = _assetBundle.LoadAsset<AssetBundleManifest>(ResourcesPath.AssetDependentFileAssetName); |
| | | if (_assetBundleManifest == null) |
| | | { |
| | | Debug.LogErrorFormat("AssetBundleManifest的包文件为空或者加载出错. Path:{0}", path); |
| | | return; |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | string[] _assetBundleNames = _assetBundleManifest.GetAllAssetBundles(); |
| | |
| | | |
| | | _assetBundle.Unload(true); |
| | | _assetBundle = null; |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | public AssetBundleInfo GetAssetBundleInfo(string assetBundleName) |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using UnityEngine.U2D; |
| | |
| | | using System.Threading; |
| | | using ProjSG.Resource; |
| | | using YooAsset; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #if UNITY_EDITOR |
| | |
| | | } |
| | | #endif |
| | | |
| | | // // needExt 是否需要函数内部添加后缀 |
| | | // [System.Obsolete("US2: Use LoadAssetAsync<T>(directory, name, needExt) returning UniTask<T> instead.")] |
| | | // public T LoadAsset<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | // { |
| | | // directory = directory.Replace("\\", "/"); |
| | | // name = name.Replace("\\", "/"); |
| | | // // 特殊处理 因为有一层图集的关系 directory要传入的应该是atlas的名字 |
| | | // if (typeof(T) == typeof(Sprite)) |
| | | // { |
| | | // return LoadSprite(directory, name) as T; |
| | | // } |
| | | // else if (typeof(T) == typeof(SkeletonDataAsset)) |
| | | // { |
| | | // //文件目录调整,name中包含了路径 |
| | | // if (name.Contains("/")) |
| | | // { |
| | | // directory += name.Substring(0, name.LastIndexOf("/")); |
| | | // name = name.Substring(name.LastIndexOf("/") + 1); |
| | | // } |
| | | // ==================================================================== |
| | | // 同步方法(仅非 WebGL 平台) |
| | | // ==================================================================== |
| | | #if !UNITY_WEBGL |
| | | //needExt 是否需要函数内部添加后缀 |
| | | public T LoadAsset<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | directory = directory.Replace("\\", "/"); |
| | | name = name.Replace("\\", "/"); |
| | | // 特殊处理 因为有一层图集的关系 directory要传入的应该是atlas的名字 |
| | | if (typeof(T) == typeof(Sprite)) |
| | | { |
| | | return LoadSprite(directory, name) as T; |
| | | } |
| | | else if (typeof(T) == typeof(SkeletonDataAsset)) |
| | | { |
| | | //文件目录调整,name中包含了路径 |
| | | if (name.Contains("/")) |
| | | { |
| | | directory += name.Substring(0, name.LastIndexOf("/")); |
| | | name = name.Substring(name.LastIndexOf("/") + 1); |
| | | } |
| | | } |
| | | |
| | | // } |
| | | return LoadAssetInternal<T>(directory, name, needExt); |
| | | } |
| | | |
| | | // return LoadAssetInternal<T>(directory, name, needExt); |
| | | // } |
| | | //needExt 是否需要函数内部添加后缀 |
| | | private T LoadAssetInternal<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | T asset = null; |
| | | var path = ($"Assets/ResourcesOut/{directory}/{name}" + (needExt ? GetExtension(typeof(T)) : "")).Replace("//", "/").Trim().Replace("\\", "/"); |
| | | |
| | | // //needExt 是否需要函数内部添加后缀 |
| | | // private T LoadAssetInternal<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | // { |
| | | // // 已禁用同步加载,强制业务全部走异步API。 |
| | | // throw new NotSupportedException("同步资源加载已禁用,请使用异步接口"); |
| | | // } |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | #if UNITY_EDITOR |
| | | asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | asset = YooAssetService.Instance.LoadAssetSync<T>(path); |
| | | } |
| | | |
| | | // [System.Obsolete("US2: Use LoadConfigAsync returning UniTask<string[]> instead.")] |
| | | // public string[] LoadConfig(string name) |
| | | // { |
| | | // string path = string.Empty; |
| | | // #if UNITY_EDITOR |
| | | // if (!AssetSource.isUseAssetBundle) |
| | | // { |
| | | // path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt"; |
| | | // } |
| | | // else |
| | | // #endif |
| | | // { |
| | | // path = AssetVersionUtility.GetAssetFilePath($"config/{name}.txt"); |
| | | // } |
| | | if (asset == null) |
| | | { |
| | | Debug.LogErrorFormat("LoadAsset() => 加载不到资源: {0}", path); |
| | | } |
| | | |
| | | // return File.ReadAllLines(path); |
| | | // } |
| | | return asset; |
| | | } |
| | | |
| | | public string[] LoadConfig(string name) |
| | | { |
| | | #if UNITY_EDITOR |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | string path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt"; |
| | | return File.ReadAllLines(path); |
| | | } |
| | | #endif |
| | | // AB 模式:通过 YooAsset 同步加载 TextAsset |
| | | var location = $"Assets/ResourcesOut/Config/{name}.txt"; |
| | | var textAsset = YooAssetService.Instance.LoadAssetSync<TextAsset>(location); |
| | | if (textAsset != null && !string.IsNullOrEmpty(textAsset.text)) |
| | | return textAsset.text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); |
| | | Debug.LogError($"[ResManager] LoadConfig failed for '{name}'"); |
| | | return Array.Empty<string>(); |
| | | } |
| | | |
| | | private Sprite LoadSprite(string atlasName, string spriteName) |
| | | { |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | SpriteAtlas atlas = LoadAsset<SpriteAtlas>("Sprite", atlasName.Replace("Sprite/", "")); |
| | | if (null == atlas) |
| | | { |
| | | return null; |
| | | } |
| | | return atlas.GetSprite(spriteName); |
| | | } |
| | | else |
| | | { |
| | | // YooAsset 使用完整路径直接加载 Sprite |
| | | var path = $"Assets/ResourcesOut/{atlasName}/{spriteName}.png".Replace("//", "/"); |
| | | return YooAssetService.Instance.LoadAssetSync<Sprite>(path); |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | // ==================================================================== |
| | | // 异步加载方法(所有平台统一) |
| | | // ==================================================================== |
| | | |
| | | //needExt 是否需要函数内部添加后缀(回调版本) |
| | | public void LoadAssetAsync<T>(string directory, string name, Action<bool, UnityEngine.Object> callBack, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | directory = directory.Replace("\\", "/"); |
| | | name = name.Replace("\\", "/"); |
| | | |
| | | // 特殊处理 因为有一层图集的关系 directory要传入的应该是atlas的名字 |
| | | if (typeof(T) == typeof(Sprite)) |
| | | { |
| | | LoadSpriteAsync<T>(directory, name, callBack); |
| | | return; |
| | | } |
| | | else if (typeof(T) == typeof(SkeletonDataAsset)) |
| | | { |
| | | //文件目录调整,name中包含了路径 |
| | | if (name.Contains("/")) |
| | | { |
| | | directory += name.Substring(0, name.LastIndexOf("/")); |
| | | name = name.Substring(name.LastIndexOf("/") + 1); |
| | | } |
| | | } |
| | | |
| | | LoadAssetAsyncInternal<T>(directory, name, callBack, needExt); |
| | | } |
| | | |
| | | public async UniTask<T> LoadAssetAsync<T>(string directory, string name) where T : UnityEngine.Object |
| | | { |
| | | return await LoadAssetAsync<T>(directory, name, needExt: true); |
| | | } |
| | | |
| | | public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | return await LoadAssetAsync<T>(directory, name, needExt, CancellationToken.None); |
| | | } |
| | | |
| | | private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object |
| | | { |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | // Editor 模式下可直接加载 sprite |
| | | LoadAssetAsyncInternal<T>(atlasName, spriteName, callBack); |
| | | } |
| | | else |
| | | { |
| | | // AB 模式下直接加载单独的 Sprite 文件(YooAsset 自动处理 SpriteAtlas 依赖) |
| | | LoadAssetAsyncInternal<Sprite>(atlasName, spriteName, (isLoaded, sprite) => |
| | | { |
| | | callBack?.Invoke(isLoaded, sprite); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | private void LoadAssetAsyncInternal<T>(string directory, string name, Action<bool, UnityEngine.Object> callBack, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | var path = string.Concat($"Assets/ResourcesOut/{directory}/{name}", (needExt ? GetExtension(typeof(T)) : "")).Replace("//", "/"); |
| | | |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | #if UNITY_EDITOR |
| | | var asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path); |
| | | callBack?.Invoke(asset != null, asset); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | // US1: Route through YooAssetService async |
| | | CoLoadViaYooAsset<T>(path, callBack).Forget(); |
| | | } |
| | | } |
| | | |
| | | private async UniTaskVoid CoLoadViaYooAsset<T>(string path, Action<bool, UnityEngine.Object> callBack, CancellationToken ct = default) where T : UnityEngine.Object |
| | | { |
| | | try |
| | | { |
| | | var asset = await YooAssetService.Instance.LoadAssetAsync<T>(path, ct: ct); |
| | | callBack?.Invoke(asset != null, asset); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError($"[ResManager] Async load via YooAsset failed: {ex.Message}"); |
| | | callBack?.Invoke(false, null); |
| | | } |
| | | } |
| | | |
| | | public void UnloadAsset(string directory, string assetName) |
| | | { |
| | | directory = directory.Replace("\\", "/").TrimEnd('/'); |
| | | assetName = assetName.Replace("\\", "/"); |
| | | string path = ($"Assets/ResourcesOut/{directory}/{assetName}").Replace("//", "/"); |
| | | YooAssetService.Instance.UnloadAsset(path); |
| | | } |
| | | |
| | | public string GetAssetFilePath(string _assetKey) |
| | | { |
| | | var path = Path.Combine(ExternalStorePath, _assetKey); |
| | | if (!File.Exists(path)) |
| | | { |
| | | path = Path.Combine(StreamingAssetPath, _assetKey); |
| | | } |
| | | |
| | | return path; |
| | | } |
| | | |
| | | // ==================================================================== |
| | | // US1: New UniTask-based async variants |
| | | // ==================================================================== |
| | | |
| | | /// <summary> |
| | | /// 异步加载资源(UniTask 版本,US1 新增)。 |
| | | /// </summary> |
| | | public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true, CancellationToken ct = default) where T : UnityEngine.Object |
| | | { |
| | | directory = directory.Replace("\\", "/"); |
| | |
| | | return await YooAssetService.Instance.LoadAssetAsync<T>(path, ct: ct); |
| | | } |
| | | |
| | | // ==================================================================== |
| | | // 异步内部实现(统一) |
| | | // ==================================================================== |
| | | |
| | | private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object |
| | | { |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | // Editor 模式下可直接加载 sprite |
| | | LoadAssetAsyncInternal<T>(atlasName, spriteName, callBack); |
| | | } |
| | | else |
| | | { |
| | | // AB 模式下直接加载单独的 Sprite 文件(YooAsset 自动处理 SpriteAtlas 依赖) |
| | | LoadAssetAsyncInternal<Sprite>(atlasName, spriteName, (isLoaded, sprite) => |
| | | { |
| | | callBack?.Invoke(isLoaded, sprite); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | private void LoadAssetAsyncInternal<T>(string directory, string name, Action<bool, UnityEngine.Object> callBack, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | var path = string.Concat($"Assets/ResourcesOut/{directory}/{name}", (needExt ? GetExtension(typeof(T)) : "")).Replace("//", "/"); |
| | | |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | #if UNITY_EDITOR |
| | | var asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path); |
| | | callBack?.Invoke(asset != null, asset); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | CoLoadViaYooAsset<T>(path, callBack).Forget(); |
| | | } |
| | | } |
| | | |
| | | private async UniTaskVoid CoLoadViaYooAsset<T>(string path, Action<bool, UnityEngine.Object> callBack, CancellationToken ct = default) where T : UnityEngine.Object |
| | | { |
| | | try |
| | | { |
| | | var asset = await YooAssetService.Instance.LoadAssetAsync<T>(path, ct: ct); |
| | | callBack?.Invoke(asset != null, asset); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError($"[ResManager] Async load via YooAsset failed: {ex.Message}"); |
| | | callBack?.Invoke(false, null); |
| | | } |
| | | } |
| | | |
| | | public void UnloadAsset(string directory, string assetName) |
| | | { |
| | | if (!AssetSource.isUseAssetBundle) |
| | | return; |
| | | |
| | | directory = directory.Replace("\\", "/").TrimEnd('/'); |
| | | assetName = assetName.Replace("\\", "/"); |
| | | string path = ($"Assets/ResourcesOut/{directory}/{assetName}").Replace("//", "/"); |
| | | YooAssetService.Instance.UnloadAsset(path); |
| | | } |
| | | |
| | | public string GetAssetFilePath(string _assetKey) |
| | | { |
| | | var path = Path.Combine(ExternalStorePath, _assetKey); |
| | | if (!File.Exists(path)) |
| | | { |
| | | path = Path.Combine(StreamingAssetPath, _assetKey); |
| | | } |
| | | |
| | | return path; |
| | | } |
| | | |
| | | // ==================================================================== |
| | | // LoadConfigAsync(所有平台统一) |
| | | // ==================================================================== |
| | | |
| | | /// <summary> |
| | | /// US4: 异步加载资源并走缓存层(缓存命中直接返回,未命中则加载并缓存)。 |
| | | /// 异步加载配置文件。 |
| | | /// AB 模式使用 YooAsset 异步加载 TextAsset,非 AB 模式直接读文件。 |
| | | /// </summary> |
| | | public async UniTask<string[]> LoadConfigAsync(string name, bool needExt = true, CancellationToken ct = default) |
| | | { |
| | | if (AssetSource.isUseAssetBundle) |
| | | { |
| | | if (name.EndsWith(".txt") && needExt) |
| | | { |
| | | name = name.Substring(0, name.Length - 4); |
| | | } |
| | | var location = $"Assets/ResourcesOut/Config/{name}" + (needExt ? ".txt" : ""); |
| | | try |
| | | { |
| | | var asset = await YooAssetService.Instance.LoadAssetAsync( |
| | | location, typeof(TextAsset), 0, ct) as TextAsset; |
| | | if (asset != null && !string.IsNullOrEmpty(asset.text)) |
| | | return asset.text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError($"[ResManager] LoadConfigAsync YooAsset failed for '{name}': {ex.Message}"); |
| | | } |
| | | return Array.Empty<string>(); |
| | | } |
| | | |
| | | // 非 AB 模式: 直接读文件(Editor 开发模式) |
| | | #if UNITY_EDITOR |
| | | string path = ResourcesPath.CONFIG_FODLER + "/" + name + (needExt ? ".txt" : ""); |
| | | return await UniTask.RunOnThreadPool(() => File.ReadAllLines(path)); |
| | | #else |
| | | return Array.Empty<string>(); |
| | | #endif |
| | | } |
| | | |
| | | // ==================================================================== |
| | | // 缓存加载 & Sprite 异步加载(所有平台) |
| | | // ==================================================================== |
| | | |
| | | /// <summary> |
| | | /// 异步加载资源并走缓存层(缓存命中直接返回,未命中则加载并缓存)。 |
| | | /// </summary> |
| | | public async UniTask<T> LoadAssetCachedAsync<T>(string directory, string name, bool needExt = true, CancellationToken ct = default) where T : UnityEngine.Object |
| | | { |
| | |
| | | |
| | | var path = ($"Assets/ResourcesOut/{directory}/{name}" + (needExt ? GetExtension(typeof(T)) : "")) |
| | | .Replace("//", "/").Trim().Replace("\\", "/"); |
| | | // 音频文件扩展名统一转小写,避免 .WAV/.MP3 大小写不匹配 |
| | | // 音频文件扩展名统一转小写 |
| | | if (typeof(T) == typeof(AudioClip)) |
| | | { |
| | | var pathExt2 = System.IO.Path.GetExtension(path); |
| | |
| | | var path = $"Assets/ResourcesOut/{atlasName}/{spriteName}.png" |
| | | .Replace("//", "/").Trim().Replace("\\", "/"); |
| | | var sprite = await YooAssetService.Instance.LoadAssetAsync<Sprite>(path, ct: ct); |
| | | #if UNITY_WEBGL |
| | | if (sprite == null) |
| | | Debug.LogWarning($"[ResManager][WebGL-Diag] Sprite load returned NULL: path={path}"); |
| | | #endif |
| | | Debug.LogWarning($"[ResManager] Sprite load returned NULL: path={path}"); |
| | | return sprite; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异步加载配置文件(UniTask 版本)。 |
| | | /// AB 模式使用 YooAsset RawFile 异步加载,非 AB 模式直接读文件。 |
| | | /// </summary> |
| | | public async UniTask<string[]> LoadConfigAsync(string name, bool needExt = true, CancellationToken ct = default) |
| | | { |
| | | // AB 模式(含 WebGL): 使用 YooAsset 加载配置文件 |
| | | if (AssetSource.isUseAssetBundle) |
| | | { |
| | | // 判断一下是否原来已经包含.txt 配合 needExt 做兼容,避免调用方传入重复后缀导致路径错误 |
| | | if (name.EndsWith(".txt") && needExt) |
| | | { |
| | | name = name.Substring(0, name.Length - 4); |
| | | } |
| | | var location = $"Assets/ResourcesOut/Config/{name}" + (needExt ? ".txt" : ""); |
| | | try |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL: WebServerFileSystem 不支持 LoadRawFileAsync,改用 LoadAssetAsync<TextAsset> |
| | | // .txt 文件在 Unity 中以 TextAsset 形式导入,WebGL 支持此加载方式 |
| | | var asset = await ProjSG.Resource.YooAssetService.Instance.LoadAssetAsync( |
| | | location, typeof(UnityEngine.TextAsset), 0, ct) as UnityEngine.TextAsset; |
| | | if (asset != null && !string.IsNullOrEmpty(asset.text)) |
| | | return asset.text.Split(new[] { "\r\n", "\n" }, System.StringSplitOptions.None); |
| | | #else |
| | | var textAsset = await ProjSG.Resource.YooAssetService.Instance.LoadAssetAsync<TextAsset>(location, 0, ct); |
| | | if (textAsset != null && !string.IsNullOrEmpty(textAsset.text)) |
| | | return textAsset.text.Split(new[] { "\r\n", "\n" }, System.StringSplitOptions.None); |
| | | #endif |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | UnityEngine.Debug.LogError($"[ResManager] LoadConfigAsync YooAsset failed for '{name}': {ex.Message}"); |
| | | } |
| | | return System.Array.Empty<string>(); |
| | | } |
| | | |
| | | // 非 AB 模式: 直接读文件(Editor 开发模式) |
| | | #if UNITY_EDITOR |
| | | string path = ResourcesPath.CONFIG_FODLER + "/" + name + (needExt ? ".txt" : ""); |
| | | return await UniTask.RunOnThreadPool(() => File.ReadAllLines(path)); |
| | | #else |
| | | return System.Array.Empty<string>(); |
| | | #endif |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | if (initOp.Status != EOperationStatus.Succeed) |
| | | { |
| | | Debug.LogWarning($"[YooAssetService] Package '{pkgName}' re-init failed: {initOp.Error}"); |
| | | Debug.LogError($"[YooAssetService] Package '{pkgName}' re-init failed: {initOp.Error}"); |
| | | try { var d = package.DestroyAsync(); await d.ToUniTask(); YooAssets.RemovePackage(pkgName); } catch { } |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | if (initOp.Status != EOperationStatus.Succeed) |
| | | { |
| | | Debug.LogWarning($"[YooAssetService] Package '{pkgName}' init failed: {initOp.Error}"); |
| | | Debug.LogError($"[YooAssetService] Package '{pkgName}' init failed: {initOp.Error}"); |
| | | try |
| | | { |
| | | var dOp = package.DestroyAsync(); |
| | | await dOp.ToUniTask(); |
| | | YooAssets.RemovePackage(pkgName); |
| | | } |
| | | catch { } |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | case EPlayMode.HostPlayMode: |
| | | { |
| | | bool hasBuildin = YooAssetInitializer.HasBuildinPackage(packageName); |
| | | return new HostPlayModeParameters |
| | | { |
| | | BuildinFileSystemParameters = FileSystemParameters |
| | | .CreateDefaultBuildinFileSystemParameters(), |
| | | BuildinFileSystemParameters = hasBuildin |
| | | ? FileSystemParameters.CreateDefaultBuildinFileSystemParameters() |
| | | : null, |
| | | CacheFileSystemParameters = FileSystemParameters |
| | | .CreateDefaultCacheFileSystemParameters(remoteServices) |
| | | }; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步加载资产(仅在非 WebGL 平台过渡期使用)。 |
| | | /// 同步加载资产(非 WebGL 平台使用)。 |
| | | /// WebGL 不支持同步加载,请使用 LoadAssetAsync。 |
| | | /// </summary> |
| | | [System.Obsolete("Use LoadAssetAsync instead. Sync loading will be removed in US2.")] |
| | | public T LoadAssetSync<T>(string location) where T : UnityEngine.Object |
| | | { |
| | | throw new NotSupportedException("同步资源加载接口已禁用,请使用异步API"); |
| | | ThrowIfNotInitialized(); |
| | | |
| | | if (string.IsNullOrEmpty(location)) |
| | | { |
| | | Debug.LogError("[YooAssetService] LoadAssetSync: location is null or empty."); |
| | | return null; |
| | | } |
| | | |
| | | var package = FindPackageForAsset(location); |
| | | var handle = package.LoadAssetSync<T>(location); |
| | | if (handle.Status != EOperationStatus.Succeed) |
| | | { |
| | | Debug.LogError($"[YooAssetService] LoadAssetSync failed for '{location}': {handle.LastError}"); |
| | | return null; |
| | | } |
| | | return handle.GetAssetObject<T>(); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | |
| | | // Scene Loading |
| | | // ==================================================================== |
| | | |
| | | /// <summary> |
| | | /// 开始加载场景,返回 SceneHandle 供调用方自行控制进度和挂起。 |
| | | /// 不会等待加载完成。 |
| | | /// </summary> |
| | | public SceneHandle BeginLoadScene(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, |
| | | LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 0) |
| | | { |
| | | ThrowIfNotInitialized(); |
| | | var package = FindPackageForAsset(location); |
| | | return package.LoadSceneAsync(location, sceneMode, physicsMode, suspendLoad, priority); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async UniTask<SceneHandle> LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, |
| | | LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 0, CancellationToken ct = default) |
| | |
| | | } |
| | | } |
| | | |
| | | yield return WaitForSecondsCache.Wait1; |
| | | yield return new WaitForSeconds(1f); |
| | | // yield return WaitingForSecondConst.WaitMS1000; |
| | | } |
| | | } |
| | |
| | | } |
| | | case CodeA2U.FreePlatformInitOk: |
| | | |
| | | channelSign = _json["channelSign"].ToString(); |
| | | if (_json.Keys.Contains("channelSign")) |
| | | { |
| | | channelSign = _json["channelSign"].ToString(); |
| | | } |
| | | if (onFreePlatformInitOk != null) |
| | | { |
| | | onFreePlatformInitOk(); |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0])); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | protected override async void OpenSubUIByTabIndex() |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | ArenaManager.Instance.nowAwardTabIndex = functionOrder; |
| | | Display(); |
| | |
| | | |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)).Forget(); |
| | | enemyAvatarCell.SetOnLoaded(() => |
| | | { |
| | | if (this == null) return; |
| | |
| | | |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)).Forget(); |
| | | enemyAvatarCell.SetOnLoaded(() => |
| | | { |
| | | if (this == null) return; |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | |
| | | return; |
| | | arenaMatchInfo = list[index]; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaMatchInfo.PlayerID, (int)arenaMatchInfo.Face, (int)arenaMatchInfo.FacePic)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaMatchInfo.PlayerID, (int)arenaMatchInfo.Face, (int)arenaMatchInfo.FacePic)).Forget(); |
| | | avatarCell.SetOnLoaded(() => |
| | | { |
| | | avatarCell.SetListener(() => |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewards[i][0], true, rewards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewards[itemCellIndex][0])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewards[itemCellIndex][0])); |
| | | } |
| | | else |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = ArenaManager.Instance.score.ToString(); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget(); |
| | | avatarCell.SetOnLoaded(() => |
| | | { |
| | | avatarCell.SetListener(() => |
| | |
| | | } |
| | | |
| | | } |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6)).Forget(); |
| | | avatarCell.SetOnLoaded(() => |
| | | { |
| | | avatarCell.SetListener(() => |
| | |
| | | static List<AssetVersion> unpriorDownLoadAssetVersions = new List<AssetVersion>(); |
| | | public static bool checkAssetCompleted { get; private set; } |
| | | private static string assetVerUrl; |
| | | |
| | | public static void ForceCompleteCheck() |
| | | { |
| | | m_PriorAssetDownLoadDone = true; |
| | | m_UnPriorAssetDownLoadDone = true; |
| | | checkAssetCompleted = true; |
| | | Debug.Log("[AssetVersionUtility] ForceCompleteCheck - YooAsset 已接管资源管理,跳过旧版本检查"); |
| | | } |
| | | |
| | | public static void Init() |
| | | { |
| | | |
| | |
| | | var assetVersionUrl = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(config.branch), Language.fixPath, "/AssetsVersion.txt"); |
| | | assetVerUrl = assetVersionUrl; |
| | | Debug.Log("http地址:assetVersionUrl " + assetVersionUrl); |
| | | HttpRequest.Instance.UnityWebRequestGet(assetVersionUrl, 5, OnGetAssetVersionFile); |
| | | HttpRequest.Instance.UnityWebRequestGet(assetVersionUrl, 5, OnGetAssetVersionFile).Forget(); |
| | | }).Forget(); |
| | | |
| | | } |
| | |
| | | this.state = TaskState.Working; |
| | | FileExtersion.MakeSureDirectory(tempFile); |
| | | Debug.LogFormat("开始获取头信息:{0}", remoteUrl); |
| | | using (var www = UnityWebRequest.Head(remoteUrl)) |
| | | try |
| | | { |
| | | www.timeout = DownloadHotMgr.TimeOut; |
| | | await www.SendWebRequest(); |
| | | if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError) |
| | | using (var www = UnityWebRequest.Head(remoteUrl)) |
| | | { |
| | | Debug.LogErrorFormat("头信息获取失败:{0};error:{1}", remoteUrl, www.error); |
| | | requestHeaderOk = false; |
| | | SetFailed(www.error); |
| | | www.timeout = DownloadHotMgr.TimeOut; |
| | | await www.SendWebRequest(); |
| | | if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError) |
| | | { |
| | | Debug.LogErrorFormat("头信息获取失败:{0};error:{1}", remoteUrl, www.error); |
| | | requestHeaderOk = false; |
| | | SetFailed(www.error); |
| | | www.Dispose(); |
| | | return; |
| | | } |
| | | long.TryParse(www.GetResponseHeader(HttpHeader.ContentLength), out this.remoteLength); |
| | | this.remoteLastModified = DateTime.Parse(www.GetResponseHeader(HttpHeader.LastModified)); |
| | | var acceptRange = www.GetResponseHeader(HttpHeader.AcceptRanges); |
| | | this.isAcceptRange = acceptRange != "none"; |
| | | Debug.LogFormat("头信息获取成功:{0};大小:{1};修改时间:{2};是否支持续传:{3}", remoteUrl, remoteLength, remoteLastModified, acceptRange); |
| | | requestHeaderOk = true; |
| | | state = TaskState.Wait; |
| | | www.Dispose(); |
| | | await UniTask.CompletedTask; |
| | | } |
| | | long.TryParse(www.GetResponseHeader(HttpHeader.ContentLength), out this.remoteLength); |
| | | this.remoteLastModified = DateTime.Parse(www.GetResponseHeader(HttpHeader.LastModified)); |
| | | var acceptRange = www.GetResponseHeader(HttpHeader.AcceptRanges); |
| | | this.isAcceptRange = acceptRange != "none"; |
| | | Debug.LogFormat("头信息获取成功:{0};大小:{1};修改时间:{2};是否支持续传:{3}", remoteUrl, remoteLength, remoteLastModified, acceptRange); |
| | | requestHeaderOk = true; |
| | | state = TaskState.Wait; |
| | | www.Dispose(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.LogError("[DownloadHotTask] Co_GetHeader 异常\nURL: " + remoteUrl + "\nlocalFile: " + localFile + "\n错误: " + e.Message + "\n" + e.StackTrace); |
| | | requestHeaderOk = false; |
| | | SetFailed(e.Message); |
| | | } |
| | | } |
| | | private async UniTask Co_DownloadFile() |
| | | { |
| | | try |
| | | { |
| | | state = TaskState.Working; |
| | | while (TimeUtility.AllSeconds < beginTickCount + 5)//限制重新下载的时间间隔 |
| | | { |
| | |
| | | if (!requestHeaderOk)//头文件获取失败 |
| | | { |
| | | onCompleted?.Invoke(this); |
| | | await UniTask.CompletedTask; |
| | | return; |
| | | } |
| | | try |
| | | { |
| | |
| | | Debug.LogFormat("下载请求范围:{0} ;bytes={1}", remoteUrl, LocalLength); |
| | | var localLength = LocalLength; |
| | | this.downloadedBytes = localLength; |
| | | fileRequest.SendWebRequest(); |
| | | _ = fileRequest.SendWebRequest(); |
| | | while (!fileRequest.isDone) |
| | | { |
| | | var length = localLength + (long)fileRequest.downloadedBytes;//本地文件大小+本次下载的数据大小 |
| | |
| | | SetFailed("下载完成但是文件不存在"); |
| | | } |
| | | onCompleted?.Invoke(this); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.LogError("[DownloadHotTask] Co_DownloadFile 异常\nURL: " + remoteUrl + "\nlocalFile: " + localFile + "\n错误: " + e.Message + "\n" + e.StackTrace); |
| | | SetFailed(e.Message); |
| | | onCompleted?.Invoke(this); |
| | | } |
| | | } |
| | | |
| | | private async UniTask Move(string sourceFile, string destFile) |
| | |
| | | txtEnemyLV.text = Language.Get("Arena22", info.Lv); |
| | | txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName); |
| | | txtEnemyFightPonit.text = UIHelper.ReplaceLargeArtNum(GetFightPonit(enemyTeam)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic)).Forget(); |
| | | enemyAvatarCell.SetOnLoaded(() => |
| | | { |
| | | enemyAvatarCell.SetListener(() => |
| | |
| | | txtMyName.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | long myFightPower = GetFightPonit(myTeam); |
| | | txtMyFightPonit.text = UIHelper.ReplaceLargeArtNum(myFightPower); |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, PlayerDatas.Instance.baseData.face, PlayerDatas.Instance.baseData.facePic)); |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, PlayerDatas.Instance.baseData.face, PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | team = GetTeamHeroList(myTeam); |
| | | myCountry.RefreshOnTeamCountry(team, true); |
| | | |
| | |
| | | { |
| | | var buff = buffList[i]; |
| | | cells[i].SetActive(true); |
| | | cells[i].Init(buffList[i], () => OnClickMinggeBuff(cell, buff)); |
| | | cells[i].Init(buffList[i], () => OnClickMinggeBuff(cell, buff)).Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | Debug.LogWarning("BattleLog: " + _logMessage); |
| | | } |
| | | #elif UNITY_WEBGL && !UNITY_EDITOR |
| | | WebGLDebug.LogError("BattleLog: " + _logMessage); |
| | | #endif |
| | | } |
| | | } |
| | |
| | | protected void ReloadTeam() |
| | | { |
| | | PreloadResources(new List<TeamBase>() { TeamManager.Instance.GetTeam(BattlePreSetType.Story) }, null); |
| | | battleObjMgr.ReloadTeam(TeamManager.Instance.GetTeam(BattlePreSetType.Story), BattleCamp.Red); |
| | | battleObjMgr.ReloadTeam(TeamManager.Instance.GetTeam(BattlePreSetType.Story), BattleCamp.Red).Forget(); |
| | | } |
| | | |
| | | // public override void OnBattleEnd(JsonData turnFightStateData) |
| | |
| | | return false; |
| | | } |
| | | |
| | | public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | public override void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | { |
| | | BattleWin battleWin = UIManager.Instance.GetUI<BattleWin>(); |
| | | if (null != battleWin) |
| | |
| | | } |
| | | |
| | | |
| | | public async void SetBattleField(BattleField _battleField) |
| | | public void SetBattleField(BattleField _battleField) |
| | | { |
| | | CleanupBattleField(); |
| | | ClearContent(string.Empty, true); |
| | |
| | | vNetData.MapID = (uint)MapID; |
| | | vNetData.FuncLineID = (uint)FuncLineID; |
| | | |
| | | CreateBattleField(string.Empty, vNetData, extendData, redTeamList, blueTeamList); |
| | | CreateBattleField(string.Empty, vNetData, extendData, redTeamList, blueTeamList).Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | public bool IsRealdamage() |
| | | { |
| | | return skillConfig.HurtType / 10 == 1; |
| | | return skillConfig.HurtType / 10 == 1 || IsType(DamageType.Realdamage); |
| | | } |
| | | |
| | | public bool IsDamage() |
| | |
| | | default: |
| | | UnityEngine.Debug.LogError("Unknown Skill Effect Type " + skillSkinConfig.effectType + " skill id is " + skillConfig.SkillID); |
| | | return new NoEffect(skillBase, skillConfig, skillSkinConfig, caster, tagUseSkillAttack); |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | //取玩家自己的数据
|
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID,
|
| | | PlayerDatas.Instance.baseData.face,
|
| | | PlayerDatas.Instance.baseData.facePic));
|
| | | PlayerDatas.Instance.baseData.facePic)).Forget();
|
| | | rankText.text = Language.Get("L1045");
|
| | | rankValueText.text = "";//Language.Get("L1125");
|
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName;
|
| | |
| | | officialTitleCell.SetActive(true);
|
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
|
| | | avatarCell.SetActive(true);
|
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4));
|
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget();
|
| | | viewPlayerId = (int)rankData.id;
|
| | | nameText.text = rankData.name1;
|
| | | rankValueText.text = RankModel.Instance.GetCmpValueStr(rankType, rankData.cmpValue); ;
|
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | |
| | | int index = i; |
| | | itemCells[i].SetActive(true); |
| | | itemCells[i].Init(new ItemCellModel(items[i][0], true, items[i][1])); |
| | | itemCells[i].button.SetListener(() => |
| | | itemCells[i].SetClickListener(() => |
| | | { |
| | | ItemTipUtility.Show(items[index][0]); |
| | | }); |
| | |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | |
| | | title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | if (manager.nowChatTab == ChatChannel.World) |
| | |
| | | bool hasNewPlayerInfo = manager.TryGetNewPlayerInfoByPlayerID(nowData.PlayerID, out TalkData newPlayerInfo); |
| | | TalkData data = hasNewPlayerInfo ? newPlayerInfo : nowData; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)data.PlayerID, (int)data.Face, (int)data.FacePic, data.Job)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)data.PlayerID, (int)data.Face, (int)data.FacePic, data.Job)).Forget(); |
| | | |
| | | title.InitUI(data.RealmLV, (int)data.TitleID).Forget(); |
| | | int bubbleID = ChatBubbleHelper.GetOtherChatBubbleID(data.Job, (int)data.BubbleBox); |
| | |
| | | return false; |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | catch (System.Exception) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | itemCells[i].SetActive(true);
|
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount);
|
| | | itemCells[i].Init(itemData);
|
| | | itemCells[i].button.SetListener(() =>
|
| | | itemCells[i].SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show((int)award.ItemID);
|
| | | });
|
| | |
| | | images[i].SetActive(CustomizedRechargeModel.Instance.GetChooseSubIndex(CustomizedRechargeModel.Instance.chooseWinIndex) - 1 == i);
|
| | | itemCells[i].SetActive(true);
|
| | | itemCells[i].Init(itemData);
|
| | | itemCells[i].button.SetListener(() =>
|
| | | itemCells[i].SetClickListener(() =>
|
| | | {
|
| | | CustomizedRechargeModel.Instance.chooseIndexDict[CustomizedRechargeModel.Instance.chooseWinIndex] = itemIndex + 1;
|
| | | //选中后跳下一个
|
| | |
| | | }
|
| | |
|
| | | int index = i;
|
| | | itemCellList[i].button.SetListener(() =>
|
| | | itemCellList[i].SetClickListener(() =>
|
| | | {
|
| | | if (CustomizedRechargeModel.Instance.chooseWinIndex != index)
|
| | | {
|
| | |
| | | var award = awards[i];
|
| | | var itemData = new ItemCellModel(award.id, false, award.countEx);
|
| | | itemCells[i].Init(itemData);
|
| | | itemCells[i].button.SetListener(() =>
|
| | | itemCells[i].SetClickListener(() =>
|
| | | {
|
| | | if (index < goodsCount)
|
| | | ItemTipUtility.Show(award.id);
|
| | |
| | | else
|
| | | {
|
| | | itemCells[i].Init(null);
|
| | | itemCells[i].button.SetListener(() =>
|
| | | itemCells[i].SetClickListener(() =>
|
| | | {
|
| | | chooseWinIndex = index - goodsCount;
|
| | | chooseCTGID = ctgID;
|
| | |
| | | |
| | | bool isReceived = manager.IsReceived(shopId); |
| | | freeItem.Init(new ItemCellModel(itemId, false, itemCount)); |
| | | freeItem.button.SetListener(() => |
| | | freeItem.SetClickListener(() => |
| | | { |
| | | if (!isReceived) |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class DailySpecialsDayGiftCell : MonoBehaviour |
| | |
| | | int itemId = gainItemList[i][0]; |
| | | int count = gainItemList[i][1]; |
| | | itemCells[i].Init(new ItemCellModel(itemId, false, count)); |
| | | itemCells[i].button.SetListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetClickListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetActive(true); |
| | | } |
| | | else |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | |
| | | public class DailySpecialsItem : MonoBehaviour |
| | | { |
| | |
| | | int itemId = gainItemList[i][0]; |
| | | int count = gainItemList[i][1]; |
| | | itemCells[i].Init(new ItemCellModel(itemId, false, count)); |
| | | itemCells[i].button.SetListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetClickListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetActive(true); |
| | | } |
| | | else |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class DailySpecialsWeekGiftCell : MonoBehaviour |
| | |
| | | int itemId = gainItemList[i][0]; |
| | | int count = gainItemList[i][1]; |
| | | itemCells[i].Init(new ItemCellModel(itemId, false, count)); |
| | | itemCells[i].button.SetListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetClickListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCells[i].SetActive(true); |
| | | } |
| | | else |
| | |
| | | using System; |
| | | using System; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | int itemId = gainItemList[0][0]; |
| | | int itemCount = gainItemList[0][1]; |
| | | itemcellAllBuy.Init(new ItemCellModel(itemId, false, itemCount)); |
| | | itemcellAllBuy.button.SetListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemcellAllBuy.SetClickListener(() => { ItemTipUtility.Show(itemId); }); |
| | | |
| | | bool hasRechargeCount = RechargeManager.Instance.TryGetRechargeCount(ctgid, out RechargeCount _rechargeCount); |
| | | bool isBuyAll = hasRechargeCount && _rechargeCount.todayCount > 0; |
| | |
| | | { |
| | | SmallTipWin.showText = Language.Get("BlessLVRuleDesc"); |
| | | SmallTipWin.worldPos = tipButton.transform.position; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | { |
| | | transCount1.SetActive(true); |
| | | itemCellCount1.Init(new ItemCellModel((int)awardList[0][0], true, awardList[0][1]), awardList[0][2]); |
| | | itemCellCount1.button.SetListener(() => HandleItemClick((int)awardList[0][0], awardList[0][2])); |
| | | itemCellCount1.SetClickListener(() => HandleItemClick((int)awardList[0][0], awardList[0][2])); |
| | | imgHaveCount1.SetActive(awardState == 0); |
| | | } |
| | | |
| | |
| | | int index = i; // Lambda表达式中使用,需要创建局部副本 |
| | | itemCells[i].SetActive(true); |
| | | itemCells[i].Init(new ItemCellModel((int)awardList[i][0], true, awardList[i][1]), awardList[index][2]); |
| | | itemCells[i].button.SetListener(() => HandleItemClick((int)awardList[index][0], awardList[index][2])); |
| | | itemCells[i].SetClickListener(() => HandleItemClick((int)awardList[index][0], awardList[index][2])); |
| | | } |
| | | else |
| | | { |
| | |
| | | DisplayButton(firstId); |
| | | } |
| | | |
| | | protected override async void OpenSubUIByTabIndex() |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | int firstId = model.GetFirstIDByTabIndex(functionOrder); |
| | | model.SetClickTabState(firstId); |
| | |
| | | txtDesc.text = heroInfo.heroConfig.Desc; |
| | | imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroInfo.heroConfig.Country)); |
| | | imgJob.SetSprite(HeroUIManager.Instance.GetJobIconName(heroInfo.heroConfig.Class)); |
| | | var prev = Debug.unityLogger.logEnabled; |
| | | Debug.unityLogger.logEnabled = true; |
| | | Debug.LogWarning($"[FirstChargeWin] DisplayMainItem: skinID={heroInfo.SkinID} roleLhModel={roleLhModel != null} active={roleLhModel?.gameObject.activeSelf} frame={Time.frameCount}"); |
| | | Debug.unityLogger.logEnabled = prev; |
| | | roleLhModel.Create(heroInfo.SkinID, lhScale, motionName: "", isLh: true).Forget(); |
| | | roleLhModel.transform.localScale = new Vector3(lhScale, lhScale, lhScale); |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | |
| | | public class FunctionPreviewCell : MonoBehaviour |
| | | { |
| | |
| | | if (!awardList.IsNullOrEmpty()) |
| | | { |
| | | itemCell.Init(new ItemCellModel(awardList[0][0], true, awardList[0][1])); |
| | | itemCell.button.SetListener(() => |
| | | itemCell.SetClickListener(() => |
| | | { |
| | | if (state == 1) |
| | | { |
| | |
| | | nameText.text = data.Name; |
| | | lvText.text = data.LV.ToString(); |
| | | fightPointText.text = UIHelper.ReplaceLargeArtNum(data.FightPower); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(data.PlayerID, data.Face, data.FacePic)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(data.PlayerID, data.Face, data.FacePic)).Forget(); |
| | | officialTitleCell.InitUI(data.RealmLV, data.TitleID).Forget(); |
| | | |
| | | yesButton.SetListener(() => |
| | |
| | | var rankData = GuildBossManager.Instance.playerBossHurtRank[rank];
|
| | | int playerID = (int)rankData.Value1;
|
| | | var playerData = GuildBossManager.Instance.GetMemberData(playerID);
|
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playerData.Face, playerData.FacePic));
|
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playerData.Face, playerData.FacePic)).Forget();
|
| | | avatarCell.SetOnLoaded(() =>
|
| | | {
|
| | | avatarCell.SetListener(() =>
|
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | //公会讨伐-其他玩家 |
| | | public class GuildBossOtherPlayer : MonoBehaviour |
| | |
| | | { |
| | | playerID = (int)data.Value1; |
| | | var playData = GuildBossManager.Instance.GetMemberData(playerID); |
| | | headCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playData.Face, playData.FacePic)); |
| | | headCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playData.Face, playData.FacePic)).Forget(); |
| | | nameText.text = playData.Name; |
| | | hurtValueText.text = UIHelper.ReplaceLargeNum(data.Value4 + data.Value5 * Constants.ExpPointValue); |
| | | var rank = GetRankIndex(playerID); |
| | |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower); |
| | | headCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | BossHurtEvent(); |
| | |
| | | var playerInfo = PlayerDatas.Instance.fairyData.GetMember(playerID); |
| | | nameText.text = playerInfo.Name; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)).Forget(); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget(); |
| | | lvText.text = playerInfo.LV.ToString(); |
| | | |
| | |
| | | var playerInfo = PlayerDatas.Instance.fairyData.GetMember(playerID); |
| | | nameText.text = playerInfo.Name; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)).Forget(); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget(); |
| | | lvText.text = playerInfo.LV.ToString(); |
| | | if (playerInfo.FmLV > 0) |
| | |
| | | } |
| | | var leaderInfo = OtherPlayerDetailManager.Instance.GetViewPlayerData(playerID); |
| | | |
| | | leaderAvatar.InitUI(AvatarHelper.GetAvatarModel(0, leaderInfo.Face, leaderInfo.FacePic)); |
| | | leaderAvatar.InitUI(AvatarHelper.GetAvatarModel(0, leaderInfo.Face, leaderInfo.FacePic)).Forget(); |
| | | leaderTitle.InitUI(leaderInfo.RealmLV, leaderInfo.TitleID).Forget(); |
| | | leaderLevelText.text = leaderInfo.LV.ToString(); |
| | | guildJobText.text = RichTextMsgReplaceConfig.GetRichReplace("FAMILY", 3); |
| | |
| | | {
|
| | | if (!UIManager.Instance.IsOpened<HeroReturnCallResultWin>())
|
| | | {
|
| | | UIManager.Instance.OpenWindow<HeroReturnCallResultWin>();
|
| | | UIManager.Instance.OpenWindowAsync<HeroReturnCallResultWin>().Forget();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using UnityEngine; |
| | | using UnityEngine.Events; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class HeroCallHopeSelectCell : MonoBehaviour |
| | |
| | | } |
| | | } |
| | | HappyXBModel.Instance.OnSelectWishHeroEvent?.Invoke(); |
| | | }); |
| | | }).Forget(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | using System; |
| | | using Spine; |
| | | using Spine.Unity; |
| | |
| | | private static int lastInitFrame = -1; // 上一次执行Initialize的帧号,用于确保每帧最多1次 |
| | | private static GameObjectPoolManager.GameObjectPool cachedUIHeroPool; // 缓存UIHero预制体池 |
| | | private RectTransform _instanceRect; // 缓存RectTransform避免重复GetComponent |
| | | |
| | | public Action onComplete; |
| | | #pragma warning disable CS1998 // 异步方法内部通过 DelayedInitializeAsync 异步执行,无需直接 await |
| | | public async UniTask Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false) |
| | | { |
| | | if (skinID == _skinID) |
| | | { |
| | | //避免重复创建 |
| | | |
| | | if (skeletonGraphic != null) |
| | | { |
| | | SetMaterialNone(); |
| | |
| | | // 使用 UniTask 进行异步初始化,将instanceGO创建和资源加载都移到异步处理 |
| | | DelayedInitializeAsync(skinConfig, motionName, isLh, loadCancellationToken.Token).Forget(); |
| | | } |
| | | #pragma warning restore CS1998 |
| | | |
| | | /// <summary> |
| | | /// 取消之前的加载任务 |
| | |
| | | private async UniTaskVoid DelayedInitializeAsync(HeroSkinConfig skinConfig, string motionName, bool isLh, System.Threading.CancellationToken cancellationToken) |
| | | { |
| | | isInitializing = true; |
| | | |
| | | try |
| | | { |
| | | // 检查是否已被取消 |
| | |
| | | |
| | | // 获取加载信号量 - 限制并发数,避免资源竞争 |
| | | await AcquireLoadSlotAsync(cancellationToken); |
| | | |
| | | // 异步创建instanceGO和加载资源(真正的异步,不阻塞) |
| | | await CreateInstanceAndLoadAssetsAsync(skinConfig, isLh, cancellationToken); |
| | | |
| | | // 再次检查是否已被取消 |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | var heroSkinConfig = HeroSkinConfig.Get(skinID); |
| | | if (heroSkinConfig == null) return; |
| | | |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick); |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick).Forget(); |
| | | nameText.text = heroConfig.Name; |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | bool isChoose = manager.nowCallChooseHeroID == heroId; |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutCallRateHeroCell : CellView |
| | |
| | | { |
| | | itemCells[i].SetActive(true); |
| | | itemCells[i].Init(new ItemCellModel(dataList[dataIndex].id, true, dataList[dataIndex].countEx)); |
| | | itemCells[i].button.SetListener(() => ItemTipUtility.Show(dataList[dataIndex].id)); |
| | | itemCells[i].SetClickListener(() => ItemTipUtility.Show(dataList[dataIndex].id)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(itemInfo[0], true, itemInfo[1])); |
| | | SetCountActive(itemCell, itemInfo[1]); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemInfo[0])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemInfo[0])); |
| | | return; |
| | | } |
| | | |
| | |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(itemID, true, itemCount)); |
| | | SetCountActive(itemCell, itemCount); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | |
| | | public class HeroDebutCallResultCell : MonoBehaviour |
| | |
| | | public void DisplayItemCell(int itemID, int count) |
| | | { |
| | | itemCell.Init(new ItemCellModel(itemID, true, count)); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | |
| | | int itemId = xbManager.addXBAddItemID; |
| | | long count = xbManager.addXBItemCount; |
| | | presentItemCell.Init(new ItemCellModel(itemId, true, count)); |
| | | presentItemCell.button.SetListener(() => ItemTipUtility.Show(itemId)); |
| | | presentItemCell.SetClickListener(() => ItemTipUtility.Show(itemId)); |
| | | |
| | | // 根据单抽或十连填充物品数据 |
| | | if (isOne) |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutRankAwardCell : CellView |
| | | { |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | } |
| | | else |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = awardConfig == null || awardConfig.NeedValue == 0 ? "0" : Language.Get("HeroDebut27", awardConfig.NeedValue); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget(); |
| | | viewPlayerId = (int)rankData.id; |
| | | nameText.text = rankData.name1; |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue)); |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | |
| | | int itemID = config.AwardItemList[i][0]; |
| | | int count = config.AwardItemList[i][1]; |
| | | items[i].Init(new ItemCellModel(itemID, false, count)); |
| | | items[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | items[i].SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | items[i].SetActive(true); |
| | | } |
| | | else |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallChangeItem : MonoBehaviour |
| | | { |
| | |
| | | var heroSkinConfig = HeroSkinConfig.Get(skinID); |
| | | if (heroSkinConfig == null) return; |
| | | |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick); |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick).Forget(); |
| | | nameText.text = heroConfig.Name; |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | bool isChoose = manager.nowCallChooseHeroID == heroId; |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallChangeWin : UIBase |
| | | { |
| | |
| | | previewButton.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = manager.nowCallChooseHeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | var skinConfig = HeroSkinConfig.Get(skinID); |
| | | if (skinConfig == null) return; |
| | | |
| | | uiHeroController.Create(skinID, 1); |
| | | uiHeroController.Create(skinID, 1).Forget(); |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallChooseItem : MonoBehaviour |
| | | { |
| | |
| | | var heroSkinConfig = HeroSkinConfig.Get(skinID); |
| | | if (heroSkinConfig == null) return; |
| | | |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick); |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick).Forget(); |
| | | nameText.text = heroConfig.Name; |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | bool isChoose = manager.nowCallChooseHeroID == heroId; |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallChooseWin : UIBase |
| | | { |
| | |
| | | previewButton.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = manager.nowCallChooseHeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | var skinConfig = HeroSkinConfig.Get(skinID); |
| | | if (skinConfig == null) return; |
| | | |
| | | uiHeroController.Create(skinID, 1); |
| | | uiHeroController.Create(skinID, 1).Forget(); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class HeroReturnCallRateHeroCell : CellView |
| | |
| | | { |
| | | itemCells[i].SetActive(true); |
| | | itemCells[i].Init(new ItemCellModel(dataList[dataIndex].id, true, dataList[dataIndex].countEx)); |
| | | itemCells[i].button.SetListener(() => ItemTipUtility.Show(dataList[dataIndex].id)); |
| | | itemCells[i].SetClickListener(() => ItemTipUtility.Show(dataList[dataIndex].id)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallRateItem : MonoBehaviour |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(itemInfo[0], true, itemInfo[1])); |
| | | SetCountActive(itemCell, itemInfo[1]); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemInfo[0])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemInfo[0])); |
| | | return; |
| | | } |
| | | |
| | |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(itemID, true, itemCount)); |
| | | SetCountActive(itemCell, itemCount); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | HeroReturnCallRateHeroWin.worldPos = libButton.transform.position; |
| | | HeroReturnCallRateHeroWin.dataList = GetLibItemList(libID, list); |
| | | HeroReturnCallRateHeroWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindow<HeroReturnCallRateHeroWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnCallRateHeroWin>().Forget(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | |
| | | public class HeroReturnCallResultCell : MonoBehaviour |
| | |
| | | public void DisplayItemCell(int itemID, int count) |
| | | { |
| | | itemCell.Init(new ItemCellModel(itemID, true, count)); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCallResultWin : UIBase |
| | | { |
| | |
| | | int itemId = xbManager.addXBAddItemID; |
| | | long count = xbManager.addXBItemCount; |
| | | presentItemCell.Init(new ItemCellModel(itemId, true, count)); |
| | | presentItemCell.button.SetListener(() => ItemTipUtility.Show(itemId)); |
| | | presentItemCell.SetClickListener(() => ItemTipUtility.Show(itemId)); |
| | | |
| | | // 根据单抽或十连填充物品数据 |
| | | if (isOne) |
| | |
| | | |
| | | if (!UIManager.Instance.IsOpenedInList<HeroShowLHWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroShowLHWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroShowLHWin>().Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using EnhancedUI.EnhancedScroller; |
| | | |
| | | public class HeroReturnCallWin : UIBase |
| | |
| | | protected override void InitComponent() |
| | | { |
| | | closeButton.SetListener(CloseWindow); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnShopWin>()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnGiftWin>()); |
| | | changeHeroButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCallChangeWin>()); |
| | | rankButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnRankWin>()); |
| | | rateButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCallRateWin>()); |
| | | historyButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCallHistoryWin>()); |
| | | chooseHeroButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCallChooseWin>()); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnShopWin>().Forget()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnGiftWin>().Forget()); |
| | | changeHeroButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCallChangeWin>().Forget()); |
| | | rankButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnRankWin>().Forget()); |
| | | rateButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCallRateWin>().Forget()); |
| | | historyButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCallHistoryWin>().Forget()); |
| | | chooseHeroButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCallChooseWin>().Forget()); |
| | | previewButton.SetListener(OnClickPreview); |
| | | skipToggle.AddListener((value) => |
| | | { |
| | |
| | | { |
| | | if (heroConfig == null) return; |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | OperationHeroAppearInfo act; |
| | | ActHeroAppearConfig config; |
| | |
| | | |
| | | bgImage.SetSprite(StringUtility.Concat("HeroReturnCallBG_", heroID.ToString())); |
| | | |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true); |
| | | uiHeroController.Create(skinID, modleSize); |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | uiHeroController.Create(skinID, modleSize).Forget(); |
| | | uiHeroController.transform.localScale = new Vector3(modleSize, modleSize, modleSize); |
| | | |
| | | ownItemCell.itemID = treasureSetConfig.CostItemID; |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | public class HeroReturnCell : MonoBehaviour |
| | | { |
| | | [SerializeField] ButtonEx clickButton; |
| | |
| | | { |
| | | clickButton.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroReturnWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnWin>().Forget(); |
| | | }); |
| | | |
| | | int heroID = manager.GetFirstHeroId(); |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnCheckInWin : UIBase |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true); |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | OnSecondEvent(); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnGiftCell : MonoBehaviour |
| | | { |
| | |
| | | if (config.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto5"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | if (config.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto7"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | RechargeManager.Instance.CTG(ctgId); |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | |
| | | |
| | | public void SetHeroSquareIcon(ImageEx image, string name) |
| | | { |
| | | var sprite = UILoader.LoadSprite("HeroHead", name); |
| | | if (sprite != null) |
| | | { |
| | | image.overrideSprite = sprite; |
| | | return; |
| | | } |
| | | |
| | | image.SetSprite("herohead_default"); |
| | | UILoader.LoadSprite("HeroHead", name, image, "herohead_default").Forget(); |
| | | } |
| | | |
| | | public void GetActTimeStr(TextEx timeText, string key = "TimeRush05") |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnPopWin : UIBase |
| | | { |
| | |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroReturnPopWin>(); |
| | | if (!UIManager.Instance.IsOpened<HeroReturnWin>()) |
| | | UIManager.Instance.OpenWindow<HeroReturnWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnWin>().Forget(); |
| | | }); |
| | | todayPopToggle.AddListener((bool value) => |
| | | { |
| | |
| | | infoText.text = artConfig.PopInfoText; |
| | | infoText.color = manager.ParseColor32(artConfig.PopInfoColor); |
| | | |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true); |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | |
| | | OnSecondEvent(); |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | |
| | | public class HeroReturnRankAwardCell : CellView |
| | | { |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnRankCell : MonoBehaviour |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = awardConfig == null || awardConfig.NeedValue == 0 ? "0" : Language.Get("HeroDebut27", awardConfig.NeedValue); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | return; |
| | | } |
| | | rank = rankData.rank; |
| | |
| | | else |
| | | { |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget(); |
| | | viewPlayerId = (int)rankData.id; |
| | | nameText.text = rankData.name1; |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue)); |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnRankTop3Cell : MonoBehaviour |
| | | { |
| | |
| | | officialTitleCell.SetActive(true); |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue)); |
| | | nameText.text = rankData.name1; |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | model.SetActive(true); |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f); |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget(); |
| | | queryPlayerBtn.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id); |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnShopCell : MonoBehaviour |
| | | { |
| | |
| | | else |
| | | { |
| | | StoreModel.Instance.buyShopID = shopID; |
| | | UIManager.Instance.OpenWindow<BuyItemWin>(); |
| | | UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnSkinWin : UIBase |
| | | { |
| | |
| | | int heroID = manager.GetHeroIDBySkinID(manager.currentChooseSkinID); |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroID; |
| | | HeroUIManager.Instance.selectSkinIndex = manager.GetSkinIndexInHeroConfig(heroID, manager.currentChooseSkinID); |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(1); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>(1).Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | awardBgImage.SetSprite(StringUtility.Concat("HeroReturnSkinAwardBG_", skinID.ToString())); |
| | | awardBgImage.SetNativeSize(); |
| | | |
| | | uiHeroController.Create(skinID, modelScale); |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true); |
| | | uiHeroController.Create(skinID, modelScale).Forget(); |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | countryImage.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | OnSecondEvent(); |
| | | |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnStarUpChangeItem : MonoBehaviour |
| | | { |
| | |
| | | var heroSkinConfig = HeroSkinConfig.Get(skinID); |
| | | if (heroSkinConfig == null) return; |
| | | |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick); |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, OnClick).Forget(); |
| | | nameText.text = heroConfig.Name; |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | bool isChoose = manager.nowStarUpChooseHeroID == heroId; |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnStarUpChangeWin : UIBase |
| | | { |
| | |
| | | previewButton.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = manager.nowStarUpChooseHeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | manager.OnNowStarUpChooseHeroIDChangeEvent -= OnNowStarUpChooseHeroIDChangeEvent; |
| | | if (!UIManager.Instance.IsOpened<HeroReturnStarUpWin>() && manager.LoadStarUpChooseHeroStateKey(manager.GetOperationHeroAppearInfo())) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpWin>().Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | var skinConfig = HeroSkinConfig.Get(skinID); |
| | | if (skinConfig == null) return; |
| | | |
| | | uiHeroController.Create(skinID, 1); |
| | | uiHeroController.Create(skinID, 1).Forget(); |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnStarUpWin : UIBase |
| | | { |
| | |
| | | goCallButton.SetListener(() => |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroReturnStarUpWin>(); |
| | | UIManager.Instance.OpenWindow<HeroReturnCallWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnCallWin>().Forget(); |
| | | }); |
| | | goInfoButton.SetListener(() => |
| | | { |
| | | if (heroConfig == null) return; |
| | | UIManager.Instance.CloseWindow<HeroReturnStarUpWin>(); |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | }); |
| | | changeButton.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpChangeWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpChangeWin>().Forget(); |
| | | }); |
| | | lockButton.SetListener(() => |
| | | { |
| | |
| | | heroHeadBaseCell.Init(heroConfig.HeroID, skinID, 0, 0, 0, () => |
| | | { |
| | | if (isLockStarHero) return; |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpChangeWin>(); |
| | | }); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpChangeWin>().Forget(); |
| | | }).Forget(); |
| | | nameText.text = heroConfig.Name; |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroReturnWin : UIBase |
| | | { |
| | |
| | | protected override void InitComponent() |
| | | { |
| | | closeButton.SetListener(() => UIManager.Instance.CloseWindow<HeroReturnWin>()); |
| | | checkInButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCheckInWin>()); |
| | | checkInButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCheckInWin>().Forget()); |
| | | starUpButton.SetListener(() => |
| | | { |
| | | |
| | | if (manager.IsLockStarHero(manager.GetOperationHeroAppearInfo())) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpWin>().Forget(); |
| | | return; |
| | | } |
| | | |
| | | if (!manager.LoadStarUpChooseHeroStateKey(manager.GetOperationHeroAppearInfo())) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpChangeWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpChangeWin>().Forget(); |
| | | return; |
| | | } |
| | | UIManager.Instance.OpenWindow<HeroReturnStarUpWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroReturnStarUpWin>().Forget(); |
| | | }); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnShopWin>()); |
| | | skinButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnSkinWin>()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnGiftWin>()); |
| | | callButton.SetListener(() => UIManager.Instance.OpenWindow<HeroReturnCallWin>()); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnShopWin>().Forget()); |
| | | skinButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnSkinWin>().Forget()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnGiftWin>().Forget()); |
| | | callButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroReturnCallWin>().Forget()); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | manager.LoadCallChooseHeroStateKey(manager.GetOperationHeroAppearInfo()) ? |
| | | manager.GetCurrentDisplayCallHeroId() : |
| | | manager.GetFirstHeroId()); |
| | | uiHeroController.Create(chosenHeroSkinID, modleSize); |
| | | uiHeroController.Create(chosenHeroSkinID, modleSize).Forget(); |
| | | |
| | | uiHeroController.transform.localScale = new Vector3(-modleSize, modleSize, modleSize); |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true); |
| | | lhController.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | |
| | | // 更新背景 |
| | | bgImage.SetSprite(StringUtility.Concat("HeroReturnMainBG_", heroID.ToString())); |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | slectGos[i].SetActive(i == selectIndex); |
| | | if (i < hero.talentAwakeRandomIDList.Count) |
| | | { |
| | | giftCells[i].Init(hero.talentAwakeRandomIDList[i], 1); |
| | | giftCells[i].Init(hero.talentAwakeRandomIDList[i], 1).Forget(); |
| | | var giftConfig = HeroTalentConfig.Get(hero.talentAwakeRandomIDList[i]); |
| | | skillText[i].text = PlayerPropertyConfig.GetFullDescription(giftConfig.AttrID, giftConfig.AttrValue); |
| | | } |
| | |
| | | RefreshFetter(); |
| | | RefreshGift(); |
| | | RefreshAwake(); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | |
| | | public class HeroCollectionCardCell : MonoBehaviour |
| | | { |
| | |
| | | [SerializeField] GameObject activeObj; // 可激活带流光效果材质 |
| | | [SerializeField] GameObject actLimitObj; // 活动限定 |
| | | |
| | | private CancellationTokenSource displayCts; |
| | | private int displayVersion; |
| | | |
| | | public void Display(int index, int quality) |
| | | { |
| | | displayVersion++; |
| | | int version = displayVersion; |
| | | |
| | | var heroID = HeroUIManager.Instance.heroCollectDict[quality][index]; |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | |
| | |
| | | |
| | | HB122_tagSCHeroInfo.tagSCHero colData; |
| | | HeroUIManager.Instance.TryGetHeroBookInfo(heroID, out colData); |
| | | heroCardBG.SetSprite("herocardbg" + heroConfig.Quality); |
| | | |
| | | LoadImageAsync(heroCardBG, "herocardbg" + heroConfig.Quality, version).Forget(); |
| | | |
| | | //分为0未获得、1可激活、2常规、3突破升级、4、星升级、5已满级 |
| | | int funcState = HeroUIManager.Instance.GetHeroBookState(heroID, quality); |
| | |
| | | unGetObj.SetActive(funcState == 0); |
| | | actLimitObj.SetActive(heroConfig.IsActLimit == 1); |
| | | |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | LoadImageAsync(countryImg, HeroUIManager.Instance.GetCountryIconName(heroConfig.Country), version).Forget(); |
| | | LoadImageAsync(jobImg, HeroUIManager.Instance.GetJobIconName(heroConfig.Class), version).Forget(); |
| | | |
| | | // 去抖加载:快速滚动时延迟2帧再创建Spine,如果卡片在延迟内被复用则取消旧加载 |
| | | displayCts?.Cancel(); |
| | | displayCts?.Dispose(); |
| | | displayCts = new CancellationTokenSource(); |
| | | DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, displayCts.Token).Forget(); |
| | | DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, version).Forget(); |
| | | |
| | | redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID; |
| | | |
| | | if (funcState == 3 || funcState == 4) |
| | | { |
| | | trainStateImg.SetActive(true); |
| | | trainStateImg.SetSprite("herofuncstate4"); |
| | | LoadImageAsync(trainStateImg, "herofuncstate4", version).Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | }); |
| | | |
| | | // bookLVBtn.AddListener(() => |
| | | // { |
| | | // HeroUIManager.Instance.selectCollectHeroID = heroID; |
| | | // UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); |
| | | // }); |
| | | } |
| | | |
| | | private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, CancellationToken ct) |
| | | private async UniTaskVoid LoadImageAsync(Image image, string iconKey, int version) |
| | | { |
| | | // 延迟2帧,快速滚动时卡片会被复用,CTS取消后不会继续创建Spine |
| | | await UniTask.NextFrame(ct); |
| | | await UniTask.NextFrame(ct); |
| | | var sprite = await UILoader.LoadSpriteAsync(iconKey); |
| | | if (displayVersion != version) return; |
| | | if (image != null && sprite != null) |
| | | image.overrideSprite = sprite; |
| | | } |
| | | |
| | | private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, int version) |
| | | { |
| | | await UniTask.NextFrame(); |
| | | await UniTask.NextFrame(); |
| | | if (displayVersion != version) return; |
| | | heroModel.Create(skinID, scale).Forget(); |
| | | } |
| | | |
| | | void OnDestroy() |
| | | { |
| | | displayCts?.Cancel(); |
| | | displayCts?.Dispose(); |
| | | } |
| | | } |
| | | |
| | |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | // fullPanel.SetActive(true); |
| | | lvupPanel.SetActive(state == 1); |
| | | fullHeadCell.Init(HeroUIManager.Instance.selectCollectHeroID, config.SkinIDList[0]); |
| | | fullHeadCell.Init(HeroUIManager.Instance.selectCollectHeroID, config.SkinIDList[0]).Forget(); |
| | | name3.text = config.Name; |
| | | |
| | | |
| | |
| | | } |
| | | heroListScroller.Restart(); |
| | | heroListScroller.JumpIndex(jumpIndex); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | {
|
| | | int itemID = items[index].id;
|
| | | itemCell.Init(new ItemCellModel(itemID, false, items[index].countEx));
|
| | | itemCell.button.SetListener(() =>
|
| | | itemCell.SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | |
| | | { |
| | | //点击飞入 延迟显示 |
| | | objForfly.SetActive(false); |
| | | DelayShow(); |
| | | DelayShow().Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | leaderWord.Play(); |
| | | leaderText.text = Language.Get(!pathPosEvent.m_IsRandom ? pathPosEvent.m_Text1 : |
| | | pathPosEvent.m_Text1 + UnityEngine.Random.Range((int)pathPosEvent.m_Value1, (int)pathPosEvent.m_Value2 + 1)); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.TargetWord) |
| | | { |
| | |
| | | wordArr[index].SetActive(true); |
| | | wordArr[index].Play(); |
| | | textArr[index].text = Language.Get(content); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | else if (posEvent == PosEvent.TargetAction) |
| | | { |
| | |
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | | int count = itemArr[1];
|
| | | itemCell.Init(new ItemCellModel(itemId, false, count));
|
| | | itemCell.button.SetListener(() =>
|
| | | itemCell.SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemId);
|
| | | });
|
| | |
| | | var item = ItemLogicUtility.Instance.totalShowItems[idInfo];
|
| | | itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
|
| | | txtItemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemCell.button.SetListener(() =>
|
| | | itemCell.SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | |
| | |
|
| | |
|
| | | GameObject cellContainer;
|
| | | AsyncLazy lazyPrefab;
|
| | |
|
| | | protected async UniTask LoadPrefab()
|
| | | {
|
| | | if (cellContainer != null)
|
| | | return;
|
| | |
|
| | | if (lazyPrefab == null)
|
| | | lazyPrefab = new AsyncLazy(LoadPrefabInternal);
|
| | |
|
| | | await lazyPrefab.Task;
|
| | | }
|
| | |
|
| | | private async UniTask LoadPrefabInternal()
|
| | | {
|
| | | //clone 会造成二次创建
|
| | | var tmp = transform.Find("Container_ItemCell");
|
| | | if (tmp != null)
|
| | |
| | | public virtual void Init(ItemModel model, bool isCompare = false)
|
| | | {
|
| | | itemId = model.itemId;
|
| | | InitUI(model.guid, model.itemId, model.count, model.isAuction, model.packType, isCompare, model.useDataDict);
|
| | | InitUI(model.guid, model.itemId, model.count, model.isAuction, model.packType, isCompare, model.useDataDict).Forget();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | InitUI(model.guid, model.itemId, model.count, false, model.packType, model.isCompare, model.useDataDic).Forget();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 在prefab加载完成后安全设置button点击事件
|
| | | /// </summary>
|
| | | public void SetClickListener(UnityEngine.Events.UnityAction action)
|
| | | {
|
| | | SetClickListenerAsync(action).Forget();
|
| | | }
|
| | |
|
| | | private async UniTask SetClickListenerAsync(UnityEngine.Events.UnityAction action)
|
| | | {
|
| | | await LoadPrefab();
|
| | | if (this == null) return;
|
| | | button.SetListener(action);
|
| | | }
|
| | |
|
| | | private async UniTask InitUI(string guid, int itemId, long count, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null) return;
|
| | | if (config == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | await LoadPrefab(); //存在被卸载的可能,重新加载
|
| | | if (this == null) return;
|
| | |
| | | |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class ItemCell : CommonItemBaisc |
| | | { |
| | | |
| | |
| | | base.Init(model); |
| | | if (appointID > 0) |
| | | { |
| | | countText.text = Language.Get("L1113", AppointItemConfig.Get(appointID).ItemLV); |
| | | ApplyAppointText(appointID).Forget(); |
| | | } |
| | | } |
| | | |
| | | private async Cysharp.Threading.Tasks.UniTask ApplyAppointText(int appointID) |
| | | { |
| | | await LoadPrefab(); |
| | | if (this == null) return; |
| | | countText.text = Language.Get("L1113", AppointItemConfig.Get(appointID).ItemLV); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | public static readonly string[] JUMP_URL = new string[] |
| | | { |
| | | #if TEST_BUILD |
| | | "http://gamecenter.secondworld.net.cn:11000/center/server_list.php/?", |
| | | #else |
| | | "http://xssgcenter.secondworld.net.cn:11000/center/server_list.php/?", |
| | | #endif |
| | | "http://106.55.151.92:11000/center/server_list_new.php/?" |
| | | }; |
| | | |
| | |
| | | base.OnOpen(); |
| | | // 窗口打开时的逻辑 |
| | | ServerListCenter.Instance.serverGroupSelectEvent += RefreshServerList; |
| | | m_ServerGroupScroll.Init(ServerListCenter.Instance.GetAllServerGroup()); |
| | | m_ServerGroupScroll.Init(ServerListCenter.Instance.GetAllServerGroup()).Forget(); |
| | | RefreshServerList(); |
| | | } |
| | | |
| | |
| | | groupDatas.Add(new ServerDataCouple(serverDataList[i])); |
| | | } |
| | | |
| | | m_ServerScroll.Init(groupDatas); |
| | | m_ServerScroll.Init(groupDatas).Forget(); |
| | | } |
| | | else |
| | | { |
| | | m_ServerScroll.Init<ServerDataCouple>(null); |
| | | m_ServerScroll.Init<ServerDataCouple>(null).Forget(); |
| | | } |
| | | |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class MailCell : CellView |
| | | { |
| | |
| | | int mailState = mailData.MailState;//0-未知;1-未读;2-已读;3-已领; |
| | | MailItemData data = mailData.Items[index]; |
| | | itemCell.Init(new ItemCellModel((int)data.ItemID, true, data.Count)); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show((int)data.ItemID, true)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show((int)data.ItemID, true)); |
| | | float expiryDays = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays); |
| | | imgHave.SetActive(mailState == 3); |
| | | imgMask.SetActive(mailState == 3 || expiryDays <= 0); |
| | |
| | | txtCurrentMailCount.text = StringUtility.Concat(personalMailCount.ToString(), "/", MailManager.Instance.personalMailMaxLimitCount.ToString()); |
| | | } |
| | | |
| | | protected override async void OpenSubUIByTabIndex() |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | switch (functionOrder) |
| | | { |
| | |
| | | mgTip.SetActive(false); |
| | | // 刷新UI |
| | | Display(); |
| | | |
| | | var temp = Debug.unityLogger.logEnabled; |
| | | Debug.unityLogger.logEnabled = true; |
| | | Debug.LogError("MainWin OnPreOpen 了 特殊标识"); |
| | | Debug.unityLogger.logEnabled = temp; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | |
| | | break; |
| | | case PlayerDataType.Face: |
| | | case PlayerDataType.FacePic: |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | break; |
| | |
| | | |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | void RefreshFightIng(bool isfighting = false) |
| | |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | SmallTipWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget(); |
| | | }); |
| | | }).Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | public static Regex Color_Start_Regex = new Regex(@"<color=#([0-9a-zA-Z]+)>", RegexOptions.Singleline); |
| | | |
| | | public override async UniTask<string> Analysis(string val, bool IsRich) |
| | | public override UniTask<string> Analysis(string val, bool IsRich) |
| | | { |
| | | return val; |
| | | return UniTask.FromResult(val); |
| | | // if (!Color_Start_Regex.IsMatch(val) || RichTextMgr.Inst.presentRichText == null) |
| | | // { |
| | | // return val; |
| | |
| | | |
| | | static int insertIndex = 0; |
| | | |
| | | public override async UniTask<string> Analysis(string val, bool IsRich) |
| | | public override UniTask<string> Analysis(string val, bool IsRich) |
| | | { |
| | | if (!HrefRegex.IsMatch(val)) |
| | | { |
| | | return val; |
| | | return UniTask.FromResult(val); |
| | | } |
| | | int index = 0; |
| | | m_StringBuilder.Length = 0; |
| | |
| | | } |
| | | m_StringBuilder.Append(val.Substring(index, val.Length - index)); |
| | | presentHrefInfo = null; |
| | | return m_StringBuilder.ToString(); |
| | | return UniTask.FromResult(m_StringBuilder.ToString()); |
| | | } |
| | | |
| | | public override string CalculateTextIndex(string val, int index) |
| | |
| | | set |
| | | { |
| | | m_AutoNewLine = value; |
| | | SetRichTextDirty(); |
| | | SetRichTextDirty().Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | public void SetReplaceInfo(Dictionary<string, string> _infoDic) |
| | | { |
| | | extenalDataDic = _infoDic; |
| | | SetRichTextDirty(); |
| | | SetRichTextDirty().Forget(); |
| | | } |
| | | |
| | | private string GetTaskInfo(string val) |
| | |
| | | { |
| | | public static Regex SuitName_Regex = new Regex(@"<Suitname=(.*?)/>\|{0,1}"); |
| | | |
| | | public override async UniTask<string> Analysis(string val, bool IsRich) |
| | | public override UniTask<string> Analysis(string val, bool IsRich) |
| | | { |
| | | if (!SuitName_Regex.IsMatch(val)) |
| | | { |
| | | return val; |
| | | return UniTask.FromResult(val); |
| | | } |
| | | int index = 0; |
| | | m_StringBuilder.Length = 0; |
| | |
| | | index = match.Index + match.Length; |
| | | } |
| | | m_StringBuilder.Append(val.Substring(index, val.Length - index)); |
| | | return m_StringBuilder.ToString(); |
| | | return UniTask.FromResult(m_StringBuilder.ToString()); |
| | | } |
| | | |
| | | public override string CalculateTextIndex(string val, int index) |
| | |
| | | private static int presentColor = 0; |
| | | private static bool hasColor = false; |
| | | |
| | | public override async UniTask<string> Analysis(string val, bool IsRich) |
| | | public override UniTask<string> Analysis(string val, bool IsRich) |
| | | { |
| | | if (!Word_Regex.IsMatch(val)) |
| | | { |
| | | return val; |
| | | return UniTask.FromResult(val); |
| | | } |
| | | int index = 0; |
| | | m_StringBuilder.Length = 0; |
| | |
| | | index = match.Index + match.Length; |
| | | } |
| | | m_StringBuilder.Append(val.Substring(index, val.Length - index)); |
| | | return m_StringBuilder.ToString(); |
| | | return UniTask.FromResult(m_StringBuilder.ToString()); |
| | | } |
| | | |
| | | public override string CalculateTextIndex(string val, int index) |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = ctgConfig.GainItemList[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, ctgConfig.GainItemList[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = award[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, award[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = ctgConfig.GainItemList[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, ctgConfig.GainItemList[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = award[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, award[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = ctgConfig.GainItemList[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, ctgConfig.GainItemList[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = award[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, award[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | private void Awake() |
| | | { |
| | | //如果有需要按钮点击逻辑,在外层创建,此处不处理点击逻辑 |
| | | LoadPrefab().Forget(); |
| | | |
| | | lazyPrefab = new AsyncLazy(LoadPrefabInternal, "OfficialTitleCell"); |
| | | lazyPrefab.Task.Forget(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | GameObject prefab; |
| | | AsyncLazy lazyPrefab; |
| | | |
| | | |
| | | protected async UniTask<GameObject> LoadPrefab() |
| | | private async UniTask LoadPrefabInternal() |
| | | { |
| | | if (prefab != null) |
| | | return prefab; |
| | | var tmp = transform.Find("OfficialTitleCell"); |
| | | |
| | | if (tmp != null) |
| | | { |
| | | prefab = tmp.gameObject; |
| | | return prefab; |
| | | return; |
| | | } |
| | | prefab = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell"); |
| | | |
| | | var inst = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | GameObject.DestroyImmediate(prefab); |
| | | return null; |
| | | if (inst != null) GameObject.DestroyImmediate(inst); |
| | | return; |
| | | } |
| | | |
| | | prefab = inst; |
| | | prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | prefab.transform.SetAsFirstSibling(); |
| | | return prefab; |
| | | } |
| | | |
| | | public async UniTask InitUI(int offcialRank, int titleID, float scale = 0.6f) |
| | | { |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await lazyPrefab.Task; |
| | | if (this == null) return; |
| | | if (!TitleConfig.HasKey(titleID)) |
| | | { |
| | |
| | | DisplayPotential(heroID, breakLevel); |
| | | RefreshAwake(heroID, quality, awakeLevel); |
| | | |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | |
| | | } |
| | | |
| | |
| | | DisplayFetter(teams: null, FetterIDList); |
| | | DisplayPotential(heroID, breakLevel); |
| | | RefreshAwake(heroID, quality, awakeLevel); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | void DiplayByViewOtherPlayer(OtherPlayerDetailManager.RolePlusData.HeroData heroData, |
| | |
| | | DisplayPotential(heroID, breakLevel); |
| | | RefreshAwake(heroID, quality, awakeLevel); |
| | | |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | |
| | |
| | | DisplayAttr(attrDict); |
| | | DisplayPotential(heroID, breakLevel); |
| | | RefreshAwake(heroID, quality, awakeLevel); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | List<GameObject> awakeCellList; //觉醒 |
| | |
| | | txtPlayerId.text = Language.Get("OtherPlayerDetail02", viewPlayerData.PlayerID); |
| | | txtServerName.text = Language.Get("PlayerProfile11", ServerListCenter.Instance.GetServerName(viewPlayerData.ServerID)); |
| | | txtLV.text = viewPlayerData.LV.ToString(); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(viewPlayerData.PlayerID, viewPlayerData.Face, viewPlayerData.FacePic)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(viewPlayerData.PlayerID, viewPlayerData.Face, viewPlayerData.FacePic)).Forget(); |
| | | officialTitle.InitUI(viewPlayerData.RealmLV, viewPlayerData.TitleID, 0.65f).Forget(); |
| | | DisplayHorseModel(viewPlayerData); |
| | | |
| | |
| | | using System;
|
| | | using System;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.Events;
|
| | |
|
| | | //头像模块
|
| | | //澶村儚妯″潡
|
| | | public class AvatarCell : MonoBehaviour
|
| | | {
|
| | | ButtonEx m_button;
|
| | |
| | | return;
|
| | | InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID,
|
| | | PlayerDatas.Instance.baseData.face,
|
| | | PlayerDatas.Instance.baseData.facePic));
|
| | | PlayerDatas.Instance.baseData.facePic)).Forget();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | | avatarModel = model;
|
| | | await LoadPrefab(); //存在被卸载的可能,重新加载
|
| | | await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞?
|
| | |
|
| | | if (this == null)
|
| | | {
|
| | |
| | |
|
| | | int faceID = model.faceID;
|
| | | int facePicID = model.facePicID;
|
| | |
|
| | | // 璇婃柇锛氭鏌?Mask_Face 鑺傜偣鍙婂叾瀛愬璞?
|
| | | var maskTf = prefab?.transform.Find("Img_FaceBG/Mask_Face");
|
| | | if (maskTf != null)
|
| | | {
|
| | | for (int i = 0; i < maskTf.childCount; i++)
|
| | | {
|
| | | var child = maskTf.GetChild(i);
|
| | | var img = child.GetComponent<UnityEngine.UI.Graphic>();
|
| | | }
|
| | | }
|
| | |
|
| | | // 璇婃柇锛氭鏌?Img_FacePic 鑺傜偣
|
| | | var facePicTf = prefab?.transform.Find("Img_FaceBG/Img_FacePic");
|
| | | if (facePicTf != null)
|
| | | {
|
| | | var fpImg = facePicTf.GetComponent<UnityEngine.UI.Graphic>();
|
| | | }
|
| | |
|
| | | await manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID);
|
| | |
|
| | | if (this == null) return;
|
| | |
| | |
|
| | | BindButtonClick(model);
|
| | | }
|
| | | // 添加标志位:是否已设置自定义监听器
|
| | | // 娣诲姞鏍囧織浣嶏細鏄惁宸茶缃嚜瀹氫箟鐩戝惉鍣?
|
| | | private bool hasCustomListener = false;
|
| | | public void SetListener(UnityAction action)
|
| | | {
|
| | | hasCustomListener = true; // 标记已设置自定义监听
|
| | | hasCustomListener = true; // 鏍囪宸茶缃嚜瀹氫箟鐩戝惉
|
| | | button.SetListener(action);
|
| | | }
|
| | | public void AddListener(UnityAction action)
|
| | | {
|
| | | hasCustomListener = true; // 标记已设置自定义监听
|
| | | hasCustomListener = true; // 鏍囪宸茶缃嚜瀹氫箟鐩戝惉
|
| | | button.SetListener(action);
|
| | | }
|
| | | private void BindButtonClick(AvatarModel model)
|
| | | {
|
| | | // 如果已经设置了自定义监听器,不覆盖
|
| | | // 濡傛灉宸茬粡璁剧疆浜嗚嚜瀹氫箟鐩戝惉鍣紝涓嶈鐩?
|
| | | if (hasCustomListener)
|
| | | return;
|
| | |
|
| | |
| | | this.faceID = faceID;
|
| | | this.facePicID = facePicID;
|
| | | }
|
| | | } |
| | | }
|
| | |
| | | { |
| | | [SerializeField] InputField input; |
| | | [SerializeField] Button receiveBtn; |
| | | const string exchangeUrl = "http://gamecenter.secondworld.net.cn:53003/Coupon/CouponCode.php?"; |
| | | // const string exchangeUrl = "http://gamecenter.secondworld.net.cn:53003/Coupon/CouponCode.php?"; |
| | | |
| | | #if TEST_BUILD |
| | | const string exchangeUrl = "http://gamecenter.secondworld.net.cn:53003/center/CouponCode.php/?"; |
| | | #else |
| | | const string exchangeUrl = "http://xssgcenter.secondworld.net.cn:53003/center/CouponCode.php/?"; |
| | | #endif |
| | | |
| | | bool isCool = false; |
| | | float time = 0; |
| | | |
| | |
| | | txtFamilyName.text = Language.Get("PlayerProfile12", PlayerDatas.Instance.fairyData.HasFairy ? PlayerDatas.Instance.baseData.FamilyName : Language.Get("PlayerProfile14")); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f).Forget(); |
| | | var languages = Language.GetLanguages(); |
| | | btnLanguage.SetActive(!languages.IsNullOrEmpty()); |
| | |
| | | itemCell.SetActive(true); |
| | | int itemID = rankAwards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, rankAwards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)).Forget(); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Qunying); |
| | |
| | | |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)).Forget(); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Qunying); |
| | |
| | | txtEnemyLV.text = Language.Get("Arena22", info.LV); |
| | | txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName); |
| | | txtEnemyFightPonit.text = UIHelper.ReplaceLargeArtNum(GetFightPonit(enemyTeam)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic)); |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic)).Forget(); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)info.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Qunying); |
| | |
| | | txtMyName.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | long myFightPower = GetFightPonit(myTeam); |
| | | txtMyFightPonit.text = UIHelper.ReplaceLargeArtNum(myFightPower); |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, PlayerDatas.Instance.baseData.face, PlayerDatas.Instance.baseData.facePic)); |
| | | myAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, PlayerDatas.Instance.baseData.face, PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | team = GetTeamHeroList(myTeam); |
| | | myCountry.RefreshOnTeamCountry(team, true); |
| | | |
| | |
| | | using UnityEngine; |
| | | using System; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class QYNoteCell : CellView |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | lvTxt.text = PlayerDatas.Instance.baseData.LV.ToString(); |
| | | nameTxt.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | serverTxt.text = ServerListCenter.Instance.GetServerName(UIHelper.GetServerIDByAccount(PlayerDatas.Instance.baseData.AccID)); |
| | | stateImg.SetSprite("QYResult" + (arenaGameRec.Value4 == 1 ? 1 : 2)); |
| | | rankTxt.text = arenaGameRec.CurRank == 0 ? Language.Get("L1045") : Language.Get("Qunying20") + arenaGameRec.CurRank; |
| | | |
| | | tagAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6)); |
| | | tagAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6)).Forget(); |
| | | |
| | | tagAvatarCell.SetListener(() => |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0])); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Linq; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | itemCells[i].SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCells[i].Init(new ItemCellModel(itemID, false, awards[i][1])); |
| | | itemCells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCells[i].SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | |
|
| | | itemCell.Init(new ItemCellModel(itemID, false, count));
|
| | | txtItemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemCell.button.SetListener(() =>
|
| | | itemCell.SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | |
| | | Debug.Log("SoundPlayer 创建完成"); |
| | | } |
| | | |
| | | public async UniTask PlayBackGroundMusic(int _audioId) |
| | | public UniTask PlayBackGroundMusic(int _audioId) |
| | | { |
| | | if (_audioId <= 0) |
| | | { |
| | | return; |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | backGroudAudioIdRef = _audioId; |
| | |
| | | StartCoroutine(Co_BackGroundMusicFadeOutIn(clip, false)); |
| | | } |
| | | } |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | int backGroudAudioIdRef = 0; |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | itemCells[i].SetActive(true); |
| | | int itemID = itemList[i].id; |
| | | itemCells[i].Init(new ItemCellModel(itemID, true, itemList[i].countEx)); |
| | | itemCells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | itemCells[i].SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | |
| | | int itemCellIndex = i; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true)); |
| | | } |
| | | else |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "0";//Language.Get("L1125"); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget(); |
| | | viewPlayerId = (int)rankData.id; |
| | | nameText.text = rankData.name1; |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue2 + rankData.cmpValue * Constants.ExpPointValue)); |
| | |
| | | Refresh(); |
| | | } |
| | | |
| | | protected override async void OpenSubUIByTabIndex() |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | transRank.SetActive(functionOrder == 0); |
| | | transAward.SetActive(functionOrder == 1); |
| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
| | | int index = i; |
| | | itemCells[i].SetActive(true); |
| | | itemCells[i].Init(new ItemCellModel(items[i][0], true, items[i][1])); |
| | | itemCells[i].button.SetListener(() => |
| | | itemCells[i].SetClickListener(() => |
| | | { |
| | | ItemTipUtility.Show(items[index][0], true); |
| | | }); |
| | |
| | | using UnityEngine; |
| | | using UnityEngine; |
| | | |
| | | public class TimingGiftAwardCell : MonoBehaviour |
| | | { |
| | |
| | | int itemId = gainItemList[index][0]; |
| | | int count = gainItemList[index][1]; |
| | | itemCell.Init(new ItemCellModel(itemId, false, count)); |
| | | itemCell.button.SetListener(() => { ItemTipUtility.Show(itemId); }); |
| | | itemCell.SetClickListener(() => { ItemTipUtility.Show(itemId); }); |
| | | } |
| | | } |
| | | |
| | |
| | | var item = ConfirmCancel.getItems[index];
|
| | | int itemID = item.id;
|
| | | itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
|
| | | itemCell.button.SetListener(() =>
|
| | | itemCell.SetClickListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | |
| | | { |
| | | while (ScrollTip.m_Hints.Count > 0) |
| | | { |
| | | OnTipReceiveEvent(); |
| | | OnTipReceiveEvent().Forget(); |
| | | await UniTask.Delay(100); |
| | | if (this == null) return; // destroyed during await |
| | | } |
| | |
| | | isComponentReady = true; |
| | | } |
| | | |
| | | protected override async void OpenSubUIByTabIndex() |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | } |
| | | |
| | |
| | | if (UIManager.Instance.IsOpened(config.WinName)) |
| | | { |
| | | UIManager.Instance.CloseWindow(config.WinName); |
| | | UIManager.Instance.OpenWindow(config.WinName); |
| | | UIManager.Instance.OpenWindowAsync(config.WinName).Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using LitJson; |
| | | using Cysharp.Threading.Tasks; |
| | |
| | | int itemID = items[i][0]; |
| | | int count = items[i][1]; |
| | | cells[i].Init(new ItemCellModel(itemID, false, count)); |
| | | cells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | cells[i].SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | PlayerDatas.Instance.baseData.facePic)).Forget(); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)).Forget(); |
| | | viewPlayerId = (int)rankData.id; |
| | | nameText.text = rankData.name1; |
| | | manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum); |
| | |
| | | int itemID = items[i][0]; |
| | | int count = items[i][1]; |
| | | cells[i].Init(new ItemCellModel(itemID, false, count)); |
| | | cells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | cells[i].SetClickListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | /// <summary> |
| | | /// 异步懒加载:保证 factory 只执行一次,支持多个并发 await(每个调用者独立 TCS) |
| | | /// 非泛型设计,避免热更 AOT 泛型问题 |
| | | /// </summary> |
| | | public class AsyncLazy |
| | | { |
| | | public delegate UniTask AsyncFactory(); |
| | | |
| | | private readonly AsyncFactory factory; |
| | | private List<UniTaskCompletionSource> waiters; |
| | | private bool hasCompleted; |
| | | private bool isRunning; |
| | | |
| | | public AsyncLazy(AsyncFactory factory, string debugName = "") |
| | | { |
| | | this.factory = factory; |
| | | } |
| | | |
| | | public UniTask Task |
| | | { |
| | | get |
| | | { |
| | | if (hasCompleted) |
| | | { |
| | | return UniTask.CompletedTask; |
| | | } |
| | | |
| | | var tcs = new UniTaskCompletionSource(); |
| | | if (waiters == null) waiters = new List<UniTaskCompletionSource>(); |
| | | waiters.Add(tcs); |
| | | |
| | | if (!isRunning) |
| | | { |
| | | isRunning = true; |
| | | Run().Forget(); |
| | | } |
| | | |
| | | return tcs.Task; |
| | | } |
| | | } |
| | | |
| | | private async UniTaskVoid Run() |
| | | { |
| | | try |
| | | { |
| | | await factory(); |
| | | hasCompleted = true; |
| | | if (waiters != null) |
| | | { |
| | | for (int i = 0; i < waiters.Count; i++) |
| | | waiters[i].TrySetResult(); |
| | | waiters.Clear(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | if (waiters != null) |
| | | { |
| | | for (int i = 0; i < waiters.Count; i++) |
| | | waiters[i].TrySetException(ex); |
| | | waiters.Clear(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void Reset() |
| | | { |
| | | hasCompleted = false; |
| | | isRunning = false; |
| | | waiters = null; |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 53996bfe50eb80c4d99f202ede213b25 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public class OperationLogCollect : Singleton<OperationLogCollect>
|
| | | {
|
| | |
|
| | | #if TEST_BUILD
|
| | | const string bugReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | |
|
| | | #else
|
| | | const string bugReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | #endif
|
| | | public void BugReport(string _title, string _content)
|
| | | {
|
| | | var tables = new Dictionary<string, string>();
|
| | |
| | | #endif
|
| | | }
|
| | |
|
| | |
|
| | | #if TEST_BUILD
|
| | | const string chatReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | #else
|
| | | const string chatReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | #endif
|
| | |
|
| | | public void ChatReport(string content, string channelName, string toPlayer, int chatType)
|
| | | {
|
| | | #if !UNITY_EDITOR
|
| | |
| | | { |
| | | public static void DelayFrame(this GameObject go, Action action) |
| | | { |
| | | DelayFrameInternal(1, action); |
| | | DelayFrameInternal(1, action).Forget(); |
| | | } |
| | | |
| | | public static void DelayFrame(this Component cmp, Action action) |
| | | { |
| | | DelayFrameInternal(1, action); |
| | | DelayFrameInternal(1, action).Forget(); |
| | | } |
| | | |
| | | private async static UniTask DelayFrameInternal(int frame, Action action) |
| | |
| | | |
| | | public static void DelayFrames(this Component cmp, int frames, Action action) |
| | | { |
| | | DelayFrameInternal(frames, action); |
| | | DelayFrameInternal(frames, action).Forget(); |
| | | } |
| | | |
| | | public static void DelayFrames(this GameObject go, int frames, Action action) |
| | | { |
| | | DelayFrameInternal(frames, action); |
| | | DelayFrameInternal(frames, action).Forget(); |
| | | } |
| | | |
| | | public static void DelayFrame(Action action) |
| | | { |
| | | DelayFrameInternal(1, action); |
| | | DelayFrameInternal(1, action).Forget(); |
| | | } |
| | | |
| | | public static void DelayTime(this GameObject go, float time, Action action) |
| | | { |
| | | DelayTimeInternal(time, action); |
| | | DelayTimeInternal(time, action).Forget(); |
| | | } |
| | | |
| | | public static void DelayTime(this Component cmp, float time, Action action) |
| | | { |
| | | DelayTimeInternal(time, action); |
| | | DelayTimeInternal(time, action).Forget(); |
| | | } |
| | | |
| | | private async static UniTask DelayTimeInternal(float time, Action action) |