diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab index 824b9eab6e..85e7009b74 100644 --- a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab @@ -900,8 +900,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 30.6318} - m_SizeDelta: {x: 1067.9689, y: 248.9211} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1960, y: 1440} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2243330050876855902 CanvasRenderer: diff --git a/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs b/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs index 694f976809..96bf5bcbb4 100644 --- a/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs +++ b/Assets/PerfectWorld/Scripts/Addressable/AddressableManager.cs @@ -152,16 +152,22 @@ namespace BrewMonster.Scripts // remove the asset from the release timestamp dictionary. So it won't be released. RemoveFromReleaseAssetDictionary(assetPath); + if (!KeyExists(assetPath, typeof(GameObject))) + { + BMLogger.LogWarning($"AddressableManager: Prefab '{assetPath}' does not exist"); + return null; + } + if (_loadedPrefabAssets.TryGetValue(assetPath, out _loadedPrefabHandle)) { if (_loadedPrefabHandle.IsValid() && _loadedPrefabHandle.Result != null) { - BMLogger.Log($"AddressableManager: Loaded prefab from cache: {assetPath}"); + // BMLogger.Log($"AddressableManager: Loaded prefab from cache: {assetPath}"); return _loadedPrefabHandle.Result; } else { - BMLogger.Log($"AddressableManager: Prefab handle is invalid or result is null, need to load new one: {assetPath}"); + // BMLogger.Log($"AddressableManager: Prefab handle is invalid or result is null, need to load new one: {assetPath}"); } } @@ -331,6 +337,31 @@ namespace BrewMonster.Scripts { return _loadedPrefabAssets.ContainsKey(assetPath) && _loadedPrefabAssets[assetPath].IsValid(); } + + /// + /// Checks if a given Addressable key or path exists in the current catalogs. + /// + /// The Addressable key, path, or label to check. + /// Optional: The specific type of asset you are looking for. + /// True if the key exists, false otherwise. + public static bool KeyExists(object key, System.Type type = null) + { + // Iterate through all loaded locators (catalogs) + foreach (IResourceLocator locator in Addressables.ResourceLocators) + { + // If the locator finds the key, it returns true + if (locator.Locate(key, type, out var locations)) + { + // Double check that it actually yielded at least one location + if (locations != null && locations.Count > 0) + { + return true; + } + } + } + + return false; + } #endregion diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs index 694a482e6d..065bd0e96c 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs @@ -74,10 +74,10 @@ namespace BrewMonster.Scripts /// RMap marks deep water as blocked; AutoPF snaps goals to nearest land. If the real mission point /// (m_vMoveDest) is still farther horizontally (e.g. in water), continue with DEST_2D after AutoPF ends. /// - const float AutoPF_WorldDestContinueDistH = 0.2f; + const float AutoPF_WorldDestContinueDistH = 0.1f; /// Horizontal radius to treat DEST_2D as arrived (swim/fly overshoot logic often never fires). - const float Dest2D_ArrivalDistH = 0.2f; + const float Dest2D_ArrivalDistH = 0.1f; public CECHPWorkMove(CECHPWorkMan pWorkMan) : base(Host_work_ID.WORK_MOVETOPOS, pWorkMan) { diff --git a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs index bed574fbb8..9662cb3cc0 100644 --- a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs +++ b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs @@ -369,7 +369,7 @@ namespace BrewMonster && GetModel().QueueAction(szActName, nTransTime, (uint)iAction, bForceStopPrevAct, false, bNoFx, bResetSpeed, bResetActFlag, attackEvent, dwNewFlagMode); if (!check) { - BMLogger.LogError($"Fall back to base implementation: {szActName} failed"); + // BMLogger.LogError($"Fall back to base implementation: {szActName} failed"); //fallback to base implementation(which is non policy based) base.QueueNonSkillActionWithName(iAction, szActName, nTransTime, bForceStopPrevAct, bNoFx, bResetSpeed, bResetActFlag, attackEvent, dwNewFlagMode); } diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs index f345c2ef48..6ffdda0042 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs @@ -34,6 +34,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay public IReadOnlyList SkillGroupIndexes => _skillGroupIndexes; private AUIDialog m_pParent; + public override void Awake() { if (skillbutton == null) @@ -44,7 +45,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay skillbutton.onClick.RemoveAllListeners(); skillbutton.onClick.AddListener(Execute); m_pParent = GetComponentInParent(); - _skillID = int.Parse(this.name.Split('_')[1]); + // _skillID = int.Parse(this.name.Split('_')[1]); } public void SetInteract(bool isInteract) diff --git a/Assets/PerfectWorld/Scripts/Utils/Editor/AddressableTools.cs b/Assets/PerfectWorld/Scripts/Utils/Editor/AddressableTools.cs index a0821d22ac..c3f30fbd46 100644 --- a/Assets/PerfectWorld/Scripts/Utils/Editor/AddressableTools.cs +++ b/Assets/PerfectWorld/Scripts/Utils/Editor/AddressableTools.cs @@ -81,7 +81,7 @@ namespace BrewMonster [MenuItem("Tools/Addressable/Update Addressable Path For Sfx")] public static void UpdateAddressablePathForSfx() { - UpdateAddressableAddressesPath("sfx", _sfxPathPrefixToRemove, ".sfx"); + UpdateAddressableAddressesPath("sfx", _sfxPathPrefixToRemove, ""); } [MenuItem("Tools/Addressable/Update Addressable Path For a61")] @@ -132,12 +132,22 @@ namespace BrewMonster newAddress = newAddress.Substring(prefixToRemove.Length); if (newAddress.StartsWith("/")) newAddress = newAddress.Substring(1); } - - // Change suffix from .prefab to .ecm if applicable - if (newAddress.EndsWith(".prefab")) + + // remove the current subfix if present + int subfixIndex = newAddress.LastIndexOf('.'); + if (subfixIndex != -1) { - newAddress = newAddress.Substring(0, newAddress.Length - ".prefab".Length) + subfix; + newAddress = newAddress.Substring(0, subfixIndex); } + + // apply the new subfix + newAddress = newAddress + subfix; + + // Change suffix from .prefab to .ecm if applicable + // if (newAddress.EndsWith(".prefab")) + // { + // newAddress = newAddress.Substring(0, newAddress.Length - ".prefab".Length) + subfix; + // } if (newAddress != address) {