update router

This commit is contained in:
Le Duc Anh
2026-04-18 16:45:13 +07:00
parent ba6d0a82b0
commit fd08797f4a
6 changed files with 55 additions and 13 deletions
@@ -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:
@@ -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();
}
/// <summary>
/// Checks if a given Addressable key or path exists in the current catalogs.
/// </summary>
/// <param name="key">The Addressable key, path, or label to check.</param>
/// <param name="type">Optional: The specific type of asset you are looking for.</param>
/// <returns>True if the key exists, false otherwise.</returns>
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
@@ -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.
/// </summary>
const float AutoPF_WorldDestContinueDistH = 0.2f;
const float AutoPF_WorldDestContinueDistH = 0.1f;
/// <summary>Horizontal radius to treat DEST_2D as arrived (swim/fly overshoot logic often never fires).</summary>
const float Dest2D_ArrivalDistH = 0.2f;
const float Dest2D_ArrivalDistH = 0.1f;
public CECHPWorkMove(CECHPWorkMan pWorkMan) : base(Host_work_ID.WORK_MOVETOPOS, pWorkMan)
{
@@ -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);
}
@@ -34,6 +34,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
public IReadOnlyList<int> 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<AUIDialog>();
_skillID = int.Parse(this.name.Split('_')[1]);
// _skillID = int.Parse(this.name.Split('_')[1]);
}
public void SetInteract(bool isInteract)
@@ -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)
{