Skip to content

Commit

Permalink
Fixed path for loading files (broken by new launcher)
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxgurugamer committed Dec 7, 2022
1 parent 457decf commit fa1e003
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 16 deletions.
21 changes: 21 additions & 0 deletions .vs/WaypointManager/project-colors.json
@@ -0,0 +1,21 @@
{
"Version": 1,
"ProjectMap": {
"c2c97615-1b94-4a31-9a68-042f6457403e": {
"ProjectGuid": "c2c97615-1b94-4a31-9a68-042f6457403e",
"DisplayName": "WaypointManager",
"ColorIndex": 0
},
"e9463310-6814-47f6-8fbe-881501c4309c": {
"ProjectGuid": "e9463310-6814-47f6-8fbe-881501c4309c",
"DisplayName": "Solution Items",
"ColorIndex": 1
},
"a2fe74e1-b743-11d0-ae1a-00a0c90fffc3": {
"ProjectGuid": "a2fe74e1-b743-11d0-ae1a-00a0c90fffc3",
"DisplayName": "Miscellaneous Files",
"ColorIndex": -1
}
},
"NextColorIndex": 2
}
5 changes: 4 additions & 1 deletion Changelog.txt
@@ -1,6 +1,9 @@
Changelog

2.8.4.4
2.8.3.5
Fixed path for loading files (broken by new launcher)

2.8.3.4
Fixed memory leak caused by the WaypointManagerGameEvents being unloaded

