public void DeserializeViewBlockAttrMap() { this.ViewBlockAttrMap.Clear(); if (this.SerializedBlockAttrList != null && this.SerializedBlockAttrList.Length > 0) { FieldObj.SViewBlockAttrIndexed[] serializedBlockAttrList = this.SerializedBlockAttrList; for (int i = 0; i < serializedBlockAttrList.Length; i++) { FieldObj.SViewBlockAttrIndexed sViewBlockAttrIndexed = serializedBlockAttrList[i]; this.AddViewBlockAttr(sViewBlockAttrIndexed.ViewBlockId, sViewBlockAttrIndexed.Attr.BlockType, sViewBlockAttrIndexed.Attr.LightType); } if (Application.isPlaying) { this.SerializedBlockAttrList = null; } } }
public void SerializeViewBlockAttrMap() { if (this.ViewBlockAttrMap.get_Count() > 0) { this.SerializedBlockAttrList = new FieldObj.SViewBlockAttrIndexed[this.ViewBlockAttrMap.get_Count()]; Dictionary <byte, FieldObj.SViewBlockAttr> .Enumerator enumerator = this.ViewBlockAttrMap.GetEnumerator(); int num = 0; while (enumerator.MoveNext()) { FieldObj.SViewBlockAttrIndexed sViewBlockAttrIndexed = default(FieldObj.SViewBlockAttrIndexed); KeyValuePair <byte, FieldObj.SViewBlockAttr> current = enumerator.get_Current(); sViewBlockAttrIndexed.ViewBlockId = current.get_Key(); KeyValuePair <byte, FieldObj.SViewBlockAttr> current2 = enumerator.get_Current(); sViewBlockAttrIndexed.Attr = current2.get_Value(); this.SerializedBlockAttrList[num++] = sViewBlockAttrIndexed; } } else { this.SerializedBlockAttrList = new FieldObj.SViewBlockAttrIndexed[0]; } }