Esempio n. 1
0
 public Room(string name, Area area)
 {
     InitializeRoom();
     Name = name;
     Description = Name + " is a newly created room";
     Area = area;
 }
Esempio n. 2
0
 public Room(string name, string description, Area area)
 {
     InitializeRoom();
     Name = name;
     Description = description;
     Area = area;
 }
Esempio n. 3
0
 public AreaForm(Area area)
 {
     this.area = area;
     InitializeComponent();
     DisplayArea();
     RefreshRooms();
 }
Esempio n. 4
0
 public Room(Area area)
 {
     InitializeRoom();
     Name = "New Room";
     Description = "This is a newly created room";
     Area = area;
 }
Esempio n. 5
0
 private void CreateDefaultAdminArea()
 {
     // if (File.Exists("path to area template folder.adminTemplate.xml"){
     //    area.Load("adminTemplate.xml");
     //} else {
     area = Build.AdminArea();
     DisplayArea();
     RefreshRooms();
 }
Esempio n. 6
0
 private void areaComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     string name = areaComboBox.SelectedItem.ToString();
     SelectedArea = Common.Settings.World.Areas.Find(area => area.Name == (string)areaComboBox.SelectedItem);
     roomListBox.Items.Clear();
     roomListBox.Items.AddRange(SelectedArea.Rooms.Select(room => room.Name).ToArray());
     if (roomListBox.Items.Count > 0) roomListBox.SelectedIndex = roomListBox.Items.IndexOf(Exit.Owner.Name);
     propertyGrid.Refresh();
 }
Esempio n. 7
0
 public ExitEditor(Exit exit)
 {
     InitializeComponent();
     Exit = exit.ShallowCopy();
     propertyGrid.SelectedObject = Exit;
     SelectedArea = Exit.Area;
     if (Common.Settings.World.Areas.Any()) {
         areaComboBox.Items.AddRange(Common.Settings.World.Areas.Select(x => x.Name).ToArray());
         areaComboBox.SelectedIndex = areaComboBox.Items.IndexOf(SelectedArea.Name);
     }
 }
Esempio n. 8
0
 private void areaComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     string name = areaComboBox.SelectedItem.ToString();
     SelectedArea = world.Areas.Find(area => area.Name == (string)areaComboBox.SelectedItem);
     areaTextBox.Text = SelectedArea.Name;
     roomsListBox.Items.Clear();
     roomsListBox.Items.AddRange(SelectedArea.Rooms.Select(room => room.Name).ToArray());
     SelectedRoom = SelectedArea.Rooms.List[0];
     if (roomsListBox.Items.Count > 0) {
         roomsListBox.SelectedIndex = 0;
         roomTextBox.Text = SelectedRoom.Name;
     }
 }
Esempio n. 9
0
        public RoomForm(Room room, ApplicationSettings settings)
        {
            InitializeComponent();

            roomEdits = Functions.CloneRoomToEdit(room, settings);
            roomCheckBoxList = new List<CheckBox>();
            roomCheckBoxList.Add(roomTypeCheckBox);
            roomCheckBoxList.Add(roomLimitCheckBox);
            roomCheckBoxList.Add(roomTraitsCheckBox);

            roomTypeCheckBox.Tag = roomItem.roomType;
            roomLimitCheckBox.Tag = roomItem.roomLimits;
            roomTraitsCheckBox.Tag = roomItem.roomTraits;

            this.settings = settings;
            roomTypeTextBox.Text = GetRoomTypeFlaggedList(roomItem.roomType);

            name = nameTextBox.Text = room.Name;
            area = room.Linkage.Area;
            areaLabel.Text = room.Linkage.Area.Name;
            description = descriptionTextBox.Text = room.Description;
            tagTextBox.Text = room.Tag;

            PopulateExitRestrictedCheckedComboBox(Enum.GetNames(typeof(exitRestrictionType)));
            PopulateExitListBox(room.Exits);
            PopulateAreaComboBox(settings.world.Areas.ToArray());
            PopulateRoomComboBox();

            PopulateRoomLimitsCheckedComboBox();
            PopulateRoomTraitsCheckedComboBox();

            exitLinkTypeComboBox.DataSource = Enum.GetValues(typeof(exitType));
            exitDoorLockTypeComboBox.DataSource = Enum.GetValues(typeof(lockType));
            exitDoorDirectionalComboBox.DataSource = Enum.GetValues(typeof(direction));
            exitLinkTypeComboBox.DataSource = Enum.GetValues(typeof(exitType));

            CheckAttributes();
        }
