Skip to content

Commit

Permalink
Merge 2.2.2.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Jun 9, 2014
2 parents 4a11a89 + 9152680 commit 894ced4
Show file tree
Hide file tree
Showing 16 changed files with 222 additions and 34 deletions.
40 changes: 27 additions & 13 deletions AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,25 +385,39 @@ internal override void RepeatingWorker()
//store a list of all resources in vessel so we can nuke resources from the other lists later
if (!ActiveResources.Contains(pr.info.id)) ActiveResources.Add(pr.info.id);

//Is this resource set to split on disabled parts List - and thus we work out whether to include this parts resource in the last stage counts
Boolean ShowInLastStage = false;
if (settings.Resources[pr.info.id].SplitOnFlowDisabled)
ShowInLastStage = pr.flowState;

//update the resource in the vessel list
lstResourcesVessel.UpdateResource(pr);//,InitialSettings:settings.Resources[pr.info.id]);

//and if it needs to go in the last stage list
if (DecoupledInLastStage || ShowInLastStage)
//Is this resource set to split on disabled parts instead of staging
if ((PartResourceLibrary.Instance.resourceDefinitions[pr.info.id].resourceFlowMode == ResourceFlowMode.ALL_VESSEL ||
PartResourceLibrary.Instance.resourceDefinitions[pr.info.id].resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) &&
settings.Resources[pr.info.id].ShowReserveLevels)
{
lstResourcesLastStage.UpdateResource(pr);
if (pr.flowState) {
//update the resource in the vessel list
lstResourcesVessel.UpdateResource(pr);//,InitialSettings:settings.Resources[pr.info.id]);
} else {
//and if it needs to go in the last stage list
lstResourcesLastStage.UpdateResource(pr);
}
}
else {
//update the resource in the vessel list
lstResourcesVessel.UpdateResource(pr);//,InitialSettings:settings.Resources[pr.info.id]);

//and if it needs to go in the last stage list
if (DecoupledInLastStage)
{
lstResourcesLastStage.UpdateResource(pr);
}
}

