右侧工具栏切换

This commit is contained in:
liuyu 2024-09-03 14:05:26 +08:00
parent da457d6aff
commit 36098d8173
1 changed files with 12 additions and 1 deletions

View File

@ -123,11 +123,15 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
/// </summary> /// </summary>
public void RecoverScene() public void RecoverScene()
{ {
//先恢复场景
ScenesManager.Instance.LoadSceneAsyn(UserExamStat.sceneName, () => { ScenesManager.Instance.LoadSceneAsyn(UserExamStat.sceneName, () => {
//右侧工具栏切换
GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchScene, GameManager.RunModelMgr.SceneType);
//恢复场景中各项装备
BaseToolOrDevice[] allThings = FindObjectsOfType<BaseToolOrDevice>(); BaseToolOrDevice[] allThings = FindObjectsOfType<BaseToolOrDevice>();
foreach (BaseToolOrDevice item in allThings) foreach (BaseToolOrDevice item in allThings)
{ {
item.gameObject.SetActive(false); item.gameObject.SetActive(false);//先全部隐藏
foreach (ReconnetItemInfo rec in UserExamStat.currentSceneTools) foreach (ReconnetItemInfo rec in UserExamStat.currentSceneTools)
{ {
if (item.itemInfo.toolName.Equals(rec.toolName) && item.itemInfo.toolId == rec.toolId) if (item.itemInfo.toolName.Equals(rec.toolName) && item.itemInfo.toolId == rec.toolId)
@ -139,6 +143,13 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
} }
} }
} }
//恢复背包中的装备
List<ItemInfo> itemInPack = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allToolAndMaterial);
foreach (ItemInfo item in itemInPack)
{
PacksackBagMgr.Instance.AddOneToolOrMater(item);
}
}); });
} }
// Start is called before the first frame update // Start is called before the first frame update