Esempio n. 10
0
 public void LoadXml(string filename)
 {
     if (Areas.Count > 0) Areas.Clear();
     string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     XmlDocument doc = new XmlDocument();
     doc.Load(path + filename);
     XmlNode root = doc.DocumentElement;
     XmlNodeList nodes = root.SelectNodes("Areas");
     foreach (XmlNode node in nodes) {
         Area newArea = new Area();
         newArea.LoadXml(node);
         Areas.Add(newArea);
     }
     foreach(Area area in Areas) {
         foreach(Room room in area.Rooms) {
             foreach(Exit exit in room.Exits) {
                 exit.Validate();
             }
         }
     }
 }
Esempio n. 11
0
 public void LoadXml(XmlNode node, Area area)
 {
     Name = node["Name"].InnerText;
     Description = node["Description"].InnerText;
     shortDescription = node["ShortDescription"].InnerText;
     Tag = node["Tag"].InnerText;
     Area = area;
     var exitsNode = node.SelectSingleNode("Exits");
     if (exitsNode != null) {
         XmlNodeList exits = node["Exits"].SelectNodes("Exit");
         foreach (XmlNode exit in exits) {
             Exit newExit = new Exit();
             newExit.LoadXml(exit, this);
             Exits.Add(newExit);
         }
     }
 }
Esempio n. 12
0
 private void Button_Click(object sender, EventArgs e)
 {
     if (((ToolStripSplitButton)sender).Text == "Exits:") return;
     SelectedRoom = ((Exit)((ToolStripSplitButton)sender).Tag).Room;
     SelectedArea = SelectedRoom.Area;
     RefreshEditor();
     SyncControls();
 }
Esempio n. 13
0
 public void Validate()
 {
     Area = Common.Settings.World.AreaByName(areaName);
     Room = Common.Settings.World.RoomByName(roomName);
 }
Esempio n. 14
0
        public void LoadXml(XmlNode node, Room room)
        {
            Owner = room;
            Area = room.Area;

            Name = node["Name"].InnerText;
            Description = node["Description"].InnerText;
            DoorLabel = node["DoorDescription"].InnerText;
            roomName = node["Room"].InnerText;
            areaName = node["Area"].InnerText;
            Visible = Convert.ToBoolean(node["Visible"].InnerText);
            Breakable = Convert.ToBoolean(node["Breakable"].InnerText);
            ExitType = (exitType)Enum.Parse(typeof(exitType), node["ExitType"].InnerText);

            var lockNode = node.SelectSingleNode("Lock");
            if (lockNode != null) {
                LockType = new lockType();
                XmlNodeList locks = node["Lock"].SelectNodes("LockType");
                foreach (XmlNode locktype in locks) {
                    LockType |= (lockType)Enum.Parse(typeof(lockType), locktype.InnerText);
                }
            }

            var doorNode = node.SelectSingleNode("Door");
            if (doorNode != null) {
                DoorType = new doorType();
                XmlNodeList doors = node["Door"].SelectNodes("DoorType");
                foreach (XmlNode doortype in doors) {
                    DoorType |= (doorType)Enum.Parse(typeof(doorType), doortype.InnerText);
                }
            }

            var restrictionNode = node.SelectSingleNode("Restrictions");
            if (restrictionNode != null) {
                Restrictions = new exitRestrictions();
                XmlNodeList restrictions = node["Restrictions"].SelectNodes("Restriction");
                foreach (XmlNode restriction in restrictions) {
                    Restrictions |= (exitRestrictions)Enum.Parse(typeof(exitRestrictions), restriction.InnerText);
                }
            }
        }
Esempio n. 15
0
 public void Validate()
 {
     Area = Common.Settings.World.AreaByName(areaName);
     Room = Common.Settings.World.RoomByName(roomName);
 }