void LoadPreRequisites() { roomParentTransform = new GameObject("Level").transform; roomCollection = RoomCollection.Instance; roomCollection.Load(Application.dataPath + "/StreamingAssets/XML/room_collection.xml"); RoomData.BaseSize = roomCollection.BaseSize; roomFactory = new RoomFactory(); }
private void LoadRooms(TabPage roomTypeTab) { try { long TypeID = ((RoomType)roomTypeTab.Tag).Typeid; KryptonPanel roomOutlinePane = new KryptonPanel(); TableLayoutPanel roomLayoutPane = new TableLayoutPanel(); RoomCollection mRoomColl = new RoomCollection(); if (TypeID > -1) mRoomColl.Where(Room.TypeidColumn.ColumnName, TypeID).Load(); else mRoomColl.Load(); roomLayoutPane.RowCount = mRoomColl.Count >= 26 ? mRoomColl.Count - 1 : 25; roomLayoutPane.ColumnCount = 12; roomLayoutPane.Size = new Size(ROOM_BUTTON_WIDTH * roomLayoutPane.RowCount + 3, ROOM_BUTTON_HEIGHT * roomLayoutPane.ColumnCount + 3); int currRowIndex = 0; int currColIndex = 0; roomLayoutPane.SuspendLayout(); foreach (Room room in mRoomColl) { var roomButton = new KryptonButton { Name = ("RM" + room.Roomid), Size = new Size(ROOM_BUTTON_WIDTH, ROOM_BUTTON_HEIGHT), Text = (room.Name.Trim().ToLowerInvariant().StartsWith("room") ? room.Name : "Room " + room.Name), Tag = room }; CreateRoomMenu(roomButton); roomLayoutPane.Controls.Add(roomButton); roomLayoutPane.SetRow(roomButton, currRowIndex); roomLayoutPane.SetColumn(roomButton, currColIndex); if (currColIndex == roomLayoutPane.ColumnCount) { currRowIndex++; currColIndex = 0; } else { currColIndex++; } } roomLayoutPane.ResumeLayout(); roomLayoutPane.BackColor = Color.Transparent; roomOutlinePane.Dock = DockStyle.Fill; roomOutlinePane.Controls.Add(roomLayoutPane); roomTypeTab.Controls.Add(roomOutlinePane); //Add to Current Tab } catch (Exception ex) { } }