Skip to content

Commit e762f79

Browse files
committed
Version 2.1
KSP 1.2 Update
1 parent 7b90455 commit e762f79

File tree

6 files changed

+143
-126
lines changed

6 files changed

+143
-126
lines changed

AGExt/AGExt.csproj

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,18 @@
2525
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2626
<DebugType>pdbonly</DebugType>
2727
<Optimize>false</Optimize>
28-
<OutputPath>..\..\..\1.1 Dev\GameData\Diazo\AGExt\</OutputPath>
28+
<OutputPath>..\..\..\1.2 Dev\GameData\Diazo\AGExt\</OutputPath>
2929
<DefineConstants>TRACE</DefineConstants>
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
3333
<ItemGroup>
3434
<Reference Include="Assembly-CSharp">
35-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
35+
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
3636
<Private>False</Private>
3737
</Reference>
3838
<Reference Include="Assembly-CSharp-firstpass">
39-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
40-
<Private>False</Private>
41-
</Reference>
42-
<Reference Include="KSPAssets">
43-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPAssets.dll</HintPath>
44-
<Private>False</Private>
45-
</Reference>
46-
<Reference Include="KSPCore">
47-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPCore.dll</HintPath>
48-
<Private>False</Private>
49-
</Reference>
50-
<Reference Include="KSPUtil">
51-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPUtil.dll</HintPath>
39+
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
5240
<Private>False</Private>
5341
</Reference>
5442
<Reference Include="System" />
@@ -58,11 +46,11 @@
5846
<Reference Include="System.Data" />
5947
<Reference Include="System.Xml" />
6048
<Reference Include="UnityEngine">
61-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
49+
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
6250
<Private>False</Private>
6351
</Reference>
6452
<Reference Include="UnityEngine.UI">
65-
<HintPath>..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
53+
<HintPath>..\..\..\1.2 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
6654
<Private>False</Private>
6755
</Reference>
6856
</ItemGroup>

