Skip to content

Commit

Permalink
Version 2.1
Browse files Browse the repository at this point in the history
KSP 1.2 Update
  • Loading branch information
SirDiazo committed Oct 16, 2016
1 parent 7b90455 commit e762f79
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 126 deletions.
22 changes: 5 additions & 17 deletions AGExt/AGExt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,18 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\1.1 Dev\GameData\Diazo\AGExt\</OutputPath>
<OutputPath>..\..\..\1.2 Dev\GameData\Diazo\AGExt\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<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>
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand All @@ -58,11 +46,11 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>..\..\..\1.2 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>
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion AGExt/CommonMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,8 @@ public static AGXAction LoadAGXActionVer2(ConfigNode actNode, Part actPart, bool
foreach (PartModule pmSensor in actPart.Modules.OfType<ModuleEnviroSensor>())
{
ModuleEnviroSensor mesSensor = (ModuleEnviroSensor)pmSensor;
if (mesSensor.sensorType == sensorType)
if (mesSensor.sensorType.ToString() == sensorType) //.sensorType changed from String to Enum in KSP 1.2, did not change save code as this should never run per note above

{
actsToCompare.AddRange(mesSensor.Actions);
}
Expand Down
209 changes: 120 additions & 89 deletions AGExt/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void Start()
//print("b");
if ((string)AGExtNode.GetValue("OverrideCareer") == "1")
{
//print("c");
//print("AGX 0");
showCareerCustomAGs = true;
showCareerStockAGs = true;
}
Expand All @@ -362,19 +362,19 @@ public void Start()

if (GameVariables.Instance.UnlockedActionGroupsCustom(facilityLevel, inVAB))
{
// print("g");
//print("AGX 1");
showCareerStockAGs = true;
showCareerCustomAGs = true;
}
else if (GameVariables.Instance.UnlockedActionGroupsStock(facilityLevel, inVAB))
{
//print("h");
//print("AGX 2");
showCareerStockAGs = true;
showCareerCustomAGs = false;
}
else
{
//print("i");
//print("AGX 3");
showCareerStockAGs = false;
showCareerCustomAGs = false;
}
Expand Down Expand Up @@ -765,43 +765,49 @@ public void onLeftButtonClick()
//Debug.Log("AGX nods editor" + EditorLogic.fetch.editorScreen);
try
{
if (EditorLogic.fetch.editorScreen != EditorScreen.Actions)
if (showCareerStockAGs)
{
if (EditorLogic.SortedShipList.Count > 0)
if (EditorLogic.fetch.editorScreen != EditorScreen.Actions)
{
EditorLogic.fetch.SelectPanelActions();
}
//Debug.Log("AGX no editor");
//if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs)
//{
if (EditorLogic.SortedShipList.Count > 0)
{
EditorLogic.fetch.SelectPanelActions();
}
//Debug.Log("AGX no editor");
//if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs)
//{

// EditorLogic.fetch.SelectPanelActions();
// StartCoroutine("DelayPanelsMovement");
//}
// EditorLogic.fetch.SelectPanelActions();
// StartCoroutine("DelayPanelsMovement");
//}

}
else
{
//Debug.Log("AGX iseditor");
if (AGXShow)
{
//UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel
AGXShow = false;
AGExtNode.SetValue("EditShow", "0");
//EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
//StartCoroutine("DelayPanelsMovement");
}
else
{
// UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel
AGXShow = true;
AGExtNode.SetValue("EditShow", "1");
//EditorPanels.Instance.panelManager.Dismiss();
//StartCoroutine("DelayPanelsMovement");
//Debug.Log("AGX iseditor");
if (AGXShow)
{
//UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel
AGXShow = false;
AGExtNode.SetValue("EditShow", "0");
//EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
//StartCoroutine("DelayPanelsMovement");
}
else
{
// UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel
AGXShow = true;
AGExtNode.SetValue("EditShow", "1");
//EditorPanels.Instance.panelManager.Dismiss();
//StartCoroutine("DelayPanelsMovement");
}
AGXStaticData.SaveBaseConfigNode(AGExtNode);
}
AGXStaticData.SaveBaseConfigNode(AGExtNode);
}

else
{
ScreenMessages.PostScreenMessage("Action Groups Unavailable. Facility Upgrade Required.");
}
}
catch
{
Expand Down Expand Up @@ -836,7 +842,12 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
// ErrLine = "5";
// }
ErrLine = "6";

//Debug.Log("AGX 1 " + host_target.host.name);
//Debug.Log("AGX 2 " + host_target.host.Modules.Count);
//foreach(PartModule pm in host_target.host.Modules)
//{
// Debug.Log("AGX 3 " + pm.moduleName);
//}
ErrLine = "7";
ModuleAGX agxMod = host_target.host.Modules.OfType<ModuleAGX>().First();
ErrLine = "8";
Expand Down Expand Up @@ -1133,11 +1144,11 @@ public static void LoadGroupVisibility(string LoadString)

//}

public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well
{
//Debug.Log("act button click");
StartCoroutine("DelayPanelsMovement");
}
//public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well
//{
// //Debug.Log("act button click");
// StartCoroutine("DelayPanelsMovement");
//}

public void ImmediatePanelsMovement()
{
Expand Down Expand Up @@ -1250,11 +1261,11 @@ public void ActualPanelsMovement()
}


public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
{
//Debug.Log("Part button click");
StartCoroutine("DelayPanelsMovement");
}
//public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// //Debug.Log("Part button click");
// StartCoroutine("DelayPanelsMovement");
//}
//public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// if(agxWindowsShowing)
Expand All @@ -1268,57 +1279,57 @@ public void ActualPanelsMovement()
// EditorLogic.fetch.SetBackup();
//}

public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed
{
StartCoroutine("DelayPanelsMovement");
}
//public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// StartCoroutine("DelayPanelsMovement");
//}

public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed
{
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
{
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
}
//StartCoroutine("DelayPanelsMovement");
}
//public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed
//{
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
// {
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
// }
// //StartCoroutine("DelayPanelsMovement");
//}

public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed
{
//save button actually doesn't affect the visible UI, do nothing
}
//public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// //save button actually doesn't affect the visible UI, do nothing
//}

public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed
{
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
{
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
}
//StartCoroutine("DelayPanelsMovement");
}
//public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
// {
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
// }
// //StartCoroutine("DelayPanelsMovement");
//}

public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed
{
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
{
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
}
// StartCoroutine("DelayPanelsMovement");
//public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
// {
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
// }
// // StartCoroutine("DelayPanelsMovement");

}
//}

public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed
{
if(EditorLogic.fetch.editorScreen == EditorScreen.Actions)
{
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
}
//StartCoroutine("DelayPanelsMovement");
}
//public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
// if(EditorLogic.fetch.editorScreen == EditorScreen.Actions)
// {
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
// }
// //StartCoroutine("DelayPanelsMovement");
//}

public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed
{
//StartCoroutine("DelayPanelsMovement");
}
//public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed
//{
// //StartCoroutine("DelayPanelsMovement");
//}

//public void OnOtherButtonClick(IUIObject obj) //reset EditorPanel if needed
//{
Expand Down Expand Up @@ -1500,24 +1511,36 @@ public void LeavingEditor(GameScenes gScn)

public void OnDisable()
{

string errLine = "1";
try
{
LoadFinished = false;
errLine = "2";
SaveCurrentKeyBindings();
errLine = "3";
SaveWindowPositions();
errLine = "4";
if (ToolbarManager.ToolbarAvailable) //if toolbar loaded, destroy button on leaving scene
{
errLine = "5";
AGXBtn.Destroy();
}
else
{
errLine = "6";
ApplicationLauncher.Instance.RemoveModApplication(AGXAppEditorButton);
}
//EditorSaveToFile(); //some of my data has already been deleted by this point
errLine = "7";
GameEvents.onPartAttach.Remove(PartAttaching);
errLine = "8";
GameEvents.onPartRemove.Remove(PartRemove);
errLine = "9";
GameEvents.onEditorPartEvent.Remove(OnPartEvent);
errLine = "10";
//GameEvents.onEditorShipModified.Remove(VesselChanged);
GameEvents.onEditorLoad.Remove(OnShipLoad);
errLine = "11";
//GameEvents.onGameStateSave.Remove(OnSaveTest);
//GameEvents.onGameSceneLoadRequested.Remove(LeavingEditor);
//GameEvents.onEditorLoad(OnEditorLoadCall);
Expand All @@ -1541,8 +1564,16 @@ public void OnDisable()
//EditorLogic.fetch.launchBtn.RemoveValueChangedDelegate(OnLaunchButtonClick);
//EditorLogic.fetch.exitBtn.RemoveValueChangedDelegate(OnExitButtonClick);
//EditorLogic.fetch.newBtn.RemoveValueChangedDelegate(OnNewButtonClick);
EditorLogic.fetch.Unlock("AGXLock");
//EditorLogic.fetch.Unlock("AGXLock");
InputLockManager.RemoveControlLock("AGXLock");
errLine = "12";
StaticData.CurrentVesselActions.Clear();
errLine = "13";
}
catch(Exception e)
{
Debug.Log("AGX Editor.OnDestroy " + errLine + "|" + e);
}

}

Expand Down
Loading

0 comments on commit e762f79

Please sign in to comment.