using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class XmlParsing : MonoBehaviour {
public Dictionary<int, RoomInfo> dictRI = new Dictionary<int, RoomInfo>();
// Use this for initialization
void Start () {
WriteXML();
ReadXML();
}
void WriteXML()
{
RoomInfo ri = new RoomInfo();
ri.id = 1;
ri.byteB = 1;
ri.stringS = "aaa";
ri.boolB = false;
dictRI.Add(ri.id, ri);
ri = new RoomInfo();
ri.id = 2;
ri.byteB = 2;
ri.stringS = "bbb";
ri.boolB = true;
dictRI.Add(ri.id, ri);
DataControl.i.WriteRoomInfo(dictRI, "RoomInfo.xml");
}
void ReadXML()
{
dictRI.Clear();
dictRI = DataControl.i.ReadRoomInfo("RoomInfo.xml");
foreach(RoomInfo ri in dictRI.Values)
{
Debug.Log ("id : " + ri.id + ", byte : " + ri.byteB + ", string : " + ri.stringS + ", bool : " + ri.boolB);
}
}
}
댓글 없음:
댓글 쓰기