Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Crzyrndm committed Dec 26, 2014
1 parent 3b743b7 commit 57f974c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
29 changes: 23 additions & 6 deletions FilterExtension/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class customCategory
internal Color colour;
internal string type;
internal string value; // mod folder name for mod type categories

internal static AvailablePart roid = PartLoader.Instance.parts.First(ap => ap.name == "PotatoRoid");
internal string location; // filter == top set, category = custom section

public customCategory(ConfigNode node)
{
Expand All @@ -24,18 +23,20 @@ public customCategory(ConfigNode node)
convertToColor(node.GetValue("colour"));
type = node.GetValue("type");
value = node.GetValue("value");
location = node.GetValue("location");
}

internal void initialise()
{
if (categoryTitle == null)
return;

// PartCategorizer.Instance.filters.Add(new PartCategorizer.Category(
// PartCategorizer.ButtonType.FILTER, EditorPartList.State.PartsList, categoryTitle, Core.getIcon(iconName), colour, colour,


PartCategorizer.AddCustomFilter(categoryTitle, Core.getIcon(iconName), colour);

//PartCategorizer.Instance.filters.Add(new PartCategorizer.Category(
// PartCategorizer.ButtonType.FILTER, EditorPartList.State.PartsList, categoryTitle, Core.getIcon(iconName), colour, colour,
// new EditorPartListFilter<AvailablePart>(categoryTitle, (part => Exclude(part)))));

PartCategorizer.Category category = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == categoryTitle);
category.displayType = EditorPartList.State.PartsList;
category.exclusionFilter = PartCategorizer.Instance.filterGenericNothing;
Expand Down Expand Up @@ -65,6 +66,22 @@ private bool Filter(AvailablePart part, string category)
return false;
}

private bool Exclude(AvailablePart part)
{
if (PartType.checkFolder(part, value))
return true;
else
return false;
}

private bool genericExclude(AvailablePart part)
{
if (part.category != PartCategories.none)
return true;
else
return false;
}

private void convertToColor(string hex_ARGB)
{
hex_ARGB = hex_ARGB.Replace("#", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CATEGORY
title = TestCategory
icon = R&D_node_icon_experimentalmotors
colour = #FF0000FF
location = filter
}

SUBCATEGORY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CATEGORY
colour = #FF00FF00
type = mod
value = Squad
location = category
}

SUBCATEGORY
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CATEGORY
{
title = TestNASA
icon = R&D_node_icon_experimentalmotors
colour = #FF00FF00
type = mod
value = NASAmission
location = filter
}

SUBCATEGORY
{
category = TestNASA
title = TestCustom1
icon = R&D_node_icon_advrocketry
FILTER
{
CHECK
{
type = custom
value = isEngine
pass = true
}
}
}
Binary file modified GameData/Filter Extensions/FilterExtensions.dll
Binary file not shown.

0 comments on commit 57f974c

Please sign in to comment.