/// <summary> /// Saves current window contents, creates a new room, navigates to it, and returns the number. /// This can be called from the edit window itself or from elsewhere, such as creating rooms /// from within exit editing. Navigating to the created room is optional, and inadvisable /// when creating rooms from exits. /// </summary> /// <returns></returns> public int AddNewRoom(bool navigate) { // We need to store current index so we can return to it later if need be. int selectedIndex = roomList.SelectedIndex; ApplyWindowContents(); RoomTemplate room = new RoomTemplate(); if (_area.HighRoomIndexNumber >= 0) { room.IndexNumber = _area.HighRoomIndexNumber + 1; } _area.Rooms.Add(room); _area.RebuildIndexes(); UpdateRoomList(); SetControlAvailability(); // Navigate either to the new room or the original room we were editing. if (navigate) { roomList.SelectedIndex = roomList.Items.Count - 1; UpdateWindowContents(room); } else { roomList.SelectedIndex = selectedIndex; } _parent.UpdateStatusBar(); _parent.UpdateRoomMap(); return(room.IndexNumber); }
private void btnNew_Click(object sender, EventArgs e) { ApplyWindowContents(); ObjTemplate obj = new ObjTemplate(); if (_area.HighObjIndexNumber >= 0) { obj.IndexNumber = _area.HighObjIndexNumber + 1; } _area.Objects.Add(obj); _area.RebuildIndexes(); UpdateObjList(); SetControlAvailability(); objectList.SelectedIndex = objectList.Items.Count - 1; UpdateWindowContents(obj); _parent.UpdateStatusBar(); }
private void btnNew_Click(object sender, EventArgs e) { ApplyWindowContents(); MobTemplate mob = new MobTemplate(); if (_area.HighMobIndexNumber >= 0) { mob.IndexNumber = _area.HighMobIndexNumber + 1; } _area.Mobs.Add(mob); _area.RebuildIndexes(); UpdateMobList(); SetControlAvailability(); mobList.SelectedIndex = mobList.Items.Count - 1; UpdateWindowContents(mob); _parent.UpdateStatusBar(); }
private void btnNew_Click(object sender, EventArgs e) { ApplyWindowContents(); QuestTemplate quest = new QuestTemplate(); _area.Quests.Add(quest); UpdateQuestList(); SetControlAvailability(); questList.SelectedIndex = questList.Items.Count - 1; UpdateWindowContents(quest); _parent.UpdateStatusBar(); }
private void btnNew_Click(object sender, EventArgs e) { ApplyWindowContents(); Shop shop = new Shop(); _area.Shops.Add(shop); UpdateShopList(); SetControlAvailability(); shopList.SelectedIndex = shopList.Items.Count - 1; UpdateWindowContents(shop); _parent.UpdateStatusBar(); }
private void btnNew_Click(object sender, EventArgs e) { ApplyWindowContents(); Reset reset = new Reset(); _area.Resets.Add(reset); UpdateResetList(); SetControlAvailability(); resetList.SelectedIndex = resetList.Items.Count - 1; UpdateWindowContents(reset); _parent.UpdateStatusBar(); }