//is the resource in the selected list
if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].AllVisible)
if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].AllVisible && !settings.Resources[pr.info.id].ShowReserveLevels)
lstPartWindows.AddPartWindow(p, pr,this);
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].LastStageVisible && (DecoupledInLastStage || ShowInLastStage)) //adjusted this last piece so if its in the last stage list it gets toggled - not just decoupled
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].LastStageVisible && DecoupledInLastStage && !settings.Resources[pr.info.id].ShowReserveLevels)
lstPartWindows.AddPartWindow(p, pr,this);
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].AllVisible && settings.Resources[pr.info.id].ShowReserveLevels && pr.flowState)
lstPartWindows.AddPartWindow(p, pr, this);
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].LastStageVisible && settings.Resources[pr.info.id].ShowReserveLevels && !pr.flowState)
lstPartWindows.AddPartWindow(p, pr, this);
else if (lstPartWindows.ContainsKey(p.GetInstanceID()))
{
//or not,but the window is in the list
Expand Down
6 changes: 3 additions & 3 deletions AlternateResourcePanel/ARPWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ internal override void DrawWindow(Int32 id)
//Is this resource selected
Boolean Highlight = SelectedResources.ContainsKey(ResourceID) && SelectedResources[ResourceID].AllVisible;

//For resources with no stage specifics - or the Resources is sey yp split display and values are different for all vessel and flow enabled ones
//For resources with no stage specifics - or the Resources is set to split display and values are different for all vessel and flow enabled ones
if ((lstResources[ResourceID].ResourceDef.resourceFlowMode == ResourceFlowMode.ALL_VESSEL ||
lstResources[ResourceID].ResourceDef.resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) &&
(( !settings.Resources[ResourceID].SplitOnFlowDisabled )
|| (lstResources[ResourceID].Amount == lstResourcesLastStage[ResourceID].Amount))
(( !settings.Resources[ResourceID].ShowReserveLevels )
|| (!lstResourcesLastStage.ContainsKey(ResourceID)))
)
{
//full width bar
Expand Down
6 changes: 4 additions & 2 deletions AlternateResourcePanel/ARPWindowResourceConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ARPWindowResourceConfig : MonoBehaviourWindowPlus
Int32 ScrollAreaWidth = 395;

internal Vector2 ScrollPosition = new Vector2();
internal Vector2 vectMonTypeOffset = new Vector2(8, 56);
Int32 ResourceToShowAlarm;
Int32 ResourceToShowAlarmChanger = 0;
Boolean ResourceToShowAlarmChangeNeeded = false;
Expand All @@ -31,7 +32,7 @@ internal override void Awake()
WindowRect = new Rect(300, 0, 410, WindowHeight);

ddlMonType = new DropDownList(EnumExtensions.ToEnumDescriptions<ResourceSettings.MonitorDirections>(),this);
ddlMonType.SetListBoxOffset(new Vector2(8,56));
ddlMonType.SetListBoxOffset(vectMonTypeOffset-ScrollPosition);

ddlMonType.OnSelectionChanged += ddlMonType_OnSelectionChanged;
ddlManager.AddDDL(ddlMonType);
Expand Down Expand Up @@ -167,6 +168,7 @@ internal override void DrawWindow(int id)
GUILayout.BeginHorizontal();
GUILayout.Label("Monitoring Levels:",Styles.styleStageTextHead, GUILayout.Width(151));
//GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1));
ddlMonType.SetListBoxOffset(vectMonTypeOffset - ScrollPosition);
ddlMonType.DrawButton();
GUILayout.Space(4);
GUILayout.EndHorizontal();
Expand Down Expand Up @@ -209,7 +211,7 @@ internal override void DrawWindow(int id)
PartResourceLibrary.Instance.resourceDefinitions[item.id].resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) {
GUILayout.BeginHorizontal();
GUILayout.Label("Split Behaviour:", temp, GUILayout.Width(120));
DrawToggle(ref settings.Resources[item.id].SplitOnFlowDisabled, "Hide disabled flows from last stage", Styles.styleToggle);
DrawToggle(ref settings.Resources[item.id].ShowReserveLevels, new GUIContent("Show Reserve Levels","instead of Whole Vessel/Last Stage split"), Styles.styleToggle);
GUILayout.EndHorizontal();
}
GUILayout.Space(3);
Expand Down
4 changes: 2 additions & 2 deletions AlternateResourcePanel/ARPWindowSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private void DrawWindow_About()
GUILayout.BeginVertical();
//GUILayout.Label("Written by:", Styles.styleStageTextHead);
GUILayout.Label("Documentation and Links:", Styles.styleStageTextHead);
GUILayout.Label("Spaceport Page:", Styles.styleStageTextHead);
GUILayout.Label("GitHub Page:", Styles.styleStageTextHead);
GUILayout.Label("Forum Page:", Styles.styleStageTextHead);
GUILayout.EndVertical();

Expand All @@ -531,7 +531,7 @@ private void DrawWindow_About()
if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen))
Application.OpenURL("https://sites.google.com/site/kspalternateresourcepanel/");
if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen))
Application.OpenURL("http://kerbalspaceport.com/kspalternateresourcepanel/");
Application.OpenURL("https://github.com/TriggerAu/AlternateResourcePanel/");
if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen))
Application.OpenURL("http://forum.kerbalspaceprogram.com/threads/60227-KSP-Alternate-Resource-Panel");

Expand Down
9 changes: 8 additions & 1 deletion AlternateResourcePanel/ClassDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,14 @@ internal static String DisplayValue(Double Amount)
String strFormat = "{0:0}";
if (Amount < 100)
strFormat = "{0:0.00}";
return String.Format(strFormat, Amount);

