-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathWBIUnlockTechNodeMgr.cs
More file actions
53 lines (48 loc) · 2.28 KB
/
WBIUnlockTechNodeMgr.cs
File metadata and controls
53 lines (48 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using KSP.IO;
using KSP.UI.Screens;
/*
Source code copyrighgt 2015, by Michael Billard (Angel-125)
License: GPLV3
If you want to use this code, give me a shout on the KSP forums! :)
Wild Blue Industries is trademarked by Michael Billard and may be used for non-commercial purposes. All other rights reserved.
Note that Wild Blue Industries is a ficticious entity
created for entertainment purposes. It is in no way meant to represent a real entity.
Any similarity to a real entity is purely coincidental.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace WildBlueIndustries
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, false)]
public class WBIUnlockTechNodeMgr : MonoBehaviour
{
private void Start()
{
RDTechTree.OnTechTreeSpawn.Add(new EventData<RDTechTree>.OnEvent(this.onTechTreeSpawn));
}
private void OnDestroy()
{
RDTechTree.OnTechTreeSpawn.Remove(new EventData<RDTechTree>.OnEvent(this.onTechTreeSpawn));
}
private void onTechTreeSpawn(RDTechTree rdTechTree)
{
// ProtoRDNode[] rdNodes = rdTechTree.GetTreeNodes();
RDNode[] rdNodes = RDController.Instance.nodes.ToArray();
for (int index = 0; index < rdNodes.Length; index++)
{
Debug.Log("FRED checking " + rdNodes[index].name);
if (rdNodes[index].tech.state == RDTech.State.Available || rdNodes[index].name == "Advanced Aerodynamics")
{
Debug.Log("FRED tech node " + rdNodes[index].name + " is researched");
rdNodes[index].SetButtonState(RDNode.State.RESEARCHED);
// rdNodes[index].UpdateGraphics();
}
}
rdTechTree.RefreshUI();
}
}
}