public void LoadPanel(PanelItemHolder panelToLoadTo, PanelItemHolder panelToLoadFrom) { panelToLoadTo.RemoveAll(); for (int i = 0; i < items.Length; i++) { panelToLoadTo.AddType(items[i], subitems[i], panelToLoadFrom); } }
public void AddType(string t, int subitem, PanelItemHolder fromPanel) { PuzzleItem item; item = fromPanel.getItemByType(t, subitem); if (item != null) { this.InsertBefore(item.Clone(), this.GetNumberOfItems()); } }
public override bool Equals(object obj) { try { if (obj is PanelItemHolder) { PanelItemHolder aPanelItemHolder = (PanelItemHolder)obj; return(base.Equals(obj) && aPanelItemHolder.PuzzleItems.Equals(this.PuzzleItems)); } else { return(false); } } catch { return(false); } }
public static void PopulateWithAllItems(PanelItemHolder holder) { string[] filePaths = Directory.GetFiles(itemDirectory, "*.bee"); string[] temp; foreach (string path in filePaths) { if (path.EndsWith(individualItemExtension)) { temp = path.Split('\\'); PuzzleItem aPuzzleItem = new PuzzleItem(temp[temp.Length - 1].Replace(individualItemExtension, "")); //get each subcatagory for (int i = 0; i <= aPuzzleItem.SubcatagoryIndexMax; i++) { holder.InsertBefore(aPuzzleItem.Clone(), 0); aPuzzleItem.ToggleSubcatagory(); } } } }
public void AddType(string t, int subitem, PanelItemHolder fromPanel) { PuzzleItem item; item = fromPanel.getItemByType(t, subitem); if (item != null) this.InsertBefore(item.Clone(), this.GetNumberOfItems()); }
private void MarkAsSender(PanelItemHolder panel) { lastClickedPanel = panel; }
public static void PopulateWithAllItemsCollection(PanelItemHolder holder, string styleName, string filterName) { List<PuzzleItem> allItems = new List<PuzzleItem>(); // can only have duplicates in same style List<PuzzleItem> styleItems = new List<PuzzleItem>(); // can have duplicates List<PuzzleItem> nonMatchingItems = new List<PuzzleItem>(); List<PuzzleItem> sortedItems = new List<PuzzleItem>(); List<PuzzleItem> remainingItems = new List<PuzzleItem>(); int RecursionDepth = 0; //List<string> filter; //Global.Filters.TryGetValue(filterName, out filter); //switch (filterName) //{ // case "All Items": filter = null; // break; // case "Portal 2 Items": filter = Portal2Items; // break; // case "BEE Items": filter = BEE1Items; // break; // case "HMW Items": filter = HMWItems; // break; // case "Carl's Items": filter = CarlItems; // break; // case "FGE Items": filter = FGEItems; // break; // case "Miscellaneous": filter = MiscItems; // break; // default: filter = null; // break; //} VBSPStyle style = Global.GetStyle(styleName); while (style != null) { RecursionDepth++; if (RecursionDepth > 12) break; styleItems.Clear(); foreach (PuzzleItem aPuzzleItem in style.BaseItems) { if ((!HasItemType(allItems, aPuzzleItem.TypeName))) { //get each subcatagory for (int i = 0; i <= aPuzzleItem.SubcatagoryIndexMax; i++) { styleItems.Add(aPuzzleItem.Clone()); aPuzzleItem.ToggleSubcatagory(); } } } allItems.AddRange(styleItems); style = Global.GetStyle(style.Base); } // repeat for base style of this style, so eg. 1950s items show up for 1970 if they aren't in 1970 //if (filterName != "Items Matching Style") //{ // // lastly, add any remaining items that don't have a matching style // foreach (VBSPStyle style2 in Global.ListOfStyles) // { // foreach (PuzzleItem aPuzzleItem in style2.BaseItems) // { // if ((!HasItemType(allItems, aPuzzleItem.TypeName))) // { // //get each subcatagory // for (int i = 0; i <= aPuzzleItem.SubcatagoryIndexMax; i++) // { // PuzzleItem subtype = aPuzzleItem.Clone(); // if (subtype.PreviewImage != null) // { // subtype.PreviewImage = Global.ScaleImage(subtype.PreviewImage, 64, 64); // using (Graphics g = Graphics.FromImage(subtype.PreviewImage)) // { // g.DrawString(style2.Name, new Font("Tahoma", 12), Brushes.Blue, new PointF(0, 0)); // } // } // allItems.Add(subtype); // aPuzzleItem.ToggleSubcatagory(); // } // } // } // } //} //else //{ // // lastly, add any remaining items that don't have a matching style // foreach (VBSPStyle style2 in Global.ListOfStyles) // { // foreach (PuzzleItem aPuzzleItem in style2.BaseItems) // { // if ((!HasItemType(allItems, aPuzzleItem.TypeName))) // { // //get each subcatagory // for (int i = 0; i <= aPuzzleItem.SubcatagoryIndexMax; i++) // { // PuzzleItem subtype = aPuzzleItem.Clone(); // if (subtype.PreviewImage != null) // { // subtype.PreviewImage = Global.ScaleImage(subtype.PreviewImage, 64, 64); // using (Graphics g = Graphics.FromImage(subtype.PreviewImage)) // { // g.DrawString(style2.Name, new Font("Tahoma", 12), Brushes.Blue, new PointF(0, 0)); // } // } // holder.unfilteredPuzzleItems.Add(subtype); // aPuzzleItem.ToggleSubcatagory(); // } // } // } // } //} foreach (PuzzleItem p in allItems) { holder.InsertBefore(p, 0); } //////if (filter != null) //////{ ////// // now sort them according to the filter ////// string[] sorter = filter.ToArray(); ////// //if (sorter == null || sorter == MiscItems) sorter = AllItems; ////// remainingItems.AddRange(allItems); ////// foreach (string s in sorter) ////// { ////// // in order, add all items that match to the sortedItems ////// foreach (PuzzleItem p in allItems) ////// { ////// if (p.TypeName == s) ////// { ////// sortedItems.Add(p); ////// remainingItems.Remove(p); ////// } ////// } ////// } ////// sortedItems.AddRange(remainingItems); ////// // now add them all to our PanelItemHolder ////// foreach (PuzzleItem aPuzzleItem in sortedItems) ////// { ////// if (filter.Contains(aPuzzleItem.TypeName)) ////// holder.InsertAfter(aPuzzleItem, holder.GetNumberOfItems() - 1); ////// else ////// holder.PuzzleItems.Add(aPuzzleItem); ////// } //////} if (filterName.Trim() == "Items Matching Style") { remainingItems.Clear(); remainingItems.AddRange(allItems); // lastly, add any remaining items that don't have a matching style //foreach (VBSPStyle style2 in Global.ListOfStyles) //{ VBSPStyle style2 = Global.GetStyle(StyleName); foreach (PuzzleItem aPuzzleItem in style2.BaseItems) { if (aPuzzleItem.SubcatagoryIndexMax > 0) { holder.InsertAfter(aPuzzleItem.Clone(), holder.GetNumberOfItems() - 1); remainingItems.Remove((from ri in remainingItems where ri.TypeName == aPuzzleItem.TypeName select ri).FirstOrDefault()); } // if ((!HasItemType(allItems, aPuzzleItem.TypeName))) // { // //get each subcatagory // for (int i = 0; i <= aPuzzleItem.SubcatagoryIndexMax; i++) // { // PuzzleItem subtype = aPuzzleItem.Clone(); // if (subtype.PreviewImage != null) // { // subtype.PreviewImage = Global.ScaleImage(subtype.PreviewImage, 64, 64); // using (Graphics g = Graphics.FromImage(subtype.PreviewImage)) // { // g.DrawString(style2.Name, new Font("Tahoma", 12), Brushes.Blue, new PointF(0, 0)); // } // } // holder.InsertAfter(subtype, holder.GetNumberOfItems() - 1); // //holder.unfilteredPuzzleItems.Add(subtype); // aPuzzleItem.ToggleSubcatagory(); // } // } } foreach (PuzzleItem aPuzzleItem in remainingItems) { holder.PuzzleItems.Add(aPuzzleItem); } //holder.PuzzleItems.AddRange(remainingItems); //} } int oooo = 0; }