void Start() { //@"Assets\\Resources\\tracks.csv" //if (false) //{ //// Debug.Log("Downloading csv.."); //// WWW www = new WWW(address); //// Debug.Log(www); //// yield return www; //// text = www.text; //// Debug.Log("Downloaded: " + text); // yield return ""; //} //else //{ //var file = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "tracks.xml"); //UnityEngine.Debug.Log(file); //XmlDocument doc = new XmlDocument(); //doc.Load(file); //} var XMLTests = new Track.XMLTests(); //XMLTests. = "chain8cL_diff,0,1\r\nchain11aG_same,1,0\r\n\r\nchain8cL_diff,0,1\r\nchain11aG_same,1,0\r\nend\r\n"; var XMLTest = new Track.XMLTest(); XMLTest.TutorialTracks.Add(new Track.XMLTutorial("chain8cL_diff")); XMLTest.ActualTracks.Add(new Track.XMLActual("chain8cL_diff")); XMLTests.Tests.Add(XMLTest); //foreach (XmlNode test in doc.DocumentElement.ChildNodes) //{ // var XMLTest = new Track.XMLTest(); // foreach (XmlNode tutorial_or_actual_test in test.ChildNodes) // { //if (tutorial_or_actual_test.Name.ToLower() == "tutorial") // XMLTest.TutorialTracks.Add(new Track.XMLTutorial(tutorial_or_actual_test.InnerText)); //or loop through its children as well // else // XMLTest.ActualTracks.Add(new Track.XMLActual(tutorial_or_actual_test.InnerText)); //or loop through its children as well // } // XMLTests.Tests.Add(XMLTest); //} Track.TrackManager.Init(XMLTests); }
public static void Init(XMLTests tests) { ExperimentNumber = 0; ResultToStore = ""; //var file1 = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), file); //if (!System.IO.File.Exists(file1)) // new Exception("The referenced file does not exist. " + file1); List<Item> experiment; List<Item> tuorial; foreach (var test in tests.Tests) { experiment = new List<Item>(); tuorial = new List<Item>(); foreach(var t in test.TutorialTracks) tuorial.Add(new Item(t.path)); foreach(var a in test.ActualTracks) experiment.Add(new Item(a.path)); ItemsToPlay.Add(experiment); TutorialItems.Add(tuorial); } TotExperiments = ItemsToPlay.Count; Debug.Log(TotExperiments); CurrentExperiment = ItemsToPlay[0]; CurrentTutorial = TutorialItems[0]; ItemsToPlay.RemoveAt(0); TutorialItems.RemoveAt(0); ExperimentNumber++; //Debug.Log("Items to play: " + ItemsToPlay.Count); //Debug.Log("Experiment to play: " + CurrentExperiment.Count); //Debug.Log("Experiment tutorial to play: " + CurrentTutorial.Count); }