load equipment async

This commit is contained in:
Le Duc Anh
2026-03-17 17:39:28 +07:00
parent d2fd3db327
commit 2c5b9a9104
5 changed files with 29 additions and 11 deletions
@@ -26,13 +26,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7683706845393114874}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0.365, y: -0.002, z: -0.002}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!33 &2133889840078759797
MeshFilter:
m_ObjectHideFlags: 0
@@ -26,13 +26,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1062321236472470772}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0.365, y: -0.002, z: -0.002}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!33 &3655013707296471465
MeshFilter:
m_ObjectHideFlags: 0
@@ -26,13 +26,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3330708356810309571}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0.388, y: -0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!33 &666975227472843166
MeshFilter:
m_ObjectHideFlags: 0
@@ -36,6 +36,11 @@ namespace BrewMonster
[SerializeField] internal INFO m_PlayerInfo;
public CECModel m_pPlayerCECModel;
protected GameObject m_pPlayerModel => m_pPlayerCECModel.m_pPlayerModel;
public bool IsPlayerModelReady
{
get;
protected set;
}
protected float rotationSpeed = 5;
internal int m_iMoveMode; // Player's move mode
[SerializeField] internal int m_idSelTarget;
@@ -331,6 +336,9 @@ namespace BrewMonster
m_pModels[(int)PLAYERMODEL_TYPE.PLAYERMODEL_MAJOR] = m_pPlayerModel;
m_iShape = 0;
// Set the player model ready flag
IsPlayerModelReady = true;
// Update visual components after model is set (with delay to ensure NamedAnimancerComponent is available)
// 设置模型后更新视觉组件(延迟以确保NamedAnimancerComponent可用)
StartCoroutine(UpdateVisualComponentsDelayed());
@@ -533,7 +533,7 @@ namespace BrewMonster
}
}
public void OnMsgPlayerEquipData(ECMSG Msg)
public async void OnMsgPlayerEquipData(ECMSG Msg)
{
// using namespace S2C;
@@ -567,7 +567,17 @@ namespace BrewMonster
}
// // Change equipment
ChangeEquipments(bReset, crc, iAddMask, iDelMask, aAdded);
// ChangeEquipments(bReset, crc, iAddMask, iDelMask, aAdded);
await QueueChangeEquipments(bReset, crc, iAddMask, iDelMask, aAdded);
}
private async UniTask QueueChangeEquipments(bool bReset, int crc, long iAddMask, long iDelMask, int[] aAddedEquip)
{
while (!IsPlayerModelReady)
{
await UniTask.DelayFrame(1);
}
ChangeEquipments(bReset, crc, iAddMask, iDelMask, aAddedEquip);
}
/// <summary>