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

Commit

Permalink
Merge pull request #19 from Crzyrndm/master
Browse files Browse the repository at this point in the history
Update from parent.
  • Loading branch information
Kerbas-ad-astra authored Jun 26, 2016
2 parents 0079f03 + 259a942 commit ed8367c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 49 deletions.
2 changes: 1 addition & 1 deletion FilterExtension/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace FilterExtensions
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
public class Core : MonoBehaviour
{
public static readonly Version version = new Version(2, 5, 1, 0);
public static readonly Version version = new Version(2, 6, 0, 0);

private static Core instance;
public static Core Instance
Expand Down
8 changes: 4 additions & 4 deletions FilterExtension/FilterExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>set SOURCE="D:\Users\Joshua\GitHub\FilterExtension\GameData"
set DESTINATION="D:\Users\Joshua\Desktop\Kerbal Space Program Dev\GameData"
<PostBuildEvent>set SOURCE="D:\Libraries\GitHub\FilterExtension\GameData"
set DESTINATION="D:\Libraries\Desktop\Kerbal Space Program Dev\GameData"
xcopy %25SOURCE%25 %25DESTINATION%25 /E /C /R /I /K /Y

set SOURCE="D:\Users\Joshua\GitHub\FilterExtension\Testing"
set DESTINATION="D:\Users\Joshua\Desktop\Kerbal Space Program Dev\GameData\000_FilterExtensions Configs\Testing"
set SOURCE="D:\Libraries\GitHub\FilterExtension\Testing"
set DESTINATION="D:\Libraries\Desktop\Kerbal Space Program Dev\GameData\000_FilterExtensions Configs\Testing"
xcopy %25SOURCE%25 %25DESTINATION%25 /E /C /R /I /K /Y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
19 changes: 16 additions & 3 deletions FilterExtension/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;

namespace FilterExtensions
{
Expand All @@ -16,9 +18,9 @@ class Settings : MonoBehaviour
{
static Canvas settingsCanvasPrefab;
static Canvas windowInstance;
RectTransform windowPosition;


Rect settingsRect = new Rect(Screen.width / 2, Screen.height / 2, 400, 0);
static bool showWindow;
private static ApplicationLauncherButton btnLauncher;

public const string RelativeSettingsPath = "GameData/000_FilterExtensions/PluginData/";
Expand All @@ -32,7 +34,6 @@ class Settings : MonoBehaviour

public void Start()
{
showWindow = false;
if (btnLauncher == null)
btnLauncher = ApplicationLauncher.Instance.AddModApplication(toggleSettingsVisible, toggleSettingsVisible,
null, null, null, null, ApplicationLauncher.AppScenes.SPACECENTER,
Expand Down Expand Up @@ -123,6 +124,13 @@ static void toggleSettingsVisible()
private void InstantiateCanvas()
{
windowInstance = Instantiate(settingsCanvasPrefab);
windowPosition = windowInstance.transform.GetChild(0) as RectTransform; // windowInstance.gameObject.GetChild("Panel");
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.Drag;
entry.callback = new EventTrigger.TriggerEvent();
entry.callback.AddListener((x) => windowDrag(x));
windowPosition.gameObject.GetComponent<EventTrigger>().triggers.Add(entry);


Toggle[] boolSettings = windowInstance.GetComponentsInChildren<Toggle>();
foreach (Toggle t in boolSettings)
Expand Down Expand Up @@ -193,5 +201,10 @@ public void subCat_txtInputChanged(string newValue)
{
Settings.subCategoryDefault = newValue;
}

public void windowDrag(UnityEngine.EventSystems.BaseEventData data)
{
windowPosition.position += new Vector3(((PointerEventData)data).delta.x, ((PointerEventData)data).delta.y);
}
}
}
10 changes: 5 additions & 5 deletions FilterExtension/Utility/PartType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ public static bool checkCategory(AvailablePart part, string[] value)
return value.Contains("Pods", StringComparer.OrdinalIgnoreCase);
case PartCategories.Propulsion:
if (isEngine(part))
return value.Contains("Engines", StringComparer.OrdinalIgnoreCase);
return value.Contains("Engines", StringComparer.OrdinalIgnoreCase) || value.Contains("Engine", StringComparer.OrdinalIgnoreCase);
else
return value.Contains("Fuel Tanks", StringComparer.OrdinalIgnoreCase);
return value.Contains("Fuel Tanks", StringComparer.OrdinalIgnoreCase) || value.Contains("FuelTank", StringComparer.OrdinalIgnoreCase);
case PartCategories.Engine:
return value.Contains("Engines", StringComparer.OrdinalIgnoreCase);
return value.Contains("Engines", StringComparer.OrdinalIgnoreCase) || value.Contains("Engine", StringComparer.OrdinalIgnoreCase);
case PartCategories.FuelTank:
return value.Contains("Fuel Tanks", StringComparer.OrdinalIgnoreCase);
return value.Contains("Fuel Tanks", StringComparer.OrdinalIgnoreCase) || value.Contains("FuelTank", StringComparer.OrdinalIgnoreCase);
case PartCategories.Control:
return value.Contains("Control", StringComparer.OrdinalIgnoreCase);
case PartCategories.Structural:
return value.Contains("Structural", StringComparer.OrdinalIgnoreCase);
case PartCategories.Aero:
return value.Contains("Aerodynamics", StringComparer.OrdinalIgnoreCase);
return value.Contains("Aerodynamics", StringComparer.OrdinalIgnoreCase) || value.Contains("Aero", StringComparer.OrdinalIgnoreCase);
case PartCategories.Utility:
return value.Contains("Utility", StringComparer.OrdinalIgnoreCase);
case PartCategories.Science:
Expand Down
38 changes: 3 additions & 35 deletions GameData/000_FilterExtensions Configs/SubCategories_Bulkhead.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,7 @@ SUBCATEGORY
CHECK
{
type = profile
value = optA
}
}
FILTER
{
CHECK
{
type = profile
value = k
value = optA, k
}
}
}
Expand All @@ -86,15 +78,7 @@ SUBCATEGORY
CHECK
{
type = profile
value = optB
}
}
FILTER
{
CHECK
{
type = profile
value = j
value = optB, j
}
}
}
Expand Down Expand Up @@ -248,23 +232,7 @@ SUBCATEGORY
CHECK
{
type = profile
value = size2
}
}
FILTER
{
CHECK
{
type = profile
value = i //temporary check to catch OPT's "i"-type cockpits.
}
}
FILTER
{
CHECK
{
type = profile
value = optI //temporary check to catch OPT's "i"-type cockpits.
value = size2, i, optI
}
}
}
Expand Down
Binary file modified GameData/000_FilterExtensions/FilterExtensions.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion GameData/000_FilterExtensions/FilterExtensions.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"NAME":"Filter Extensions","URL":"https://github.com/Crzyrndm/FilterExtension/blob/master/GameData/000_FilterExtensions/FilterExtensions.version","DOWNLOAD":"https://github.com/Crzyrndm/FilterExtension/releases","VERSION":{"MAJOR":2,"MINOR":5,"PATCH":2,"BUILD":0},"KSP_VERSION":{"MAJOR":1,"MINOR":1,"PATCH":2}}
{"NAME":"Filter Extensions","URL":"https://github.com/Crzyrndm/FilterExtension/blob/master/GameData/000_FilterExtensions/FilterExtensions.version","DOWNLOAD":"https://github.com/Crzyrndm/FilterExtension/releases","VERSION":{"MAJOR":2,"MINOR":6,"PATCH":0,"BUILD":0},"KSP_VERSION":{"MAJOR":1,"MINOR":1,"PATCH":3}}
Binary file modified GameData/000_FilterExtensions/fesettings.ksp
Binary file not shown.

0 comments on commit ed8367c

Please sign in to comment.