Skip to content

Commit 0083a7c

Browse files
committed
1.0.3.4
1 parent 2db6a2b commit 0083a7c

9 files changed

Lines changed: 361 additions & 97 deletions

Source/AssemblyVersion.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+

2+
// This code was generated by a tool. Any changes made manually will be lost
3+
// the next time this code is regenerated.
4+
//
5+
6+
using System.Reflection;
7+
8+
[assembly: AssemblyVersion("1.0.3.4")]

Source/AssemblyVersion.tt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<#@ template debug="false" hostspecific="true" language="C#" #>
2+
<#@ import namespace="System.IO" #>
3+
<#@ output extension=".cs" #>
4+
5+
<#
6+
7+
// Instructions
8+
// 1. Add a new Text Template to the project
9+
// 2. Copy this file into the new template
10+
// 3. Update the string: versionfile with the complete path to the .version file
11+
// 4. Remove the following line from the file AssemblyInfo.cs (usually located in the "Property" folder inside your C# project):
12+
// [assembly: AssemblyVersion("1.0.0.0")]
13+
// 5. Add the following to the PreBuild steps:
14+
// set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
15+
//
16+
// if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
17+
//
18+
// %textTemplatingPath% "$(ProjectDir)AssemblyFileVersion.tt"
19+
20+
int major = 0;
21+
int minor = 0;
22+
int build = 0;
23+
int patch = 0;
24+
bool versionSection = false;
25+
26+
int i = 0;
27+
int i2 = 0;
28+
string s;
29+
30+
//
31+
// Update the following with the complete path to the .version file
32+
//
33+
string versionfile = @"C:\KSP_DEV\Workspace\FieldTrainingLab\FieldTrainingLab.version";
34+
35+
if (!File.Exists(versionfile))
36+
{
37+
Write("File: " + versionfile + " missing\n");
38+
}
39+
40+
try
41+
{
42+
foreach (var line in File.ReadAllLines(versionfile))
43+
{
44+
if (line != null)
45+
{
46+
if (!versionSection)
47+
{
48+
if (line.Contains("\"VERSION\""))
49+
versionSection = true;
50+
}
51+
else
52+
{
53+
if (line.Contains("}"))
54+
versionSection = false;
55+
i = line.IndexOf(":");
56+
i2 = line.IndexOf(",");
57+
if (i2 == -1)
58+
i2 = line.Length;
59+
if (i >= 0 && i2 >= 0)
60+
{
61+
s = line.Substring(i + 1, i2 - i - 1);
62+
63+
if (line.Contains("MAJOR"))
64+
Int32.TryParse(s, out major);
65+
66+
if (line.Contains("MINOR"))
67+
Int32.TryParse(s, out minor);
68+
69+
if (line.Contains("PATCH"))
70+
Int32.TryParse(s, out patch);
71+
72+
if (line.Contains("BUILD"))
73+
Int32.TryParse(s, out build);
74+
}
75+
}
76+
}
77+
}
78+
79+
}
80+
catch
81+
{
82+
major = 1;
83+
minor = 0;
84+
patch = 0;
85+
build = 0;
86+
}
87+
//Write("File done");
88+
89+
#>
90+
// This code was generated by a tool. Any changes made manually will be lost
91+
// the next time this code is regenerated.
92+
//
93+
94+
using System.Reflection;
95+
96+
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
namespace Efour
1+

