Skip to content

Commit

Permalink
Merge pull request #15 from ihsoft/next
Browse files Browse the repository at this point in the history
Release 1.6
  • Loading branch information
ihsoft authored Mar 9, 2018
2 parents b53fa9b + 717c185 commit 648cf30
Show file tree
Hide file tree
Showing 14 changed files with 1,598 additions and 480 deletions.
Binary file removed Binaries/KSPDev_Utils.0.28.dll
Binary file not shown.
Binary file added Binaries/KSPDev_Utils.0.31.dll
Binary file not shown.
1,187 changes: 750 additions & 437 deletions Binaries/KSPDev_Utils.0.28.xml → Binaries/KSPDev_Utils.0.31.xml

Large diffs are not rendered by default.

Binary file modified Binaries/MiniAVC.dll
Binary file not shown.
674 changes: 674 additions & 0 deletions Binaries/MiniAVC_License.txt

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.6 (March 7th, 2018)
* [Change] KSP 1.4.0 compatibility.
* [Change] Completely disable the highlighting logic if the alpha component of the highlight color is 0.

# 1.5 (September 19th, 2017)
* [Fix #11] Wrong location of the settings file.
* [Change] Fix the location of the localization files.
Expand Down
2 changes: 1 addition & 1 deletion EasyVesselSwitch.netkan
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"spec_version" : 1,
"name" : "Easy Vessel Switch (EVS)",
"identifier" : "EasyVesselSwitch",
"abstract" : "Stock game doesn't offer consistent model of the camera positioning when active vessel is switched. EVS does. Now, your camera won't jump randomly as you switch between the vessels. Additionally to that you get some more features.",
"abstract" : "The stock game doesn't offer a consistent model of the camera positioning when the active vessel is switched. The EVS does. Now, your camera won't jump randomly as you switch between the vessels. Additionally to that you get some more features (see the forum).",
"resources": {
"homepage": "http://forum.kerbalspaceprogram.com/index.php?/topic/141180-easy-vessel-switch-evs/",
"repository": "https://github.com/ihsoft/EasyVesselSwitch",
Expand Down
14 changes: 7 additions & 7 deletions EasyVesselSwitch.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
"DOWNLOAD": "http://kerbal.curseforge.com/projects/easy-vessel-switch-evs",
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 3,
"MINOR": 4,
"PATCH": 0
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
"MINOR": 3,
"MINOR": 4,
"PATCH": 99
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 3,
"MINOR": 4,
"PATCH": 0
},
"NAME": "Easy Vessel Switch",
"URL": "https://raw.githubusercontent.com/ihsoft/EasyVesselSwitch/master/EasyVesselSwitch.version",
"VERSION": {
"BUILD": 31118,
"BUILD": 41793,
"MAJOR": 1,
"MINOR": 5,
"PATCH": 6471
"MINOR": 6,
"PATCH": 6640
}
}
}
96 changes: 96 additions & 0 deletions Lang/es-es.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Localization
{
es-es
{

// ********** Type: EasyVesselSwitch.Controller, KSPDev Messages

// The message to display in the title of the hover menu when the switch mode is
// activated and the vessel, being hovered, is NOT the currently selected vessel.
// Argument <<1>> is the localized name of the mouse button that's bound to the
// action.
#evsLOC_00000 = Click [<<1>>] para cambiar a:
// The message to display in the title of the hover menu when the switch mode is
// activated and the vessel, being hovered, IS the currently selected vessel.
#evsLOC_00001 = Actualmente seleccionado:
// The pattern to construct a human friendly vessel name.
// Argument <<1>> is a localized vessel type (e.g. "station").
// Argument <<2>> is the vessel's name.
#evsLOC_00002 = <<1>>: <<2>>
// The pattern to construct a human friendly kerbal's name.
// Argument <<1>> is a full name of the kerbal.
// Argument <<2>> is a localized name of the kerbal's main skill (e.g. "pilot").
// Argument <<3>> is the current level of the kerbal.
#evsLOC_00003 = <<1>> (<<2>>-<<3>>)
// The message to display in the hover menu to present the vessel's total mass.
// Argument <<1>> is the total mass. Format: MassType.
#evsLOC_00004 = Masa total: <<1>>
// The pattern to construct a human friendly vessel name when the type is Unknown,
// and the vessel has only one part.
// Argument <<1>> is the vessel's name.
#evsLOC_00005 = Parte: <<1>>
// The pattern to construct a human friendly vessel name when the type is Unknown,
// and the vessel has multiple parts.
// Argument <<1>> is the vessel's name.
#evsLOC_00006 = Ensamblado: <<1>>
// The message to display in the hover menu to present the kerbal's EVA fuel
// reserve.
// Argument <<1>> is the total amount of the fuel. Format: CompactNumberType.
#evsLOC_00007 = Propelente AEV: <<1>>
// The message to display in the hover menu to tell that the vessel CAN be operated
// by the player.
#evsLOC_00008 = La nave ES controlable
// The message to display in the hover menu to tell that the vessel CANNOT be
// operated by the player.
#evsLOC_00009 = La nave NO es controlable
// The string that identifies a no camera stabilization mode. It's displayed when
// the mode is changed.
#evsLOC_00010 = NINGUNA
// The string that identifies a stabilization mode when the camera position is
// constant, and it only changes the focus to the newly selected vessel/part. It's
// displayed when the mode is changed.
#evsLOC_00011 = Mantener cámara en POSICIÓN
// The string that identifies a stabilization mode when the distance from the camera
// to the newly selected vessel/part is kept the same as it was on the former
// vessel/part. It's displayed when the mode is changed.
#evsLOC_00012 = Mantener cámara a DISTANCIA
// The mesage to present when the EVS mode has changed or updated.
// Argumnent <<1>> is a localized description of the mode.
#evsLOC_00013 = Modo de estabilización: <<1>>
// The message to display in the hover menu when the vessel, being hoverd, is too
// far to switch to it.
// Argument <<1>> is the vessel's name.
#evsLOC_00014 = La nave está demasiado distante: <<1>>
// The message to display in the hover menu to tell that the vessel IS attached to
// the ground via the KIS mod part(s).
#evsLOC_00015 = La nave está unida al suelo
// The message to display in the hover menu to tell that the vessel is NOTattached
// to the ground via the KIS mod part(s).
#evsLOC_00016 = La nave no está unida al suelo
// The status message in the hover menu when the player enables the part's focus
// change mode, but the currently hovered part is already has the focus.
#evsLOC_00017 = Esta parte está actualmente enfocada.
// The message to display when the player attempts to set the focus to a part which
// doesn't belong to the current vessel.
#evsLOC_00018 = ¡Esta parte NO pertenece a la nave actual!
// The string that identifies the MIDDLE mouse button.
#evsLOC_00019 = Botón central del ratón
// The hint message to display in the hover menu to tell what to do to set the focus
// on the hoverd part.
// Argument <<1>> is the localized name of the mosue button event (e.g. "LMB").
#evsLOC_00020 = Click [<<1>>] para establecer el foco en esta parte.
// The hint message to display in the hover menu to tell what to do to reset the
// part's focus back to the vessel focus mode.
// Argument <<1>> is the localized name of the mosue button event (e.g. "LMB").
#evsLOC_00021 = Click [<<1>>] para restablecer el foco a la embarcación actual.
// The hint message to display in the hover menu when the part's focus mode is
// enabled, but the cirrently hovered part is already in focus.
#evsLOC_00022 = Pase el cursor sobre otra parte para cambiar el foco.
// The hint message to display in the hover menu to tell what to do to set the focus
// on the currently hovered part.
#evsLOC_00023 = Pase el cursor sobre una parte para enfocarla.
// The hint message to display in the hover menu to tell what to do to reset the
// focus to the default vessel focus mode.
#evsLOC_00024 = Señale el espacio exterior para restablecer el enfoque.
}
}
2 changes: 1 addition & 1 deletion PluginData/settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UI
partFocusSwitchKey { keyCode = O }
// Allowed values: Left, Right, Middle, Btn4, Btn5.
switchMouseButton = Left
// RGBA format.
// RGBA format. Set it to 0,0,0,0 to completely disable the highlighting.
targetVesselHighlightColor = 1, 0.921568632, 0.0156862754, 1
// Seconds.
newVesselHighlightTimeout = 0.5
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ A mod for [Kerbal Space Program](http://www.kerbalspaceprogram.com/).
* Almost anything can be configured via settings file that's located at:
`EasyVesselSwitch\Plugins\PluginData\settings.cfg`.

#Forum
# Forum

See how to install the mod, ask questions and propose suggestions on
[the forum](http://forum.kerbalspaceprogram.com/index.php?/topic/141180-12-easy-vessel-switch-evs-v120/).

#Development
# Development

To start your local building envirtonment read [BUILD.md](https://github.com/ihsoft/EasyVesselSwitch/blob/master/BUILD.md).

Expand Down
85 changes: 58 additions & 27 deletions Source/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace EasyVesselSwitch {
// Next localization ID: #evsLOC_00025.
[KSPAddon(KSPAddon.Startup.Flight, false /*once*/)]
[PersistentFieldsFile("EasyVesselSwitch/Plugins/PluginData/settings.cfg", "")]
sealed class Controller : MonoBehaviour {
sealed class Controller : MonoBehaviour, IHasGUI {
#region Persistent fields
/// <summary>Key to activate vessel select mode.</summary>
[PersistentField("UI/vesselSwitchKey")]
Expand Down Expand Up @@ -276,6 +276,7 @@ sealed class Controller : MonoBehaviour {
+ " focus to the default vessel focus mode.");
#endregion

#region Local methods and types
/// <summary>A mode of camera stabilization.</summary>
enum CameraStabilization {
/// <summary>No stabilization. Allow dfeault KSP behavior.</summary>
Expand All @@ -299,30 +300,51 @@ enum SwitchEvent {

/// <summary>Vessel which is currently hovered.</summary>
Vessel hoveredVessel;

/// <summary>Overaly window to show info about vessel under the mouse cursor.</summary>
HintOverlay mouseInfoOverlay;

/// <summary>Old vessel context.</summary>
VesselInfo oldInfo;

/// <summary>New vessel context.</summary>
VesselInfo newInfo;

/// <summary>Defines if currently selected vessel was a result of EVS mouse click event.</summary>
bool evsSwitchAction;

/// <summary>Event to handle in the controller.</summary>
/// <remarks>
/// Controller code reacts to anything different from <see cref="SwitchEvent.Idle"/>. Once the
/// event is handled it's reset to the default.
/// </remarks>
SwitchEvent state = SwitchEvent.Idle;

/// <summary>Specifies if hovered vessel is attached to the ground.</summary>
/// <remarks><c>null</c> means no static attachable parts found.</remarks>
bool? isKisStaticAttached;

/// <summary>If hovered vessel is a kerbal then this will be the component.</summary>
/// <remarks><c>null</c> means hovered vessel is not a kerbal.</remarks>
KerbalEVA kerbalEva;

/// <summary>Part that is currently hovered when EVS mode is enabled.</summary>
/// <remarks>Used to determine part's focus change.</remarks>
Part lastHoveredPart;

/// <summary>Tells if the vessel highlighting logic should be presented.</summary>
/// <remarks><c>true</c> if the hovered or selected vessel should be highlighted.</remarks>
/// <remarks>
/// The state is determined from the <i>alpha</i> component of the highlighing color. If it's
/// <c>0</c>, then no visual appearance will happen anyways. So don't event trigger the logic to
/// not affect the part renderer states.
/// </remarks>
bool isHighlighingEnabled {
get { return !Mathf.Approximately(targetVesselHighlightColor.a, 0); }
}
#endregion

#region MonoBehaviour methods
/// <summary>Overridden from MonoBehaviour.</summary>
/// <remarks>Registers listeners, reads configuration and creates global UI objects.</remarks>
void Awake() {
Expand All @@ -346,17 +368,6 @@ void OnDestroy() {
GameEvents.onPartCouple.Remove(OnPartCouple);
}

/// <summary>Overridden from MonoBehaviour.</summary>
/// <remarks>Persents hovered vessel info.</remarks>
void OnGUI() {
if (hoveredVessel != null) {
ShowHoveredVesselInfo();
}
if (partFocusSwitchKey.isHold) {
ShowHoveredPartInfo();
}
}

/// <summary>Overridden from MonoBehaviour.</summary>
/// <remarks>Tracks keys and mouse moveement.</remarks>
void Update() {
Expand All @@ -377,8 +388,10 @@ void Update() {
if (lastHoveredPart != null && lastHoveredPart.vessel == hoveredVessel) {
// Let game core to disable highlighter and then restore it.
var restoreHighlightPart = lastHoveredPart; // Make a cope for the delayed call.
AsyncCall.CallOnEndOfFrame(
this, () => restoreHighlightPart.highlighter.ConstantOn(targetVesselHighlightColor));
if (isHighlighingEnabled) {
AsyncCall.CallOnEndOfFrame(
this, () => restoreHighlightPart.highlighter.ConstantOn(targetVesselHighlightColor));
}
}
lastHoveredPart = Mouse.HoveredPart;
}
Expand Down Expand Up @@ -406,7 +419,22 @@ void LateUpdate() {
isBeingDocked: true));
}
}
#endregion

#region IHasGUI implementation
/// <summary>Overridden from MonoBehaviour.</summary>
/// <remarks>Persents hovered vessel info.</remarks>
public void OnGUI() {
if (hoveredVessel != null) {
ShowHoveredVesselInfo();
}
if (partFocusSwitchKey.isHold) {
ShowHoveredPartInfo();
}
}
#endregion

#region Local methods
/// <summary>GameEvents callback.</summary>
/// <remarks>
/// Detects vessel docking events.
Expand Down Expand Up @@ -762,15 +790,17 @@ string GetShortVesselTitle(Vessel vessel) {
/// A color to use for highlighting. If set to <c>null</c> then vessel highlighting will be
/// cancelled.
/// </param>
static void SetVesselHighlight(Vessel vessel, Color? color) {
foreach (var part in vessel.parts) {
if (part == Mouse.HoveredPart) {
continue; // KSP core highlights hovered part with own color.
}
if (color.HasValue) {
part.highlighter.ConstantOn(color.Value);
} else {
part.highlighter.ConstantOff();
void SetVesselHighlight(Vessel vessel, Color? color) {
if (isHighlighingEnabled) {
foreach (var part in vessel.parts) {
if (part == Mouse.HoveredPart) {
continue; // KSP core highlights hovered part with own color.
}
if (color.HasValue) {
part.highlighter.ConstantOn(color.Value);
} else {
part.highlighter.ConstantOff();
}
}
}
}
Expand Down Expand Up @@ -802,8 +832,8 @@ static bool IsFreeCameraPositionMode(FlightCamera.Modes mode) {
/// It may put some extra loading on CPU, though.
/// </param>
/// <returns><c>WaitForSeconds</c>.</returns>
static IEnumerator TimedHighlightCoroutine(Vessel vessel, float timeout, Color color,
bool isBeingDocked = false) {
IEnumerator TimedHighlightCoroutine(Vessel vessel, float timeout, Color color,
bool isBeingDocked = false) {
SetVesselHighlight(vessel, color);
if (isBeingDocked) {
// On dock event completion the set of vessel parts will increase. Though, there is no
Expand Down Expand Up @@ -831,7 +861,7 @@ static IEnumerator TimedHighlightCoroutine(Vessel vessel, float timeout, Color c
/// <param name="newInfo">New vessel info.</param>
/// <param name="trasitionDuration">The duration to play the transition animation.</param>
/// <returns><c>null</c> until the animation is done or aborted.</returns>
static IEnumerator AnimateCameraPivotCoroutine(
IEnumerator AnimateCameraPivotCoroutine(
Transform target, VesselInfo oldInfo, VesselInfo newInfo, float trasitionDuration) {
float startTime = Time.unscaledTime;
float progress;
Expand Down Expand Up @@ -863,7 +893,7 @@ static IEnumerator AnimateCameraPivotCoroutine(
/// <param name="newInfo">The new vessel info.</param>
/// <param name="trasitionDuration">The duration to play the transition animation.</param>
/// <returns><c>null</c> until the animation is done or aborted.</returns>
static IEnumerator AnimateCameraPositionCoroutine(
IEnumerator AnimateCameraPositionCoroutine(
Transform target, VesselInfo oldInfo, VesselInfo newInfo, float trasitionDuration) {
float startTime = Time.unscaledTime;
float progress;
Expand All @@ -878,6 +908,7 @@ static IEnumerator AnimateCameraPositionCoroutine(
yield return null;
} while (progress < 1.0f && FlightCamera.fetch.Target == target);
}
#endregion
}

}
4 changes: 2 additions & 2 deletions Source/EasyVesselSwitch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>Q:\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="KSPDev_Utils.0.28">
<HintPath>..\Binaries\KSPDev_Utils.0.28.dll</HintPath>
<Reference Include="KSPDev_Utils.0.31">
<HintPath>..\Binaries\KSPDev_Utils.0.31.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>Q:\KSP_Data\Managed\System.dll</HintPath>
Expand Down
6 changes: 3 additions & 3 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion ("1.5.*")]
[assembly: AssemblyInformationalVersion ("1.5-pre for KSP v1.3")]
[assembly: AssemblyVersion ("1.6.*")]
[assembly: AssemblyInformationalVersion ("1.6 for KSP v1.4+")]
[assembly: Guid ("52fd90de-a2a6-4642-8fc4-50f8d938319c")]
[assembly: KSPAssembly ("EasyVesselSwitch", 1, 5)]
[assembly: KSPAssembly ("EasyVesselSwitch", 1, 6)]
[assembly: AssemblyFlags (AssemblyNameFlags.PublicKey | AssemblyNameFlags.EnableJITcompileOptimizer)]

0 comments on commit 648cf30

Please sign in to comment.