-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add refresher courses and mission training
- v3.19.0.0
- v3.18.0.0
- v3.17.0.0
- v3.16.0.0
- v3.15.0.0
- v3.14.0.0
- v3.13.0.0
- v3.12.0.0
- v3.11.0.0
- v3.10.0.0
- v3.9.0.0
- v3.8.0.0
- v3.7.0.0
- v3.6.1.0
- v3.6.0.0
- v3.5.0.0
- v3.4.0.0
- v3.3.0.1
- v3.3.0.0
- v3.2.1.0
- v3.2.0.1
- v3.2.0.0
- v3.1.1.2
- v3.1.1.1
- v3.1.1.0
- v3.0.0.2
- v3.0.0.1
- v3.0.0.0
- v2.13.0.0
- v2.12.0.0
- v2.11.0.1
- v2.11.0.0
- v2.10.0.0
- v2.9.1.1
- v2.9.1.0
- v2.9.0.1
- v2.9.0.0
- v2.8.1.0
- v2.8.0.0
- v2.7.1.0
- v2.7.0.0
- v2.6.4.0
- v2.6.3.0
- v2.6.2.0
- v2.6.1.1
- v2.6.0.0
- v2.5.0.0
- v2.4.2.0
- v2.4.1.0
- v2.4.0.0
- v2.3.0.0
- v2.2.0.0
- v2.1.0.0
- v2.0.2.0
- v2.0.1.0
- v2.0.0.0
- v1.13.2.2
- v1.13.2.1
- v1.13.2.0
- v1.13.1.0
- v1.13.0.0
- v1.12.19.0
- v1.12.18.0
- v1.12.17.0
- v1.12.16.0
- v1.12.15.0
- v1.12.14.0
- v1.12.13.0
- v1.12.12.0
- v1.12.11.0
- v1.12.10.0
- v1.12.9.0
- v1.12.8.0
- v1.12.7.0
- v1.12.6.0
- v1.12.5.0
- v1.12.4.0
- v1.12.3.0
- v1.12.2.0
- v1.12.1.0
- v1.12.0.0
- v1.11.11.0
- v1.11.10.0
- v1.11.9.0
- v1.11.8.0
- v1.11.7.0
- v1.11.6.0
- v1.11.5.0
- v1.11.4.0
- v1.11.3.0
- v1.11.2.0
- v1.11.1.0
- v1.11.0.0
- v1.10.7.0
- v1.10.6.1
- v1.10.6.0
- v1.10.5.0
- v1.10.4.0
- v1.10.3.0
- v1.10.2.0
- v1.10.0.1
- v1.10.0.0
- v1.9.1
- v1.9.0
- v1.8.1
- v1.8
- v1.7
- v1.6
- v1.5
- v1.4.1
- v1.3
- v1.2.1
- v1.2
- v1.1.1
- v1.1
- v1.00
- 3.1.0.0
- 3.0.1.0
- 1.4
1 parent
75720e4
commit 2135827
Showing
12 changed files
with
497 additions
and
83 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
TRAININGTIMES | ||
{ | ||
Capusles = 1 | ||
mk1pod = Capsules | ||
Capsules_Mission = 0.25 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace RP0.Crew | ||
{ | ||
public class TrainingDatabase | ||
{ | ||
public class TrainingHolder | ||
{ | ||
#region Fields | ||
|
||
public string name; | ||
|
||
public double days = 0; | ||
|
||
public List<string> children = new List<string>(); | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
||
public TrainingHolder(string name, string val) | ||
{ | ||
this.name = name; | ||
|
||
double tmp; | ||
string[] split = val.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); | ||
foreach (string s in split) | ||
{ | ||
if (double.TryParse(s, out tmp)) | ||
days += tmp; | ||
else | ||
children.Add(s); | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public double GetTime() | ||
{ | ||
double c = days; | ||
|
||
foreach (string s in children) | ||
c += TrainingDatabase._GetTime(s); | ||
|
||
return c; | ||
} | ||
|
||
#endregion | ||
} | ||
|
||
#region Fields | ||
|
||
protected static Dictionary<string, TrainingHolder> holders = null; | ||
|
||
protected static HashSet<string> unlockPathTracker = new HashSet<string>(); | ||
|
||
#endregion | ||
|
||
#region Setup | ||
|
||
public TrainingDatabase() | ||
{ | ||
Initialize(); | ||
} | ||
public static void Initialize() | ||
{ | ||
if (holders == null) | ||
holders = new Dictionary<string, TrainingHolder>(); | ||
|
||
FillHolders(); | ||
} | ||
|
||
protected static void FillHolders() | ||
{ | ||
holders.Clear(); | ||
|
||
foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("TRAININGTIMES")) | ||
{ | ||
foreach (ConfigNode.Value v in node.values) | ||
{ | ||
TrainingHolder p = new TrainingHolder(v.name, v.value); | ||
holders[p.name] = p; | ||
} | ||
} | ||
} | ||
#endregion | ||
|
||
#region Interface | ||
|
||
public static double GetTime(string name) | ||
{ | ||
ClearTracker(); | ||
return _GetTime(name); | ||
} | ||
protected static double _GetTime(string name) | ||
{ | ||
if (unlockPathTracker.Contains(name)) | ||
{ | ||
/*string msg = "[TrainingDatabase]: Circular reference on " + name; | ||
foreach (string s in unlockPathTracker) | ||
msg += "\n" + s; | ||
Debug.LogError(msg);*/ | ||
return 0; | ||
} | ||
|
||
unlockPathTracker.Add(name); | ||
|
||
TrainingHolder h; | ||
if (holders.TryGetValue(name, out h)) | ||
return h.GetTime(); | ||
|
||
return 0d; | ||
} | ||
|
||
public static string SynonymReplace(string name) | ||
{ | ||
TrainingHolder h; | ||
if (holders.TryGetValue(name, out h)) | ||
{ | ||
if (h.children.Count == 1) | ||
{ | ||
return h.children[0]; | ||
} | ||
} | ||
return name; | ||
} | ||
|
||
|
||
public static void ClearTracker() | ||
{ | ||
unlockPathTracker.Clear(); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters