Пример #1
0
 public void addNotes(Notes_Container n)
 {
     if (allNotes.ContainsKey(n.ID))
         Debug.LogWarning("BetterNotes: Note already present with key: " + n.ID);
     else
         allNotes.Add(n.ID, n);
 }
 public Notes_DataContainer(Notes_DataContainer copy, Notes_Container n)
 {
     allData = copy.allData;
     returnedData = copy.returnedData;
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_ContractContainer(Notes_ContractContainer copy, List<Guid> id, Notes_Container n)
 {
     activeContracts = copy.activeContracts;
     completedContracts = copy.completedContracts;
     activeContractIDs = id;
     completedContractIDs = id;
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_CrewContainer(Notes_Container n)
 {
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_VitalStats(Notes_VitalStats copy, Notes_Container n)
 {
     deltaV = copy.deltaV;
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_VitalStats(Notes_Container n)
 {
     root = n;
     vessel = n.NotesVessel;
 }
Пример #7
0
        public override void OnLoad(ConfigNode node)
        {
            if (core == null)
                return;

            ConfigNode vessels = node.GetNode("VESSELS");

            if (vessels != null)
            {
                for (int i = 0; i < vessels.GetNodes("VESSEL_NOTES").Length; i++)
                {
                    ConfigNode vesselNotes = vessels.GetNodes("VESSEL_NOTES")[i];

                    if (vesselNotes == null)
                        continue;

                    Vessel v;

                    try
                    {
                        Guid vID = new Guid(vesselNotes.GetValue("VESSEL_ID"));

                        if (vID == null)
                            continue;

                        v = FlightGlobals.Vessels.FirstOrDefault(a => a.id == vID);

                        if (v == null)
                            continue;
                    }
                    catch (Exception e)
                    {
                        v = null;
                        Debug.LogError("BetterNotes; error while loading vessel\n" + e);
                        continue;
                    }

                    Notes_Container n = new Notes_Container(v);

                    ConfigNode vesselStats = vesselNotes.GetNode("VESSEL_STATS");

                    if (vesselStats != null)
                    {
                        n.loadVitalStats(loadStats(vesselStats));
                    }

                    ConfigNode contracts = vesselNotes.GetNode("VESSEL_CONTRACTS");

                    if (contracts != null)
                    {
                        Notes_ContractContainer c = new Notes_ContractContainer();

                        if (contracts.HasValue("CONTRACTS"))
                            n.loadContracts(c, loadContracts(contracts));

                        if (contracts.HasValue("COMPLETED_CONTRACTS"))
                            n.loadContracts(c, loadCompletedContracts(contracts));
                    }

                    ConfigNode dataNotes = vesselNotes.GetNode("VESSEL_SCIENCE_DATA");

                    if (dataNotes != null)
                    {
                        n.loadDataNotes(loadData(dataNotes));
                    }

                    ConfigNode textNotes = vesselNotes.GetNode("VESSEL_TEXT_NOTES");

                    if (textNotes != null)
                    {
                        n.loadTextNotes(loadTextNotes(textNotes));
                    }

                    ConfigNode checkList = vesselNotes.GetNode("CHECK_LIST");

                    if (checkList != null)
                    {
                        n.loadCheckList(loadCheckList(checkList, false));
                    }

                    ConfigNode vesselLog = vesselNotes.GetNode("VESSEL_LOG");

                    if (vesselLog != null)
                    {
                        n.loadVesselLog(loadLog(vesselLog));
                    }

                    core.addNotes(n);
                }
            }

            ConfigNode archivedVessels = node.GetNode("ARCHIVED_VESSELS");

            if (archivedVessels != null)
            {
                for (int i = 0; i < archivedVessels.GetNodes("ARCHIVED_VESSEL_NOTES").Length; i++)
                {
                    ConfigNode vesselNotes = archivedVessels.GetNodes("ARCHIVED_VESSEL_NOTES")[i];

                    if (vesselNotes == null)
                        continue;

                    Guid vID;

                    try
                    {
                        vID = new Guid(vesselNotes.GetValue("VESSEL_ID"));
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("BetterNotes; error while loading archived vessel\n" + e);
                        continue;
                    }

                    if (vID == null)
                        continue;

                    string name = vesselNotes.parse("VESSEL_NAME", "");
                    double rTime = vesselNotes.parse("RECOVERY_TIME", 0d);
                    double mTime = vesselNotes.parse("MISSION_TIME", 0d);
                    VesselType vT = vesselNotes.parse("VESSEL_TYPE", VesselType.Unknown);

                    Notes_Archive_Container n = new Notes_Archive_Container(vID, name, rTime, mTime, vT);

                    ConfigNode crew = vesselNotes.GetNode("ARCHIVED_CREW");

                    if (crew != null)
                    {
                        n.loadCrewNotes(loadCrew(crew));
                    }

                    ConfigNode contracts = vesselNotes.GetNode("VESSEL_CONTRACTS");

                    if (contracts != null)
                    {
                        Notes_ContractContainer c = new Notes_ContractContainer();

                        if (contracts.HasValue("CONTRACTS"))
                            n.loadContracts(c, loadContracts(contracts));

                        if (contracts.HasValue("COMPLETED_CONTRACTS"))
                            n.loadContracts(c, loadCompletedContracts(contracts));
                    }

                    ConfigNode dataNotes = vesselNotes.GetNode("VESSEL_SCIENCE_DATA");

                    if (dataNotes != null)
                    {
                        n.loadDataNotes(loadData(dataNotes));
                    }

                    ConfigNode textNotes = vesselNotes.GetNode("VESSEL_TEXT_NOTES");

                    if (textNotes != null)
                    {
                        n.loadTextNotes(loadTextNotes(textNotes));
                    }

                    ConfigNode checkList = vesselNotes.GetNode("CHECK_LIST");

                    if (checkList != null)
                    {
                        n.loadCheckList(loadCheckList(checkList, true));
                    }

                    ConfigNode vesselLog = vesselNotes.GetNode("VESSEL_LOG");

                    if (vesselLog != null)
                    {
                        n.loadVesselLog(loadLog(vesselLog));
                    }

                    core.addArchivedNotes(n);
                }
            }
        }
 public Notes_TextContainer(Notes_TextContainer copy, Notes_Container n)
 {
     notes = copy.notes;
     root = n;
     vessel = n.NotesVessel;
 }
Пример #9
0
 public Notes_VesselLog(Notes_VesselLog copy, Notes_Container n)
 {
     targetLocation = copy.targetLocation;
     root = n;
     vessel = n.NotesVessel;
 }
Пример #10
0
 public Notes_VesselLog(Notes_Container n)
 {
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_CheckListContainer(Notes_CheckListContainer copy, Notes_Container n)
 {
     allChecks = copy.allChecks;
     root = n;
     vessel = n.NotesVessel;
 }
 public Notes_CheckListContainer(Notes_Container n)
 {
     root = n;
     vessel = n.NotesVessel;
 }