2+
using UnityEngine;
3+
namespace FieldTrainingLab
24
{
3-
public class TrainingLabModule : PartModule
5+
6+
public class FieldTrainingLab : PartModule
47
{
58
ProtoCrewMember[] crewArr = new ProtoCrewMember[8];
69
string[] eventArr =
@@ -41,50 +44,54 @@ public class TrainingLabModule : PartModule
4144
[KSPField]
4245
public float TimeFactor = 426 * 6 * 60 * 60; // 1Year = 426day, 1day = 6hour, 1hour = 60minutes, 1min = 60sec
4346

44-
[KSPField(guiActive = false, guiName = "Science Point")]
47+
[KSPField(isPersistant = true, guiActive = true, guiName = "Training Lab Status", groupName = "TrainingLab", groupDisplayName = "Training Lab", groupStartCollapsed = true)]
48+
public bool TrainingStatus = false;
49+
50+
[KSPField(guiActive = false, guiName = "Science Point", groupName = "TrainingLab", groupDisplayName = "Field Training Lab", groupStartCollapsed = true)]
4551
public int SciRemain;
4652

47-
[KSPEvent(guiActive = false, guiName = "Training0")]
53+
[KSPEvent(guiActive = false, guiName = "Training0", groupName = "TrainingLab")]
4854
public void TrainKerbalInside0()
4955
{
5056
TrainKerbal(0);
5157
}
52-
[KSPEvent(guiActive = false, guiName = "Training1")]
58+
[KSPEvent(guiActive = false, guiName = "Training1", groupName = "TrainingLab")]
5359
public void TrainKerbalInside1()
5460
{
5561
TrainKerbal(1);
5662
}
57-
[KSPEvent(guiActive = false, guiName = "Training2")]
63+
[KSPEvent(guiActive = false, guiName = "Training2", groupName = "TrainingLab")]
5864
public void TrainKerbalInside2()
5965
{
6066
TrainKerbal(2);
6167
}
62-
[KSPEvent(guiActive = false, guiName = "Training3")]
68+
[KSPEvent(guiActive = false, guiName = "Training3", groupName = "TrainingLab")]
6369
public void TrainKerbalInside3()
6470
{
6571
TrainKerbal(3);
6672
}
67-
[KSPEvent(guiActive = false, guiName = "Training4")]
73+
[KSPEvent(guiActive = false, guiName = "Training4", groupName = "TrainingLab")]
6874
public void TrainKerbalInside4()
6975
{
7076
TrainKerbal(4);
7177
}
72-
[KSPEvent(guiActive = false, guiName = "Training5")]
78+
[KSPEvent(guiActive = false, guiName = "Training5", groupName = "TrainingLab")]
7379
public void TrainKerbalInside5()
7480
{
7581
TrainKerbal(5);
7682
}
77-
[KSPEvent(guiActive = false, guiName = "Training6")]
83+
[KSPEvent(guiActive = false, guiName = "Training6", groupName = "TrainingLab")]
7884
public void TrainKerbalInside6()
7985
{
8086
TrainKerbal(6);
8187
}
82-
[KSPEvent(guiActive = false, guiName = "Training7")]
88+
[KSPEvent(guiActive = false, guiName = "Training7", groupName = "TrainingLab")]
8389
public void TrainKerbalInside7()
8490
{
8591
TrainKerbal(7);
8692
}
8793

94+
#region private functions
8895
private void TrainKerbal(int index)
8996
{
9097
ProtoCrewMember crew = crewArr[index];
@@ -93,14 +100,14 @@ private void TrainKerbal(int index)
93100

94101
if (lastLog == 5)
95102
{
96-
ScreenMessages.PostScreenMessage(crew.name + " already had every trainings.");
103+
ScreenMessages.PostScreenMessage(crew.name + " already had every training.");
97104
return;
98105
}
99106

100107
float SciCost = calculateSciCost(levelUpExpTable[lastLog], crew);
101108
if (ResearchAndDevelopment.Instance.Science < SciCost)
102109
{
103-
ScreenMessages.PostScreenMessage("Insufficient Science Point.\n" +
110+
ScreenMessages.PostScreenMessage("Insufficient Science Points.\n" +
104111
"Needed : " + SciCost + ", Remain : " + ResearchAndDevelopment.Instance.Science);
105112
return;
106113
}
@@ -110,7 +117,9 @@ private void TrainKerbal(int index)
110117
ScreenMessages.PostScreenMessage(levelNumber[lastLog] + " Training Complete : " + crew.name);
111118

112119
}
120+
#endregion
113121

122+
#region public functions
114123
public override void OnUpdate()
115124
{
116125
if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) return;
@@ -138,6 +147,8 @@ public override void OnUpdate()
138147
for(; index < eventArr.Length; index++) Events[eventArr[index]].guiActive = false;
139148
}
140149

150+
151+
#endregion
141152
private int calculateSciCost(float baseValue, ProtoCrewMember crew)
142153
{
143154
double calculated = baseValue * TrainFactor * (1 - (getKerbalTrainingExp(crew) / (TimeFactor * baseValue / 64)));
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,38 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{AD686AF3-DDDC-4991-909F-EAD9C16C469B}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>TrainingLabModule</RootNamespace>
11-
<AssemblyName>TrainingLabModule</AssemblyName>
10+
<RootNamespace>FieldTrainingLab</RootNamespace>
11+
<AssemblyName>FieldTrainingLab</AssemblyName>
1212
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<ProductVersion>12.0.0</ProductVersion>
15-
<SchemaVersion>2.0</SchemaVersion>
1614
</PropertyGroup>
17-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release KSP 0.90|AnyCPU' ">
18-
<DebugType>pdbonly</DebugType>
19-
<Optimize>true</Optimize>
20-
<OutputPath>..\..\..\..\..\Games\Kerbal Space Program 0.90\GameData\WarpPlugin\Plugins\</OutputPath>
21-
<DefineConstants>TRACE</DefineConstants>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
2221
<ErrorReport>prompt</ErrorReport>
2322
<WarningLevel>4</WarningLevel>
2423
</PropertyGroup>
25-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release KSP 0.25|AnyCPU'">
26-
<OutputPath>bin\Release KSP 0.25\</OutputPath>
27-
<DefineConstants>TRACE</DefineConstants>
28-
<Optimize>true</Optimize>
29-
<DebugType>pdbonly</DebugType>
30-
<PlatformTarget>AnyCPU</PlatformTarget>
31-
<ErrorReport>prompt</ErrorReport>
32-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
33-
</PropertyGroup>
3424
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
3527
<OutputPath>bin\Release\</OutputPath>
3628
<DefineConstants>TRACE</DefineConstants>
37-
<Optimize>true</Optimize>
38-
<DebugType>pdbonly</DebugType>
39-
<PlatformTarget>AnyCPU</PlatformTarget>
4029
<ErrorReport>prompt</ErrorReport>
41-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
30+
<WarningLevel>4</WarningLevel>
31+
<DebugSymbols>true</DebugSymbols>
4232
</PropertyGroup>
4333
<ItemGroup>
4434
<Reference Include="Assembly-CSharp">
45-
<HintPath>..\..\..\..\Games\Career\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
46-
<Private>False</Private>
47-
</Reference>
48-
<Reference Include="Assembly-CSharp-firstpass">
49-
<HintPath>..\..\..\..\Games\Career\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
35+
<HintPath>$(DevDir)\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
5036
<Private>False</Private>
5137
</Reference>
5238
<Reference Include="System" />
@@ -56,20 +42,28 @@
5642
<Reference Include="System.Data" />
5743
<Reference Include="System.Xml" />
5844
<Reference Include="UnityEngine">
59-
<HintPath>..\..\..\..\Games\Career\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
60-
<Private>False</Private>
61-
</Reference>
62-
<Reference Include="UnityEngine.UI">
63-
<HintPath>..\..\..\..\Games\Career\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
45+
<HintPath>$(DevDir)\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
6446
<Private>False</Private>
6547
</Reference>
6648
</ItemGroup>
6749
<ItemGroup>
68-
<Compile Include="TrainingLabModule.cs" />
50+
<Compile Include="AssemblyVersion.cs">
51+
<AutoGen>True</AutoGen>
52+
<DesignTime>True</DesignTime>
53+
<DependentUpon>AssemblyVersion.tt</DependentUpon>
54+
</Compile>
55+
<Compile Include="FieldTrainingLab.cs" />
6956
<Compile Include="Properties\AssemblyInfo.cs" />
57+
<Compile Include="InstallChecker.cs" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Content Include="AssemblyVersion.tt">
61+
<Generator>TextTemplatingFileGenerator</Generator>
62+
<LastGenOutput>AssemblyVersion.cs</LastGenOutput>
63+
</Content>
7064
</ItemGroup>
7165
<ItemGroup>
72-
<WCFMetadata Include="Service References\" />
66+
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
7367
</ItemGroup>
7468
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7569
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -79,4 +73,19 @@
7973
<Target Name="AfterBuild">
8074
</Target>
8175
-->
76+
<PropertyGroup>
77+
<PostBuildEvent>start /D $(ProjectDir)..\ /WAIT deploy.bat $(TargetDir) $(TargetFileName)
78+
79+
if $(ConfigurationName) == Release start /D C:\KSP_DEV\Workspace\FieldTrainingLab /WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
80+
</PostBuildEvent>
81+
</PropertyGroup>
82+
<PropertyGroup>
83+
<PreBuildEvent>set textTemplatingPath="$(DevEnvDir)texttransform.exe"
84+
%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt"
85+
</PreBuildEvent>
86+
</PropertyGroup>
87+
<!--<Target Name="BeforeBuild">
88+
</Target>
89+
<Target Name="AfterBuild">
90+
</Target>-->
8291
</Project>
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.29230.47
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainingLabPlugin", "TrainingLabPlugin.csproj", "{AD686AF3-DDDC-4991-909F-EAD9C16C469B}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FieldTrainingLab", "FieldTrainingLab.csproj", "{AD686AF3-DDDC-4991-909F-EAD9C16C469B}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{7B84804D-D321-451A-B023-DE3BC7F8F184}"
9+
ProjectSection(SolutionItems) = preProject
10+
..\buildRelease.bat = ..\buildRelease.bat
11+
..\deploy.bat = ..\deploy.bat
12+
..\FieldTrainingLab.version = ..\FieldTrainingLab.version
13+
EndProjectSection
714
EndProject
815
Global
916
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10-
Release KSP 0.25|Any CPU = Release KSP 0.25|Any CPU
11-
Release KSP 0.90|Any CPU = Release KSP 0.90|Any CPU
17+
Debug|Any CPU = Debug|Any CPU
1218
Release|Any CPU = Release|Any CPU
1319
EndGlobalSection
1420
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15-
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release KSP 0.25|Any CPU.ActiveCfg = Release KSP 0.25|Any CPU
16-
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release KSP 0.25|Any CPU.Build.0 = Release KSP 0.25|Any CPU
17-
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release KSP 0.90|Any CPU.ActiveCfg = Release KSP 0.90|Any CPU
18-
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release KSP 0.90|Any CPU.Build.0 = Release KSP 0.90|Any CPU
21+
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Debug|Any CPU.Build.0 = Debug|Any CPU
1923
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release|Any CPU.ActiveCfg = Release|Any CPU
2024
{AD686AF3-DDDC-4991-909F-EAD9C16C469B}.Release|Any CPU.Build.0 = Release|Any CPU
2125
EndGlobalSection

0 commit comments

Comments
 (0)