Skip to content

Commit

Permalink
Version 3.0
Browse files Browse the repository at this point in the history
KSP 1.1
  • Loading branch information
SirDiazo committed Apr 25, 2016
1 parent fdafe9a commit 8b5477c
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 47 deletions.
Binary file modified RCSLandAid.v12.suo
Binary file not shown.
82 changes: 45 additions & 37 deletions RCSLandAid/RCSLandAid.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using System.IO;

using KSP.UI.Screens;

namespace RCSLandAid
{
Expand All @@ -15,7 +16,7 @@ public class RCSLandingAid : MonoBehaviour

bool selectingTarget = false;
private IButton RCSla1Btn;

private bool buttonCreated = false;
//LineRenderer theLine = new LineRenderer();
//public static bool forceSASup = true;
//RCSLandingAidWindow RCSwin;
Expand All @@ -38,8 +39,8 @@ public class RCSLandingAid : MonoBehaviour

public void Start()
{
print("Landing Aid Ver. 2.7 start.");
RenderingManager.AddToPostDrawQueue(0, LAOnDraw); //GUI window hook
print("Landing Aid Ver. 3.0 start.");
//RenderingManager.AddToPostDrawQueue(0, LAOnDraw); //GUI window hook
byte[] importTxtRed = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconRed.png"); //load our button textures
byte[] importTxtBlue = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconBlue.png");
byte[] importTxt = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconWhiteB.png");
Expand Down Expand Up @@ -86,15 +87,33 @@ public void Start()
{
//AGXShow = true; //toolbar not installed, show AGX regardless
//now using stock toolbar as fallback
LAButton = ApplicationLauncher.Instance.AddModApplication(onStockToolbarClick, onStockToolbarClick, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("Diazo/RCSLandAid/iconWhiteB", false));
//LAButton = ApplicationLauncher.Instance.AddModApplication(onStockToolbarClick, onStockToolbarClick, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("Diazo/RCSLandAid/iconWhiteB", false));
StartCoroutine("AddButtons");
checkBlizzyToolbar = false;
}
//RCSLandingAidWindow RCSwin = new RCSLandingAidWindow();


}

public void LAOnDraw()
IEnumerator AddButtons()
{
while (!ApplicationLauncher.Ready)
{
yield return null;
}
if (!buttonCreated)
{
LAButton = ApplicationLauncher.Instance.AddModApplication(onStockToolbarClick, onStockToolbarClick, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("Diazo/RCSLandAid/iconWhiteB", false));
//GameEvents.onGUIApplicationLauncherReady.Remove(AddButtons);
//CLButton.onLeftClick(StockToolbarClick);
LAButton.onRightClick = (Callback)Delegate.Combine(LAButton.onLeftClick, LeftClick); //combine delegates together
LAButton.onRightClick = (Callback)Delegate.Combine(LAButton.onRightClick, RightClick); //combine delegates together
buttonCreated = true;
}
}

public void OnGUI()
{
if (showLAMenu)
{
Expand All @@ -119,14 +138,15 @@ public void onStockToolbarClick()
{

//print("mouse " + Input.GetMouseButtonUp(1) + Input.GetMouseButtonDown(1));
if (Input.GetMouseButtonUp(1))
{
RightClick();
}
else
{
LeftClick();
}
//superceeded by delegates in KSP 1.1
//if (Input.GetMouseButtonUp(1))
//{
// RightClick();
//}
//else
//{
// LeftClick();
//}

}

Expand Down Expand Up @@ -260,52 +280,40 @@ public void SetHoldOnHere()
}
}

public void LeftClick()
public Callback LeftClick = delegate
{
if (curVsl != null)
{
if (curVsl.controlState == 0)
{
SetHoverOn();
FindObjectOfType<RCSLandingAid>().SetHoverOn();
}
else
{
SetHoverOff();
FindObjectOfType<RCSLandingAid>().SetHoverOff();
}
}

}
};

public void RightClick()


public Callback RightClick = delegate
{
if (curVsl != null)
{
if (curVsl.controlState == 2)
{
SetHoverOn();
//curVsl.controlState = 1;
//curVsl.targetSelected = false;
//selectingTarget = false;
//curVsl.theLine.SetWidth(0, 0);
//if (checkBlizzyToolbar)
//{
// RCSla1Btn.TexturePath = "Diazo/RCSLandAid/iconBlue";
// RCSla1Btn.Drawable = null;
//}
//else
//{
// LAButton.SetTexture(btnBlue);
// showLAMenu = false;
//}

FindObjectOfType<RCSLandingAid>().SetHoverOn();

}
else
{
SetHoldOn();
FindObjectOfType<RCSLandingAid>().SetHoldOn();

}
}
}
};

public bool DataModulePresent(Vessel vsl)
{
Expand Down
36 changes: 26 additions & 10 deletions RCSLandAid/RCSLandAid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,45 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\1.0.5 Dev\GameData\Diazo\RCSLandAid\</OutputPath>
<OutputPath>..\..\..\..\1.1 Dev\GameData\Diazo\RCSLandAid\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\1.0.5 Dev\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\1.0.5 Dev\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="KSPAssets">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPAssets.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="KSPCore">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="KSPUtil">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPUtil.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\1.0.5 Dev\KSP_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions RCSLandAid/obj/Release/RCSLandAid.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ H:\1.0.4 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.dll
H:\1.0.4 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.pdb
H:\1.0.5 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.dll
H:\1.0.5 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.pdb
H:\1.1 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.dll
H:\1.1 Dev\GameData\Diazo\RCSLandAid\RCSLandAid.pdb
Binary file not shown.
Binary file modified RCSLandAid/obj/Release/RCSLandAid.dll
Binary file not shown.
Binary file modified RCSLandAid/obj/Release/RCSLandAid.pdb
Binary file not shown.

0 comments on commit 8b5477c

Please sign in to comment.