Skip to content

Commit

Permalink
Release 0.5
Browse files Browse the repository at this point in the history
Added toolbar support for GameDatabase refresh icon for SpaceCenter, VAB
and SpacePlane Hangar. No more loading F12 debug menu!
  • Loading branch information
sirkut committed Jul 16, 2014
1 parent d7637aa commit 266c126
Show file tree
Hide file tree
Showing 5 changed files with 832 additions and 6 deletions.
29 changes: 28 additions & 1 deletion DevHelper/DevHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Xml.Serialization;
using UnityEngine;
using KSP.IO;
using MuMech;

namespace DevHelper
{
Expand All @@ -24,6 +25,7 @@ private void FindSaves()
saveNames = dirs.Where(x => System.IO.File.Exists(x + "\\persistent.sfs")).Select(x => x.Split(new[] { '\\' })[1]).ToList();
}

//IButton DHReloadDatabase;
private void Awake()
{
print("Injector awake");
Expand Down Expand Up @@ -109,7 +111,32 @@ private void Update()
}
}
}

private IButton DHReloadDatabase;

//private BoxDrawable boxDrawable;
internal void DHButtons() {
// button that toggles its icon when clicked
DHReloadDatabase = ToolbarManager.Instance.add("DevHelper", "DHReloadGD");
DHReloadDatabase.TexturePath = "DevHelper/Textures/icon_buttonReload";
DHReloadDatabase.ToolTip = "Reload Game Database";
DHReloadDatabase.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.SPH, GameScenes.SPACECENTER);
DHReloadDatabase.OnClick += (e) =>
{
GameDatabase.Instance.Recompile = true;
GameDatabase.Instance.StartLoad();
PartLoader.Instance.Recompile = true;
PartLoader.Instance.StartLoad();
};
}

void OnDestroy()
{
if (ToolbarManager.ToolbarAvailable)
{
DHReloadDatabase.Destroy();
}
}


private bool isTooLateToLoad = false;

Expand Down
7 changes: 4 additions & 3 deletions DevHelper/DevHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\KSP_win_235\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\KSP_win32\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -41,17 +41,18 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\KSP_win_235\KSP_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>..\..\..\KSP_win32\KSP_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DevHelper.cs" />
<Compile Include="GUI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToolbarWrapper.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetFileName) C:\kerbal\KSP_win_235\GameData\DevHelper\Plugins\$(TargetFileName)</PostBuildEvent>
<PostBuildEvent>copy $(TargetFileName) C:\kerbal\KSP_win32\GameData\DevHelper\Plugins\$(TargetFileName)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
8 changes: 8 additions & 0 deletions DevHelper/GUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System.Xml.Serialization;
using UnityEngine;
using KSP.IO;
using MuMech;


namespace DevHelper
{
Expand All @@ -19,6 +21,7 @@ public partial class DevHelper : MonoBehaviour
private ComboBox comboBoxControlSpecificScene = new ComboBox();
private GUIStyle listStyle = new GUIStyle();


private void InitComboBox()
{
comboBoxList = saveNames.Select(x=>new GUIContent(x)).ToArray();
Expand Down Expand Up @@ -55,6 +58,10 @@ private void InitComboBoxScenes()

private void OnGUI()
{
if (ToolbarManager.ToolbarAvailable)
{
DHButtons();
}
if (!isTooLateToLoad)
{
//Auto load feature
Expand All @@ -81,6 +88,7 @@ private void OnGUI()
}
}


}


Expand Down
4 changes: 2 additions & 2 deletions DevHelper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
Loading

0 comments on commit 266c126

Please sign in to comment.