AGExt/CommonMethods.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,8 @@ public static AGXAction LoadAGXActionVer2(ConfigNode actNode, Part actPart, bool
10791079
foreach (PartModule pmSensor in actPart.Modules.OfType<ModuleEnviroSensor>())
10801080
{
10811081
ModuleEnviroSensor mesSensor = (ModuleEnviroSensor)pmSensor;
1082-
if (mesSensor.sensorType == sensorType)
1082+
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
1083+
10831084
{
10841085
actsToCompare.AddRange(mesSensor.Actions);
10851086
}

AGExt/Editor.cs

Lines changed: 120 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public void Start()
339339
//print("b");
340340
if ((string)AGExtNode.GetValue("OverrideCareer") == "1")
341341
{
342-
//print("c");
342+
//print("AGX 0");
343343
showCareerCustomAGs = true;
344344
showCareerStockAGs = true;
345345
}
@@ -362,19 +362,19 @@ public void Start()
362362

363363
if (GameVariables.Instance.UnlockedActionGroupsCustom(facilityLevel, inVAB))
364364
{
365-
// print("g");
365+
//print("AGX 1");
366366
showCareerStockAGs = true;
367367
showCareerCustomAGs = true;
368368
}
369369
else if (GameVariables.Instance.UnlockedActionGroupsStock(facilityLevel, inVAB))
370370
{
371-
//print("h");
371+
//print("AGX 2");
372372
showCareerStockAGs = true;
373373
showCareerCustomAGs = false;
374374
}
375375
else
376376
{
377-
//print("i");
377+
//print("AGX 3");
378378
showCareerStockAGs = false;
379379
showCareerCustomAGs = false;
380380
}
@@ -765,43 +765,49 @@ public void onLeftButtonClick()
765765
//Debug.Log("AGX nods editor" + EditorLogic.fetch.editorScreen);
766766
try
767767
{
768-
if (EditorLogic.fetch.editorScreen != EditorScreen.Actions)
768+
if (showCareerStockAGs)
769769
{
770-
if (EditorLogic.SortedShipList.Count > 0)
770+
if (EditorLogic.fetch.editorScreen != EditorScreen.Actions)
771771
{
772-
EditorLogic.fetch.SelectPanelActions();
773-
}
774-
//Debug.Log("AGX no editor");
775-
//if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs)
776-
//{
772+
if (EditorLogic.SortedShipList.Count > 0)
773+
{
774+
EditorLogic.fetch.SelectPanelActions();
775+
}
776+
//Debug.Log("AGX no editor");
777+
//if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs)
778+
//{
777779

778-
// EditorLogic.fetch.SelectPanelActions();
779-
// StartCoroutine("DelayPanelsMovement");
780-
//}
780+
// EditorLogic.fetch.SelectPanelActions();
781+
// StartCoroutine("DelayPanelsMovement");
782+
//}
781783

782-
}
783-
else
784-
{
785-
//Debug.Log("AGX iseditor");
786-
if (AGXShow)
787-
{
788-
//UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel
789-
AGXShow = false;
790-
AGExtNode.SetValue("EditShow", "0");
791-
//EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
792-
//StartCoroutine("DelayPanelsMovement");
793784
}
794785
else
795786
{
796-
// UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel
797-
AGXShow = true;
798-
AGExtNode.SetValue("EditShow", "1");
799-
//EditorPanels.Instance.panelManager.Dismiss();
800-
//StartCoroutine("DelayPanelsMovement");
787+
//Debug.Log("AGX iseditor");
788+
if (AGXShow)
789+
{
790+
//UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel
791+
AGXShow = false;
792+
AGExtNode.SetValue("EditShow", "0");
793+
//EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
794+
//StartCoroutine("DelayPanelsMovement");
795+
}
796+
else
797+
{
798+
// UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel
799+
AGXShow = true;
800+
AGExtNode.SetValue("EditShow", "1");
801+
//EditorPanels.Instance.panelManager.Dismiss();
802+
//StartCoroutine("DelayPanelsMovement");
803+
}
804+
AGXStaticData.SaveBaseConfigNode(AGExtNode);
801805
}
802-
AGXStaticData.SaveBaseConfigNode(AGExtNode);
803806
}
804-
807+
else
808+
{
809+
ScreenMessages.PostScreenMessage("Action Groups Unavailable. Facility Upgrade Required.");
810+
}
805811
}
806812
catch
807813
{
@@ -836,7 +842,12 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
836842
// ErrLine = "5";
837843
// }
838844
ErrLine = "6";
839-
845+
//Debug.Log("AGX 1 " + host_target.host.name);
846+
//Debug.Log("AGX 2 " + host_target.host.Modules.Count);
847+
//foreach(PartModule pm in host_target.host.Modules)
848+
//{
849+
// Debug.Log("AGX 3 " + pm.moduleName);
850+
//}
840851
ErrLine = "7";
841852
ModuleAGX agxMod = host_target.host.Modules.OfType<ModuleAGX>().First();
842853
ErrLine = "8";
@@ -1133,11 +1144,11 @@ public static void LoadGroupVisibility(string LoadString)
11331144

11341145
//}
11351146

1136-
public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well
1137-
{
1138-
//Debug.Log("act button click");
1139-
StartCoroutine("DelayPanelsMovement");
1140-
}
1147+
//public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well
1148+
//{
1149+
// //Debug.Log("act button click");
1150+
// StartCoroutine("DelayPanelsMovement");
1151+
//}
11411152

11421153
public void ImmediatePanelsMovement()
11431154
{
@@ -1250,11 +1261,11 @@ public void ActualPanelsMovement()
12501261
}
12511262

12521263

1253-
public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
1254-
{
1255-
//Debug.Log("Part button click");
1256-
StartCoroutine("DelayPanelsMovement");
1257-
}
1264+
//public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
1265+
//{
1266+
// //Debug.Log("Part button click");
1267+
// StartCoroutine("DelayPanelsMovement");
1268+
//}
12581269
//public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed
12591270
//{
12601271
// if(agxWindowsShowing)
@@ -1268,57 +1279,57 @@ public void ActualPanelsMovement()
12681279
// EditorLogic.fetch.SetBackup();
12691280
//}
12701281

1271-
public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed
1272-
{
1273-
StartCoroutine("DelayPanelsMovement");
1274-
}
1282+
//public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed
1283+
//{
1284+
// StartCoroutine("DelayPanelsMovement");
1285+
//}
12751286

1276-
public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed
1277-
{
1278-
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1279-
{
1280-
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1281-
}
1282-
//StartCoroutine("DelayPanelsMovement");
1283-
}
1287+
//public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed
1288+
//{
1289+
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1290+
// {
1291+
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1292+
// }
1293+
// //StartCoroutine("DelayPanelsMovement");
1294+
//}
12841295

1285-
public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed
1286-
{
1287-
//save button actually doesn't affect the visible UI, do nothing
1288-
}
1296+
//public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed
1297+
//{
1298+
// //save button actually doesn't affect the visible UI, do nothing
1299+
//}
12891300

1290-
public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed
1291-
{
1292-
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1293-
{
1294-
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1295-
}
1296-
//StartCoroutine("DelayPanelsMovement");
1297-
}
1301+
//public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed
1302+
//{
1303+
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1304+
// {
1305+
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1306+
// }
1307+
// //StartCoroutine("DelayPanelsMovement");
1308+
//}
12981309

1299-
public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed
1300-
{
1301-
if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1302-
{
1303-
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1304-
}
1305-
// StartCoroutine("DelayPanelsMovement");
1310+
//public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed
1311+
//{
1312+
// if (EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1313+
// {
1314+
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1315+
// }
1316+
// // StartCoroutine("DelayPanelsMovement");
13061317

1307-
}
1318+
//}
13081319

1309-
public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed
1310-
{
1311-
if(EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1312-
{
1313-
EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1314-
}
1315-
//StartCoroutine("DelayPanelsMovement");
1316-
}
1320+
//public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed
1321+
//{
1322+
// if(EditorLogic.fetch.editorScreen == EditorScreen.Actions)
1323+
// {
1324+
// EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions);
1325+
// }
1326+
// //StartCoroutine("DelayPanelsMovement");
1327+
//}
13171328

1318-
public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed
1319-
{
1320-
//StartCoroutine("DelayPanelsMovement");
1321-
}
1329+
//public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed
1330+
//{
1331+
// //StartCoroutine("DelayPanelsMovement");
1332+
//}
13221333

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

15011512
public void OnDisable()
15021513
{
1503-
1514+
string errLine = "1";
1515+
try
1516+
{
15041517
LoadFinished = false;
1518+
errLine = "2";
15051519
SaveCurrentKeyBindings();
1520+
errLine = "3";
15061521
SaveWindowPositions();
1522+
errLine = "4";
15071523
if (ToolbarManager.ToolbarAvailable) //if toolbar loaded, destroy button on leaving scene
15081524
{
1525+
errLine = "5";
15091526
AGXBtn.Destroy();
15101527
}
15111528
else
15121529
{
1530+
errLine = "6";
15131531
ApplicationLauncher.Instance.RemoveModApplication(AGXAppEditorButton);
15141532
}
15151533
//EditorSaveToFile(); //some of my data has already been deleted by this point
1534+
errLine = "7";
15161535
GameEvents.onPartAttach.Remove(PartAttaching);
1536+
errLine = "8";
15171537
GameEvents.onPartRemove.Remove(PartRemove);
1538+
errLine = "9";
15181539
GameEvents.onEditorPartEvent.Remove(OnPartEvent);
1540+
errLine = "10";
15191541
//GameEvents.onEditorShipModified.Remove(VesselChanged);
15201542
GameEvents.onEditorLoad.Remove(OnShipLoad);
1543+
errLine = "11";
15211544
//GameEvents.onGameStateSave.Remove(OnSaveTest);
15221545
//GameEvents.onGameSceneLoadRequested.Remove(LeavingEditor);
15231546
//GameEvents.onEditorLoad(OnEditorLoadCall);
@@ -1541,8 +1564,16 @@ public void OnDisable()
15411564
//EditorLogic.fetch.launchBtn.RemoveValueChangedDelegate(OnLaunchButtonClick);
15421565
//EditorLogic.fetch.exitBtn.RemoveValueChangedDelegate(OnExitButtonClick);
15431566
//EditorLogic.fetch.newBtn.RemoveValueChangedDelegate(OnNewButtonClick);
1544-
EditorLogic.fetch.Unlock("AGXLock");
1567+
//EditorLogic.fetch.Unlock("AGXLock");
1568+
InputLockManager.RemoveControlLock("AGXLock");
1569+
errLine = "12";
15451570
StaticData.CurrentVesselActions.Clear();
1571+
errLine = "13";
1572+
}
1573+
catch(Exception e)
1574+
{
1575+
Debug.Log("AGX Editor.OnDestroy " + errLine + "|" + e);
1576+
}
15461577

15471578
}
15481579

0 commit comments

Comments
 (0)