Ejemplo n.º 1
0
 private void DiscoverProtoVesselAntennas(Dictionary <ProtoVessel, List <RealAntenna> > dict)
 {
     dict.Clear();
     foreach (ProtoVessel pv in HighLogic.CurrentGame.flightState.protoVessels)
     {
         List <RealAntenna> antennas = new List <RealAntenna>();
         foreach (ProtoPartSnapshot part in pv.protoPartSnapshots)
         {
             if (part.FindModule(ModuleRealAntenna.ModuleName) is ProtoPartModuleSnapshot snap)
             {
                 ModuleRealAntenna mra = part.partInfo.partPrefab.FindModuleImplementing <ModuleRealAntenna>();
                 RealAntenna       ra  = new RealAntennaDigital(mra.name)
                 {
                     ParentNode = null
                 };
                 ra.LoadFromConfigNode(snap.moduleValues);
                 antennas.Add(ra);
             }
         }
         if (antennas.Count > 0)
         {
             dict.Add(pv, antennas);
         }
     }
 }
Ejemplo n.º 2
0
 private void GUI_HandleProtoVessels()
 {
     foreach (ProtoVessel pv in HighLogic.CurrentGame.flightState.protoVessels)
     {
         foreach (ProtoPartSnapshot part in pv.protoPartSnapshots)
         {
             if (part.FindModule(ModuleRealAntenna.ModuleName) is ProtoPartModuleSnapshot snap)
             {
                 ModuleRealAntenna mra     = part.partInfo.partPrefab.FindModuleImplementing <ModuleRealAntenna>();
                 string            sTarget = $"{pv.vesselName}_{mra.RAAntenna}";
                 if (GUILayout.Button(sTarget))
                 {
                     RealAntenna ra = new RealAntennaDigital(mra.name)
                     {
                         ParentNode = null
                     };
                     ra.LoadFromConfigNode(snap.moduleValues);
                     ConfigTarget(sTarget, ra);
                 }
             }
         }
     }
 }