if (Amount<10000)
return String.Format(strFormat, Amount);
else if (Amount < 1000000)
return String.Format("{0:0.0}K", Amount / 1000);
else
return String.Format("{0:0.0}M", Amount / 1000000);

}
internal static String DisplayRateValue(Double Amount)
{
Expand Down
9 changes: 8 additions & 1 deletion AlternateResourcePanel/Framework/ConfigNodeStorage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
/* Part of KSPPluginFramework
Version 1.2
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
Author: TriggerAu, 2014
License: The MIT License (MIT)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
9 changes: 8 additions & 1 deletion AlternateResourcePanel/Framework/ExtensionsUnity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
/* Part of KSPPluginFramework
Version 1.2
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
Author: TriggerAu, 2014
License: The MIT License (MIT)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
9 changes: 8 additions & 1 deletion AlternateResourcePanel/Framework/MonoBehaviourExtended.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
/* Part of KSPPluginFramework
Version 1.2
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
Author: TriggerAu, 2014
License: The MIT License (MIT)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
13 changes: 12 additions & 1 deletion AlternateResourcePanel/Framework/MonoBehaviourWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
/* Part of KSPPluginFramework
Version 1.2
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
Author: TriggerAu, 2014
License: The MIT License (MIT)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -332,6 +339,10 @@ private void DrawToolTip()
TooltipShown = false;
}

//if we've moved to a diffn tooltip then reset the counter
if (strToolTipText != strLastTooltipText) fltTooltipTime = 0f;

//make sure the last text is correct
strLastTooltipText = strToolTipText;
}

Expand Down
9 changes: 8 additions & 1 deletion AlternateResourcePanel/Framework/SkinsLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
/* Part of KSPPluginFramework
Version 1.2
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
Author: TriggerAu, 2014
License: The MIT License (MIT)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,15 @@ internal Boolean ListVisible {
/// <summary>
/// This is for DropDowns inside extra containers like scrollviews - where getlastrect does not cater to the scrollview position
/// </summary>
private Vector2 vectListBoxOffset = new Vector2(0,0);
private Vector2 vectListBoxOffset = new Vector2(0, 0);
internal void SetListBoxOffset(Vector2 WrapperOffset)
{
vectListBoxOffset = WrapperOffset;
if (vectListBoxOffset != WrapperOffset)
{
vectListBoxOffset = WrapperOffset;
if (_ListVisible)
CalcPagesAndSizes();
}
}

private GUIStyle stylePager;
Expand Down
4 changes: 2 additions & 2 deletions AlternateResourcePanel/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("2.2.1.0")]
[assembly: AssemblyFileVersion("2.2.1.0")]
[assembly: AssemblyVersion("2.2.2.0")]
[assembly: AssemblyFileVersion("2.2.2.0")]
2 changes: 1 addition & 1 deletion AlternateResourcePanel/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public class ResourceSettings:ConfigNodeStorage
[Persistent] internal Int32 MonitorWarningLevel = 20;
[Persistent] internal Int32 MonitorAlertLevel = 10;

[Persistent] internal Boolean SplitOnFlowDisabled = false;
[Persistent] internal Boolean ShowReserveLevels = false;

internal enum VisibilityTypes
{
Expand Down
7 changes: 7 additions & 0 deletions PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ LICENSE
Licensed under Creative Commons Attribution-NonCommercial-Sharealike 3.0 Unported License. Visit the documentation site for more details and Attribution

VERSION HISTORY
Version 2.2.2.0 - KSP Version: 0.23.5
- Removed links to spaceport
- Updated PluginFramework Tooltip issue
- Reworked split display to be Active and Reserve resources (Issue #1)
- Fixed Issues with dropdown and scrollview in resources Config (Issue #10)
- Adjusted display value for large values to use K and M suffixes (Issue #11)

Version 2.2.1.0 - KSP Version: 0.23.5
- Added option for splitting display of All_Vessel resources on flow enabled
- Fixed Alarm firing on transitioning from Alert to Warn (Issue #6)
Expand Down
107 changes: 107 additions & 0 deletions PluginBuilder/PublishKSPARP.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
$GitHubName="AlternateResourcePanel"
$PluginName="KSPAlternateResourcePanel"
$UploadDir = "$($PSScriptRoot)\..\..\_Uploads\$($PluginName)"

$Version = Read-Host -Prompt "Enter the Version Number to Publish"


if ($Version -eq "")
{
"No version string supplied... Quitting"
return
}
else
{
$Path = "$UploadDir\v$($Version)\$($PluginName)_$($Version)\GameData\TriggerTech\$($PluginName)\$($PluginName).dll"
"DLL Path:`t$($Path)"
if (Test-Path $Path)
{
$dll = get-item $Path
$VersionString = $dll.VersionInfo.ProductVersion

if ($Version -ne $VersionString) {
"Versions dont match`r`nEntered:`t$Version`r`nFrom File:`t$VersionString"
return
} else {
$OAuthToken = Read-Host -Prompt "OAuth Token"
}
} else {
"Cant find the dll - have you built the dll first?"
return
}
}




"`r`nThis will Merge the devbranch with master and push the release of v$($Version) of the $($PluginName)"
"`tFrom:`t$UploadDir\v$($Version)"
"`tOAauth:`t$OAuthToken"
$Choices= [System.Management.Automation.Host.ChoiceDescription[]] @("&Yes","&No")
$ChoiceRtn = $host.ui.PromptForChoice("Do you wish to Continue?","Be sure develop is ready before hitting yes",$Choices,1)

if($ChoiceRtn -eq 0)
{
#git add -A *
#git commit -m "Version history $($Version)"

#write-host -ForegroundColor Yellow "`r`nPUSHING DEVELOP TO GITHUB"
#git push

write-host -ForegroundColor Yellow "`r`nMERGING DEVELOP TO MASTER"

git checkout master
git merge --no-ff develop -m "Merge $($Version) to master"
git tag -a "v$($Version)" -m "Released version $($Version)"

write-host -ForegroundColor Yellow "`r`nPUSHING MASTER AND TAGS TO GITHUB"
git push
git push --tags

write-host -ForegroundColor Yellow "----------------------------"
write-host -ForegroundColor Yellow "Finished Version $($Version)"
write-host -ForegroundColor Yellow "----------------------------"

write-host -ForegroundColor Yellow "`r`n Creating Release"
$readme = (Get-Content -Raw "PluginFiles\ReadMe-$($PluginName).txt")
$reldescr = [regex]::match($readme,"Version\s$($Version).+?(?=[\r\n]*Version\s\d+|$)","singleline,ignorecase").Value

#Now get the KSPVersion from the first line
$KSPVersion = [regex]::match($reldescr,"KSP\sVersion\:.+?(?=[\r\n]|$)","singleline,ignorecase").Value

#Now drop the first line
$reldescr = [regex]::replace($reldescr,"^.+?\r\n","","singleline,ignorecase")

$reldescr = $reldescr.Trim("`r`n")
$reldescr = $reldescr.Replace("- ","* ")
$reldescr = $reldescr.Replace("`r`n","\r\n")
$reldescr = $reldescr.Replace("`"","\`"")

$reldescr = "$($reldescr)\r\n\r\n``````$($KSPVersion)``````"

$CreateBody = "{`"tag_name`":`"v$($Version)`",`"name`":`"v$($Version) Release`",`"body`":`"$($relDescr)`"}"

$RestResult = Invoke-RestMethod -Method Post `
-Uri "https://api.github.com/repos/TriggerAu/$($GitHubName)/releases" `
-Headers @{"Accept"="application/vnd.github.v3+json";"Authorization"="token " + $OAuthToken} `
-Body $CreateBody
if ($?)
{
write-host -ForegroundColor Yellow "Uploading File"
$File = get-item "$($UploadDir)\v$($Version)\$($pluginname)_$($Version).zip"
$RestResult = Invoke-RestMethod -Method Post `
-Uri "https://uploads.github.com/repos/TriggerAu/$($GitHubName)/releases/$($RestResult.id)/assets?name=$($File.Name)" `
-Headers @{"Accept"="application/vnd.github.v3+json";"Authorization"="token 585a29de3d6a38a3cb777f49335e8024572a23dc";"Content-Type"="application/zip"} `
-InFile $File.fullname

"Result = $($RestResult.state)"
}

write-host -ForegroundColor Yellow "----------------------------"
write-host -ForegroundColor Yellow "Finished Release $($Version)"
write-host -ForegroundColor Yellow "----------------------------"
}
else
{
"Skipping..."
}
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
AlternateResourcePanel
======================
An alternate view of vessel resources plugin for [Kerbal Space Program](http://www.kerbalspaceprogram.com/)

Forum Thread: [KSP Alternate Resource Panel](http://forum.kerbalspaceprogram.com/threads/60227-KSP-Alternate-Resource-Panel)
#####An alternate view of vessel resources plugin for [Kerbal Space Program](http://www.kerbalspaceprogram.com/)
Forum Thread: [KSP Alternate Resource Panel](http://forum.kerbalspaceprogram.com/threads/60227-KSP-Alternate-Resource-Panel).
Author: TriggerAu

####About
Basically the Alternate Resource panel displays a view of resources in the current vessel with a bit more clarity. It also lets you see the remaining values in the currently active stage for fuels as you fly - which is useful for asparagus staging.

It also has some Staging capabilities added so you can stage from map view and also have autostaging on ascent (tied it in because of the resources/last stage tie in)

####Downloads
You can find a full list of all the released versions and their associated KSP version in the [GitHub Releases for the project](https://github.com/TriggerAu/AlternateResourcePanel/releases)

0 comments on commit 894ced4

Please sign in to comment.