Exemplo n.º 1
0
    /// <summary>
    /// Loads the building data.
    /// </summary>
    void LoadBuildingData()
    {
        Building temp;

        //load science and computing data
        temp = new Building ("245", "Science and Computing");
        //add occupant names
        temp.AddOccupant ("Shri Rai");
        temp.AddOccupant ("Dr Mohd Fairuz Shiratuddin");
        temp.AddOccupant ("Danny Toohey");
        temp.AddOccupant ("Dr Kevin Wong");
        temp.AddOccupant ("Dr Hong Xie");
        temp.AddOccupant ("Dr Nik Thompson");
        temp.AddOccupant ("Dr Pyara Dhillon");
        temp.AddOccupant ("Dr Christian Payne");
        temp.AddOccupant ("Peter Cole");
        temp.AddOccupant ("Dr Graham Mann");
        //add services
        temp.AddService ("Computing Labs x5");
        temp.AddService ("Meeting Rooms x3");
        temp.AddService ("Research Labs x18");
        temp.AddService ("Male Toilets lvl 2");
        temp.AddService ("Female Toilets lvl 2");
        temp.AddService ("Male Toilets lvl 3");
        temp.AddService ("Female Toilets lvl 3");
        temp.AddService ("Male Emergency Shower 3.048");
        temp.AddService ("Female Emergency Shower 3.046");
        temp.AddService ("First Aid Room 3.052");
        temp.AddService ("RLT");
        //add lectures
        temp.AddLecture (8);
        //add building to building manager
        bm.AddBuilding (temp);

        //load library
        temp = new Building ("350", "Library");
        //add occupant names
        temp.AddOccupant ("Pamela Martin-Lynch");
        temp.AddOccupant ("Dr Rebecca Bennett");
        temp.AddOccupant ("Karyn Barenberg");
        temp.AddOccupant ("Dr Angela Jones");
        temp.AddOccupant ("Professor Geoffrey Bolton");
        temp.AddOccupant ("Kate Makowiecka");
        temp.AddOccupant ("Sonia Boccardo");
        temp.AddOccupant ("Ghylene Palmer");
        temp.AddOccupant ("Joanne Lisciandro");
        temp.AddOccupant ("Jodie-Lee McLeod");
        //add services
        temp.AddService ("Computing Labs x5");
        temp.AddService ("Meeting Rooms x2");
        temp.AddService ("Private Study Rooms x20");
        temp.AddService ("Silent Computing Lab lvl 1 South");
        temp.AddService ("Library & Information Services lvl 2 South");
        temp.AddService ("After Hours Entry lvl 2 Learning Link");
        temp.AddService ("DVD Viewing Rooms x3");
        temp.AddService ("Photocopying & Printing Services");
        temp.AddService ("IT Service Desk lvl 3 North");
        temp.AddService ("Reserve Section lvl 3 North");
        //no lectures
        //add building to building manager
        bm.AddBuilding (temp);

        //load ECL
        temp = new Building ("460", "Economics, Commerce and Law");
        //add occupant names
        temp.AddOccupant ("Andrew Syme");
        temp.AddOccupant ("Abigayle Carmody");
        temp.AddOccupant ("Nikola Horley");
        temp.AddOccupant ("Supratik Mukherji");
        temp.AddOccupant ("Dr Courtney Field");
        //add services
        temp.AddService ("Male/Female Toilets");
        temp.AddService ("Lift Access");
        temp.AddService ("Kitchens");
        temp.AddService ("Meeting/Seminar Rooms");
        temp.AddService ("Computer Labs");
        temp.AddService ("Post Graduate Area");
        temp.AddService ("Lunch Box Cafe");
        temp.AddService ("First Aid Boxes");
        temp.AddService ("Security Call Points");
        temp.AddService ("Catholic Chaplain");
        temp.AddService ("ECL1");
        temp.AddService ("ECL2");
        temp.AddService ("ECL3");
        temp.AddService ("ECL4");
        //add lectures
        temp.AddLecture (1);
        temp.AddLecture (9);
        temp.AddLecture (16);
        temp.AddLecture (17);
        temp.AddLecture (21);
        //add building to building manager
        bm.AddBuilding (temp);

        //load Chancellery
        temp = new Building ("330", "Chancellery");
        //add occupant names
        temp.AddOccupant ("Linda Barton");
        temp.AddOccupant ("Dr Erich von Dietze");
        temp.AddOccupant ("Dr Graham O'Hara");
        temp.AddOccupant ("Joanne Hulme");
        temp.AddOccupant ("Paul Comiskey");
        //add services
        temp.AddService ("Meeting Rooms x5");
        temp.AddService ("Male Toilets lvl 1");
        temp.AddService ("Female Toilets lvl 1");
        temp.AddService ("Male Toilets lvl 2");
        temp.AddService ("Female Toilets lvl 2");
        //no lectures
        //add building to building manager
        bm.AddBuilding (temp);

        //		//Load building data here
        //		string dirInfo = Application.dataPath + "/Resources/Buildings";
        //		string[] subdirectories = Directory.GetDirectories (dirInfo);
        //
        //		foreach (string d in subdirectories) //for each directory
        //		{
        //			Building temp = new Building();
        //			DirectoryInfo dir = new DirectoryInfo(d);
        //			string path = dir.Name;
        //			txtfile = Resources.Load("Buildings/" + path + "/building_info") as TextAsset;
        //			char[] separators = {'\n'};
        //			string[] linesFromfile = txtfile.text.Split (separators);
        //			string[] tokens;
        //
        //			//occupants
        //			int oIndex = 3; //index of first occupant
        //			tokens = linesFromfile[oIndex-1].Split(':'); //split "Number of Occupants: " string
        //			int oCount = Int32.Parse (tokens[1].Trim()); //get number of occupants
        //			//Debug.Log("OCCUPANTS " + oIndex.ToString() + "   " + tokens[1].Trim() + "   " + oCount.ToString());
        //
        //			//services
        //			int sIndex = oIndex + oCount + 1; //index of first service
        //			tokens = linesFromfile[sIndex-1].Split(':'); //split "Number of Services: " string
        //			int sCount = Int32.Parse (tokens[1].Trim()); //get the number of services
        //			//Debug.Log("SERVICES " + sIndex.ToString() + "   " + tokens[1].Trim() + "   " + sCount.ToString());
        //
        //			//lectures
        //			int lIndex = sIndex + sCount + 1; //index of the first lecture
        //			tokens = linesFromfile[lIndex-1].Split(':'); //split "Number of Lectures: " string
        //			//Debug.Log(tokens[1]);
        //			int lCount = Int32.Parse (tokens[1].Trim()); //get the number of lectures
        //
        //			//set building number
        //			tokens = linesFromfile[0].Split(':'); //split the "Building Number: " string
        //			temp.SetNumber(tokens[1].Trim()); //set the building number
        //
        //			//set building name
        //			tokens = linesFromfile[1].Split(':'); //split the "Building Name: " string
        //			temp.SetName(tokens[1].Trim()); //set the building name
        //
        //			//add occupants
        //			for(int i=oIndex; i<oIndex + oCount; i++)
        //			{
        //				temp.AddOccupant(linesFromfile[i]);
        //			}
        //
        //			//add services
        //			for(int i=sIndex; i<sIndex + sCount; i++)
        //			{
        //				temp.AddService(linesFromfile[i]);
        //			}
        //
        //			//add lectures
        //			if(lCount > 0)
        //			{
        //				for(int i=lIndex; i<lIndex + lCount; i++) //for each lecture
        //				{
        //					string room = linesFromfile[i].Trim ();
        //					temp.AddService(room + " (Lecture Room)");
        //
        //					for(int j=0; j<lm.NumberOfLectures(); j++) //for each lecture in lecture manager
        //					{
        //						//Debug.Log(lm.GetLectureAt(j).GetRoom());
        //						if(lm.GetLectureAt(j).GetRoom().Trim().Equals(room)) //if the lecture room matches current lecture room
        //							temp.AddLecture(lm.GetLectureAt(j).GetID());
        //					}
        //				}
        //			}
        //
        //			bm.AddBuilding(temp);
        //		}

        //		Debug.Log (">>>No Buildings");
        //		Debug.Log(bm.NumberOfBuildings().ToString());
        //
        //		for(int i=0; i<bm.NumberOfBuildings(); i++)
        //		{
        //			Debug.Log (">>>Building");
        //			Debug.Log(bm.GetBuildingAt(i).GetName());
        //			Debug.Log(bm.GetBuildingAt(i).GetNumber());
        //
        //			Debug.Log (">>>Occupants");
        //			for(int j=0; j<bm.GetBuildingAt(i).NumberOfOccupants(); j++)
        //				Debug.Log(bm.GetBuildingAt(i).GetOccupantAt(j));
        //
        //			Debug.Log (">>>Services");
        //			for(int j=0; j<bm.GetBuildingAt(i).NumberOfServices(); j++)
        //				Debug.Log(bm.GetBuildingAt(i).GetServiceAt(j));
        //
        //			Debug.Log (">>>Lectures");
        //			Debug.Log(bm.GetBuildingAt(i).NumberOfLectures());
        //			for(int j=0; j<bm.GetBuildingAt(i).NumberOfLectures(); j++)
        //			{
        //				int id = bm.GetBuildingAt(i).GetLectureAt(j);
        //
        //				for(int k=0; k<lm.NumberOfLectures(); k++)
        //				{
        //					if(lm.GetLectureAt(k).GetID() == id)
        //						Debug.Log(lm.GetLectureAt(k).GetUnitCode() + " " + lm.GetLectureAt(k).GetUnitName());
        //				}
        //			}
        //		}
    }