Skip to content

Commit

Permalink
Updated for KSP 1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
taraniselsu committed Apr 30, 2015
1 parent 85eacb5 commit ee8ae3e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
31 changes: 26 additions & 5 deletions Source/TacPartLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void Start()
button.Visible = true;

GameEvents.onEditorShipModified.Add(OnEditorShipModified);
GameEvents.onEditorRestart.Add(OnEditorRestart);
GameEvents.onLevelWasLoaded.Add(OnLevelWasLoaded);
}

Expand Down Expand Up @@ -102,6 +103,7 @@ void OnDestroy()
button.Destroy();

GameEvents.onEditorShipModified.Remove(OnEditorShipModified);
GameEvents.onEditorRestart.Remove(OnEditorRestart);
GameEvents.onLevelWasLoaded.Remove(OnLevelWasLoaded);

// Make sure we remove our locks
Expand Down Expand Up @@ -137,19 +139,38 @@ private void Save()
private void OnIconClicked()
{
window.ToggleVisible();
if (window.IsVisible())
{
this.Log("Window was made visible");
window.RefreshPartInfos(EditorLogic.fetch.ship.parts);
}
}

private void OnEditorShipModified(ShipConstruct shipConstruct)
{
this.Log("OnEditorShipModified - shipConstruct: " + shipConstruct);
window.RefreshPartInfos(shipConstruct.parts);
// may be EditorLogic.fetch.ship.parts , not shipConstruct.parts ? I'm not sure. It seems to me that it doesn't matter
if (window.IsVisible())
{
this.Log("OnEditorShipModified - shipConstruct: " + shipConstruct);
window.RefreshPartInfos(shipConstruct.parts);
}
}

private void OnEditorRestart()
{
if (window.IsVisible())
{
this.Log("OnEditorRestart");
window.RefreshPartInfos(EditorLogic.fetch.ship.parts);
}
}

private void OnLevelWasLoaded(GameScenes gameScene)
{
this.Log("Game scene loaded: " + gameScene);
window.RefreshPartInfos(EditorLogic.fetch.ship.parts);
if (window.IsVisible())
{
this.Log("Game scene loaded: " + gameScene);
window.RefreshPartInfos(EditorLogic.fetch.ship.parts);
}
}
}
}
8 changes: 4 additions & 4 deletions Source/TacPartLister.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<Import Project="..\TacLib\Source\CommonProperties.proj" />
<PropertyGroup>
<AssemblyMajorVersion>1</AssemblyMajorVersion>
<AssemblyMinorVersion>3</AssemblyMinorVersion>
<AssemblyBuildNumber>1</AssemblyBuildNumber>
<AssemblyMinorVersion>4</AssemblyMinorVersion>
<AssemblyBuildNumber>0</AssemblyBuildNumber>
<AssemblyFileMajorVersion>$(AssemblyMajorVersion)</AssemblyFileMajorVersion>
<AssemblyFileMinorVersion>$(AssemblyMinorVersion)</AssemblyFileMinorVersion>
<AssemblyFileBuildNumber>$(AssemblyBuildNumber)</AssemblyFileBuildNumber>
Expand All @@ -94,8 +94,8 @@
<ModUrl>http://ksp-avc.cybutek.net/version.php?id=71</ModUrl>
<DownloadUrl>
</DownloadUrl>
<KspVersionMajor>0</KspVersionMajor>
<KspVersionMinor>90</KspVersionMinor>
<KspVersionMajor>1</KspVersionMajor>
<KspVersionMinor>0</KspVersionMinor>
<KspVersionPatch>0</KspVersionPatch>
</PropertyGroup>
<Target Name="BeforeBuild">
Expand Down

0 comments on commit ee8ae3e

Please sign in to comment.