fix code update equip thing character
This commit is contained in:
@@ -39,10 +39,15 @@ namespace BrewMonster.Scripts
|
||||
_loadVersion++;
|
||||
int version = _loadVersion;
|
||||
|
||||
ClearModels();
|
||||
|
||||
if (roleInfos == null || roleInfos.Count == 0 || NPCManager.Instance == null)
|
||||
{
|
||||
ClearModels();
|
||||
return;
|
||||
}
|
||||
|
||||
List<GameObject> oldModels = new List<GameObject>(playerModels);
|
||||
playerModels.Clear();
|
||||
playerModelIds.Clear();
|
||||
|
||||
for (int i = 0; i < roleInfos.Count; i++)
|
||||
{
|
||||
@@ -68,6 +73,14 @@ namespace BrewMonster.Scripts
|
||||
|
||||
ApplyRequestedModelVisibility();
|
||||
}
|
||||
|
||||
for(int i=0; i < oldModels.Count; i++)
|
||||
{
|
||||
if (oldModels[i] != null)
|
||||
{
|
||||
Destroy(oldModels[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -130,16 +143,16 @@ namespace BrewMonster.Scripts
|
||||
// }
|
||||
//}
|
||||
|
||||
playerModels.Clear();
|
||||
playerModelIds.Clear();
|
||||
|
||||
if(modelRoot != null)
|
||||
for (int i = 0; i < playerModels.Count; i++)
|
||||
{
|
||||
foreach (Transform child in modelRoot)
|
||||
if (playerModels[i] != null)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
Destroy(playerModels[i]);
|
||||
}
|
||||
}
|
||||
|
||||
playerModels.Clear();
|
||||
playerModelIds.Clear();
|
||||
}
|
||||
|
||||
private void ClearModelsImmediate()
|
||||
|
||||
@@ -246,6 +246,11 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
return;
|
||||
}
|
||||
|
||||
if (_previewInstance != null && _previewInstance != sourceRoot.gameObject)
|
||||
{
|
||||
DestroyPreviewInstance();
|
||||
}
|
||||
|
||||
if (!sourceRoot.gameObject.activeSelf)
|
||||
{
|
||||
sourceRoot.gameObject.SetActive(true);
|
||||
@@ -269,6 +274,15 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
EnsureCameraBindings();
|
||||
}
|
||||
|
||||
private void DestroyPreviewInstance()
|
||||
{
|
||||
if (_previewInstance != null)
|
||||
{
|
||||
Destroy(_previewInstance);
|
||||
_previewInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Transform ResolveSourceModelRoot()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user