2.8.3.3
Expand Down
Binary file modified GameData/WaypointManager/Plugins/WaypointManager.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions GameData/WaypointManager/WaypointManager.version
Expand Up @@ -16,11 +16,11 @@
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
"PATCH": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
}
26 changes: 26 additions & 0 deletions GameData/WaypointManager/WaypointManager.version.1-12-3
@@ -0,0 +1,26 @@
{
"NAME": "Waypoint Manager",
"URL": "http://ksp.spacetux.net/avc/WaypointManager",
"DOWNLOAD": "https://github.com/linuxgurugamer/WaypointManager/releases",
"GITHUB": {
"USERNAME": "jrossignol",
"REPOSITORY": "WaypointManager",
"ALLOW_PRE_RELEASE": false
},
"VERSION": {
"MAJOR": 2,
"MINOR": 8,
"PATCH": 3,
"BUILD": 4
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
6 changes: 3 additions & 3 deletions WaypointManager.version
Expand Up @@ -11,16 +11,16 @@
"MAJOR": 2,
"MINOR": 8,
"PATCH": 3,
"BUILD": 4
"BUILD": 5
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
"PATCH": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
}
26 changes: 26 additions & 0 deletions WaypointManager.version.1-12-3
@@ -0,0 +1,26 @@
{
"NAME": "Waypoint Manager",
"URL": "http://ksp.spacetux.net/avc/WaypointManager",
"DOWNLOAD": "https://github.com/linuxgurugamer/WaypointManager/releases",
"GITHUB": {
"USERNAME": "jrossignol",
"REPOSITORY": "WaypointManager",
"ALLOW_PRE_RELEASE": false
},
"VERSION": {
"MAJOR": 2,
"MINOR": 8,
"PATCH": 3,
"BUILD": 4
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
4 changes: 2 additions & 2 deletions WaypointManager/CustomWaypointGUI.cs
Expand Up @@ -235,9 +235,9 @@ public static void OnGUI()
foreach (ConfigNode configNode in iconConfig)
{
string dir = configNode.GetValue("url");
if (Directory.Exists("GameData/" + dir))
if (Directory.Exists(KSPUtil.ApplicationRootPath+"GameData/" + dir))
{
foreach (var str in Directory.GetFiles("GameData/" + dir))
foreach (var str in Directory.GetFiles(KSPUtil.ApplicationRootPath+"GameData/" + dir))
{
var icon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref icon, str);
Expand Down
79 changes: 79 additions & 0 deletions WaypointManager/WaypointFlightRenderer.cs
Expand Up @@ -70,6 +70,85 @@ public void OnShowUI()
visible = true;
}

#if false
new bool enabled = false;

bool drag = false;
float offset_x;
float offset_y;

void OnMouseDown()
{
drag = true;
offset_x = rightBoxLeft - Input.mousePosition.x / Screen.width;
//offset_y = guiText.transform.position.y - (Screen.height - Input.mousePosition.y) / Screen.height;
}

void OnMouseUp()
{
drag = false;

rightBoxLeft = Input.mousePosition.x / Screen.width;
//Settings.position_y = (Screen.height - Input.mousePosition.y) / Screen.height;
}

float x, y;
public static KeyBinding PLUGIN_TOGGLE = new KeyBinding(KeyCode.F8);

void Update()
{
if (drag)
{
x = Input.mousePosition.x / Screen.width;
y = (Screen.height - Input.mousePosition.y) / Screen.height;
//guiText.transform.position = new Vector3(x + offset_x, y + offset_y, 0f);
}
else
{
x = Settings.position_x;
y = Settings.position_y;
}
if (PLUGIN_TOGGLE.GetKeyDown())
{
#if true
if (Input.GetKey(KeyCode.LeftControl)
|| Input.GetKey(KeyCode.RightControl))
{
if (!enabled)
{
return;
}
}
else
{
enabled = !enabled;
//guiText.enabled = enabled;

//guiText.useGUILayout = false;
}
#endif
}
if (enabled)
{
if (drag || fpsPos.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
{
bool b = Input.GetMouseButton(0);

if (!drag && b)
{
OnMouseDown();
}
else
if (drag && !b)
OnMouseUp();
drag = b;

}
else drag = false;
}
}
#endif

public void OnGUI()
{
if (visible && !ImportExport.helpDialogVisible)
Expand Down
16 changes: 8 additions & 8 deletions WaypointManager/WaypointManager.cs
Expand Up @@ -99,18 +99,18 @@ void OnDestroy()
private void LoadTextures()
{
Config.toolbarIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.toolbarIcon, "GameData/WaypointManager/PluginData/icons/toolbar");
ToolbarControl.LoadImageFromFile(ref Config.toolbarIcon, KSPUtil.ApplicationRootPath+"GameData/WaypointManager/PluginData/icons/toolbar");

Config.addWaypointIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.addWaypointIcon, "GameData/WaypointManager/PluginData/icons/addWaypoint");
ToolbarControl.LoadImageFromFile(ref Config.addWaypointIcon, KSPUtil.ApplicationRootPath + "GameData/WaypointManager/PluginData/icons/addWaypoint");
Config.editWaypointIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.editWaypointIcon, "GameData/WaypointManager/PluginData/icons/editWaypoint");
ToolbarControl.LoadImageFromFile(ref Config.editWaypointIcon, KSPUtil.ApplicationRootPath + "GameData/WaypointManager/PluginData/icons/editWaypoint");
Config.deleteWaypointIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.deleteWaypointIcon, "GameData/WaypointManager/PluginData/icons/deleteWaypoint");
ToolbarControl.LoadImageFromFile(ref Config.deleteWaypointIcon, KSPUtil.ApplicationRootPath + "GameData/WaypointManager/PluginData/icons/deleteWaypoint");
Config.settingsIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.settingsIcon, "GameData/WaypointManager/PluginData/icons/settings");
ToolbarControl.LoadImageFromFile(ref Config.settingsIcon, KSPUtil.ApplicationRootPath + "GameData/WaypointManager/PluginData/icons/settings");
Config.closeIcon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref Config.closeIcon, "GameData/WaypointManager/PluginData/icons/close");
ToolbarControl.LoadImageFromFile(ref Config.closeIcon, KSPUtil.ApplicationRootPath + "GameData/WaypointManager/PluginData/icons/close");
}

internal const string MODID = "WaypointManager";
Expand Down Expand Up @@ -178,10 +178,10 @@ void LoadConfiguration()
{
url += '/';
}
if (Directory.Exists("GameData/" + url))
if (Directory.Exists(KSPUtil.ApplicationRootPath + "GameData/" + url))
{

foreach (var str in Directory.GetFiles("GameData/" + url))
foreach (var str in Directory.GetFiles(KSPUtil.ApplicationRootPath + "GameData/" + url))
{
var icon = new Texture2D(2, 2);
ToolbarControl.LoadImageFromFile(ref icon, str);
Expand Down

0 comments on commit fa1e003

Please sign in to comment.