public void Initialize() { DirectoryInfo dir = new DirectoryInfo(InuOhaDatas.GetOutSideDataFolderPass() + "/CardDatas"); FileInfo[] info = dir.GetFiles("*.txt"); if (info.Length == 0) { return; } for (int i = 0; i < info.Length; i++) { CardData cardData = new CardData(); if (cardData.LoadFromFile(info[i].Name)) { GenerateNewNode(cardData); } } if (InuOhaDatas.firstPlay) { cardNodeList [0].SetIsOn(true); } else { foreach (CardData cd in InuOhaDatas.useCards) { foreach (CardNode cn in cardNodeList) { if (cd.GetFileName() == cn.GetCardData().GetFileName()) { cn.SetIsOn(true); } } } } }
public bool LoadFromFile(string fileName) { this.fileName = fileName; string filePass = InuOhaDatas.GetOutSideDataFolderPass() + "/CardDatas/" + fileName; StreamReader sr = new StreamReader(filePass); string line; /*-Title-探し*/ for (;;) { if (sr.EndOfStream == true) { return(false); } line = sr.ReadLine(); //Debug.Log ("1:" + line); if (line == "-Title-") { break; } } /*次の文を探してタイトルに設定*/ for (;;) { if (sr.EndOfStream == true) { return(false); } line = sr.ReadLine(); //Debug.Log ("2:" + line); if (line == string.Empty) { continue; } title = line; break; } /*-Pinch-探し*/ for (;;) { if (sr.EndOfStream == true) { return(false); } line = sr.ReadLine(); //Debug.Log ("3:" + line); if (line == "-Pinch-") { break; } } /*-Item-が見つかるまでピンチを格納*/ for (;;) { if (sr.EndOfStream == true) { return(false); } line = sr.ReadLine(); //Debug.Log ("4:" + line); if (line == string.Empty) { continue; } if (line == "-Item-") { break; } pinchs.Add(line); } /*残りの行をアイテムに格納*/ while (sr.EndOfStream != true) { line = sr.ReadLine(); //Debug.Log ("5:" + line); if (line == string.Empty) { continue; } items.Add(line); } return(true); }
void Update() { text.text = InuOhaDatas.ToStringAsDebug(); }