| | |
| | | public JaceOptions() |
| | | { |
| | | CultureInfo = CultureInfo.CurrentCulture; |
| | | #if UNITY_WEBGL |
| | | ExecutionMode = ExecutionMode.Interpreted; |
| | | #else |
| | | ExecutionMode = ExecutionMode.Compiled; |
| | | #endif |
| | | CacheEnabled = true; |
| | | OptimizerEnabled = true; |
| | | CaseSensitive = false; |
| | |
| | | /// </summary>
|
| | | private async UniTask<string[]> LoadConfigTextAsync(Type configType)
|
| | | {
|
| | | <<<<<<< HEAD
|
| | | string configName = configType.Name;
|
| | | if (configName.EndsWith("Config"))
|
| | | configName = configName.Substring(0, configName.Length - 6);
|
| | | return await ResManager.Instance.LoadConfigAsync(configName);
|
| | | =======
|
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | /// <summary>
|
| | | /// Editor 自检:反射加载所有配置类并记录耗时。
|
| | | /// </summary>
|
| | | public async void SelfCheckAllConfigs()
|
| | | {
|
| | | // 获取 Editor Assembly
|
| | | var editorAsm = System.AppDomain.CurrentDomain.GetAssemblies()
|
| | | .FirstOrDefault(a => a.FullName.Contains("Editor"));
|
| | |
| | | foreach (var className in checkClasses)
|
| | | {
|
| | | // 这里也要用 Editor Assembly 获取类型
|
| | | var configType = editorAsm.GetType(className) ?? Type.GetType(className);
|
| | | if (configType == null)
|
| | | var cfgType = editorAsm.GetType(className) ?? Type.GetType(className);
|
| | | if (cfgType == null)
|
| | | {
|
| | | Debug.LogWarning($"[自检] 未找到类型: {className}");
|
| | | continue;
|
| | |
| | | var sw = System.Diagnostics.Stopwatch.StartNew();
|
| | |
|
| | | // 反射调用静态Init方法
|
| | | string configName = configType.Name;
|
| | | string configName = cfgType.Name;
|
| | | if (configName.EndsWith("Config"))
|
| | | configName = configName.Substring(0, configName.Length - 6);
|
| | |
|
| | | string[] texts = ResManager.Instance.LoadConfig(configName);
|
| | | string[] texts = await ResManager.Instance.LoadConfigAsync(configName);
|
| | | if (texts != null)
|
| | | {
|
| | | string[] lines = texts;
|
| | | var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
|
| | | var methodInfo = cfgType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
|
| | | if (methodInfo != null)
|
| | | {
|
| | | methodInfo.Invoke(null, new object[] { lines });
|
| | |
| | |
|
| | | if (sw.ElapsedMilliseconds >= 500)
|
| | | {
|
| | | Debug.LogError($"[自检] 加载配置 {configType.Name} 耗时较长: {sw.ElapsedMilliseconds} ms");
|
| | | Debug.LogError($"[自检] 加载配置 {cfgType.Name} 耗时较长: {sw.ElapsedMilliseconds} ms");
|
| | | }
|
| | | else if (sw.ElapsedMilliseconds <= 5)
|
| | | {
|
| | | fastName.Add(configType.Name);
|
| | | fastName.Add(cfgType.Name);
|
| | | }
|
| | | Debug.Log($"[自检] 加载配置: {configType.Name} 用时: {sw.ElapsedMilliseconds} ms");
|
| | | Debug.Log($"[自检] 加载配置: {cfgType.Name} 用时: {sw.ElapsedMilliseconds} ms");
|
| | | }
|
| | |
|
| | | // 释放所有已加载的配置
|
| | | foreach (var className in checkClasses)
|
| | | {
|
| | | var configType = editorAsm.GetType(className) ?? Type.GetType(className);
|
| | | if (configType == null) continue;
|
| | | var methodInfo = configType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
|
| | | var cfgType = editorAsm.GetType(className) ?? Type.GetType(className);
|
| | | if (cfgType == null) continue;
|
| | | var methodInfo = cfgType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
|
| | | if (methodInfo != null)
|
| | | {
|
| | | methodInfo.Invoke(null, null);
|
| | |
| | |
|
| | | System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
|
| | | Debug.Log($"[自检] fastConfig.txt 生成完毕,快速表有:{string.Join(", ", fastName)}");
|
| | | >>>>>>> origin/master
|
| | | }
|
| | | #endif
|
| | |
|
| | | /// <summary>
|
| | | /// 从已加载的文本初始化配置(纯内存操作,无网络)。
|
| | |
| | | { |
| | | done = true; |
| | | } |
| | | else if (Application.platform == RuntimePlatform.WebGLPlayer) |
| | | { |
| | | // WebGL平台无需拷贝文件,资源由 YooAsset WebPlayMode 加载 |
| | | done = true; |
| | | } |
| | | else |
| | | { |
| | | switch (Application.platform) |
| | |
| | | |
| | | public static void WriteAllNetLog(bool @details) |
| | | { |
| | | #if !UNITY_WEBGL |
| | | if (packages != null) |
| | | { |
| | | var count = 0; |
| | |
| | | |
| | | File.WriteAllLines(Application.dataPath + "/PackageLogs_" + (@details ? "details" : "abstract") + "_" + DateTime.Now.ToString("HH_mm_ss") + ".txt", lines.ToArray()); |
| | | } |
| | | #endif |
| | | } |
| | | } |
| | | |
| | |
| | | }; |
| | | |
| | | // 根据内存判定性能档次 |
| | | #if UNITY_WEBGL |
| | | // WebGL下systemMemorySize不准确,默认中端 |
| | | profile.PerformanceLevel = PerformanceLevel.Medium; |
| | | #else |
| | | if (profile.TotalMemory < 2048) |
| | | profile.PerformanceLevel = PerformanceLevel.Low; |
| | | else if (profile.TotalMemory < 4096) |
| | | profile.PerformanceLevel = PerformanceLevel.Medium; |
| | | else |
| | | profile.PerformanceLevel = PerformanceLevel.High; |
| | | #endif |
| | | |
| | | return profile; |
| | | } |
| | |
| | | /// </summary> |
| | | public async UniTask<T> OpenWindowAsync<T>(int functionOrder = 0) where T : UIBase |
| | | { |
| | | if (typeof(T).Name == "MainWin") |
| | | { |
| | | //MainWin 比较关键且唯一,做安全防范 |
| | | var ui = GetUI<MainWin>(); |
| | | if (ui != null) |
| | | { |
| | | ui.ClickFunc(0); |
| | | return ui as T; |
| | | } |
| | | } |
| | | string uiName = typeof(T).Name; |
| | | var result = await OpenWindowAsync(uiName, functionOrder); |
| | | return result as T; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public async UniTask<UIBase> OpenWindow(string uiName, int functionOrder = 0) |
| | | { |
| | | // 优先从closedUIDict中获取 |
| | | UIBase parentUI = null; |
| | | |
| | | UIBase returnValue = null; |
| | | |
| | | List<UIBase> closedUIList = new List<UIBase>(); |
| | | |
| | | if (closedUIDict.TryGetValue(uiName, out closedUIList) && closedUIList.Count > 0) |
| | | { |
| | | #if UNITY_EDITOR |
| | | Debug.Log("OpenWindow getFromClosedDict " + uiName); |
| | | #endif |
| | | |
| | | returnValue = closedUIList[0] as UIBase; |
| | | closedUIList.RemoveAt(0); |
| | | |
| | | if (closedUIList.Count == 0) |
| | | { |
| | | closedUIDict.Remove(uiName); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | #if UNITY_EDITOR |
| | | Debug.Log("OpenWindow getNewLoad " + uiName); |
| | | #endif |
| | | returnValue = await LoadUIResourceAsync(uiName); |
| | | if (returnValue == null) |
| | | { |
| | | // 记录错误日志 |
| | | Debug.LogError($"打开UI失败: {uiName}"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | returnValue.gameObject.SetActive(true); |
| | | |
| | | // 自动设置父级UI, 如果勾选了ismainui 则不需要找父级UI |
| | | if (returnValue.supportParentChildRelation && uiStack.Count > 0 && !returnValue.isMainUI) |
| | | { |
| | | // 获取栈顶UI |
| | | parentUI = GetLastSupportParentChildRelationUI(); |
| | | } |
| | | |
| | | // 设置父级UI |
| | | if (parentUI != null) |
| | | { |
| | | // 设置父子关系 |
| | | returnValue.parentUI = parentUI; |
| | | if (parentUI.childrenUI == null) |
| | | { |
| | | // 初始化父级UI的子UI列表 |
| | | parentUI.childrenUI = new List<UIBase>(); |
| | | } |
| | | // 添加到父级UI的子UI列表 |
| | | parentUI.childrenUI.Add(returnValue); |
| | | } |
| | | |
| | | // 更新回合数 |
| | | currentRound++; |
| | | // 设置UI的最后使用回合数 |
| | | returnValue.lastUsedRound = currentRound; |
| | | // 更新父级UI的回合数 |
| | | UpdateParentUIRounds(returnValue); |
| | | |
| | | // 将UI添加到字典中 |
| | | if (!uiDict.ContainsKey(uiName)) |
| | | { |
| | | // 如果字典中不存在该类型的UI,创建新列表 |
| | | uiDict[uiName] = new List<UIBase>(); |
| | | } |
| | | // 添加到UI列表 |
| | | uiDict[uiName].Add(returnValue); |
| | | |
| | | #if UNITY_EDITOR |
| | | if (uiDict[uiName].Count > 5) |
| | | { |
| | | Debug.LogError("已打开" + uiDict[uiName].Count + "个界面:" + uiName); |
| | | } |
| | | #endif |
| | | |
| | | // 将UI添加到栈中 |
| | | uiStack.Push(returnValue); |
| | | |
| | | // 更新UI排序顺序 |
| | | UpdateUISortingOrder(); |
| | | |
| | | // 打开UI |
| | | returnValue.functionOrder = functionOrder; |
| | | returnValue.HandleOpen(); |
| | | |
| | | OnOpenWindow?.Invoke(returnValue); |
| | | |
| | | // 检查并关闭长时间未使用的UI |
| | | CheckAndCloseIdleUI(); |
| | | |
| | | return returnValue; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 打开UI |
| | | /// </summary> |
| | | public T OpenWindow<T>(int functionOrder = 0) where T : UIBase |
| | | { |
| | | if (typeof(T).Name == "MainWin") |
| | | { |
| | | //MainWin 比较关键且唯一,做安全防范 |
| | | var ui = GetUI<MainWin>(); |
| | | if (ui != null) |
| | | { |
| | | ui.ClickFunc(0); |
| | | return ui as T; |
| | | } |
| | | } |
| | | // 获取UI类型名称 |
| | | string uiName = typeof(T).Name; |
| | | return OpenWindow(uiName, functionOrder) as T; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关闭UI |
| | | /// </summary> |
| | |
| | | public static async UniTask LoadSprite(string directory, string name, Image image, string failureName) |
| | | { |
| | | var sprite = await LoadSpriteAsync(directory, name); |
| | | if (image == null) return; |
| | | if (sprite != null) |
| | | { |
| | | if (image != null) |
| | | { |
| | | image.overrideSprite = sprite; |
| | | } |
| | | image.overrideSprite = sprite; |
| | | } |
| | | else |
| | | { |
| | |
| | | StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/" + iconConfig.folder), iconConfig.sprite, ct: ct); |
| | | } |
| | | |
| | | public static UniTask<Texture2D> LoadTexture2DPNGAsync(string name, CancellationToken ct = default) |
| | | public static async UniTask<Texture2D> LoadTexture2DPNGAsync(string name, CancellationToken ct = default) |
| | | { |
| | | return ResManager.Instance.LoadAssetAsync<Texture2D>( |
| | | StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/FullScreenBg"), name + ".png", false, ct); |
| | | var path = StringUtility.Concat(ResourcesPath.UI_TEXTURE_SUFFIX, "/FullScreenBg"); |
| | | var result = await ResManager.Instance.LoadAssetAsync<Texture2D>(path, name + ".png", false, ct); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | #elif UNITY_IOS |
| | | AotSdkUtility.IOSUniyMessageHandle(json.ToJson()); |
| | | #elif UNITY_STANDALONE |
| | | #elif UNITY_STANDALONE || UNITY_WEBGL |
| | | InitFinished=true; |
| | | #endif |
| | | |
| | |
| | | // else |
| | | { |
| | | //默认都是退出游戏 |
| | | #if UNITY_WEBGL |
| | | Application.OpenURL("about:blank"); |
| | | #else |
| | | Application.Quit(); |
| | | #endif |
| | | } |
| | | break; |
| | | case CodeA2U.GetAdAward: |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class ArenaChallengeCell : MonoBehaviour |
| | |
| | | txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaMatchInfo.FightPower); |
| | | txtAddScore.text = Language.Get("Arena16", ArenaManager.Instance.GetChallengePoints(index)); |
| | | |
| | | officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID, 0.55f); |
| | | officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID, 0.55f).Forget(); |
| | | |
| | | int[][] rewards = ArenaManager.Instance.fixedChallengeRewards; |
| | | for (int i = 0; i < itemCells.Count; i++) |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = ArenaManager.Instance.score.ToString(); |
| | | 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; |
| | |
| | | { |
| | | viewPlayerId = (int)rankData.id; |
| | | 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.SetOnLoaded(() => |
| | |
| | | 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.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 1).Forget(); |
| | | queryPlayerBtn.SetListener(() => |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using System; |
| | | |
| | |
| | | }); |
| | | txtName.text = arenaGameRec.Name; |
| | | txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaGameRec.FightPower); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 0.55f); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 0.55f).Forget(); |
| | | imgMoneyIcon.SetIconWithMoneyType(ArenaManager.Instance.ChallengeMoneyType); |
| | | txtNeedCount.text = ArenaManager.Instance.NeedChallengeMoneyCnt.ToString(); |
| | | } |
| | |
| | | |
| | | public bool CheckLocalFileValid(bool _completeFile) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL无本地文件系统,资源由YooAsset WebPlayMode管理 |
| | | return true; |
| | | #else |
| | | if (_completeFile) |
| | | { |
| | | var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, m_RelativePath); |
| | |
| | | } |
| | | |
| | | return true; |
| | | #endif |
| | | } |
| | | |
| | | // 检查外部存储文件是否存在 |
| | |
| | | { |
| | | string path = string.Concat(ResourcesPath.Instance.ExternalStorePath, m_RelativePath); |
| | | |
| | | #if UNITY_WEBGL |
| | | // WebGL无本地文件系统,直接走流式加载路径 |
| | | if (!m_RelativePath.Contains(".txt")) |
| | | { |
| | | if (otherAssetInfo == null || string.IsNullOrEmpty(otherAssetInfo.relativePath)) |
| | | return false; |
| | | |
| | | if (otherAssetInfo.size != size) |
| | | { |
| | | Debug.LogFormat("StreamingAssetPath 文件大小不对{0}-{1}", size, otherAssetInfo.size); |
| | | return false; |
| | | } |
| | | |
| | | if (otherAssetInfo.md5 != md5) |
| | | { |
| | | Debug.LogFormat("StreamingAssetPath 文件md5不对{0}-{1}", md5, otherAssetInfo.md5); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | return true; |
| | | #else |
| | | if (!File.Exists(path) && !m_RelativePath.Contains(".txt")) |
| | | { |
| | | //Debug.LogFormat("转查StreamingAssetPath - 文件不存在 {0} ", path); |
| | |
| | | } |
| | | |
| | | return CheckLocalFileValid(false); |
| | | |
| | | #endif |
| | | } |
| | | |
| | | |
| | |
| | | if (reverse) |
| | | _assetKey = EncodeFileName(_assetKey); |
| | | var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, _assetKey); |
| | | #if !UNITY_WEBGL |
| | | if (!File.Exists(path)) |
| | | { |
| | | path = StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, _assetKey); |
| | | } |
| | | |
| | | #endif |
| | | return path; |
| | | } |
| | | |
| | |
| | | if (reverse) |
| | | _assetKey = EncodeFileName(_assetKey); |
| | | var path = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, _assetKey); |
| | | #if !UNITY_WEBGL |
| | | if (!File.Exists(path)) |
| | | { |
| | | path = StringUtility.Concat(ResourcesPath.Instance.StreamingAssetPath, _assetKey); |
| | | } |
| | | |
| | | #endif |
| | | return path; |
| | | } |
| | | |
| | |
| | | |
| | | public void Prepare(List<AssetVersion> _downLoadTasks, Action _downLoadOkCallBack) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL 下文件下载由 YooAsset WebPlayMode 处理,跳过旧的文件下载流程 |
| | | Debug.Log("[DownLoadAndDiscompressHotTask] WebGL 平台跳过文件下载,YooAsset 负责资源加载"); |
| | | foreach (var asset in _downLoadTasks) |
| | | asset.localValid = true; |
| | | step = Step.Completed; |
| | | _downLoadOkCallBack?.Invoke(); |
| | | return; |
| | | #endif |
| | | tasks = _downLoadTasks; |
| | | downLoadOkCallBack = _downLoadOkCallBack; |
| | | |
| | |
| | | |
| | | private void Cancel() |
| | | { |
| | | #if UNITY_WEBGL |
| | | Application.OpenURL("about:blank"); |
| | | #else |
| | | Application.Quit(); |
| | | #endif |
| | | } |
| | | |
| | | } |
| | |
| | | public string SpeedFormat { get { return StringUtility.FormatSpeed(downloadedSpeed); } } |
| | | |
| | | //本地文件大小 |
| | | public long LocalLength { get { return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L; } } |
| | | public long LocalLength { |
| | | get { |
| | | #if UNITY_WEBGL |
| | | return 0L; |
| | | #else |
| | | return (File.Exists(tempFile)) ? (new FileInfo(tempFile)).Length : 0L; |
| | | #endif |
| | | } |
| | | } |
| | | |
| | | //本地文件最后修改时间 |
| | | private System.DateTime LocalLastModified { get { return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue; } } |
| | | private System.DateTime LocalLastModified { |
| | | get { |
| | | #if UNITY_WEBGL |
| | | return DateTime.MinValue; |
| | | #else |
| | | return File.Exists(tempFile) ? File.GetLastWriteTime(tempFile) : DateTime.MinValue; |
| | | #endif |
| | | } |
| | | } |
| | | public bool IsWorking { get { return state == TaskState.Working; } } |
| | | public bool IsDone { get { return state == TaskState.Succeed; } } |
| | | |
| | |
| | | private bool IsOutdated //本地文件是否已过时 |
| | | { |
| | | get { |
| | | #if UNITY_WEBGL |
| | | return false; |
| | | #else |
| | | if (File.Exists(tempFile)) |
| | | return remoteLastModified > LocalLastModified; |
| | | return false; |
| | | #endif |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public bool BeginDownload(Action<DownloadHotTask> onCompleted) |
| | | { |
| | | if ((IsWorking && requestHeaderOk) || IsDone)//已经在下载任务中或已经下载完成了 |
| | | #if UNITY_WEBGL |
| | | Debug.LogWarning("DownloadHotTask: 文件下载在WebGL上不支持"); |
| | | return false; |
| | | #else |
| | | if ((IsWorking && requestHeaderOk) || IsDone) |
| | | return false; |
| | | if (state == TaskState.Wait)//第一次尝试 |
| | | if (state == TaskState.Wait) |
| | | failedTimes = 0; |
| | | this.onCompleted = onCompleted; |
| | | this.isStop = false; |
| | | Co_DownloadFile().Forget(); |
| | | // SnxxzGame.Instance.StartCoroutine(Co_DownloadFile()); |
| | | return true; |
| | | #endif |
| | | } |
| | | |
| | | //停止下载 |
| | |
| | | |
| | | private async UniTask Move(string sourceFile, string destFile) |
| | | { |
| | | |
| | | var copyState = 0;//复制文件状态,0等待,1成功,2失败 |
| | | #if UNITY_WEBGL |
| | | SetFailed("WebGL不支持文件操作"); |
| | | await UniTask.CompletedTask; |
| | | return; |
| | | #else |
| | | var copyState = 0; |
| | | try |
| | | { |
| | | if (File.Exists(destFile)) |
| | |
| | | SetFailed("临时文件改名出错"); |
| | | |
| | | await UniTask.CompletedTask; |
| | | #endif |
| | | } |
| | | |
| | | } |
| | |
| | | //开始分配任务 |
| | | public void AssignTasks(List<AssetVersion> assets, Action _onDownLoadOk) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL 下文件下载由 YooAsset WebPlayMode 处理,跳过旧的文件下载流程 |
| | | Debug.Log("[InGameDownLoad] WebGL 平台跳过文件下载,YooAsset 负责资源加载"); |
| | | foreach (var asset in assets) |
| | | asset.localValid = true; |
| | | state = State.Completed; |
| | | _onDownLoadOk?.Invoke(); |
| | | return; |
| | | #endif |
| | | |
| | | this.inGameDownLoadAllow = false; |
| | | this.assets = assets; |
| | |
| | | |
| | | public static void ClearAssets() |
| | | { |
| | | #if !UNITY_WEBGL |
| | | Directory.Delete(Application.persistentDataPath, true); |
| | | #endif |
| | | LocalSave.DeleteKey("HasDownLoadFullAsset"); |
| | | } |
| | | |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using LitJson; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | |
| | | } |
| | | |
| | | public override void Init(int MapID, int FuncLineID, JsonData _extendData, |
| | | public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData, |
| | | List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax) |
| | | { |
| | | base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax); |
| | | await base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax); |
| | | |
| | | SetBattleMode(BattleMode.Record); |
| | | } |
| | |
| | | BattleManager.Instance.DistributeNextReportPackage(guid); |
| | | } |
| | | |
| | | public override void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | { |
| | | PreviewBattleWin fsBattleWin = UIManager.Instance.GetUI<PreviewBattleWin>();// as FullScreenBattleWin; |
| | | if (null == fsBattleWin) |
| | | { |
| | | fsBattleWin = UIManager.Instance.OpenWindow<PreviewBattleWin>(); |
| | | fsBattleWin = await UIManager.Instance.OpenWindowAsync<PreviewBattleWin>(); |
| | | } |
| | | if (fsBattleWin == null) return; |
| | | fsBattleWin.SetBattleField(this); |
| | | |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using System; |
| | | using LitJson; |
| | | using UnityEngine; |
| | |
| | | |
| | | } |
| | | |
| | | public override void Init(int MapID, int FuncLineID, JsonData _extendData, |
| | | public override async UniTask Init(int MapID, int FuncLineID, JsonData _extendData, |
| | | List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax) |
| | | { |
| | | base.Init(MapID, FuncLineID, _extendData, _redTeamList, _blueTeamList, turnMax); |
| | | await base.Init(MapID, FuncLineID, _extendData, _redTeamList, _blueTeamList, turnMax); |
| | | |
| | | SetBattleMode(BattleMode.Record); |
| | | } |
| | |
| | | { |
| | | UIManager.Instance.CloseWindow<QYBattleWin>(); |
| | | QunyingManager.Instance.openQYWinNeedRoll = false; |
| | | UIManager.Instance.OpenWindow<QYWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYWin>().Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | public override void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | public override async void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | { |
| | | QYBattleWin fsBattleWin = UIManager.Instance.GetUI<QYBattleWin>();// as FullScreenBattleWin; |
| | | if (null == fsBattleWin) |
| | | { |
| | | fsBattleWin = UIManager.Instance.OpenWindow<QYBattleWin>(); |
| | | fsBattleWin = await UIManager.Instance.OpenWindowAsync<QYBattleWin>(); |
| | | } |
| | | if (fsBattleWin == null) return; |
| | | fsBattleWin.SetBattleField(this); |
| | | if (UIManager.Instance.IsOpened<QYWin>()) |
| | | { |
| | |
| | | // [Author]: 玩个游戏
|
| | | // [ Date ]: Wednesday, September 26, 2018
|
| | | //--------------------------------------------------------
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | | rankText.text = Language.Get("L1045");
|
| | | rankValueText.text = "";//Language.Get("L1125");
|
| | | 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));
|
| | | viewPlayerId = (int)rankData.id;
|
| | |
| | | rankValueText.text = RankModel.Instance.GetCmpValueStr(rankType, rankData.cmpValue);
|
| | | }
|
| | | nameText.text = rankData.name1;
|
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2);
|
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget();
|
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f).Forget();
|
| | | queryPlayerBtn.SetListener(() =>
|
| | | {
|
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class QunyingTabHandler : BaseChallengeTabHandler |
| | | { |
| | |
| | | return HandleNavigation; |
| | | } |
| | | |
| | | private void HandleNavigation() |
| | | private async void HandleNavigation() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true)) |
| | | return; |
| | |
| | | QYBattleWin battleWin; |
| | | if (!UIManager.Instance.IsOpened<QYBattleWin>()) |
| | | { |
| | | battleWin = UIManager.Instance.OpenWindow<QYBattleWin>(); |
| | | battleWin = await UIManager.Instance.OpenWindowAsync<QYBattleWin>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | else |
| | | { |
| | | QunyingManager.Instance.openQYWinNeedRoll = true; |
| | | UIManager.Instance.OpenWindow<QYWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYWin>().Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | using System.Collections; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class ChatPlayerMineCell : MonoBehaviour |
| | |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | |
| | | title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | if (manager.nowChatTab == ChatChannel.World) |
| | | { |
| | | string serverName = ServerListCenter.Instance.GetServerName(UIHelper.GetServerIDByAccount(PlayerDatas.Instance.baseData.AccID)); |
| | |
| | | using System.Collections; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)data.PlayerID, (int)data.Face, (int)data.FacePic, data.Job)); |
| | | |
| | | title.InitUI(data.RealmLV, (int)data.TitleID); |
| | | title.InitUI(data.RealmLV, (int)data.TitleID).Forget(); |
| | | int bubbleID = ChatBubbleHelper.GetOtherChatBubbleID(data.Job, (int)data.BubbleBox); |
| | | m_ChatBubble.DisplayBubble(bubbleID, (int)data.PlayerID); |
| | | |
| | |
| | | CloseWindow(); |
| | | #if UNITY_EDITOR |
| | | UnityEditor.EditorApplication.isPlaying = false; |
| | | #elif UNITY_WEBGL |
| | | Application.OpenURL("about:blank"); |
| | | #else |
| | | Application.Quit(); |
| | | #endif |
| | |
| | | } |
| | | |
| | | public static VersionConfig config = null; |
| | | // public static VersionConfig Get() |
| | | // { |
| | | // if (config == null) |
| | | // { |
| | | // if (Application.isEditor) |
| | | // { |
| | | // config = Resources.Load<VersionConfig>("VersionConfig"); |
| | | // //debug登录后第二次启动默认恢复test |
| | | // if (LocalSave.GetBool("RestoreTest")) |
| | | // { |
| | | // config.m_AppId = "test"; |
| | | // LocalSave.SetBool("RestoreTest", false); |
| | | // Debug.Log("appid 恢复test"); |
| | | // } |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // var text = Resources.Load<TextAsset>("VersionConfigEx"); |
| | | // if (text != null) |
| | | // { |
| | | // config = ScriptableObject.CreateInstance<VersionConfig>(); |
| | | // var json = JsonMapper.ToObject(text.text); |
| | | // ReadJson(json); //逐一解析,不用VersionConfig类结构读取,因为变量定义是按asset的结构定义的 |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // return config; |
| | | // } |
| | | public static VersionConfig Get() |
| | | { |
| | | return config; |
| | | } |
| | | |
| | | public static void ReadJson(JsonData _data) |
| | | { |
| | |
| | | { |
| | | step = Step.Completed; |
| | | |
| | | #if !UNITY_WEBGL |
| | | var apkFiles = new DirectoryInfo(ResourcesPath.Instance.ExternalStorePath).GetFiles("*.apk"); |
| | | for (int i = apkFiles.Length - 1; i >= 0; i--) |
| | | { |
| | | File.Delete(apkFiles[i].FullName); |
| | | } |
| | | #endif |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | #if !UNITY_WEBGL |
| | | var parentDirectory = Directory.GetParent(Application.persistentDataPath); |
| | | debugAccount = File.Exists(parentDirectory + "/Debug"); |
| | | #else |
| | | debugAccount = false; |
| | | #endif |
| | | } |
| | | |
| | | if (LocalSave.GetString("#@#BrancH") != string.Empty) |
| | |
| | | |
| | | if (debugAccount) |
| | | { |
| | | #if !UNITY_WEBGL |
| | | if (Application.isMobilePlatform) |
| | | { |
| | | var parentDirectory = Directory.GetParent(Application.persistentDataPath); |
| | |
| | | } |
| | | } |
| | | } |
| | | #endif |
| | | } |
| | | }).Forget(); |
| | | |
| | |
| | | private void OnClickPreviewHero() |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = model.mainItemId; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>().Forget(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | private void InitRedPoint() |
| | | { |
| | |
| | | txtDesc.text = heroInfo.heroConfig.Desc; |
| | | imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroInfo.heroConfig.Country)); |
| | | imgJob.SetSprite(HeroUIManager.Instance.GetJobIconName(heroInfo.heroConfig.Class)); |
| | | roleLhModel.Create(heroInfo.SkinID, lhScale, motionName: "", isLh: true); |
| | | roleLhModel.Create(heroInfo.SkinID, lhScale, motionName: "", isLh: true).Forget(); |
| | | roleLhModel.transform.localScale = new Vector3(lhScale, lhScale, lhScale); |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | lvText.text = data.LV.ToString(); |
| | | fightPointText.text = UIHelper.ReplaceLargeArtNum(data.FightPower); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(data.PlayerID, data.Face, data.FacePic)); |
| | | officialTitleCell.InitUI(data.RealmLV, data.TitleID); |
| | | officialTitleCell.InitUI(data.RealmLV, data.TitleID).Forget(); |
| | | |
| | | yesButton.SetListener(() => |
| | | { |
| | |
| | | // [Author]: 玩个游戏
|
| | | // [ Date ]: Wednesday, September 26, 2018
|
| | | //--------------------------------------------------------
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | | AvatarHelper.TryViewOtherPlayerInfo(playerID);
|
| | | });
|
| | | });
|
| | | officialTitleCell.InitUI(playerData.RealmLV, playerData.TitleID);
|
| | | officialTitleCell.InitUI(playerData.RealmLV, playerData.TitleID).Forget();
|
| | | nameText.text = playerData.Name;
|
| | |
|
| | | lvText.text = playerData.LV.ToString();
|
| | |
| | | UIManager.Instance.OpenWindowAsync<GuildBossAwardWin>().Forget(); |
| | | }); |
| | | |
| | | bossModel.Create(GuildBossManager.Instance.bossSkinID, 1, motionName: "chuxian"); |
| | | bossModel.Create(GuildBossManager.Instance.bossSkinID, 1, motionName: "chuxian").Forget(); |
| | | |
| | | } |
| | | |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | nameText.text = playerInfo.Name; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget(); |
| | | lvText.text = playerInfo.LV.ToString(); |
| | | |
| | | |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | nameText.text = playerInfo.Name; |
| | | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel(0, playerInfo.Face, playerInfo.FacePic)); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID); |
| | | titleCell.InitUI(playerInfo.RealmLV, playerInfo.TitleID).Forget(); |
| | | lvText.text = playerInfo.LV.ToString(); |
| | | if (playerInfo.FmLV > 0) |
| | | { |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | var leaderInfo = OtherPlayerDetailManager.Instance.GetViewPlayerData(playerID); |
| | | |
| | | leaderAvatar.InitUI(AvatarHelper.GetAvatarModel(0, leaderInfo.Face, leaderInfo.FacePic)); |
| | | leaderTitle.InitUI(leaderInfo.RealmLV, leaderInfo.TitleID); |
| | | leaderTitle.InitUI(leaderInfo.RealmLV, leaderInfo.TitleID).Forget(); |
| | | leaderLevelText.text = leaderInfo.LV.ToString(); |
| | | guildJobText.text = RichTextMsgReplaceConfig.GetRichReplace("FAMILY", 3); |
| | | leaderFightPowerText.text = UIHelper.ReplaceLargeArtNum(leaderInfo.FightPower); |
| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using Cysharp.Threading.Tasks; |
| | | using Cysharp.Threading.Tasks;
|
| | |
|
| | |
|
| | | public partial class HappyXBModel : GameSystemManager<HappyXBModel>
|
| | |
| | | {
|
| | | if (!UIManager.Instance.IsOpened<HeroDebutCallResultWin>())
|
| | | {
|
| | | UIManager.Instance.OpenWindow<HeroDebutCallResultWin>();
|
| | | UIManager.Instance.OpenWindowAsync<HeroDebutCallResultWin>().Forget();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | public void DisplayHero(HeroConfig heroConfig) |
| | | { |
| | | heroModel.SetActive(true); |
| | | heroModel.Create(heroConfig.SkinIDList[0], 0.7f); |
| | | heroModel.Create(heroConfig.SkinIDList[0], 0.7f).Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | var hero = HeroConfig.Get(heroID); |
| | | roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true); |
| | | roleLHModel.Create(hero.SkinIDList[0], 1, motionName: "", isLh: true).Forget(); |
| | | qualityImg.SetSprite("HeroCallQuality" + hero.Quality); |
| | | newMarkLHImg.SetActive(HeroUIManager.Instance.IsNewHero(heroID)); |
| | | showLHResultCell.Display(heroID, 0, true); |
| | |
| | | bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(hero.SkinIDList[0], hero.Country)); |
| | | if (IsWishHero(heroID)) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroCallXYFinishWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroCallXYFinishWin>().Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | if (IsWishHero(heroID)) |
| | | { |
| | | // 抽到了心愿武将,打开完成特效界面 |
| | | UIManager.Instance.OpenWindow<HeroCallXYFinishWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroCallXYFinishWin>().Forget(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | private const int MAX_CONCURRENT_LOADS = 4; |
| | | private static int currentLoadingCount = 0; |
| | | private static readonly object loadLock = new object(); |
| | | private static int initializationOrder = 0; // 用于分帧延迟的序号 |
| | | private static int lastInitFrame = -1; // 上一次执行Initialize的帧号,用于确保每帧最多1次 |
| | | private static GameObjectPoolManager.GameObjectPool cachedUIHeroPool; // 缓存UIHero预制体池 |
| | | |
| | | public Action onComplete; |
| | | public async UniTask Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false) |
| | |
| | | { |
| | | //图片替换 |
| | | lhImg.SetTexture2DPNG(skinConfig.Tachie); |
| | | lhImg.SetNativeSize(); |
| | | if (skeletonGraphic != null) |
| | | { |
| | | skeletonGraphic.enabled = false; |
| | | } |
| | | lhImg.enabled = true; |
| | | lhImg.raycastTarget = false; |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | onComplete = _onComplete; |
| | | pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero")); |
| | | if (cachedUIHeroPool == null) |
| | | cachedUIHeroPool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero")); |
| | | pool = cachedUIHeroPool; |
| | | if (this == null) return; |
| | | |
| | | if (!transform.gameObject.activeSelf) |
| | |
| | | } |
| | | |
| | | skeletonGraphic.enabled = true; |
| | | // 注册到SpineUpdateManager,批量更新减少跨语言调用开销 |
| | | SpineUpdateManager.Instance.Register(skeletonGraphic); |
| | | // 不可见时完全停止更新,滚动列表场景收益很大 |
| | | skeletonGraphic.updateWhenInvisible = Spine.Unity.UpdateMode.Nothing; |
| | | SetMaterialNone(); |
| | | |
| | | spineAnimationState = skeletonGraphic.AnimationState; |
| | |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | spineAnimationState.Complete += OnAnimationComplete; |
| | | |
| | | #if UNITY_EIDTOR |
| | | #if UNITY_EDITOR |
| | | await UniTask.Delay(100); |
| | | if (skeletonGraphic != null && skeletonGraphic.material != null) |
| | | { |
| | |
| | | { |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | } |
| | | // 从SpineUpdateManager中移除 |
| | | if (skeletonGraphic != null) |
| | | SpineUpdateManager.Instance.Unregister(skeletonGraphic); |
| | | if (pool != null) |
| | | pool.Release(instanceGO); |
| | | skeletonGraphic = null; |
| | |
| | | Debug.LogWarning("skeletonGraphic is null, cannot set material to none"); |
| | | return; |
| | | } |
| | | skeletonGraphic.material = null; |
| | | skeletonGraphic.material = GetDefaultSpineMaterial(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取默认的 Spine 渲染材质。 |
| | | /// 对于包含非 Normal 混合模式(Additive/Multiply/Screen)插槽的角色, |
| | | /// 返回 atlas 原始材质(Blend One OneMinusSrcAlpha),保证 PMA 混合正确; |
| | | /// 对于普通角色,返回 null(使用 Canvas 默认材质,行为不变)。 |
| | | /// </summary> |
| | | private Material GetDefaultSpineMaterial() |
| | | { |
| | | if (skeletonGraphic == null || skeletonGraphic.Skeleton == null) |
| | | return null; |
| | | |
| | | var slotsData = skeletonGraphic.Skeleton.Data.Slots; |
| | | for (int i = 0; i < slotsData.Count; i++) |
| | | { |
| | | if (slotsData.Items[i].BlendMode != Spine.BlendMode.Normal) |
| | | { |
| | | // 存在非 Normal 混合模式的插槽,必须使用 Spine 材质 |
| | | // Canvas 默认材质的 Blend SrcAlpha OneMinusSrcAlpha 会导致 |
| | | // PMA Additive 效果(vertex alpha=0)完全消失 |
| | | var dataAsset = skeletonGraphic.skeletonDataAsset; |
| | | if (dataAsset != null && dataAsset.atlasAssets.Length > 0) |
| | | return dataAsset.atlasAssets[0].PrimaryMaterial; |
| | | break; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | // 异步创建instanceGO和加载资源(真正的异步,不阻塞) |
| | | await CreateInstanceAndLoadAssetsAsync(skinConfig, isLh, cancellationToken); |
| | | |
| | | // 获取当前序号用于分帧延迟 |
| | | int myOrder; |
| | | lock (loadLock) |
| | | { |
| | | myOrder = initializationOrder++; |
| | | } |
| | | |
| | | // 再次检查是否已被取消 |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | |
| | | // 在 skeletonGraphic.Initialize() 前进行分帧延迟 |
| | | // 根据 MAX_CONCURRENT_LOADS 调整延迟,避免所有对象同时执行 Initialize |
| | | int delayFrames = (myOrder % MAX_CONCURRENT_LOADS); |
| | | if (delayFrames > 0) |
| | | // 确保每帧最多执行1次Initialize(true),避免同帧大量骨骼解析导致卡顿 |
| | | while (Time.frameCount == lastInitFrame) |
| | | { |
| | | for (int i = 0; i < delayFrames; i++) |
| | | { |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | await UniTask.NextFrame(cancellationToken); |
| | | } |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | await UniTask.NextFrame(cancellationToken); |
| | | } |
| | | |
| | | // 再次检查是否已被取消(可能在延迟期间被取消) |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | lastInitFrame = Time.frameCount; |
| | | |
| | | if (skeletonGraphic == null || skeletonGraphic.skeletonDataAsset == null) |
| | | { |
| | |
| | | |
| | | skeletonGraphic.initialSkinName = skinConfig.InitialSkinName; |
| | | skeletonGraphic.Initialize(true); |
| | | Debug.Log($"[UIHeroController] Spine Initialize完成, skeleton valid: {skeletonGraphic.IsValid}, enabled: {skeletonGraphic.enabled}"); |
| | | |
| | | // 初始化完成后设置皮肤 |
| | | if (!string.IsNullOrEmpty(skinConfig.InitialSkinName)) |
| | |
| | | // 初始化完成后才显示模型 |
| | | skeletonGraphic.enabled = pendingEnabled; |
| | | |
| | | // 注册到SpineUpdateManager,批量更新减少跨语言调用开销 |
| | | SpineUpdateManager.Instance.Register(skeletonGraphic); |
| | | // 不可见时完全停止更新,滚动列表场景收益很大 |
| | | skeletonGraphic.updateWhenInvisible = Spine.Unity.UpdateMode.Nothing; |
| | | |
| | | if (pendingGray) |
| | | { |
| | | skeletonGraphic.material = MaterialUtility.GetDefaultSpriteGrayMaterial(); |
| | | } |
| | | else |
| | | { |
| | | skeletonGraphic.material = null; |
| | | skeletonGraphic.material = GetDefaultSpineMaterial(); |
| | | } |
| | | |
| | | // 检查是否有待设置的速度,如果有则设置 |
| | |
| | | } |
| | | catch (System.Exception e) |
| | | { |
| | | Debug.LogError($"英雄初始化异常: {e.Message}"); |
| | | Debug.LogError($"英雄初始化异常: {e.Message}\n{e.StackTrace}"); |
| | | isInitializing = false; |
| | | } |
| | | finally |
| | |
| | | // 检查是否已被取消 |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | |
| | | // 创建pool和instanceGO |
| | | pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHero")); |
| | | // 创建pool和instanceGO(使用缓存避免重复加载预制体) |
| | | if (cachedUIHeroPool == null) |
| | | cachedUIHeroPool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHero")); |
| | | pool = cachedUIHeroPool; |
| | | |
| | | if (instanceGO == null) |
| | | { |
| | |
| | | |
| | | // 真正的异步加载资源 - 不阻塞主线程 |
| | | string assetName = isLh ? skinConfig.Tachie : skinConfig.SpineRes; |
| | | Debug.Log($"[UIHeroController] 开始加载spine 资源: {assetName}"); |
| | | SkeletonDataAsset loadedAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("Hero/SpineRes/", assetName); |
| | | |
| | | // 再次检查是否已被取消 |
| | |
| | | if (loadedAsset != null) |
| | | { |
| | | skeletonGraphic.skeletonDataAsset = loadedAsset; |
| | | Debug.Log($"[UIHeroController] Spine资源加载成功: {assetName}, atlas count: {loadedAsset.atlasAssets?.Length}"); |
| | | } |
| | | else |
| | | { |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutCallChangeWin : 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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | HeroDebutCallRateHeroWin.worldPos = libButton.transform.position; |
| | | HeroDebutCallRateHeroWin.dataList = GetLibItemList(libID, list); |
| | | HeroDebutCallRateHeroWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindow<HeroDebutCallRateHeroWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroDebutCallRateHeroWin>().Forget(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroDebutCallResultWin : UIBase |
| | | { |
| | |
| | | |
| | | if (!UIManager.Instance.IsOpenedInList<HeroShowLHWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroShowLHWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroShowLHWin>().Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | |
| | | protected override void InitComponent() |
| | | { |
| | | closeButton.SetListener(CloseWindow); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutShopWin>()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutGiftWin>()); |
| | | changeHeroButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallChangeWin>()); |
| | | rankButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutRankWin>()); |
| | | rateButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallRateWin>()); |
| | | historyButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallHistoryWin>()); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutShopWin>().Forget()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutGiftWin>().Forget()); |
| | | changeHeroButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallChangeWin>().Forget()); |
| | | rankButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutRankWin>().Forget()); |
| | | rateButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallRateWin>().Forget()); |
| | | historyButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallHistoryWin>().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(artConfig.MainBgImage); |
| | | |
| | | 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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | public class HeroDebutCell : MonoBehaviour |
| | | { |
| | |
| | | { |
| | | clickButton.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroDebutWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroDebutWin>().Forget(); |
| | | }); |
| | | |
| | | |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutCheckInWin : UIBase |
| | |
| | | } |
| | | } |
| | | |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true); |
| | | rolelhShow.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | OnSecondEvent(); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutGiftCell : 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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroDebutPopWin>(); |
| | | if (!UIManager.Instance.IsOpened<HeroDebutWin>()) |
| | | UIManager.Instance.OpenWindow<HeroDebutWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroDebutWin>().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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | 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)); |
| | | viewPlayerId = (int)rankData.id; |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | 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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class HeroDebutShopCell : MonoBehaviour |
| | |
| | | else |
| | | { |
| | | StoreModel.Instance.buyShopID = shopID; |
| | | UIManager.Instance.OpenWindow<BuyItemWin>(); |
| | | UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | 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(skinArtConfig.AwardBGImage); |
| | | 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 Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class HeroDebutStarUpWin : UIBase |
| | |
| | | goCallButton.SetListener(() => |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroDebutStarUpWin>(); |
| | | UIManager.Instance.OpenWindow<HeroDebutCallWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroDebutCallWin>().Forget(); |
| | | }); |
| | | goInfoButton.SetListener(() => |
| | | { |
| | | if (heroConfig == null) return; |
| | | UIManager.Instance.CloseWindow<HeroDebutStarUpWin>(); |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | protected override void InitComponent() |
| | | { |
| | | closeButton.SetListener(() => UIManager.Instance.CloseWindow<HeroDebutWin>()); |
| | | checkInButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCheckInWin>()); |
| | | starUpButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutStarUpWin>()); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutShopWin>()); |
| | | skinButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutSkinWin>()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutGiftWin>()); |
| | | callButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallWin>()); |
| | | checkInButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCheckInWin>().Forget()); |
| | | starUpButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutStarUpWin>().Forget()); |
| | | shopButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutShopWin>().Forget()); |
| | | skinButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutSkinWin>().Forget()); |
| | | giftButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutGiftWin>().Forget()); |
| | | callButton.SetListener(() => UIManager.Instance.OpenWindowAsync<HeroDebutCallWin>().Forget()); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | var skinArtConfig = ActHeroAppearSkinArtConfig.Get(artConfig.MainSkinID); |
| | | if (skinArtConfig == null) return; |
| | | |
| | | uiHeroController.Create(skinID, modleSize); |
| | | uiHeroController.Create(skinID, 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(); |
| | | |
| | | callRedImage.SetActive(!manager.IsShopVisitedToday || manager.HasGiftCanHave()); |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | uiHeroController.Create(heroSkinConfig.SkinID, lhSize); |
| | | uiHeroController.Create(heroSkinConfig.SkinID, lhSize).Forget(); |
| | | bool isHasHero = HeroManager.Instance.HasHero(heroId); |
| | | if (isHasHero) |
| | | { |
| | |
| | | } |
| | | HeroInfo heroInfo = nowMaxStarHeroDict[heroId]; |
| | | HeroUIManager.Instance.selectHeroGuid = heroInfo.itemHero.guid; |
| | | UIManager.Instance.OpenWindow<HeroTrainBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>().Forget(); |
| | | } |
| | | else |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroId; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class HeroBestBaseWin : OneLevelWin |
| | | { |
| | | |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | protected override async void OpenSubUIByTabIndex() |
| | | { |
| | | ShowSkinBtn(); |
| | | switch (functionOrder) |
| | | { |
| | | case 0: |
| | | |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroBestWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroBestWin>(); |
| | | |
| | | if (GetSortingOrder() < currentSubUI.GetSortingOrder()) |
| | | { |
| | |
| | | |
| | | case 1: |
| | | //皮肤 图鉴界面打开的传1 |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroSkinWin>(1); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroSkinWin>(1); |
| | | |
| | | if (GetSortingOrder() < currentSubUI.GetSortingOrder()) |
| | | { |
| | |
| | | heroConfig = HeroConfig.Get(HeroUIManager.Instance.selectForPreviewHeroID); |
| | | int skinID = heroConfig.SkinIDList[0]; |
| | | bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(skinID, heroConfig.Country)); |
| | | roleLhModel.Create(skinID, 1, motionName: "", isLh: true); |
| | | roleXsModel.Create(skinID, 1); |
| | | roleLhModel.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | roleXsModel.Create(skinID, 1).Forget(); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | jobPosNameText.text = HeroUIManager.Instance.GetJobName(heroConfig.Class); |
| | | descText.text = heroConfig.Desc; |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | |
| | | var heroConfig = hero.heroConfig; |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale); |
| | | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale).Forget(); |
| | | onStateImg.SetActive(hero.IsInTeamByTeamType(BattlePreSetType.Story)); |
| | | |
| | | int teamPos = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetPosition(hero.itemHero.guid); |
| | |
| | | heroCardBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectHeroGuid = guid; |
| | | UIManager.Instance.OpenWindow<HeroTrainBaseWin>(funcState == 3 ? 1 : 0); |
| | | UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>(funcState == 3 ? 1 : 0).Forget(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | |
| | | public class HeroCollectionCardCell : MonoBehaviour |
| | | { |
| | |
| | | [SerializeField] GameObject unGetObj; |
| | | [SerializeField] GameObject activeObj; // 可激活带流光效果材质 |
| | | [SerializeField] GameObject actLimitObj; // 活动限定 |
| | | |
| | | private CancellationTokenSource displayCts; |
| | | public void Display(int index, int quality) |
| | | { |
| | | var heroID = HeroUIManager.Instance.heroCollectDict[quality][index]; |
| | |
| | | |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale); |
| | | |
| | | // 去抖加载:快速滚动时延迟2帧再创建Spine,如果卡片在延迟内被复用则取消旧加载 |
| | | displayCts?.Cancel(); |
| | | displayCts?.Dispose(); |
| | | displayCts = new CancellationTokenSource(); |
| | | DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, displayCts.Token).Forget(); |
| | | |
| | | redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID; |
| | | |
| | |
| | | var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality); |
| | | if (state == 1 || state == 3 || state == 4) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget(); |
| | | } |
| | | else |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | }); |
| | | |
| | |
| | | // UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); |
| | | // }); |
| | | } |
| | | |
| | | private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, CancellationToken ct) |
| | | { |
| | | // 延迟2帧,快速滚动时卡片会被复用,CTS取消后不会继续创建Spine |
| | | await UniTask.NextFrame(ct); |
| | | await UniTask.NextFrame(ct); |
| | | heroModel.Create(skinID, scale).Forget(); |
| | | } |
| | | |
| | | void OnDestroy() |
| | | { |
| | | displayCts?.Cancel(); |
| | | displayCts?.Dispose(); |
| | | } |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | |
| | | SinglePack singlePack; |
| | | |
| | | protected override void InitComponent() |
| | | protected override async void InitComponent() |
| | | { |
| | | attrBtn.AddListener(() => |
| | | { |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | SmallTipWin.showText = Language.Get("herocard6"); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget(); |
| | | }); |
| | | |
| | | heroPackBtn.AddListener(() => |
| | |
| | | HeroUIManager.Instance.QueryUnLockHeroPack(); |
| | | }); |
| | | |
| | | fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour); |
| | | fiterManager = await HeroSelectBehaviour.Create(heroSelectBehaviour); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | |
| | | void Display() |
| | | { |
| | | fiterManager.Display(0, SelectJobCountry); |
| | | fiterManager?.Display(0, SelectJobCountry); |
| | | |
| | | // CreateScroller(); |
| | | // RefreshTotalAttr(); |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | var heroConfig = hero.heroConfig; |
| | | |
| | | taiziBG.SetSprite("herodz" + heroConfig.Quality); |
| | | heroModel.Create(hero.SkinID, heroConfig.UIScale); |
| | | heroModel.Create(hero.SkinID, heroConfig.UIScale).Forget(); |
| | | nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel); |
| | | nameText.color = UIHelper.GetUIColorByFunc(heroConfig.Quality); |
| | | } |
| | |
| | | lvText.text = Language.Get("L1099", hero.heroLevel); |
| | | var heroConfig = hero.heroConfig; |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale); |
| | | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale).Forget(); |
| | | |
| | | nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel); |
| | | posCircleImg.SetSprite("heroposcircle" + heroConfig.Quality); |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | public class HeroSkinRoleCell : MonoBehaviour
|
| | |
| | | public void Display(HeroConfig heroConfig, int index)
|
| | | {
|
| | | selectImg.SetActive(HeroSkinChooseWin.selectIndex == index);
|
| | | heroModel.Create(heroConfig.SkinIDList[index], heroConfig.UIScale);
|
| | | heroModel.Create(heroConfig.SkinIDList[index], heroConfig.UIScale).Forget();
|
| | | selectBtn.AddListener(() =>
|
| | | {
|
| | | var ui = UIManager.Instance.GetUI<HeroSkinChooseWin>();
|
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | }); |
| | | shopBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(1); |
| | | UIManager.Instance.OpenWindowAsync<StoreBaseWin>(1).Forget(); |
| | | }); |
| | | unlockBtn.AddListener(() => |
| | | { |
| | |
| | | |
| | | changeClothBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroSkinChooseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroSkinChooseWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | skinID = heroConfig.SkinIDList[tmpIndex]; |
| | | bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(skinID, heroConfig.Country)); |
| | | roleLhModel.Create(skinID, 1, motionName: "", isLh: true); |
| | | roleXsModel.Create(skinID, 1); |
| | | roleLhModel.Create(skinID, 1, motionName: "", isLh: true).Forget(); |
| | | roleXsModel.Create(skinID, 1).Forget(); |
| | | HeroUIManager.Instance.PlayerLHSound(skinID); |
| | | nameText.text = heroConfig.Name; |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | // 武将功能界面 |
| | | public class HeroTrainBaseWin : OneLevelWin |
| | | { |
| | | |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | protected override async void OpenSubUIByTabIndex() |
| | | { |
| | | ShowSkinBtn(); |
| | | switch (functionOrder) |
| | |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroTrainWin>(); |
| | | } |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroTrainWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroTrainWin>(); |
| | | |
| | | if (GetSortingOrder() < currentSubUI.GetSortingOrder()) |
| | | { |
| | |
| | | { |
| | | UIManager.Instance.CloseWindow<HeroTrainWin>(); |
| | | } |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroTrainWin>(1); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroTrainWin>(1); |
| | | |
| | | if (GetSortingOrder() < currentSubUI.GetSortingOrder()) |
| | | { |
| | |
| | | break; |
| | | case 2: |
| | | //皮肤 |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroSkinWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<HeroSkinWin>(); |
| | | |
| | | if (GetSortingOrder() < currentSubUI.GetSortingOrder()) |
| | | { |
| | |
| | | if (functionOrder == 0) |
| | | { |
| | | DisplayTrainOrBreak(hero); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | else if (functionOrder == 1) |
| | | { |
| | |
| | | public void Display() |
| | | { |
| | | bgTexture.SetTexture2D(HeroUIManager.Instance.GetBGName(hero.SkinID, hero.heroConfig.Country)); |
| | | roleLhModel.Create(hero.SkinID, 1, motionName: "", isLh: true); |
| | | roleLhModel.Create(hero.SkinID, 1, motionName: "", isLh: true).Forget(); |
| | | |
| | | roleXsModel.Create(hero.SkinID, 1); |
| | | roleXsModel.Create(hero.SkinID, 1).Forget(); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class)); |
| | | jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class); |
| | | descText.text = hero.heroConfig.Desc; |
| | |
| | | ShowDeleteTip(); |
| | | |
| | | HeroUIManager.Instance.RemoveNewHero(hero.heroId); |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using Spine.Unity; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
| | | |
| | | // 创建坐骑 :id为0空坐骑也有配置 |
| | | //_skinID 坐骑的皮肤ID |
| | | public void Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle") |
| | | public async UniTask Create(int _skinID, int _heroSkinID = 0, float scale = 1f, Action _onComplete = null, string motionName = "idle") |
| | | { |
| | | pool = GameObjectPoolManager.Instance.GetPool(UILoader.LoadPrefab("UIHorse")); |
| | | pool = GameObjectPoolManager.Instance.GetPool(await UILoader.LoadPrefabAsync("UIHorse")); |
| | | if (this == null) return; |
| | | if (instanceGO == null) |
| | | { |
| | | instanceGO = pool.Request(); |
| | |
| | | { |
| | | skeletonGraphic.enabled = false; |
| | | } |
| | | CreateHero(_heroSkinID, scale); |
| | | await CreateHero(_heroSkinID, scale); |
| | | //避免重复创建 |
| | | return; |
| | | } |
| | |
| | | //卸下坐骑的情况 |
| | | skeletonGraphic.enabled = false; |
| | | spineAnimationState = null; |
| | | CreateHero(_heroSkinID, scale); |
| | | await CreateHero(_heroSkinID, scale); |
| | | return; |
| | | } |
| | | |
| | | skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine); |
| | | skeletonGraphic.skeletonDataAsset = await ResManager.Instance.LoadAssetAsync<SkeletonDataAsset>("UIEffect/Spine/Horse", skinConfig.Spine); |
| | | if (this == null) return; |
| | | if (skeletonGraphic.skeletonDataAsset == null) |
| | | { |
| | | |
| | |
| | | if (motionName == "") |
| | | motionName = GetFistSpineAnim(); |
| | | PlayAnimation(motionName, true); |
| | | CreateHero(_heroSkinID, scale); |
| | | await CreateHero(_heroSkinID, scale); |
| | | if (this == null) return; |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | spineAnimationState.Complete += OnAnimationComplete; |
| | | } |
| | | |
| | | public void CreateHero(int heroSkinID, float _scale) |
| | | public async UniTask CreateHero(int heroSkinID, float _scale) |
| | | { |
| | | if (instanceGO == null) |
| | | { |
| | |
| | | return; |
| | | } |
| | | hero.SetActive(true); |
| | | hero.Create(heroSkinID, _scale); |
| | | await hero.Create(heroSkinID, _scale); |
| | | if (this == null) return; |
| | | |
| | | // 确保 BoneFollowerGraphic 引用到正确的坐骑 SkeletonGraphic |
| | | var boneFollower = hero.GetComponent<BoneFollowerGraphic>(); |
| | |
| | | leaderPathPointArr[leaderPathPointArr.Length - 1].transform.localPosition; |
| | | OnComplete = _OnComplete; |
| | | this.SetActive(true); |
| | | leader.Create(GoldRushManager.Instance.GetWorkerSkinID(tendID, index), leaderScale); |
| | | leader.Create(GoldRushManager.Instance.GetWorkerSkinID(tendID, index), leaderScale).Forget(); |
| | | Go(waitTime, isBack).Forget(); |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | { |
| | | heroModels[i].SetActive(true); |
| | | var skinID = GoldRushManager.Instance.GetWorkerSkinID(campID, i); |
| | | heroModels[i].Create(skinID, 0.6f, motionName:"run"); |
| | | heroModels[i].Create(skinID, 0.6f, motionName:"run").Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | { |
| | | var config = GoldRushWorkerConfig.Get(workerID); |
| | | nameText.text = config.Name; |
| | | heroModel.Create(config.SkinID, 0.8f); |
| | | heroModel.Create(config.SkinID, 0.8f).Forget(); |
| | | var lockState = GoldRushManager.Instance.GetWorkerLockState(workerID); |
| | | if (lockState == 0) |
| | | { |
| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine.UI; |
| | | using System.Linq; |
| | | using LitJson; |
| | |
| | | if (count < rechargeCount.totalCount) |
| | | { |
| | | lastTotalBuyCountDict[type] = rechargeCount.totalCount; |
| | | UIManager.Instance.OpenWindow<PrivilegeActiveCardWin>(type); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeActiveCardWin>(type).Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | |
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | | if (StoreModel.Instance.CheckPopBuyWin(shopID))
|
| | | {
|
| | | StoreModel.Instance.buyShopID = shopID;
|
| | | UIManager.Instance.OpenWindow<BuyItemWin>();
|
| | | UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
|
| | | }
|
| | | break;
|
| | | case 2:
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(2);
|
| | | UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
|
| | | }
|
| | | break;
|
| | | case 3:
|
| | |
| | | }
|
| | | if (!UIManager.Instance.IsOpened<TimingGiftWin>())
|
| | | {
|
| | | UIManager.Instance.OpenWindow<TimingGiftWin>(int.Parse(way.CustomValue));
|
| | | UIManager.Instance.OpenWindowAsync<TimingGiftWin>(int.Parse(way.CustomValue)).Forget();
|
| | | }
|
| | | break;
|
| | | case 0:
|
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //拥有的货币:数量显示,点击按钮打开对应获取界面 |
| | |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(2); |
| | | UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(2); |
| | | UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | languageStartDict = JsonMapper.ToObject<Dictionary<string, string[]>>(config.Numerical2); |
| | | languageDict = JsonMapper.ToObject<Dictionary<string, string>>(config.Numerical3); |
| | | |
| | | if (languageStartDict == null || !languageStartDict.ContainsKey(VersionConfigEx.Get().appId)) |
| | | if (languageStartDict == null || !languageStartDict.ContainsKey(VersionConfigEx.config.appId)) |
| | | { |
| | | //检查有没多语言 |
| | | Debug.Log("当前渠道未开启多语言:" + VersionConfigEx.Get().appId); |
| | | Debug.Log("当前渠道未开启多语言:" + VersionConfigEx.config.appId); |
| | | return; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | var defaultCfg = languageStartDict[VersionConfigEx.Get().appId]; |
| | | var defaultCfg = languageStartDict[VersionConfigEx.config.appId]; |
| | | string languageMark; |
| | | if (defaultCfg[1] == "0") |
| | | { |
| | |
| | | { |
| | | return ""; |
| | | } |
| | | if (!languageStartDict.ContainsKey(VersionConfigEx.Get().appId)) |
| | | if (!languageStartDict.ContainsKey(VersionConfigEx.config.appId)) |
| | | { |
| | | return ""; |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class LineupRecommendItem : MonoBehaviour |
| | |
| | | if (!manager.TryGetHeroSkinConfig(heroID, out HeroSkinConfig heroSkinConfig)) |
| | | return; |
| | | |
| | | var sprite = UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon); |
| | | if (sprite == null) |
| | | { |
| | | imgHeroHead.SetSprite("herohead_default"); |
| | | } |
| | | else |
| | | { |
| | | imgHeroHead.overrideSprite = sprite; |
| | | } |
| | | UILoader.LoadSprite("HeroHead", heroSkinConfig.SquareIcon, imgHeroHead, "herohead_default").Forget(); |
| | | |
| | | imgSquareIcon.SetSprite("heroheadBG" + heroConfig.Quality); |
| | | imgCountry.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | |
| | | else |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroConfig.HeroID; |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | }); |
| | | |
| | |
| | | { |
| | | if (isOk) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL无本地文件系统,仅清理PlayerPrefs |
| | | LocalSave.DeleteAll(); |
| | | #else |
| | | try |
| | | { |
| | | LocalSave.DeleteAll(); |
| | |
| | | { |
| | | Debug.LogError("Failed to clean persistent data: " + e.Message); |
| | | } |
| | | finally |
| | | #endif |
| | | Clock.AlarmAfter(0.1f, () => |
| | | { |
| | | Clock.AlarmAfter(0.1f, () => |
| | | { |
| | | Application.Quit(); |
| | | }); |
| | | Debug.Log("Persistent data cleaned."); |
| | | } |
| | | |
| | | Application.Quit(); |
| | | }); |
| | | Debug.Log("Persistent data cleaned."); |
| | | } |
| | | }); |
| | | |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | qualityBG.SetSprite("herocBG" + heroConfig.Quality); |
| | | |
| | | var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon); |
| | | if (sprite == null) |
| | | { |
| | | // 内网未配置时 |
| | | heroIcon.SetSprite("herohead_big_default"); |
| | | } |
| | | else |
| | | { |
| | | heroIcon.overrideSprite = sprite; |
| | | } |
| | | UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon, heroIcon, "herohead_big_default").Forget(); |
| | | |
| | | if (star == 0) |
| | | { |
| | |
| | | { |
| | | HeroUIManager.Instance.SortHeroList(); |
| | | HeroUIManager.Instance.selectHeroGuid = guid; |
| | | UIManager.Instance.OpenWindow<HeroTrainBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroTrainBaseWin>().Forget(); |
| | | } |
| | | |
| | | void ClickEmpty() |
| | |
| | | } |
| | | return; |
| | | } |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget(); |
| | | } |
| | | void OnSkillCast(bool isfighting) |
| | | { |
| | |
| | | }); |
| | | osBeautyMMBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<OSBeautyMMBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<OSBeautyMMBaseWin>().Forget(); |
| | | }); |
| | | osHeroTrainBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<OSHeroTrainBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<OSHeroTrainBaseWin>().Forget(); |
| | | }); |
| | | osMinggeBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<OSMinggeBaseWin>(); |
| | | UIManager.Instance.OpenWindowAsync<OSMinggeBaseWin>().Forget(); |
| | | }); |
| | | DailySpecialsBtns.AddListener(() => |
| | | { |
| | |
| | | playerNameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | powerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower); |
| | | |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | } |
| | | |
| | | void PlayerDataRefresh(PlayerDataType type) |
| | |
| | | powerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower); |
| | | break; |
| | | case PlayerDataType.RealmLevel: |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | break; |
| | | case PlayerDataType.Face: |
| | | case PlayerDataType.FacePic: |
| | |
| | | hammerText.text = UIHelper.GetMoneyCnt(41).ToString(); |
| | | break; |
| | | case PlayerDataType.ExAttr3: |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | break; |
| | | } |
| | | |
| | |
| | | }); |
| | | reviewBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<GoodReviewWin>(); |
| | | UIManager.Instance.OpenWindowAsync<GoodReviewWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | rankBtn.AddListener(() => |
| | | { |
| | | |
| | | UIManager.Instance.OpenWindow<PlayerRankWin>(0); |
| | | UIManager.Instance.OpenWindowAsync<PlayerRankWin>(0).Forget(); |
| | | |
| | | }); |
| | | |
| | |
| | | |
| | | heroRoadBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<DayMissionBaseWin>(2); |
| | | UIManager.Instance.OpenWindowAsync<DayMissionBaseWin>(2).Forget(); |
| | | }); |
| | | |
| | | funPresetBtn.AddListener(()=> |
| | |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat",SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description) ; |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | SmallTipWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget(); |
| | | }); |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | bossModel.Create(npcConfig.SkinID, npcConfig.ModelScale); |
| | | bossModel.Create(npcConfig.SkinID, npcConfig.ModelScale).Forget(); |
| | | |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(levelConfig.FightPower); |
| | | |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public abstract class OSActivityBaseWin : FunctionsBaseWin |
| | | { |
| | |
| | | protected abstract int GetRankType(); |
| | | |
| | | // 由子类实现:实例化对应的三个子窗口 |
| | | protected abstract UIBase GetRankWin(); |
| | | protected abstract UIBase GetAwardWin(); |
| | | protected abstract UIBase GetGiftWin(); |
| | | protected abstract UniTask<UIBase> GetRankWin(); |
| | | protected abstract UniTask<UIBase> GetAwardWin(); |
| | | protected abstract UniTask<UIBase> GetGiftWin(); |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | protected override async void OpenSubUIByTabIndex() |
| | | { |
| | | switch (functionOrder) |
| | | { |
| | | case 0: |
| | | currentSubUI = GetRankWin(); |
| | | currentSubUI = await GetRankWin(); |
| | | break; |
| | | case 1: |
| | | currentSubUI = GetAwardWin(); |
| | | currentSubUI = await GetAwardWin(); |
| | | break; |
| | | case 2: |
| | | // 如果后续有活动没有礼包页签,只需在子类里返回 null 或不调用即可 |
| | | currentSubUI = GetGiftWin(); |
| | | currentSubUI = await GetGiftWin(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | // 开服活动-红颜冲刺活动 |
| | | public class OSBeautyMMBaseWin : OSActivityBaseWin |
| | |
| | | // 红颜冲榜对应的 RankType 为 8 |
| | | protected override int GetRankType() => 8; |
| | | |
| | | protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMWin>(8); |
| | | protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMWin>(8); |
| | | |
| | | protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMAwardWin>(); |
| | | protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMAwardWin>(); |
| | | |
| | | protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankBeautyMMGiftWin>(); |
| | | protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankBeautyMMGiftWin>(); |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto5"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto7"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | ////开服活动-武将招募活动 |
| | |
| | | } |
| | | |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | protected override async void OpenSubUIByTabIndex() |
| | | { |
| | | switch (functionOrder) |
| | | { |
| | | case 0: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(4); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(4); |
| | | break; |
| | | case 1: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallAwardWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallAwardWin>(); |
| | | break; |
| | | case 2: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSRankHeroCallGiftWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankHeroCallGiftWin>(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | // 开服活动-武将冲榜主界面 |
| | | public class OSHeroTrainBaseWin : OSActivityBaseWin |
| | | { |
| | | protected override int GetRankType() => 7; |
| | | |
| | | protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainWin>(7); |
| | | protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainWin>(7); |
| | | |
| | | protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainAwardWin>(); |
| | | protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainAwardWin>(); |
| | | |
| | | protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankHeroTrainGiftWin>(); |
| | | protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankHeroTrainGiftWin>(); |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | ////开服活动-主线关卡活动 |
| | |
| | | } |
| | | } |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | protected override async void OpenSubUIByTabIndex() |
| | | { |
| | | switch (functionOrder) |
| | | { |
| | | case 0: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSRankWin>(3); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankWin>(3); |
| | | break; |
| | | case 1: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSRankMainLeveAwardWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<OSRankMainLeveAwardWin>(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | // 开服活动-命格冲榜主界面 |
| | | public class OSMinggeBaseWin : OSActivityBaseWin |
| | | { |
| | | protected override int GetRankType() => 9; |
| | | |
| | | protected override UIBase GetRankWin() => UIManager.Instance.OpenWindow<OSRankMinggeWin>(9); |
| | | protected override async UniTask<UIBase> GetRankWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeWin>(9); |
| | | |
| | | protected override UIBase GetAwardWin() => UIManager.Instance.OpenWindow<OSRankMinggeAwardWin>(); |
| | | protected override async UniTask<UIBase> GetAwardWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeAwardWin>(); |
| | | |
| | | protected override UIBase GetGiftWin() => UIManager.Instance.OpenWindow<OSRankMinggeGiftWin>(); |
| | | protected override async UniTask<UIBase> GetGiftWin() => await UIManager.Instance.OpenWindowAsync<OSRankMinggeGiftWin>(); |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto5"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto7"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | if (ctgConfig.VipLevel == 1 && !InvestModel.Instance.IsInvested(InvestModel.monthCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto5"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | if (ctgConfig.VipLevel == 2 && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MinggeAuto7"); |
| | | UIManager.Instance.OpenWindow<PrivilegeCardWin>(); |
| | | UIManager.Instance.OpenWindowAsync<PrivilegeCardWin>().Forget(); |
| | | return; |
| | | } |
| | | |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | // 开服活动-武将冲榜 排行榜界面 |
| | |
| | | OSRankTipWin.infoTextKey = "OSActivityHeroTrainRankTip"; |
| | | OSRankTipWin.isDownShow = true; |
| | | OSRankTipWin.worldPos = title.transform.position; |
| | | UIManager.Instance.OpenWindow<OSRankTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<OSRankTipWin>().Forget(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | // 开服活动-命格冲榜 排行榜界面 |
| | |
| | | OSRankTipWin.infoTextKey = "OSActivityMinggeRankTip"; |
| | | OSRankTipWin.isDownShow = true; |
| | | OSRankTipWin.worldPos = title.transform.position; |
| | | UIManager.Instance.OpenWindow<OSRankTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<OSRankTipWin>().Forget(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | private void Awake() |
| | | { |
| | | //如果有需要按钮点击逻辑,在外层创建,此处不处理点击逻辑 |
| | | LoadPrefab(); |
| | | LoadPrefab().Forget(); |
| | | |
| | | } |
| | | |
| | |
| | | GameObject prefab; |
| | | |
| | | |
| | | protected void LoadPrefab() |
| | | protected async UniTask<GameObject> LoadPrefab() |
| | | { |
| | | if (prefab != null) |
| | | return; |
| | | return prefab; |
| | | var tmp = transform.Find("OfficialTitleCell"); |
| | | |
| | | if (tmp != null) |
| | | { |
| | | prefab = tmp.gameObject; |
| | | return; |
| | | return prefab; |
| | | } |
| | | prefab = UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell"); |
| | | prefab = await UIUtility.CreateWidget("OfficialTitleCell", "OfficialTitleCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | GameObject.DestroyImmediate(prefab); |
| | | return null; |
| | | } |
| | | |
| | | prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | prefab.transform.SetAsFirstSibling(); |
| | | |
| | | return prefab; |
| | | } |
| | | |
| | | public void InitUI(int offcialRank, int titleID, float scale = 0.6f) |
| | | public async UniTask InitUI(int offcialRank, int titleID, float scale = 0.6f) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (this == null) return; |
| | | if (!TitleConfig.HasKey(titleID)) |
| | | { |
| | | officialRankObj.SetActive(true); |
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class BuffInfoWin : UIBase |
| | |
| | | if (heroSkinConfig == null) return; |
| | | |
| | | teamImage.SetSprite(data.isMySide ? "OtherHeroDetailBGBlue" : "OtherHeroDetailBGRed"); |
| | | var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(data.skinID).SquareIcon); |
| | | if (sprite == null) |
| | | { |
| | | // 内网未配置时 |
| | | heroImage.SetSprite("herohead_default"); |
| | | } |
| | | else |
| | | { |
| | | heroImage.overrideSprite = sprite; |
| | | } |
| | | UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(data.skinID).SquareIcon, heroImage, "herohead_default").Forget(); |
| | | heroNameText.text = heroConfig.Name; |
| | | |
| | | CreateScroller(); |
| | |
| | | if (this == null) return; |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | |
| | | heroModel.Create(skinID, 1.2f); |
| | | heroModel.Create(skinID, 1.2f).Forget(); |
| | | |
| | | if (star == 0) |
| | | { |
| | |
| | | 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)); |
| | | officialTitle.InitUI(viewPlayerData.RealmLV, viewPlayerData.TitleID, 0.65f); |
| | | officialTitle.InitUI(viewPlayerData.RealmLV, viewPlayerData.TitleID, 0.65f).Forget(); |
| | | DisplayHorseModel(viewPlayerData); |
| | | |
| | | } |
| | |
| | |
|
| | | int faceID = model.faceID;
|
| | | int facePicID = model.facePicID;
|
| | | manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID).Forget();
|
| | | await manager.ShowFace(faceImage, faceSpine, faceUIFrame, faceMask, faceID);
|
| | |
|
| | | if (this == null) return;
|
| | |
|
| | | string str = AvatarHelper.GetAvatarBgColorStr(faceID);
|
| | | faceBGImage.SetSprite(str);
|
| | |
| | | string resourceValue = manager.GetResourceValue(PhantasmPavilionType.FacePic, facePicID);
|
| | | manager.Show(PhantasmPavilionType.FacePic, facePicImage, facePicSpine, facePicUIFrame, resourceType, resourceValue);
|
| | |
|
| | | faceBGImage.SetNativeSize();
|
| | | faceImage.SetNativeSize();
|
| | | facePicImage.SetNativeSize();
|
| | | BindButtonClick(model);
|
| | | }
|
| | | // 添加标志位:是否已设置自定义监听器
|
| | |
| | | var sprite = await UILoader.LoadSpriteAsync("HeroHead", skinConfig.SquareIcon); |
| | | if (sprite == null) |
| | | { |
| | | Show(imgFace, spine, uiFrame, resourceType, "herohead_default", null, ellipseMask); |
| | | Show(type, imgFace, spine, uiFrame, resourceType, "herohead_default", null, ellipseMask); |
| | | } |
| | | else |
| | | { |
| | | Show(imgFace, spine, uiFrame, resourceType, string.Empty, sprite, ellipseMask); |
| | | Show(type, imgFace, spine, uiFrame, resourceType, string.Empty, sprite, ellipseMask); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | resourceValue = GetResourceValue(type, id); |
| | | Show(imgFace, spine, uiFrame, resourceType, resourceValue, null, ellipseMask); |
| | | Show(type, imgFace, spine, uiFrame, resourceType, resourceValue, null, ellipseMask); |
| | | } |
| | | |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class PhantasmPavilionModelWin : UIBase |
| | |
| | | ModelConfig model = ModelConfig.Get(id); |
| | | int skinID = model.SkinID; |
| | | lhframe.transform.localScale = new Vector3(lhSize, lhSize, lhSize); |
| | | heroIh.Create(skinID, motionName: "", isLh: true); |
| | | heroModel.Create(skinID, modelSize); |
| | | heroIh.Create(skinID, motionName: "", isLh: true).Forget(); |
| | | heroModel.Create(skinID, modelSize).Forget(); |
| | | |
| | | PhantasmPavilionState state = manager.GetUnLockState(type, id); |
| | | |
| | |
| | | }); |
| | | btnLanguage.AddListener(()=> |
| | | { |
| | | UIManager.Instance.OpenWindow<ChangeLanguageWin>(); |
| | | UIManager.Instance.OpenWindowAsync<ChangeLanguageWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | { |
| | | if (type == PlayerDataType.ExAttr3) |
| | | { |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f); |
| | | } |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f).Forget(); } |
| | | } |
| | | |
| | | private void OnUpdateRenameResultEvent() |
| | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID, 1f).Forget(); |
| | | var languages = Language.GetLanguages(); |
| | | btnLanguage.SetActive(!languages.IsNullOrEmpty()); |
| | | } |
| | |
| | | tipHeroPosBtn.AddListener(() => |
| | | { |
| | | CloseWindow(); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<MainWin>(); |
| | | UIManager.Instance.OpenWindowAsync<MainWin>().Forget(); |
| | | } |
| | | |
| | | if (isClickSkip) |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | nameText.text = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName); |
| | | |
| | | var skinConfig = HorseSkinConfig.Get(HorseManager.Instance.GetUsingHorseSkinID()); |
| | | model.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 0.9f); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | model.Create(skinConfig.SkinID, PhantasmPavilionManager.Instance.GetMyModelSkinID(), 0.9f).Forget(); |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID).Forget(); |
| | | } |
| | | else |
| | | { |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(matchInfo.FightPower); |
| | | nameText.text = UIHelper.ServerStringTrim(matchInfo.PlayerName); |
| | | model.Create((int)matchInfo.EquipShowSwitch % 1000, heroSkinID, 0.9f); |
| | | officialTitleCell.InitUI(matchInfo.RealmLV, (int)matchInfo.TitleID); |
| | | model.Create((int)matchInfo.EquipShowSwitch % 1000, heroSkinID, 0.9f).Forget(); |
| | | officialTitleCell.InitUI(matchInfo.RealmLV, (int)matchInfo.TitleID).Forget(); |
| | | } |
| | | |
| | | |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | } |
| | | |
| | | nameText.text = rankData.name1; |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2); |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 0.9f); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2).Forget(); |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 0.9f).Forget(); |
| | | queryPlayerBtn.SetListener(() => |
| | | { |
| | | if (GeneralDefine.IsRobot((int)rankData.id)) return; |
| | |
| | | }); |
| | | achievementBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<QYAchievementWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYAchievementWin>().Forget(); |
| | | }); |
| | | defentPosBtn.AddListener(() => |
| | | { |
| | |
| | | |
| | | storeBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<QYStoreWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYStoreWin>().Forget(); |
| | | }); |
| | | rankBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<PlayerRankWin>(QunyingManager.rankType); |
| | | UIManager.Instance.OpenWindowAsync<PlayerRankWin>(QunyingManager.rankType).Forget(); |
| | | }); |
| | | awardBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<QYRankAwardWin>(1); |
| | | UIManager.Instance.OpenWindowAsync<QYRankAwardWin>(1).Forget(); |
| | | }); |
| | | noteBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<QYNoteWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYNoteWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System; |
| | |
| | | itemInfos.Add(itemInfo); |
| | | } |
| | | } |
| | | UIManager.Instance.OpenWindow<QYBattleVictoryWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYBattleVictoryWin>().Forget(); |
| | | } |
| | | |
| | | //是否本周开启,周几开启 |
| | |
| | | case BattleConst.QYBattleField: |
| | | if (isWin) |
| | | { |
| | | UIManager.Instance.OpenWindow<QYBattleVictoryWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYBattleVictoryWin>().Forget(); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<QYBattleFailWin>(); |
| | | UIManager.Instance.OpenWindowAsync<QYBattleFailWin>().Forget(); |
| | | } |
| | | break; |
| | | default: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using Spine.Unity; |
| | | using UnityEngine; |
| | | |
| | | /// <summary> |
| | | /// Spine批量更新管理器(参考UWA优化方案) |
| | | /// 禁用SkeletonGraphic的Update/LateUpdate自动回调, |
| | | /// 由Manager统一批量调用,减少大量Spine对象的跨语言调用开销。 |
| | | /// 支持隔帧更新Mesh,进一步降低CPU开销。 |
| | | /// </summary> |
| | | public class SpineUpdateManager : MonoBehaviour |
| | | { |
| | | private static SpineUpdateManager instance; |
| | | public static SpineUpdateManager Instance |
| | | { |
| | | get |
| | | { |
| | | if (instance == null) |
| | | { |
| | | var go = new GameObject("[SpineUpdateManager]"); |
| | | DontDestroyOnLoad(go); |
| | | instance = go.AddComponent<SpineUpdateManager>(); |
| | | } |
| | | return instance; |
| | | } |
| | | } |
| | | |
| | | private readonly List<SkeletonGraphic> managedSpines = new List<SkeletonGraphic>(); |
| | | private readonly HashSet<SkeletonGraphic> managedSet = new HashSet<SkeletonGraphic>(); |
| | | private int frameCount; |
| | | |
| | | /// <summary> |
| | | /// 注册一个SkeletonGraphic到批量更新管理器。 |
| | | /// 注册后会禁用其自身的Update/LateUpdate(通过设置freeze=true), |
| | | /// 改由Manager统一驱动。 |
| | | /// </summary> |
| | | public void Register(SkeletonGraphic sg) |
| | | { |
| | | if (sg == null || managedSet.Contains(sg)) return; |
| | | managedSpines.Add(sg); |
| | | managedSet.Add(sg); |
| | | sg.freeze = true; // 禁用SkeletonGraphic自身的Update/LateUpdate |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 从管理器中移除一个SkeletonGraphic,恢复其自身更新。 |
| | | /// </summary> |
| | | public void Unregister(SkeletonGraphic sg) |
| | | { |
| | | if (sg == null || !managedSet.Contains(sg)) return; |
| | | managedSpines.Remove(sg); |
| | | managedSet.Remove(sg); |
| | | sg.freeze = false; // 恢复自身更新 |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | frameCount++; |
| | | float dt = Time.deltaTime; |
| | | for (int i = managedSpines.Count - 1; i >= 0; i--) |
| | | { |
| | | var sg = managedSpines[i]; |
| | | if (sg == null) |
| | | { |
| | | managedSpines.RemoveAt(i); |
| | | managedSet.Remove(sg); |
| | | continue; |
| | | } |
| | | if (!sg.isActiveAndEnabled) continue; |
| | | // 手动驱动动画更新:Update(float)不检查freeze,直接更新动画状态 |
| | | sg.Update(dt); |
| | | } |
| | | } |
| | | |
| | | void LateUpdate() |
| | | { |
| | | // 隔帧更新Mesh:动画状态每帧更新保证事件准确,但Mesh重建(开销大)隔帧即可 |
| | | // 数量少时每帧都更新,数量多于8个时隔帧更新以减少CPU负担 |
| | | bool skipMesh = managedSpines.Count > 8 && (frameCount & 1) == 0; |
| | | |
| | | for (int i = managedSpines.Count - 1; i >= 0; i--) |
| | | { |
| | | var sg = managedSpines[i]; |
| | | if (sg == null) |
| | | { |
| | | managedSpines.RemoveAt(i); |
| | | managedSet.Remove(sg); |
| | | continue; |
| | | } |
| | | if (!sg.isActiveAndEnabled) continue; |
| | | if (skipMesh) continue; |
| | | // 手动驱动Mesh更新:直接调用UpdateMesh(),不经过LateUpdate()的freeze检查 |
| | | sg.UpdateMesh(); |
| | | } |
| | | } |
| | | |
| | | void OnDestroy() |
| | | { |
| | | // 恢复所有被管理的Spine自身更新 |
| | | foreach (var sg in managedSpines) |
| | | { |
| | | if (sg != null) |
| | | sg.freeze = false; |
| | | } |
| | | managedSpines.Clear(); |
| | | managedSet.Clear(); |
| | | instance = null; |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 174da832a7db0f74d9e049555d1edbe5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroID; |
| | | HeroUIManager.Instance.selectSkinIndex = HeroDebutManager.Instance.GetSkinIndexInHeroConfig(heroID, skinID); |
| | | UIManager.Instance.OpenWindow<HeroBestBaseWin>(1); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>(1).Forget(); |
| | | }); |
| | | } |
| | | |
| | | void BuyGoods(int shopID) |
| | | { |
| | | StoreModel.Instance.buyShopID = shopID; |
| | | UIManager.Instance.OpenWindow<SkinStoreBuyTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<SkinStoreBuyTipWin>().Forget(); |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | { |
| | | giftBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroSkinGiftWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroSkinGiftWin>().Forget(); |
| | | }); |
| | | |
| | | } |
| | |
| | | break; |
| | | case 1: |
| | | //时装 |
| | | currentSubUI = UIManager.Instance.OpenWindow<SkinStoreWin>(); |
| | | currentSubUI = await UIManager.Instance.OpenWindowAsync<SkinStoreWin>(); |
| | | break; |
| | | case 2: |
| | | // 充值界面 |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | |
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | | using System.Collections;
|
| | |
| | | if (!TryGetIsSellOut(cfg, out var cnt))
|
| | | {
|
| | | buyShopID = shopID;
|
| | | UIManager.Instance.OpenWindow<BuyItemWin>();
|
| | | UIManager.Instance.OpenWindowAsync<BuyItemWin>().Forget();
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "0";//Language.Get("L1125"); |
| | | 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)); |
| | | viewPlayerId = (int)rankData.id; |
| | |
| | | officialTitleCell.SetActive(true); |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue2 + rankData.cmpValue * Constants.ExpPointValue)); |
| | | 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).Forget(); |
| | | queryPlayerBtn.SetListener(() => |
| | |
| | | { |
| | | txtBossName.text = npcConfig.NPCName; |
| | | uiEffectPlayer.Play(); |
| | | bossModel.Create(npcConfig.SkinID, modelSize); |
| | | bossModel.Create(npcConfig.SkinID, modelSize).Forget(); |
| | | txtHistoryHurt.text = Language.Get("TianziBillborad01", UIHelper.ReplaceLargeNum(model.historyHurt)); |
| | | txtTodayHurt.text = Language.Get("TianziBillborad02", UIHelper.ReplaceLargeNum(model.todayHurt)); |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class TimeRushGiftCell : 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; |
| | | } |
| | | |
| | |
| | | OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002"); |
| | | } |
| | | |
| | | ApplyClickEmptySpaceClose(); |
| | | ApplyClickEmptySpaceClose().Forget(); |
| | | |
| | | ExecuteNextFrame(() => |
| | | { |
| | |
| | | if (UIManager.Instance.IsOpened(config.WinName)) |
| | | { |
| | | UIManager.Instance.CloseWindow(config.WinName); |
| | | UIManager.Instance.OpenWindow(config.WinName); |
| | | UIManager.Instance.OpenWindowAsync(config.WinName).Forget(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 通过 ResManager 加载 VideoClip 资源(支持 AB 打包) |
| | | _loadedClip = await ResManager.Instance.LoadAssetAsync<VideoClip>(directory, videoName, false); |
| | | if (this == null) return; |
| | | |
| | | // 检查是否在加载过程中被取消 |
| | | if (!_isLoading) |
| | |
| | | |
| | | // 通过 ResManager 加载 VideoClip 资源(支持 AB 打包) |
| | | _loadedClip = await ResManager.Instance.LoadAssetAsync<VideoClip>(directory, videoName, false); |
| | | if (this == null) return; |
| | | |
| | | // 检查是否在加载过程中被取消 |
| | | if (!_isLoading) |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | |
| | | currentBuffData = data; |
| | | if (!UIManager.Instance.IsOpened<BuffInfoWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<BuffInfoWin>(); |
| | | UIManager.Instance.OpenWindowAsync<BuffInfoWin>().Forget(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionNPCItem : MonoBehaviour |
| | |
| | | return; |
| | | HeroConfig heroConfig = HeroConfig.Get(heroID); |
| | | |
| | | uiHeroController.Create(npcConfig.SkinID, modelSize); |
| | | uiHeroController.Create(npcConfig.SkinID, modelSize).Forget(); |
| | | |
| | | Color color = UIHelper.GetUIColorByFunc(heroConfig.Quality); |
| | | string name = UIHelper.AppendColor(color, heroConfig.Name); |
| | |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class WarlordPavilionPlayerRankCell : MonoBehaviour |
| | |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | 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)); |
| | | viewPlayerId = (int)rankData.id; |
| | |
| | | manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum); |
| | | rankValueText.text = Language.Get("WarlordPavilion23", layerNum, levelNum); |
| | | 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).Forget(); |
| | | queryPlayerBtn.SetListener(() => |
| | |
| | | return; |
| | | } |
| | | |
| | | _image.enabled = false; |
| | | |
| | | UILoader.LoadTexture2DPNGAsync(_id).ContinueWith(texture => |
| | | { |
| | | if (_image != null && texture != null) |
| | | if (_image == null) return; |
| | | |
| | | if (texture != null) |
| | | { |
| | | _image.texture = texture; |
| | | _image.SetNativeSize(); |
| | | _image.enabled = true; |
| | | } |
| | | }).Forget(); |
| | | } |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System.Net.NetworkInformation; |
| | | using System; |
| | | using System.Net; |
| | | using System.Net.Sockets; |
| | | using System.IO; |
| | | using System.Text.RegularExpressions; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine.Networking; |
| | | |
| | | #if !UNITY_WEBGL |
| | | using System.Net.NetworkInformation; |
| | | using System.Net; |
| | | using System.IO; |
| | | #endif |
| | | |
| | | #if UNITY_IOS |
| | | using UnityEngine.iOS; |
| | |
| | | static string mac = string.Empty; |
| | | public static string GetMac() |
| | | { |
| | | #if !UNITY_WEBGL |
| | | if (string.IsNullOrEmpty(mac)) |
| | | { |
| | | try |
| | |
| | | Debug.Log(ex); |
| | | } |
| | | } |
| | | |
| | | #endif |
| | | return mac; |
| | | } |
| | | |
| | | static string ipPattern = "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"; |
| | | static string ip = string.Empty; |
| | | public static string GetCachedIp() => ip; |
| | | public static async UniTask<string> GetIp() |
| | | { |
| | | try |
| | |
| | | if (string.IsNullOrEmpty(ip)) |
| | | { |
| | | string url = "http://pv.sohu.com/cityjson"; |
| | | WebRequest wRequest = WebRequest.Create(url); |
| | | wRequest.Method = "GET"; |
| | | wRequest.ContentType = "text/html;charset=UTF-8"; |
| | | WebResponse wResponse = await wRequest.GetResponseAsync(); |
| | | Stream stream = wResponse.GetResponseStream(); |
| | | StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default); |
| | | string str = await reader.ReadToEndAsync(); |
| | | |
| | | reader.Close(); |
| | | wResponse.Close(); |
| | | |
| | | var match = Regex.Match(str, ipPattern); |
| | | if (match != null) |
| | | using (var request = UnityWebRequest.Get(url)) |
| | | { |
| | | ip = match.Value; |
| | | await request.SendWebRequest(); |
| | | if (request.result == UnityWebRequest.Result.Success) |
| | | { |
| | | string str = request.downloadHandler.text; |
| | | var match = Regex.Match(str, ipPattern); |
| | | if (match != null) |
| | | { |
| | | ip = match.Value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | public class OperationLogCollect : Singleton<OperationLogCollect>
|
| | | {
|
| | |
|
| | | const string bugReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | const string bugReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | |
|
| | | public void BugReport(string _title, string _content)
|
| | | {
|
| | |
| | | tables["EventID"] = 9002.ToString();
|
| | | tables["ProductID"] = VersionConfig.Get().gameId;
|
| | | tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
| | | tables["IP"] = DeviceUtility.GetIp();
|
| | | tables["IP"] = DeviceUtility.GetCachedIp();
|
| | | tables["AccountID"] = LoginManager.Instance.sdkLoginResult.account;
|
| | | tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
|
| | | tables["RoleID"] = PlayerDatas.Instance.baseData.PlayerName;
|
| | |
| | | tables["EventID"] = 9002.ToString();
|
| | | tables["ProductID"] = VersionConfig.Get().gameId;
|
| | | tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
| | | tables["IP"] = DeviceUtility.GetIp();
|
| | | tables["IP"] = DeviceUtility.GetCachedIp();
|
| | | tables["AccountID"] = "system";
|
| | | tables["Level"] = "1";
|
| | | tables["RoleID"] = "system";
|
| | |
| | | }
|
| | |
|
| | |
|
| | | const string chatReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | const string chatReportUrl = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
|
| | | public void ChatReport(string content, string channelName, string toPlayer, int chatType)
|
| | | {
|
| | | #if !UNITY_EDITOR
|
| | |
| | | tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
|
| | | tables["EventID"] = 9003.ToString();
|
| | | tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
| | | tables["IP"] = DeviceUtility.GetIp();
|
| | | tables["IP"] = DeviceUtility.GetCachedIp();
|
| | | tables["ChatChannel"] = channelName;
|
| | | var sdkLoginResult = LoginManager.Instance.sdkLoginResult;
|
| | | tables["AccountID"] = sdkLoginResult == null ? LoginManager.Instance.accountBuf : sdkLoginResult.account;
|
| | |
| | | return; |
| | | } |
| | | |
| | | if (Application.platform == RuntimePlatform.Android) |
| | | if (Application.platform == RuntimePlatform.WebGLPlayer) |
| | | { |
| | | return; // WebGL不支持文件系统写入 |
| | | } |
| | | else if (Application.platform == RuntimePlatform.Android) |
| | | { |
| | | logFileRoot = Path.GetDirectoryName(Application.persistentDataPath); |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static string RunCmd(string command) |
| | | { |
| | | #if UNITY_WEBGL |
| | | UnityEngine.Debug.LogWarning("SystemCMD.RunCmd is not supported on WebGL"); |
| | | return string.Empty; |
| | | #else |
| | | System.Diagnostics.Process p = new System.Diagnostics.Process(); |
| | | p.StartInfo.FileName = "cmd.exe"; //确定程序名 |
| | | p.StartInfo.Arguments = "/c " + command; //确定程式命令行 |
| | |
| | | { |
| | | return err; //输出出流取得命令行结果果 |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | } |
| | |
| | | //获取剪切板内容 |
| | | public static string GetClipboardText() |
| | | { |
| | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | | // WebGL下浏览器安全限制,无法同步读取剪贴板 |
| | | return string.Empty; |
| | | #else |
| | | return GUIUtility.systemCopyBuffer; |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| New file |
| | |
| | | using UnityEngine; |
| | | |
| | | /// <summary> |
| | | /// WebGL 环境下直接调用浏览器 console.error,不受 Unity Release Build 日志抑制影响。 |
| | | /// 非 WebGL 平台回退到 Debug.LogError。 |
| | | /// </summary> |
| | | public static class WebGLDebug |
| | | { |
| | | public static void LogError(string msg) |
| | | { |
| | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | | string escaped = msg.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\n", "\\n").Replace("\r", ""); |
| | | Application.ExternalEval("console.error('" + escaped + "')"); |
| | | #else |
| | | Debug.LogError(msg); |
| | | #endif |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 242dde706571701498a0d9f6d02937a5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |