在工具间模型上恢复穿戴

This commit is contained in:
liuyu 2024-09-04 14:07:58 +08:00
parent 8664ce8398
commit eadf603199
1 changed files with 12 additions and 7 deletions

View File

@ -16,7 +16,7 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
[HideInInspector]
public string localStatFileName = "realtimeStat.json";//保存文件的文件名
[HideInInspector]
public int countDown_AutoSave = 60;//自动保存的时间间隔
public int countDown_AutoSave = 120;//自动保存的时间间隔
private TB_UserExamStat UserExamStat = new TB_UserExamStat();
private string localStatPath = "";
private Coroutine coroutine;//自动保存倒计时
@ -184,15 +184,20 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
}
//恢复已穿戴的装备
List<ItemInfo> itemWear = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allWear);
List<ItemInfo> itemWear = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allWear);
TooRoomMannger tooRoomMannger = FindAnyObjectByType<TooRoomMannger>();
foreach (ItemInfo item in itemWear)
{
PacksackBagMgr.Instance.WearItemState(item, true);
if (tooRoomMannger != null)//如果在工具间,则修改穿着
{
tooRoomMannger.Wear(item.toolName, true);
}
}
//恢复场景内各个触发器状态
PermanentTriggerBase[] allPermanentTriggers = FindObjectsOfType<PermanentTriggerBase>();
List<ReconnectTriggerInfo> allReconTrigs = UserExamStat.currentSceneTriggers;
PermanentTriggerBase[] allPermanentTriggers = FindObjectsOfType<PermanentTriggerBase>();
List<ReconnectTriggerInfo> allReconTrigs = UserExamStat.currentSceneTriggers;
foreach (PermanentTriggerBase item in allPermanentTriggers)
{
item.gameObject.SetActive(false);
@ -238,11 +243,11 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
if (ProcessManager.Instance.mode == E_ModeType.Practice)
{
countDown--;
Debug.Log("自动保存倒计时:" + countDown);
if (countDown_AutoSave <= 0)
//Debug.Log("自动保存倒计时:" + countDown);
if (countDown <= 0)
{
ReconnectMgr.Instance.RealtimeStatWriter();//需要在GameManager里面初始化
//Debug.Log("完成状态自动保存");
Debug.Log("完成状态自动保存");
countDown = countDown_AutoSave;
}
}