This addon provides training for your kerbalnauts by adding a
+training center to all science laboratories. Training consumes Time and
+Electric Charge. For Kerbal Space Program.
Installation Instructions
Using CurseForge/OverWolf
app or CKAN
@@ -18,9 +17,9 @@
If
your Kerbal Space Program's GameData folder:
REMOVE ANY OLD VERSIONS OF THE PRODUCT BEFORE
-INSTALLING, including any other fork:
+INSTALLING
-
Delete <KSP_ROOT>/GameData/FieldTrainingLab
+
Delete `<KSP_ROOT>/GameData/FieldTrainingLab
Extract the package's FieldTrainingLab/ folder into
your KSP's GameData folder as follows:
@@ -36,18 +35,18 @@
If
If Downloaded from
SpaceDock / GitHub / other
-
To install, place the GameData folder inside your Kerbal Space
-Program folder:
+
To install, place the GameData folder inside your Kerbal
+Space Program folder:
REMOVE ANY OLD VERSIONS OF THE PRODUCT BEFORE
INSTALLING, including any other fork:
Delete <KSP_ROOT>/GameData/FieldTrainingLab
-
Extract the package's GameData/ folder into your KSP's
+
Extract the package's GameData folder into your KSP's
root folder as follows:
+
+## Summary
+
+* Recompiled for 1.12.4 with .NET 4.7.2 using C# 7.0
+
+## Changes
+
+### Code
+
+* Recompile for
+ * KSP 1.12.2
+ * .Net 4.7.2
+ * C# 7.0
+ * v1.2.1.3 --> 1.2.2.9
+
+#### Localization
+
+* Code is localized.
+ * 1.0.2.0
+ * v1.0.1.0 (needs a serious update - many strings added)
+ * add tags
+
+#### Compatability
+
+* Add
+ * v1.0.0.0
+ * v1.0.0.0
+ * v1.0.0.0
+* Update
+ * v1.3.0.0
+* courtesy of [Gordon Dry](https://forum.kerbalspaceprogram.com/index.php?/profile/163177*/)
+
+#### Config
+
+* move primary patch into Config
+* lint and update patches
+* add tags to parts
+
+## See More
+
+* [How It Works][MOD:works]
+* [Pages][MOD:pages] for so much more (WIP)
+* [Marketing Slicks][MOD:markt]
+* [ChangeLog][MOD:chlog] for more details of changes
+* [Discussions][MOD:discu] or [KSP Forums][MOD:forum] for discussions and news
+* [Known Issues][MOD:issue] for known issues and feature requests
+
+## Localization
+
+>* ![English][EN] English
+>* ![中文][CN] Simplified Chinese (中文) thank you to [@JFYoung01](https://github.com/JFYoung01)
+>* ***your translation here***
+>
+> HELP WANTED - See the [README in the Localization folder][lreadme] or the [Quickstart Guide][qstart] for instructions for adding or improving translations. [GitHub][GitHub:url] push is the best way to contribute. *Additions and corrections welcome!*
+
+
+
red box below is a link to forum post on how to get support
Be Kind: Lithobrake, not jakebrake! Keep your Module Manager up to date
+
+
+### How to support this and other great mods by [`zer0Kerbal`][zer0Kerbal]
+
+[![Support][PAYPAL:img]][PAYPAL:url] [![Patreon][PATREON:img]][PATREON:url] [![Github Sponsor][GSPONS:img]][GSPONS:url] [![Buy zer0Kerbal a snack][BMCC:img]][BMCC:url]
+
+
compiled with: KSP 1.12.4 — .NET 4.7.2 — C# 7.0
+
+#### Release Schedule
+
+1. GitHub, reaching first manual installers and users of KSP-AVC. Right now.
+2. CurseForge. Right now.
+3. SpaceDock (and CKAN users). Soon™ *(the button has been pushed)*
+
+
+[MOD:chlog]: https://raw.githubusercontent.com/zer0Kerbal/FieldTrainingFacility/master/changelog.md "Changelog"
+[MOD:discu]: https://github.com/zer0Kerbal/FieldTrainingFacility/discussions/ "Discussions"
+[MOD:forum]: https://forum.kerbalspaceprogram.com/index.php?/topic/188841-*/ "Field Training Lab (FTL) forum thread"
+[MOD:issue]: https://github.com/zer0Kerbal/FieldTrainingFacility/issues/ "Issue Tracker"
+[MOD:markt]: https://zer0kerbal.github.io/FieldTrainingFacility/Marketing "Marketing Slicks"
+[MOD:pages]: https://zer0kerbal.github.io/FieldTrainingFacility/ "GitHub Pages"
+[MOD:works]: https://zer0kerbal.github.io/FieldTrainingFacility/HowItWorks "How It Works"
+
+[MOD:pages:shd]: https://img.shields.io/badge/GitHub-Pages-white?style=plastic&labelColor=9cf&logoColor=181717&logo=github/ "GitHub IO"
+
+[MOD:shd:stat]: https://img.shields.io/badge/Field%20Training%20Facility%20(FTF)%20-v1.2.2.0--release-BADA55.svg?style=plastic&labelColor=darkgreen/ "1.2.2.0-release"
+
+[Code:shd]: https://img.shields.io/badge/CODE-%3C.NET%204.7.2%3E%20%3CC%207.0%3E-darkblue?style=plastic&labelColor=66ccff "Code"
+
+[GITHUB:url]: https://github.com/zer0Kerbal/FieldTrainingFacility/ "GitHub"
+
+[KSP:url]: http://kerbalspaceprogram.com/ "Kerbal Space Program"
+[KSP:shd:stat]: https://img.shields.io/badge/KSP-1.12.4-blue.svg?style=plastic&labelColor=black/ "Kerbal Space Program"
+
+
+[LIC:url]: https://www.gnu.org/licenses/gpl-3.0-standalone.html "GPLv3"
+[LIC:shd]: https://img.shields.io/badge/License-GPL--3.0-A42E2B?labelColor=white&style=plastic&logoColor=A42E2B&logo=gnu "GPL-3.0"
+
+[AVCVAL:shd]: https://github.com/zer0Kerbal/FieldTrainingFacility/actions/workflows/AVC-VersionFileValidator.yml/badge.svg?style=plastic&labelColor=black "AVC Valid"
+
+[PAYPAL:img]: https://img.shields.io/badge/Buy%20me%20some%20-LFO-BADA55?style=for-the-badge&logo=paypal&labelColor=FFDD00 "PayPal"
+[PAYPAL:url]: https://www.paypal.com/donate?hosted_button_id=DC22YHMEJREKL "PayPal"
+[PATREON:img]: https://img.shields.io/badge/Patreon%20-Patreonize-FF424D?style=for-the-badge&logo=patreon "Patreon"
+[PATREON:url]: https://www.patreon.com/bePatron?u=23390503 "Patreon"
+[GSPONS:img]: https://img.shields.io/badge/Github%20-Sponsor-EA4AAA?style=for-the-badge&logo=githubsponsors "Github Sponsors"
+[GSPONS:url]: https://github.com/sponsors/zer0Kerbal "Github Sponsors"
+[BMCC:img]: https://img.shields.io/badge/Buy%20Me%20a%20-Snack!-FFDD00?style=for-the-badge&logo=buymeacoffee "Buy Me A Snack"
+[BMCC:url]: https://buymeacoffee.com/zer0Kerbal "Buy Me A Snack"
+[lreadme]: https://github.com/zer0Kerbal/zer0Kerbal/blob/master/Localization/readme.md "Localization Readme"
+[qstart]: https://github.com/zer0Kerbal/zer0Kerbal/blob/master/Localization/quickstart.md "Quickstart"
+[EN]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/EN.png "English"
+[BR]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/BR.png "Português Brasil"
+[CN]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/CH.png "中文"
+[DE]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/DE.png "Deutsch"
+[ES]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/ES.png "Español"
+[FR]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/FR.png "Français"
+[IT]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/IT.png "Italiano"
+[JA]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/JA.png "日本語"
+[KO]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/KO.png "한국어"
+[MX]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/MX.png "Mexicano Español"
+[NL]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/NL.png "Dutch"
+[NO]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/NO.png "Norsk"
+[PO]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/PO.png "Polski"
+[RU]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/RU.png "Русский"
+[SW]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/SW.png "Svenska"
+[TR]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/TR.png "Türk"
+[TW]: https://raw.githubusercontent.com/zer0Kerbal/zer0Kerbal/master/img/TW.png "国语"
+
+[zer0Kerbal]: https://forum.kerbalspaceprogram.com/index.php?/profile/190933-*/ "zer0Kerbal"
+
+
\ No newline at end of file
diff --git a/docs/changelog.md b/docs/changelog.md
new file mode 100644
index 0000000..62cbcce
--- /dev/null
+++ b/docs/changelog.md
@@ -0,0 +1,351 @@
+---
+permalink: /Changelog.html
+title: The Change Log
+description: The Opening Credits, and the closing credits, plus the first of two (or is three) end credit scenes
+tags: changes,changelog,change-log,page,kerbal,ksp,zer0Kerbal,zedK
+---
+# Changelog
+
+| modName | Field Training Lab (FTL) |
+| ---------- | ----------------------------------------------------------------- |
+| license | GPL-3.0 |
+| author | Efour and zer0Kerbal |
+| forum | (https://forum.kerbalspaceprogram.com/index.php?/topic/188841-*/) |
+| github | (https://github.com/zer0Kerbal/zer0Kerbal/FieldTrainingLab) |
+| curseforge | (https://www.curseforge.com/kerbal/ksp-mods/FieldTrainingLab) |
+| spacedock | (https://spacedock.info/mod/971) |
+| ckan | FieldTrainingLab |
+
+## Version 1.2.2.0-release `` edition
+
+* Released
+ * 11 Jan 2023
+ * Release for Kerbal Space Program 1.12.4
+ * by [zer0Kerbal](https://github.com/zer0Kerbal)
+
+### Summary 1.2.2.0
+
+* Recompiled for 1.12.4 with .NET 4.7.2 using C# 7.0
+
+### Changes 1.2.2.0
+
+#### Code 1.2.2.0
+
+* Recompile for
+ * KSP 1.12.2
+ * .Net 4.7.2
+ * C# 7.0
+ * v1.2.1.14 --> 1.2.2.22
+
+#### Localization 1.2.2.0
+
+* Code is localized.
+ * 1.0.2.0
+ * v1.0.1.0 (needs a serious update - many strings added)
+ * add tags
+* closes #14 - English
+* closes #31 - Code Localization
+* updates #13 - Localization - Master
+
+#### Compatability 1.2.2.0
+
+* Add
+ * v1.0.0.0
+ * v1.0.0.0
+ * v1.0.0.0
+* Update
+ * v1.3.0.0
+* courtesy of [Gordon Dry](https://forum.kerbalspaceprogram.com/index.php?/profile/163177*/)
+
+#### Config 1.2.2.0
+
+* move primary patch into Config
+* lint and update patches
+* add tags to parts
+
+#### Status 1.2.2.0
+
+* Issues
+ * closes #39 - Field Training Lab (FTL) 1.2.2.0-release `` edition
+ * closes #40 - 1.2.2.0 Additional Tasks
+
+---
+
+## Version 1.2.1.0-release - `` edition
+
+* 28 Jun 2022
+* For Kerbal Space Program [1.12.x]
+
+### License
+
+* Update to GPLv3
+ * was Expat/MIT
+* closes #32 - Update License to GPLv3
+
+### docs/
+
+* Add
+ * [Attribution.md] v1.0.6.0
+ * [ManualInstallation.md] v1.1.7.0
+ * [404-petunia.md]
+ * [LegalMumboJumbo.md] v1.0.5.0
+ * [Localizations.md] v1.1.3.1
+ * [Notices.md] v1.0.0.0
+ * [Why-not.md]
+ * [_config.yml]
+* closes #2 - Needs a wiki
+* closes #35 - add docs/
+
+### Convert Changelog
+
+* Convert from .cfg to md
+* Add missing information for earlier releases
+* closes #33 - Convert Changelog
+
+### Code
+
+* Recompile for KSP 1.12.3
+* Using .NET 4.6.1
+ * remove
+ * [InstallChecker.cs]
+ * [AssemblyVersion.tt]
+ * [Log.cs]
+ * update [Version.tt]]
+
+### Compatibility
+
+* Rename
+ * Patches to Compatibility
+* Update
+ * licenses
+ * [Kerbalism.cfg] v1.0.1.0
+ * fixes #34 - [Bug 🐞]: Kerbalism.cfg
+
+### Add
+
+* Agent
+* Flag
+ * 512x320
+ * 64x40 truecolor_scaled
+
+### Localization
+
+* Add
+ * [readme.md] v2.1.2.0
+ * [quickstart.md] v1.0.1.1
+* updates #14 - English
+* updates #13 - Localization - Master
+* updates #31 - Code Localization
+* updates #22 - Simplified Chinese (简体中文)
+
+### Status
+
+* Issues
+ * closes #9 - Field Training Lab (FTL) 1.2.1.0-release ``
+ * closes #10 - 1.2.1.0 Verify Legal Mumbo Jumbo
+ * closes #11 - 1.2.1.0 Update Documentation
+ * closes #12 - 1.2.1.0 Update Social Media
+* Closes Duplicate Issues
+ * #1 - Localization
+ * #4 - :sparkles: **Localization** :sparkles:
+ * #5 - Localization - en-us.cfg (English)
+ * #6 - Localization - pt-br.cfg Brazil
+ * #7 - Localization - zh-cn.cfg - Simplified Chinese
+ * #8 - Update Field Training Laboratory (FTL)
+
+---
+
+## Version 1.2.0.0 - ``
+
+* 05 Apr 2020
+* KSP 1.9.1
+* .NET 4.8
+
+### Code 1.2.0.0
+
+* update
+ * Editor GetInfo() to be more informative
+ * include assembly version in PAW
+* Add
+ * game settings page
+ * ***disabled for now***
+ * game settings page
+ * global setting to enable/disable PAW color
+ * option to globally enable/disable
+ * option: use science and ratio
+ * option: use reputation and ratio
+ * option: use funds and ratio
+
+---
+
+## Version = 1.1.0.0 - ``
+
+* KSP 1.8.1 with .NET 4.8
+
+* isn't that enough? :D
+* started adding in JoyntMail :D
+
+---
+
+## Version = 1.0.3.5 - ` Plugins/Textures/
+
+### Deployment and Backend
+
+* Update
+ * [Changelog.cfg]
+ * to include new Kerbal Changelog features
+ * [_deploy]
+ * [_buildRelease]
+ * [.gitattributes]
+ * [].gitignore]
+ * [*Readme.md]
+ * automated Readme.md -> Readme.htm
+ * Readme.htm now included in release
+ * Releases.layout.md
+* [CONTRIBUTING.md] now included in repository
+* [FieldTrainingLab.version] to be avc compliant
+* Added
+ * avc github checker and badge
+* Added
+ * json's
+
+---
+
+## Verison 1.0.3.4.1 - `` edition
+
+* released Oct 1, 2019
+* for KSP 1.7.x
+* removed SimpleLogistics.dll that stowed away.
+
+---
+
+## Version 1.0.3.4
+
+### Adoption by zer0Kerbal
+
+### Code 1.0.3.4
+
+* Added
+ * PAW grouping (really needed for these mods)
+ * a blurb in the editor getInfo{}
+ * [InstallChecker.cs]
+
+### Compatibility 1.0.3.4
+
+* Updated
+ * [FieldTrainingLab.cfg]
+ * now patches all parts with moduleScienceLab
+ * changed the [TrainingLab] to be [FieldTrainingLab]
+ * patches reflect this
+* Removed
+ * other patch
+
+---
+
+## Version 1.0.3.3
+
+=--- original ---=
+
+* for Kerbal Space Program 1.6.1
+* Released on 2018-12-21
+
+* Efour's last release
+* Recompiled 1.6.0
+
+---
+
+## Version 1.0.3.2
+
+* for Kerbal Space Program 1.5.1
+* Released on 2018-10-30
+
+* Recompiled for 1.5.1
+
+---
+
+## Version 1.0.3.1
+
+* for Kerbal Space Program 1.3.1
+* Released on 2017-11-27
+
+* Recompiled KSP 1.3.1
+
+---
+
+## Version 1.0.3
+
+* for Kerbal Space Program 1.2.2
+* Released on 2016-11-03
+
+* Recompiled to 1.2.1
+
+---
+
+## Version 1.0.2.1
+
+* for Kerbal Space Program 1.2
+* Released on 2016-10-22
+
+* KPBS support
+
+---
+
+## Version 1.0.2
+
+* for Kerbal Space Program 1.2
+* Released on 2016-10-16
+
+* Calculating Dead and respawned kerbalnaut
+
+---
+
+## Version 1.0.1.0
+
+* for Kerbal Space Program 1.2
+* Released on 2016-10-12
+
+* Co-Work with Field Training Facility Mod
+
+---
+
+## Version 1.0.0.0
+
+* for Kerbal Space Program 1.2
+* Released on 2016-10-08
+
+* No changelog provided
+
+---
+
+## Version 1.0.0.0
+
+* for Kerbal Space Program 1.1.3
+* Released on 2016-10-07
+
+* No changelog provided
+
+---
+
\ No newline at end of file
diff --git a/json/code.json b/json/code.json
index dc2068d..a120af9 100644
--- a/json/code.json
+++ b/json/code.json
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"label": "Code",
"labelColor": "66ccff",
- "message": "|none|",
+ "message": "<.NET 4.7.2> ",
"color": "darkblue",
"style": "plastic"
}
diff --git a/json/ksp.json b/json/ksp.json
index bfb79be..1f17473 100644
--- a/json/ksp.json
+++ b/json/ksp.json
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"label": "KSP",
"labelColor": "black",
- "message": "1.12.3",
+ "message": "1.12.4",
"color": "66ccff",
"style": "plastic"
}
diff --git a/json/mod.json b/json/mod.json
index 93279a0..6d7d6b5 100644
--- a/json/mod.json
+++ b/json/mod.json
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"label": "Field Training Lab",
"labelColor": "BADA55",
- "message": "1.2.1.0",
+ "message": "1.2.2.0",
"color": "darkgreen",
"style": "plastic"
}
diff --git a/source/Constants.cs b/source/Constants.cs
index 6511781..9478457 100644
--- a/source/Constants.cs
+++ b/source/Constants.cs
@@ -1,7 +1,7 @@
/* Field Training Lab (FTL)
* This addon adds a training center in the science laboratory. Paying science points gets kerbals experience. For Kerbal Space Program.
- * Copyright (C) 2016 EFour
- * Copyright (C) 2019, 2022 zer0Kerbal (zer0Kerbal at hotmail dot com)
+ * Copyright (C) 2016 Efour
+ * Copyright (C) 2019, 2022, 2023 zer0Kerbal (zer0Kerbal at hotmail dot com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,14 +20,24 @@
using System.Text;
using FieldTrainingLab;
+using KSP.Localization;
+/// Constants
public class Constants
{
- public const string MODNAME = "FieldTrainingLab";
- public const string MODTITLE = "Field Training Lab";
+/// Constants: addon folder name
+ public const string MODNAME = "#FTL-addon-nameFolder"; // #FTL-addon-nameFolder = FieldTrainingLab
+/// Constants: addon name
+ public const string MODTITLE = "#FTL-addon-name"; // #FTL-addon-name = Field Training Lab
+/// Constants: root path
public static readonly string ROOT_PATH = KSPUtil.ApplicationRootPath;
+/// Constants: config base folder (GameData)
public static readonly string CONFIG_BASE_FOLDER = ROOT_PATH + "GameData/";
+/// Constants: addon base folder
public static string FTL_BASE_FOLDER { get { return CONFIG_BASE_FOLDER + MODNAME + "/"; } }
+/// Constants: mod name
public static string FTL_NODENAME = MODNAME;
- public string FTL_CFG_FILE { get { return FTL_BASE_FOLDER + "PluginData/FTL_Settings.cfg"; } }
+/// Constants: location and name of configuration file
+ public string FTL_CFG_FILE { get { return FTL_BASE_FOLDER + "PluginData/settings.ftl"; } }
+ //public string FTL_CFG_FILE { get { return FTL_BASE_FOLDER + "PluginData/FTL_Settings.cfg"; } }
}
diff --git a/source/FieldTrainingLab.csproj b/source/FieldTrainingLab.csproj
index 87d3c04..2380bff 100644
--- a/source/FieldTrainingLab.csproj
+++ b/source/FieldTrainingLab.csproj
@@ -9,7 +9,7 @@
falseFieldTrainingLab
- v4.6.1
+ v4.7.2512truelatest
@@ -26,42 +26,50 @@
falsefalseanycpu
+ ..\..\docs\Code\Code.xml
-
+ embeddedtrue..\GameData\FieldTrainingLab\Plugins\TRACE
+ trueprompt4falseanycpufalse
+ ..\..\docs\Code\Code.xml
+
+
+ false
+ true
+ true
+ false
-
+ False
-
+ False
-
+ False
-
+ False
-
-
+
+
-
-
+ True
@@ -82,7 +90,7 @@
"$(DevEnvDir)\TextTransform.exe" "$(ProjectDir)Properties\Version.tt"
-
+
@@ -93,11 +101,12 @@ IF "%25K112%25"=="" (
PAUSE
rem GOTO DONE
)
-start /D $(ProjectDir)..\ /WAIT _deploy.bat $(TargetDir) $(TargetFileName)
-if $(ConfigurationName) == Release start /D $(ProjectDir)..\ /WAIT _buildRelease.bat $(TargetDir) $(TargetFileName)
+del $(TargetDir)\*.pdb
+start /D $(SolutionDir)..\ /WAIT _addonDeploy.bat
+if $(ConfigurationName) == Release start /D $(SolutionDir)..\ /WAIT _addonRelease.bat
del $(TargetDir)\*.tmp
:DONE
-
+
diff --git a/source/FieldTrainingLabModule.cs b/source/FieldTrainingLabModule.cs
index 872c837..ab3c587 100644
--- a/source/FieldTrainingLabModule.cs
+++ b/source/FieldTrainingLabModule.cs
@@ -1,7 +1,7 @@
/* Field Training Lab (FTL)
* This addon adds a training center in the science laboratory. Paying science points gets kerbals experience. For Kerbal Space Program.
- * Copyright (C) 2016 EFour
- * Copyright (C) 2019, 2022 zer0Kerbal (zer0Kerbal at hotmail dot com)
+ * Copyright (C) 2016 Efour
+ * Copyright (C) 2019, 2022, 2023 zer0Kerbal (zer0Kerbal at hotmail dot com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,260 +17,284 @@
* along with this program. If not, see .
*/
+using System;
using UnityEngine;
using KSP.Localization;
namespace FieldTrainingLab
{
-
- ///
- ///
- public class FieldTrainingLab : PartModule
- {
- ProtoCrewMember[] crewArr = new ProtoCrewMember[8];
- string[] eventArr =
- {
- "TrainKerbalInside0",
- "TrainKerbalInside1",
- "TrainKerbalInside2",
- "TrainKerbalInside3",
- "TrainKerbalInside4",
- "TrainKerbalInside5",
- "TrainKerbalInside6",
- "TrainKerbalInside7",
- };
-
- string[] trainingArr =
- {
- "",
- "Training1",
- "Training2",
- "Training3",
- "Training4",
- "Training5"
- };
-
- float[] levelUpExpTable = { 2, 6, 8, 16, 32, 0 };
-
- string[] levelNumber = { "1st", "2nd", "3rd", "4th", "5th", "null"};
-
- [KSPField]
- public int TrainFactor = 20;
-
+ ///
+ public class FieldTrainingLab : PartModule
+ {
+ readonly ProtoCrewMember[] crewArr = new ProtoCrewMember[8];
+ readonly string[] eventArr =
+ {
+ "TrainKerbalInside0",
+ "TrainKerbalInside1",
+ "TrainKerbalInside2",
+ "TrainKerbalInside3",
+ "TrainKerbalInside4",
+ "TrainKerbalInside5",
+ "TrainKerbalInside6",
+ "TrainKerbalInside7",
+ };
+
+ readonly string[] trainingArr =
+ {
+ "",
+ "Training1",
+ "Training2",
+ "Training3",
+ "Training4",
+ "Training5"
+ };
+
+ readonly float[] levelUpExpTable = { 2, 6, 8, 16, 32, 0 };
+
+ readonly string[] levelNumber = { Localizer.Format("#FTL-1st"), Localizer.Format("#FTL-2nd"), "#FTL-3rd", Localizer.Format("#FTL-4th"), Localizer.Format("#FTL-5th"), Localizer.Format("#FTL-null") }; // #FTL-1st = 1st // #FTL-2nd = 2nd // #FTL-null = null // #FTL-5th = 5th // #FTL-4th = 4th // #FTL-3rd = 3rd
+
+ private const string __GroupName__ = "FieldTrainingLab";
+
+ /// Train Factor
+ [KSPField]
+ public int TrainFactor = 20;
+
+ /// Space situational cost adjustment
[KSPField]
- public float inSpace = 0.5f;
+ public float inSpace = 0.5f;
+ /// Landed situational cost adjustment
[KSPField]
- public float Landed = 0.25f;
+ public float Landed = 0.25f;
+ /// Time Factor
[KSPField]
- public float TimeFactor = 426 * 6 * 60 * 60; // 1Year = 426day, 1day = 6hour, 1hour = 60minutes, 1min = 60sec
-
- [KSPField(isPersistant = true, guiActive = true, guiName = "Training Lab Status", groupName = "TrainingLab", groupDisplayName = "Training Lab v" + Version.Text, groupStartCollapsed = true)]
- public bool TrainingStatus = false;
+ public float TimeFactor = 426 * 6 * 60 * 60; // 1Year = 426day, 1day = 6hour, 1hour = 60minutes, 1min = 60sec
+
+ /// Training Lab Status
+ [KSPField(isPersistant = true, guiActive = true, groupStartCollapsed = true, groupName = __GroupName__, guiName = "#FTL-status")]
+ public bool TrainingStatus = false;
+
+ /// Science Points Remaining
+ [KSPField(guiActive = false, groupName = __GroupName__, guiName = "#FTL-funds-sci")]
+ public int SciRemain;
+
+ /// Training 0
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-0")]
+ public void TrainKerbalInside0()
+ { TrainKerbal(0); }
+
+ /// Training 1
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-1")]
+ public void TrainKerbalInside1()
+ { TrainKerbal(1); }
+
+ /// Training 2
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-2")]
+ public void TrainKerbalInside2()
+ { TrainKerbal(2); }
+
+ /// Training 3
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-3")]
+ public void TrainKerbalInside3()
+ { TrainKerbal(3); }
+
+ /// Training 4
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-4")]
+ public void TrainKerbalInside4()
+ { TrainKerbal(4); }
+
+ /// Training 5
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-5")]
+ public void TrainKerbalInside5()
+ { TrainKerbal(5); }
+
+ /// Training 6
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-6")]
+ public void TrainKerbalInside6()
+ { TrainKerbal(6); }
+
+ /// Training 7
+ [KSPEvent(guiActive = false, groupName = __GroupName__, guiName = "#FTL-training-7")]
+ public void TrainKerbalInside7()
+ { TrainKerbal(7); }
+
+#region private functions
+ private void TrainKerbal(int index)
+ {
+ ProtoCrewMember crew = crewArr[index];
+
+ int lastLog = GetCrewTrainedLevel(crew);
+
+ if (lastLog == 5)
+ {
+ ScreenMessages.PostScreenMessage(Localizer.Format("#FTL-max", crew.name));
+ // ScreenMessages.PostScreenMessage(crew.name + " already had every training.");
+ return;
+ }
+
+ float SciCost = CalculateSciCost(levelUpExpTable[lastLog], crew);
+ if (ResearchAndDevelopment.Instance.Science < SciCost)
+ {
+ ScreenMessages.PostScreenMessage(Localizer.Format("#FTL-insufficent", Localizer.Format("#FTL-funds-sci"), SciCost, ResearchAndDevelopment.Instance.Science));
+ // ScreenMessages.PostScreenMessage("Insufficient Science Points.\n" + "Needed : " + SciCost + ", Remain : " + ResearchAndDevelopment.Instance.Science);
+ return;
+ }
+ ResearchAndDevelopment.Instance.AddScience(-1 * SciCost, TransactionReasons.CrewRecruited);
+ RemoveKerbalTrainingExp(crew);
+ crew.flightLog.AddEntry(new FlightLog.Entry(crew.flightLog.Flight, trainingArr[lastLog+1], "Kerbin"));
+ ScreenMessages.PostScreenMessage(Localizer.Format("#FTL-complete", levelNumber[lastLog], crew.name));
+ // ScreenMessages.PostScreenMessage(levelNumber[lastLog] + " Training Complete : " + crew.name);
+
+ }
+#endregion
- [KSPField(guiActive = false, guiName = "Science Point", groupName = "TrainingLab", groupDisplayName = "Field Training Lab", groupStartCollapsed = true)]
- public int SciRemain;
+#region public functions
- [KSPEvent(guiActive = false, guiName = "Training0", groupName = "TrainingLab")]
- public void TrainKerbalInside0()
- {
- TrainKerbal(0);
- }
- [KSPEvent(guiActive = false, guiName = "Training1", groupName = "TrainingLab")]
- public void TrainKerbalInside1()
- {
- TrainKerbal(1);
- }
- [KSPEvent(guiActive = false, guiName = "Training2", groupName = "TrainingLab")]
- public void TrainKerbalInside2()
- {
- TrainKerbal(2);
- }
- [KSPEvent(guiActive = false, guiName = "Training3", groupName = "TrainingLab")]
- public void TrainKerbalInside3()
- {
- TrainKerbal(3);
- }
- [KSPEvent(guiActive = false, guiName = "Training4", groupName = "TrainingLab")]
- public void TrainKerbalInside4()
- {
- TrainKerbal(4);
- }
- [KSPEvent(guiActive = false, guiName = "Training5", groupName = "TrainingLab")]
- public void TrainKerbalInside5()
- {
- TrainKerbal(5);
- }
- [KSPEvent(guiActive = false, guiName = "Training6", groupName = "TrainingLab")]
- public void TrainKerbalInside6()
- {
- TrainKerbal(6);
- }
- [KSPEvent(guiActive = false, guiName = "Training7", groupName = "TrainingLab")]
- public void TrainKerbalInside7()
- {
- TrainKerbal(7);
- }
+ /// OnAwake
+ public override void OnAwake() { base.OnAwake(); }
- #region private functions
- private void TrainKerbal(int index)
+ /// OnStart
+ public override void OnStart(StartState state)
{
- ProtoCrewMember crew = crewArr[index];
-
- int lastLog = GetCrewTrainedLevel(crew);
-
- if (lastLog == 5)
- {
- ScreenMessages.PostScreenMessage(crew.name + " already had every training.");
- return;
- }
-
- float SciCost = CalculateSciCost(levelUpExpTable[lastLog], crew);
- if (ResearchAndDevelopment.Instance.Science < SciCost)
- {
- ScreenMessages.PostScreenMessage("Insufficient Science Points.\n" +
- "Needed : " + SciCost + ", Remain : " + ResearchAndDevelopment.Instance.Science);
- return;
- }
- ResearchAndDevelopment.Instance.AddScience(-1 * SciCost, TransactionReasons.CrewRecruited);
- RemoveKerbalTrainingExp(crew);
- crew.flightLog.AddEntry(new FlightLog.Entry(crew.flightLog.Flight, trainingArr[lastLog+1], "Kerbin"));
- ScreenMessages.PostScreenMessage(levelNumber[lastLog] + " Training Complete : " + crew.name);
+ base.OnStart(state);
+ if (HighLogic.CurrentGame.Parameters.CustomParams().coloredPAW)
+ Fields["TrainingStatus"].group.displayName = System.String.Format("" + Localizer.Format("#FTL-nameV", Version.SText) + "");
+ else
+ Fields["TrainingStatus"].group.displayName = Localizer.Format("#FTL-nameV", Version.SText);
}
-#endregion
-#region public functions
- public override void OnUpdate()
- {
- if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) return;
+ /// OnInactive
+ public override void OnInactive() { base.OnInactive(); }
- Fields["SciRemain"].guiActive = true;
- SciRemain = (int) ResearchAndDevelopment.Instance.Science;
+ /// OnInitialize
+ public override void OnInitialize() { base.OnInitialize(); }
- int index = 0;
- for (int cnt = 0; cnt < crewArr.Length; cnt++) crewArr[cnt] = null;
- foreach (ProtoCrewMember crew in part.protoModuleCrew)
- {
- if (index >= 8) break;
- int lastLog = GetCrewTrainedLevel(crew);
+ /// OnFixedUpdate
+ public override void OnFixedUpdate()
+ { base.OnFixedUpdate(); }
+
+ /// OnUpdate
+ public override void OnUpdate()
+ {
+ if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) return;
+ Fields["SciRemain"].guiActive = true;
+ SciRemain = (int) ResearchAndDevelopment.Instance.Science;
- crewArr[index] = crew;
- int SciCost = (int) CalculateSciCost(levelUpExpTable[lastLog], crew);
+ int index = 0;
+ for (int cnt = 0; cnt < crewArr.Length; cnt++) crewArr[cnt] = null;
+ foreach (ProtoCrewMember crew in part.protoModuleCrew)
+ {
+ if (index >= 8) break;
+ int lastLog = GetCrewTrainedLevel(crew);
- if (lastLog < 5) Events[eventArr[index]].guiName = "[" + lastLog + "->" + (lastLog + 1) + "] " + crew.name + "[" + SciCost + "p]";
- else Events[eventArr[index]].guiName = "[5]" + crew.name;
+ crewArr[index] = crew;
+ int SciCost = (int) CalculateSciCost(levelUpExpTable[lastLog], crew);
- Events[eventArr[index]].guiActive = true;
- index++;
- }
+ if (lastLog < 5) Events[eventArr[index]].guiName = "[" + lastLog + "->" + (lastLog + 1) + "] " + crew.name + "[" + SciCost + "p]";
+ else Events[eventArr[index]].guiName = "[5]" + crew.name;
- for(; index < eventArr.Length; index++) Events[eventArr[index]].guiActive = false;
- }
+ Events[eventArr[index]].guiActive = true;
+ index++;
+ }
+ for(; index < eventArr.Length; index++) Events[eventArr[index]].guiActive = false;
+ }
#endregion
- private int CalculateSciCost(float baseValue, ProtoCrewMember crew)
- {
- double calculated = baseValue * TrainFactor * (1 - (GetKerbalTrainingExp(crew) / (TimeFactor * baseValue / 64)));
- int ret = 0;
-
- if (this.vessel.mainBody.bodyName == "Kerbin" && this.vessel.LandedOrSplashed) ret = ((int) (calculated + 0.5));
- else if (this.vessel.LandedOrSplashed) ret = ((int) (calculated * Landed + 0.5));
- else ret = ((int)(calculated * inSpace + 0.5));
-
- if (ret < 1) ret = 1;
- return ret;
- }
-
+
+ /// Calculate Science Cost
+ ///
+ ///
+ ///
+ private int CalculateSciCost(float baseValue, ProtoCrewMember crew)
+ {
+ double calculated = baseValue * TrainFactor * (1 - (GetKerbalTrainingExp(crew) / (TimeFactor * baseValue / 64)));
+ int ret = 0;
+
+ if (this.vessel.mainBody.bodyName == "Kerbin" && this.vessel.LandedOrSplashed) ret = ((int) (calculated + 0.5));
+ else if (this.vessel.LandedOrSplashed) ret = ((int) (calculated * Landed + 0.5));
+ else ret = ((int)(calculated * inSpace + 0.5));
+
+ if (ret < 1) ret = 1;
+ return ret;
+ }
+
+ /// GetKerbalTrainingExp
+ ///
+ ///
private double GetKerbalTrainingExp(ProtoCrewMember crew)
- {
- string lastExpStr = "0";
+ {
+ string lastExpStr = "0";
- FlightLog totalLog = crew.careerLog.CreateCopy();
- totalLog.MergeWith(crew.flightLog.CreateCopy());
- foreach (FlightLog.Entry entry in totalLog.Entries)
- if (entry.type == "TrainingExp") lastExpStr = entry.target;
+ FlightLog totalLog = crew.careerLog.CreateCopy();
+ totalLog.MergeWith(crew.flightLog.CreateCopy());
+ foreach (FlightLog.Entry entry in totalLog.Entries)
+ if (entry.type == "TrainingExp") lastExpStr = entry.target;
- return double.Parse(lastExpStr);
- }
+ return double.Parse(lastExpStr);
+ }
+ /// RemoveKerbalTrainingExp
+ ///
private void RemoveKerbalTrainingExp(ProtoCrewMember crew)
- {
- foreach (FlightLog.Entry entry in crew.careerLog.Entries.ToArray())
- if (entry.type == "TrainingExp")
- crew.careerLog.Entries.Remove(entry);
- foreach (FlightLog.Entry entry in crew.flightLog.Entries.ToArray())
- if (entry.type == "TrainingExp")
- crew.flightLog.Entries.Remove(entry);
- }
-
+ {
+ foreach (FlightLog.Entry entry in crew.careerLog.Entries.ToArray())
+ if (entry.type == "TrainingExp")
+ crew.careerLog.Entries.Remove(entry);
+ foreach (FlightLog.Entry entry in crew.flightLog.Entries.ToArray())
+ if (entry.type == "TrainingExp")
+ crew.flightLog.Entries.Remove(entry);
+ }
+
+ /// GetCrewTrainedLevel
+ ///
+ ///
private int GetCrewTrainedLevel(ProtoCrewMember crew)
- {
- int lastLog = 0;
- FlightLog totalLog = crew.careerLog.CreateCopy();
- totalLog.MergeWith(crew.flightLog.CreateCopy());
-
- int deadFlight = -1;
- foreach (FlightLog.Entry entry in totalLog.Entries)
- {
- if (entry.flight <= deadFlight) continue;
- if (entry.type == "Die") deadFlight = entry.flight;
- }
- foreach (FlightLog.Entry entry in totalLog.Entries)
- {
- if (entry.flight <= deadFlight) continue;
- if (lastLog < 1 && entry.type == "Training1") lastLog = 1;
- if (lastLog < 2 && entry.type == "Training2") lastLog = 2;
- if (lastLog < 3 && entry.type == "Training3") lastLog = 3;
- if (lastLog < 4 && entry.type == "Training4") lastLog = 4;
- if (lastLog < 5 && entry.type == "Training5") lastLog = 5;
- }
-
- return lastLog;
- }
-
- /// Converts consumption rate into /s /m /hour and returns a formate string.
- /// The rate.
- /// RateString="Rate"
- private static string RateString(double rate)
- {
- // double rate = double.Parse(value.value);
- string sfx = "/s";
- if (rate <= 0.004444444f)
- {
- rate *= 3600;
- sfx = "/h";
- }
- else if (rate < 0.2666667f)
- {
- rate *= 60;
- sfx = "/m";
- }
- // limit decimal places to 10 and add sfx
- //return String.Format(FuelRateFormat, Rate, sfx);
- return rate.ToString("###.#####") + " EC" + sfx;
- }
- /// Module information shown in editors
- private string info = string.Empty;
-
- public override string GetInfo()
- {
- //? this is what is show in the editor
- //? As annoying as it is, pre-parsing the config MUST be done here, because this is called during part loading.
- //? The config is only fully parsed after everything is fully loaded (which is why it's in OnStart())
- if (info == string.Empty)
- {
- info += Localizer.Format("#FTL-manu"); // #FTL-manu = Kerbalnaut Training Industries, Inc.
- info += "\n v" + Version.SText; // FTL Version Number text
- info += "\n" + Localizer.Format("#FTL-desc"); // #FTL-desc = Train Kerbals using Science Points
- }
- // #autoLOC_252004 = ElectricCharge
- // #FieldTrainingFacility_titl = FieldTrainingFacility
- // #FTL-manu = Kerbalnaut Training Industries, Inc.
- // #FTL-desc = Train Kerbals using time and Electric Charge
- return info;
- }
- }
+ {
+ int lastLog = 0;
+ FlightLog totalLog = crew.careerLog.CreateCopy();
+ totalLog.MergeWith(crew.flightLog.CreateCopy());
+
+ int deadFlight = -1;
+ foreach (FlightLog.Entry entry in totalLog.Entries)
+ {
+ if (entry.flight <= deadFlight) continue;
+ if (entry.type == "Die") deadFlight = entry.flight;
+ }
+ foreach (FlightLog.Entry entry in totalLog.Entries)
+ {
+ if (entry.flight <= deadFlight) continue;
+ if (lastLog < 1 && entry.type == "Training1") lastLog = 1;
+ if (lastLog < 2 && entry.type == "Training2") lastLog = 2;
+ if (lastLog < 3 && entry.type == "Training3") lastLog = 3;
+ if (lastLog < 4 && entry.type == "Training4") lastLog = 4;
+ if (lastLog < 5 && entry.type == "Training5") lastLog = 5;
+ }
+
+ return lastLog;
+ }
+
+ /// Module information shown in editors
+ private string info = string.Empty;
+
+ /// create the GetInfo string
+ public override string GetInfo()
+ {
+ if (info == string.Empty)
+ {
+ info += Localizer.Format("#FTL-Agency-titl");
+ info += "\n\n" + Localizer.Format("#FTL-Agency-desc") + "\n";
+ info += "\n" + Localizer.Format("#FTL-nameV", Version.SText);
+ info += "\n" + Localizer.Format("#FTL-desc");
+ info += "\n\n";
+ }
+ // #FTL-Agency-titl = Kerbalnaut Training Industries, Inc.
+ // #FTL-Agency-decr = For all your hero training needs!
+ // #FTL-nameV = Field Training Lab v#.#.#.#
+ // #FTL-desc = Train Kerbals using Science Points
+ return info;
+ }
+ }
}
diff --git a/source/KACWrapper.cs b/source/KACWrapper.cs
deleted file mode 100644
index 8c95f3e..0000000
--- a/source/KACWrapper.cs
+++ /dev/null
@@ -1,617 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-
-namespace KSPPreciseManeuver {
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // BELOW HERE SHOULD NOT BE EDITED - this links to the loaded KAC module without requiring a Hard Dependancy
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- ///
- /// The Wrapper class to access KAC from another plugin
- ///
- public class KACWrapper {
- protected static System.Type KACType;
- protected static System.Type KACAlarmType;
-
- protected static Object actualKAC = null;
-
- ///
- /// This is the Kerbal Alarm Clock object
- ///
- /// SET AFTER INIT
- ///
- public static KACAPI KAC = null;
- ///
- /// Whether we found the KerbalAlarmClock assembly in the loadedassemblies.
- ///
- /// SET AFTER INIT
- ///
- public static Boolean AssemblyExists { get { return (KACType != null); } }
- ///
- /// Whether we managed to hook the running Instance from the assembly.
- ///
- /// SET AFTER INIT
- ///
- public static Boolean InstanceExists { get { return (KAC != null); } }
- ///
- /// Whether we managed to wrap all the methods/functions from the instance.
- ///
- /// SET AFTER INIT
- ///
- private static Boolean _KACWrapped = false;
-
- ///
- /// Whether the object has been wrapped and the APIReady flag is set in the real KAC
- ///
- public static Boolean APIReady { get { return _KACWrapped && KAC.APIReady && !NeedUpgrade; } }
-
-
- public static Boolean NeedUpgrade { get; private set; }
-
- ///
- /// This method will set up the KAC object and wrap all the methods/functions
- ///
- /// This option will force the Init function to rebind everything
- ///
- public static Boolean InitKACWrapper () {
- //if (!_KACWrapped )
- //{
- //reset the internal objects
- _KACWrapped = false;
- actualKAC = null;
- KAC = null;
- LogFormatted ("Attempting to Grab KAC Types...");
-
- //find the base type
- KACType = AssemblyLoader.loadedAssemblies
- .Select (a => a.assembly.GetExportedTypes ())
- .SelectMany (t => t)
- .FirstOrDefault (t => t.FullName == "KerbalAlarmClock.KerbalAlarmClock");
-
- if (KACType == null) {
- return false;
- }
-
- LogFormatted ("KAC Version:{0}", KACType.Assembly.GetName ().Version.ToString ());
- if (KACType.Assembly.GetName ().Version.CompareTo (new System.Version (3, 0, 0, 5)) < 0) {
- //No TimeEntry or alarmchoice options = need a newer version
- NeedUpgrade = true;
- }
-
- //now the Alarm Type
- KACAlarmType = AssemblyLoader.loadedAssemblies
- .Select (a => a.assembly.GetExportedTypes ())
- .SelectMany (t => t)
- .FirstOrDefault (t => t.FullName == "KerbalAlarmClock.KACAlarm");
-
- if (KACAlarmType == null) {
- return false;
- }
-
- //now grab the running instance
- LogFormatted ("Got Assembly Types, grabbing Instance");
-
- try {
- actualKAC = KACType.GetField ("APIInstance", BindingFlags.Public | BindingFlags.Static).GetValue (null);
- } catch (Exception) {
- NeedUpgrade = true;
- LogFormatted ("No APIInstance found - most likely you have KAC v2 installed");
- //throw;
- }
- if (actualKAC == null) {
- LogFormatted ("Failed grabbing Instance");
- return false;
- }
-
- //If we get this far we can set up the local object and its methods/functions
- LogFormatted ("Got Instance, Creating Wrapper Objects");
- KAC = new KACAPI (actualKAC);
- //}
- _KACWrapped = true;
- return true;
- }
-
- ///
- /// The Type that is an analogue of the real KAC. This lets you access all the API-able properties and Methods of the KAC
- ///
- public class KACAPI {
-
- internal KACAPI (Object KAC) {
- //store the actual object
- actualKAC = KAC;
-
- //these sections get and store the reflection info and actual objects where required. Later in the properties we then read the values from the actual objects
- //for events we also add a handler
- LogFormatted ("Getting APIReady Object");
- APIReadyField = KACType.GetField ("APIReady", BindingFlags.Public | BindingFlags.Static);
- LogFormatted ("Success: " + (APIReadyField != null).ToString ());
-
- //WORK OUT THE STUFF WE NEED TO HOOK FOR PEOPEL HERE
- LogFormatted ("Getting Alarms Object");
- AlarmsField = KACType.GetField ("alarms", BindingFlags.Public | BindingFlags.Static);
- actualAlarms = AlarmsField.GetValue (actualKAC);
- LogFormatted ("Success: " + (actualAlarms != null).ToString ());
-
- //Events
- LogFormatted ("Getting Alarm State Change Event");
- onAlarmStateChangedEvent = KACType.GetEvent ("onAlarmStateChanged", BindingFlags.Public | BindingFlags.Instance);
- LogFormatted_DebugOnly ("Success: " + (onAlarmStateChangedEvent != null).ToString ());
- LogFormatted_DebugOnly ("Adding Handler");
- AddHandler (onAlarmStateChangedEvent, actualKAC, AlarmStateChanged);
-
- //Methods
- LogFormatted ("Getting Create Method");
- CreateAlarmMethod = KACType.GetMethod ("CreateAlarm", BindingFlags.Public | BindingFlags.Instance);
- LogFormatted_DebugOnly ("Success: " + (CreateAlarmMethod != null).ToString ());
-
- LogFormatted ("Getting Delete Method");
- DeleteAlarmMethod = KACType.GetMethod ("DeleteAlarm", BindingFlags.Public | BindingFlags.Instance);
- LogFormatted_DebugOnly ("Success: " + (DeleteAlarmMethod != null).ToString ());
-
- LogFormatted ("Getting DrawAlarmAction");
- DrawAlarmActionChoiceMethod = KACType.GetMethod ("DrawAlarmActionChoiceAPI", BindingFlags.Public | BindingFlags.Instance);
- LogFormatted_DebugOnly ("Success: " + (DrawAlarmActionChoiceMethod != null).ToString ());
-
- //LogFormatted ("Getting DrawTimeEntry");
- //DrawTimeEntryMethod = KACType.GetMethod ("DrawTimeEntryAPI", BindingFlags.Public | BindingFlags.Instance);
- //LogFormatted_DebugOnly("Success: " + (DrawTimeEntryMethod != null).ToString ());
-
- //Commenting out rubbish lines
- //MethodInfo[] mis = KACType.GetMethods (BindingFlags.Public | BindingFlags.Instance);
- //foreach (MethodInfo mi in mis) {
- // LogFormatted ("M:{0}-{1}", mi.Name, mi.DeclaringType);
- //}
- }
-
- private Object actualKAC;
-
- private FieldInfo APIReadyField;
- ///
- /// Whether the APIReady flag is set in the real KAC
- ///
- public Boolean APIReady {
- get {
- if (APIReadyField == null)
- return false;
-
- return (Boolean)APIReadyField.GetValue (null);
- }
- }
-
- #region Alarms
- private Object actualAlarms;
- private FieldInfo AlarmsField;
-
- ///
- /// The list of Alarms that are currently active in game
- ///
- internal KACAlarmList Alarms { get { return ExtractAlarmList (actualAlarms); } }
-
- ///
- /// This converts the KACAlarmList actual object to a new List for consumption
- ///
- ///
- ///
- private KACAlarmList ExtractAlarmList (Object actualAlarmList) {
- KACAlarmList ListToReturn = new KACAlarmList ();
- try {
- //iterate each "value" in the dictionary
-
- foreach (var item in (IList)actualAlarmList) {
- KACAlarm r1 = new KACAlarm (item);
- ListToReturn.Add (r1);
- }
- } catch (Exception) {
- //LogFormatted("Arrggg: {0}", ex.Message);
- //throw ex;
- //
- }
- return ListToReturn;
- }
-
- #endregion
-
- #region Events
- ///
- /// Takes an EventInfo and binds a method to the event firing
- ///
- /// EventInfo of the event we want to attach to
- /// actual object the eventinfo is gathered from
- /// Method that we are going to hook to the event
- protected void AddHandler (EventInfo Event, Object KACObject, Action