using System.Collections; using System.Collections.Generic; using UnityEngine; [DisallowMultipleComponent] public class EquipRecord : MonoBehaviour, IRecordDiverseData, IReplayDiverseData { public void RecordDiverseData(List SpecialData, GameObject gameObject) { var bag = gameObject.GetComponent(); if (!bag) { return; } var firemandata = new FiremanEquipRecordData { equips = bag.EquipList, }; SpecialData.Add(new KeyValueData() { Key = typeof(FiremanEquipRecordData).ToString(), Value = JsonUtility.ToJson(firemandata) }); } public void ReplayDiverseData(List SpecialData, GameObject gameObject) { FiremanEquipRecordData firemanbasedata = null; for (int i = 0; i < SpecialData.Count; i++) { if (SpecialData[i].Key == typeof(FiremanEquipRecordData).ToString()) { firemanbasedata = JsonUtility.FromJson(SpecialData[i].Value); break; } } var bag = gameObject.GetComponent(); if (bag&&firemanbasedata!=null) { bag.EquipList = firemanbasedata.equips; bag.ChangeCloth(); } } }